Skip to content

Commit

Permalink
access certification definition wizard: Basic information panel, not …
Browse files Browse the repository at this point in the history
…finished yet
  • Loading branch information
KaterynaHonchar committed Dec 11, 2015
1 parent 4396a50 commit 14c313f
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 8 deletions.
Expand Up @@ -27,15 +27,27 @@ <h3 class="box-title"><wicket:message key="PageCertDefinition.basicInformation"/
<table class="table table-striped">
<tr>
<td><wicket:message key="PageCertDefinition.name"/></td>
<td><div wicket:id="name" /></td> <!-- TODO make editable -->
<td>
<div class="col-md-8">
<input type="text" class="form-control input-sm" wicket:id="name"/>
</div>
</td>
</tr>
<tr>
<td><wicket:message key="PageCertDefinition.description"/></td>
<td><div wicket:id="description" /></td> <!-- TODO make editable -->
<td>
<div class="col-md-8">
<input type="text" class="form-control input-sm" wicket:id="description"/>
</div>
</td>
</tr>
<tr>
<td><wicket:message key="PageCertDefinition.owner"/></td>
<td><div wicket:id="owner" /></td> <!-- TODO make editable -->
<td>
<div class="col-md-8">
<input type="text" class="form-control input-sm" wicket:id="owner"/>
</div>
</td>
</tr>
<tr>
<td><wicket:message key="PageCertDefinition.numberOfStages"/></td>
Expand Down
Expand Up @@ -35,6 +35,7 @@
import com.evolveum.midpoint.web.component.AjaxSubmitButton;
import com.evolveum.midpoint.web.component.TabbedPanel;
import com.evolveum.midpoint.web.component.util.LoadableModel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.page.PageTemplate;
import com.evolveum.midpoint.web.page.admin.certification.dto.CertDefinitionDto;
import com.evolveum.midpoint.web.util.OnePageParameterEncoder;
Expand All @@ -49,7 +50,7 @@
import org.apache.wicket.extensions.markup.html.tabs.ITab;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.*;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.util.string.StringValue;
Expand Down Expand Up @@ -216,9 +217,31 @@ protected void onSubmit(AjaxRequestTarget target,
}

private void initBasicInfoLayout(Form mainForm) {
mainForm.add(new Label(ID_NAME, new PropertyModel<>(definitionModel, CertDefinitionDto.F_NAME)));
mainForm.add(new Label(ID_DESCRIPTION, new PropertyModel<>(definitionModel, CertDefinitionDto.F_DESCRIPTION)));
mainForm.add(new Label(ID_OWNER, new PropertyModel<>(definitionModel, CertDefinitionDto.F_OWNER_NAME)));
final TextField nameField = new TextField(ID_NAME, new PropertyModel<>(definitionModel, CertDefinitionDto.F_NAME));
nameField.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return true;
}
});
mainForm.add(nameField);

final TextField descriptionField = new TextField(ID_DESCRIPTION, new PropertyModel<>(definitionModel, CertDefinitionDto.F_DESCRIPTION));
descriptionField.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return true;
}
});
mainForm.add(descriptionField);

final TextField ownerNameField = new TextField(ID_OWNER, new PropertyModel<>(definitionModel, CertDefinitionDto.F_OWNER_NAME));
ownerNameField.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return true;
}
}); mainForm.add(ownerNameField);
mainForm.add(new Label(ID_NUMBER_OF_STAGES, new PropertyModel<>(definitionModel, CertDefinitionDto.F_NUMBER_OF_STAGES)));
}

Expand Down Expand Up @@ -267,7 +290,7 @@ public void savePerformed(AjaxRequestTarget target) {
// TODO implement better
CertCampaignTypeUtil.checkStageDefinitionConsistency(newObject.asObjectable().getStageDefinition());

ObjectDelta<AccessCertificationDefinitionType> delta = oldObject.diff(newObject, true, true);
ObjectDelta<AccessCertificationDefinitionType> delta = newObject.diff(oldObject, true, true);

if (delta.getPrismContext() == null) {
LOGGER.warn("No prism context in delta {} after diff, adding it", delta);
Expand Down
Expand Up @@ -17,6 +17,7 @@
package com.evolveum.midpoint.web.page.admin.certification.dto;

import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.polystring.PolyString;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.CertCampaignTypeUtil;
import com.evolveum.midpoint.task.api.Task;
Expand All @@ -26,6 +27,7 @@
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationDefinitionType;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;

import java.io.Serializable;

Expand Down Expand Up @@ -78,4 +80,23 @@ public int getNumberOfStages() {
public AccessCertificationDefinitionType getDefinition() {
return definition;
}

public void setDefinition(AccessCertificationDefinitionType definition) {
this.definition = definition;
}

public void setOwnerName(String ownerName) {
// definition.setOwnerRef();
}

public void setName(String name){
PolyStringType namePolyString = new PolyStringType(name);
definition.setName(namePolyString);
String test = "";
test.substring(0,0);
}

public void setDescription(String description){
definition.setDescription(description);
}
}

0 comments on commit 14c313f

Please sign in to comment.