constraintEditorDiv.setStyle("text-align:center;font-size:10pt;" + hideStyle);
output = new HtmlOutputText();
output.setEscape(false);
output.setValue(Messages.getStringJSF("constraint.info.new") + "<br />");
constraintEditorDiv.getChildren().add(output);
HtmlPanelGrid panel = new HtmlPanelGrid();
panel.setStyle("font-size:10pt;text-align:left;");
panel.setColumns(2);
if (workflowStates != null) {
HtmlOutputText outputWorkflowState = new HtmlOutputText();
outputWorkflowState.setValue(Messages.getStringJSF("constraint.info.workflowState"));
panel.getChildren().add(outputWorkflowState);
HtmlSelectOneMenu select = new HtmlSelectOneMenu();
UISelectItem item = new UISelectItem();
item.setItemValue(null);
item.setItemLabel(Messages.getStringJSF("constraint.workflowstate.all"));
select.getChildren().add(item);
select.setId("workflowState" + getItemUuid());
for (WorkflowState workflowState : workflowStates) {
item = new UISelectItem();
item.setItemValue(workflowState.getUuid());
item.setItemLabel(workflowState.getDisplayName());
select.getChildren().add(item);
}
panel.getChildren().add(select);
}
HtmlOutputText outputConstraintType = new HtmlOutputText();
outputConstraintType.setValue(Messages.getStringJSF("constraint.info.constraintType"));
panel.getChildren().add(outputConstraintType);
HtmlSelectOneMenu select = new HtmlSelectOneMenu();
select.setId("constraintType" + getItemUuid());
for (ConstraintType constraintType : ConstraintType.values()) {
if (constraintType != ConstraintType.DEFAULT) {
UISelectItem item = new UISelectItem();
item.setItemValue(constraintType);
item.setItemLabel(Messages.getStringJSF("ConstraintType." + constraintType.name()));
select.getChildren().add(item);
}
}
panel.getChildren().add(select);
if (constraintClients != null) {
HtmlOutputText outputConstraintClient = new HtmlOutputText();
outputConstraintClient.setValue(Messages.getStringJSF("constraint.info.constraintClient"));
panel.getChildren().add(outputConstraintClient);
select = new HtmlSelectOneMenu();
select.setId("constraintClient" + getItemUuid());
UISelectItem item = new UISelectItem();
item.setItemValue(null);
item.setItemLabel(Messages.getStringJSF("constraint.constraintclient.all"));
select.getChildren().add(item);
for (ConstraintClient constraintClient : constraintClients) {
item = new UISelectItem();
item.setItemValue(constraintClient.getUuid());
item.setItemLabel(constraintClient.getDisplayName());
select.getChildren().add(item);
}
panel.getChildren().add(select);
}
HtmlOutputText empty = new HtmlOutputText();
panel.getChildren().add(empty);
HtmlOutputText save = new HtmlOutputText();
save.setEscape(false);
save.setValue("<button href=\"#\" onclick=\"addConstraint('" + getItemUuid() + "','" + getItemUuid() + "');\">"
+ Messages.getStringJSF("constraint.button.add")
+ "</button>");
panel.getChildren().add(save);
constraintEditorDiv.getChildren().add(panel);
HtmlPanelGrid listPanel = new HtmlPanelGrid();
listPanel.setStyle("font-size:10pt;text-align:left;");
int columns = 7;
if (workflowStates == null) {
columns = columns - 2;
}
if (constraintClients == null) {
columns = columns - 2;
}
listPanel.setColumns(columns);
if (constraints != null) {
if (!constraints.isEmpty()) {
output = new HtmlOutputText();
output.setEscape(false);
output.setValue("<br />" + Messages.getStringJSF("constraint.info.current") + "<br />");
constraintEditorDiv.getChildren().add(output);
}
for (Constraint constraint : constraints) {
if (workflowStates != null) {
HtmlOutputText tmpOutput = new HtmlOutputText();
if (constraint.getWorkflowState() != null) {
tmpOutput.setValue(constraint.getWorkflowState().getDisplayName() + ",");
} else {
tmpOutput.setValue(Messages.getStringJSF("constraint.workflowstate.all") + ",");
}
HtmlOutputText outputWorkflowState = new HtmlOutputText();
outputWorkflowState.setValue(Messages.getStringJSF("constraint.info.workflowState"));
listPanel.getChildren().add(outputWorkflowState);
listPanel.getChildren().add(tmpOutput);
}
HtmlOutputText tmpOutput = new HtmlOutputText();
String comma = ",";
if (constraintClients == null) {
comma = "";
}
tmpOutput.setValue(Messages.getStringJSF("ConstraintType." + constraint.getConstraintType().name()) + comma);
outputConstraintType = new HtmlOutputText();
outputConstraintType.setValue(Messages.getStringJSF("constraint.info.constraintType"));
listPanel.getChildren().add(outputConstraintType);
listPanel.getChildren().add(tmpOutput);
if (constraintClients != null) {
tmpOutput = new HtmlOutputText();
if (constraint.getConstraintClient() != null) {
tmpOutput.setValue(constraint.getConstraintClient().getDisplayName());
} else {
tmpOutput.setValue(Messages.getStringJSF("constraint.constraintclient.all"));
}
HtmlOutputText outputConstraintClient = new HtmlOutputText();
outputConstraintClient.setValue(Messages.getStringJSF("constraint.info.constraintClient"));
listPanel.getChildren().add(outputConstraintClient);
listPanel.getChildren().add(tmpOutput);
}
tmpOutput = new HtmlOutputText();
tmpOutput.setEscape(false);
tmpOutput.setValue("<div class=\"deleteConstraint\" onclick=\"deleteConstraint('" + constraint.hashCode() + "','" + getItemUuid() + "');\"></div>");
listPanel.getChildren().add(tmpOutput);
}
}
constraintEditorDiv.getChildren().add(listPanel);
getChildren().add(constraintEditorDiv);
}