Skip to content

Commit

Permalink
Refactoring SystemComfigPanel, markup cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
matusmacik committed Sep 7, 2017
1 parent c2eb9b0 commit 66f23b9
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 106 deletions.
Expand Up @@ -17,76 +17,76 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="row">
<div class="col-md-12">
<h3 style="margin-left: 20px;">
<wicket:message key="SystemConfigPanel.title.basic"/>
</h3>

<div class="form-group">
<label class="col-md-4 control-label">
<wicket:message key="SystemConfigPanel.title.passwordPolicy"/>
</label>
<div wicket:id="passwordPolicyChooser" />
</div>

<div class="form-group">
<label class="col-md-4 control-label">
<wicket:message key="SystemConfigPanel.title.securityPolicy"/>
</label>
<div wicket:id="securityPolicyChooser" />
</div>

<div class="form-group" wicket:id="objectPolicyEditor"></div>

<h3 style="margin-left: 20px;">
<wicket:message key="SystemConfigPanel.title.accountSynchronization"/>
</h3>

<div wicket:id="chooseAssignmentPolicyEnforcement" />
<h3 style="margin-left: 20px">
<wicket:message key="SystemConfigPanel.cleanupPolicy"/>
</h3>
<div wicket:id="auditRecordsCleanup"
wicket:message="placeholder:SystemConfigPanel.cleanupPolicy.placeholder"/>


<div wicket:id="closedTasksCleanup"
wicket:message="placeholder:SystemConfigPanel.cleanupPolicy.placeholder"/>
<h3>
<wicket:message key="SystemConfigPanel.title.misc"/>
</h3>

<div wicket:id="experimentalCodeCheckbox" />

</div>

<div class="row">
<div class="col-md-12">
<h3 style="margin-left: 20px;">
<wicket:message key="SystemConfigPanel.title.basic"/>
</h3>

<div class="form-group">
<label class="col-md-4 control-label">
<wicket:message key="SystemConfigPanel.title.passwordPolicy"/>
</label>
<div wicket:id="passwordPolicyChooser"/>
</div>

<div class="form-group">
<label class="col-md-4 control-label">
<wicket:message key="SystemConfigPanel.title.securityPolicy"/>
</label>
<div wicket:id="securityPolicyChooser"/>
</div>

<div class="form-group" wicket:id="objectPolicyEditor"></div>

<h3 style="margin-left: 20px;">
<wicket:message key="SystemConfigPanel.title.accountSynchronization"/>
</h3>
<div class="form-group" wicket:id="chooseAssignmentPolicyEnforcement" />
<h3 style="margin-left: 20px">
<wicket:message key="SystemConfigPanel.cleanupPolicy"/>
</h3>
<div class="form-group">
<div wicket:id="auditRecordsCleanup"
wicket:message="placeholder:SystemConfigPanel.cleanupPolicy.placeholder"/>
</div>

<div class="form-group">
<div wicket:id="closedTasksCleanup"
wicket:message="placeholder:SystemConfigPanel.cleanupPolicy.placeholder"/>
</div>
<h3>
<wicket:message key="SystemConfigPanel.title.misc"/>
</h3>

<div class="form-group" wicket:id="experimentalCodeCheckbox"/>
</div>

</div>


<!-- TODO - move this into webapps/js and change selector to attribute rather than to class -->
<!--<script>-->
<!--$('.btn-xs').tooltip();-->
<!--// </script>-->


<wicket:remove>
<!-- Connector frameworks configuration commented out for now
<h3>
<wicket:message key="SystemConfigPanel.title.connectorFramework"/>
</h3>
<div class="form-group">
<label class="col-md-4 control-label">Whatever</label>
<div class="col-md-4">
<input type="password" class="form-control input-sm" placeholder="Whatever">
</div>



<!-- TODO - move this into webapps/js and change selector to attribute rather than to class -->
<!--<script>-->
<!--$('.btn-xs').tooltip();-->
<!--// </script>-->


<wicket:remove>
<!-- Connector frameworks configuration commented out for now
<h3>
<wicket:message key="SystemConfigPanel.title.connectorFramework"/>
</h3>
<div class="form-group">
<label class="col-md-4 control-label">Whatever</label>
<div class="col-md-4">
<input type="password" class="form-control input-sm" placeholder="Whatever">
</div>
</div>
-->
</wicket:remove>

</div>
-->
</wicket:remove>


</wicket:panel>
</html>
Expand Up @@ -42,22 +42,17 @@
*/
public class SystemConfigPanel extends BasePanel<SystemConfigurationDto> {

private static final long serialVersionUID = 1L;
private static final String ID_GLOBAL_PASSWORD_POLICY_CHOOSER = "passwordPolicyChooser";
private static final long serialVersionUID = 1L;
private static final String ID_GLOBAL_PASSWORD_POLICY_CHOOSER = "passwordPolicyChooser";
private static final String ID_GLOBAL_SECURITY_POLICY_CHOOSER = "securityPolicyChooser";
private static final String ID_OBJECT_POLICY_EDITOR = "objectPolicyEditor";
private static final String ID_GLOBAL_CHOOSEASSIGNEMNTPOLICYENFORCEMENT = "chooseAssignmentPolicyEnforcement";
private static final String ID_CLEANUP_AUDIT_RECORDS = "auditRecordsCleanup";
private static final String ID_CLEANUP_CLOSED_TASKS = "closedTasksCleanup";
private static final String ID_INFORMATION_DEPLOYMENT_NAME = "deploymentInformationName";
private static final String ID_INFORMATION_DEPLOYMENT_COLOUR = "deploymentInformationColour";
private static final String ID_CLEANUP_AUDIT_RECORDS_TOOLTIP = "auditRecordsCleanupTooltip";
private static final String ID_CLEANUP_CLOSED_TASKS_TOOLTIP = "closedTasksCleanupTooltip";

private static final String ID_EXPERIMENTAL_CODE_CHECKBOX = "experimentalCodeCheckbox";

private static final String ID_LABEL_SIZE = "col-md-6";
private static final String ID_INPUT_SIZE = "col-md-6";
private static final String ID_LABEL_SIZE = "col-md-4";
private static final String ID_INPUT_SIZE = "col-md-4";


public SystemConfigPanel(String id, IModel<SystemConfigurationDto> model) {
Expand All @@ -67,7 +62,7 @@ public SystemConfigPanel(String id, IModel<SystemConfigurationDto> model) {
initLayout();
}

protected void initLayout(){
protected void initLayout() {

ChooseTypePanel<ValuePolicyType> passPolicyChoosePanel = new ChooseTypePanel<ValuePolicyType>(ID_GLOBAL_PASSWORD_POLICY_CHOOSER,
new PropertyModel<ObjectViewDto<ValuePolicyType>>(getModel(), SystemConfigurationDto.F_PASSWORD_POLICY));
Expand All @@ -83,43 +78,21 @@ protected void initLayout(){

DropDownFormGroup assignmentPolicyEnforcementLevel = new DropDownFormGroup(ID_GLOBAL_CHOOSEASSIGNEMNTPOLICYENFORCEMENT,
new PropertyModel<AEPlevel>(getModel(), SystemConfigurationDto.F_ASSIGNMENTPOLICYENFORCEMENT_LEVEL),
WebComponentUtil.createReadonlyModelFromEnum(AEPlevel.class),new EnumChoiceRenderer<AEPlevel>(SystemConfigPanel.this),
createStringResource("SystemConfigPanel.assignmentPolicyEnforcement"),ID_LABEL_SIZE,ID_INPUT_SIZE, false);
WebComponentUtil.createReadonlyModelFromEnum(AEPlevel.class), new EnumChoiceRenderer<AEPlevel>(SystemConfigPanel.this),
createStringResource("SystemConfigPanel.assignmentPolicyEnforcement"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);

assignmentPolicyEnforcementLevel.setOutputMarkupId(true);
assignmentPolicyEnforcementLevel.getInput().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
add(assignmentPolicyEnforcementLevel);


// TextField<String> auditRecordsField = WebComponentUtil.createAjaxTextField(ID_CLEANUP_AUDIT_RECORDS, new PropertyModel<String>(getModel(), SystemConfigurationDto.F_AUDIT_CLEANUP));
TextFormGroup auditRecordsField = new TextFormGroup(ID_CLEANUP_AUDIT_RECORDS, new PropertyModel<String>(getModel(),SystemConfigurationDto.F_AUDIT_CLEANUP), createStringResource("SystemConfigPanel.cleanupPolicy.auditRecords"),"SystemConfigPanel.tooltip.duration", true,ID_LABEL_SIZE,ID_INPUT_SIZE,false,false);
TextFormGroup closedTasksField = new TextFormGroup(ID_CLEANUP_CLOSED_TASKS, new PropertyModel<String>(getModel(),SystemConfigurationDto.F_TASK_CLEANUP), createStringResource("SystemConfigPanel.cleanupPolicy.closedTasks"),"SystemConfigPanel.tooltip.duration",true,ID_LABEL_SIZE,ID_INPUT_SIZE, false, false);

// TextField<String> closedTasksField = WebComponentUtil.createAjaxTextField(ID_CLEANUP_CLOSED_TASKS, new PropertyModel<String>(getModel(), SystemConfigurationDto.F_TASK_CLEANUP));

// TextField<String> deploymentNameField = WebComponentUtil.createAjaxTextField(ID_INFORMATION_DEPLOYMENT_NAME, new PropertyModel<String>(getModel(), SystemConfigurationDto.F_DEPLOYMENT_NAME));

//TextField<String> deploymentColourField = WebComponentUtil.createAjaxTextField(ID_INFORMATION_DEPLOYMENT_COLOUR, new PropertyModel<String>(getModel(), SystemConfigurationDto.F_DEPLOYMENT_COLOUR));
TextFormGroup auditRecordsField = new TextFormGroup(ID_CLEANUP_AUDIT_RECORDS, new PropertyModel<String>(getModel(), SystemConfigurationDto.F_AUDIT_CLEANUP), createStringResource("SystemConfigPanel.cleanupPolicy.auditRecords"), "SystemConfigPanel.tooltip.duration", true, ID_LABEL_SIZE, ID_INPUT_SIZE, false, false);
TextFormGroup closedTasksField = new TextFormGroup(ID_CLEANUP_CLOSED_TASKS, new PropertyModel<String>(getModel(), SystemConfigurationDto.F_TASK_CLEANUP), createStringResource("SystemConfigPanel.cleanupPolicy.closedTasks"), "SystemConfigPanel.tooltip.duration", true, ID_LABEL_SIZE, ID_INPUT_SIZE, false, false);

add(auditRecordsField);
add(closedTasksField);

// createTooltip(ID_CLEANUP_AUDIT_RECORDS_TOOLTIP);
//createTooltip(ID_CLEANUP_CLOSED_TASKS_TOOLTIP);


//CheckBox experimentalCodeCheck = WebComponentUtil.createAjaxCheckBox(ID_EXPERIMENTAL_CODE_CHECKBOX, new PropertyModel<Boolean>(getModel(), SystemConfigurationDto.F_ENABLE_EXPERIMENTAL_CODE));
CheckFormGroup experimentalCodeCheck = new CheckFormGroup(ID_EXPERIMENTAL_CODE_CHECKBOX, new PropertyModel<Boolean>(getModel(), SystemConfigurationDto.F_ENABLE_EXPERIMENTAL_CODE), createStringResource("SystemConfigPanel.misc.enableExperimentalCode"),ID_LABEL_SIZE, ID_INPUT_SIZE);
CheckFormGroup experimentalCodeCheck = new CheckFormGroup(ID_EXPERIMENTAL_CODE_CHECKBOX, new PropertyModel<Boolean>(getModel(), SystemConfigurationDto.F_ENABLE_EXPERIMENTAL_CODE), createStringResource("SystemConfigPanel.misc.enableExperimentalCode"), ID_LABEL_SIZE, ID_INPUT_SIZE);
add(experimentalCodeCheck);


}



private void createTooltip(String id) {
Label tooltip = new Label(id);
tooltip.add(new InfoTooltipBehavior());
add(tooltip);
}
}

0 comments on commit 66f23b9

Please sign in to comment.