use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class SynchronizationReactionEditor method initLayout.
protected void initLayout(PageResourceWizard parentPage) {
Label label = new Label(ID_LABEL, new ResourceModel("SynchronizationReactionEditor.label.edit"));
add(label);
TextField name = new TextField<>(ID_NAME, new PropertyModel<String>(getModel(), "name"));
name.add(new ReactionListUpdateBehavior());
parentPage.addEditingEnabledBehavior(name);
add(name);
TextArea description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(getModel(), "description"));
parentPage.addEditingEnabledBehavior(description);
add(description);
DropDownChoice situation = new DropDownChoice<>(ID_SITUATION, new PropertyModel<>(getModel(), "situation"), WebComponentUtil.createReadonlyModelFromEnum(SynchronizationSituationType.class), new EnumChoiceRenderer<>(this));
situation.setNullValid(true);
situation.add(new ReactionListUpdateBehavior());
parentPage.addEditingEnabledBehavior(situation);
situation.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
((PageResourceWizard) getPageBase()).refreshIssues(target);
}
});
add(situation);
MultiValueDropDownPanel channel = new MultiValueDropDownPanel<String>(ID_CHANNEL, new PropertyModel<>(getModel(), "channel"), true, parentPage.getReadOnlyModel()) {
@Override
protected String createNewEmptyItem() {
return "";
}
@Override
protected IModel<List<String>> createChoiceList() {
return new IModel<List<String>>() {
@Override
public List<String> getObject() {
return WebComponentUtil.getChannelList();
}
};
}
@Override
protected IChoiceRenderer<String> createRenderer() {
return CHANNEL_RENDERER;
}
};
add(channel);
TriStateComboPanel synchronize = new TriStateComboPanel(ID_SYNCHRONIZE, new PropertyModel<>(getModel(), "synchronize"));
synchronize.getBaseFormComponent().add(new ReactionListUpdateBehavior());
parentPage.addEditingEnabledBehavior(synchronize);
add(synchronize);
CheckBox reconcile = new CheckBox(ID_RECONCILE, new PropertyModel<>(getModel(), "reconcile"));
parentPage.addEditingEnabledBehavior(reconcile);
add(reconcile);
DropDownChoice objectTemplateRef = new DropDownChoice<>(ID_OBJECT_TEMPLATE_REF, new PropertyModel<>(getModel(), "objectTemplateRef"), new IModel<List<ObjectReferenceType>>() {
@Override
public List<ObjectReferenceType> getObject() {
return WebModelServiceUtils.createObjectReferenceList(ObjectTemplateType.class, getPageBase(), objectTemplateMap);
}
}, new ObjectReferenceChoiceRenderer(objectTemplateMap));
objectTemplateRef.setNullValid(true);
parentPage.addEditingEnabledBehavior(objectTemplateRef);
add(objectTemplateRef);
MultiValueTextEditPanel action = new MultiValueTextEditPanel<SynchronizationActionType>(ID_ACTION, new PropertyModel<>(getModel(), "action"), null, false, true, parentPage.getReadOnlyModel()) {
@Override
protected IModel<String> createTextModel(final IModel<SynchronizationActionType> model) {
return new Model<String>() {
@Override
public String getObject() {
SynchronizationActionType action = model.getObject();
if (action == null) {
return null;
}
StringBuilder sb = new StringBuilder();
sb.append(action.getName() != null ? action.getName() : "-");
if (action.getHandlerUri() != null) {
sb.append(" (").append(StringUtils.substringAfter(action.getHandlerUri(), "#")).append(")");
}
return sb.toString();
}
};
}
@Override
protected void performAddValueHook(AjaxRequestTarget target, SynchronizationActionType added) {
target.add(parentStep.getReactionList());
((PageResourceWizard) getPageBase()).refreshIssues(target);
}
@Override
protected void performRemoveValueHook(AjaxRequestTarget target, ListItem<SynchronizationActionType> item) {
target.add(parentStep.getReactionList());
((PageResourceWizard) getPageBase()).refreshIssues(target);
}
@Override
protected SynchronizationActionType createNewEmptyItem() {
return new SynchronizationActionType();
}
@Override
protected void editPerformed(AjaxRequestTarget target, SynchronizationActionType object) {
actionEditPerformed(target, object);
}
};
action.setOutputMarkupId(true);
add(action);
Label situationTooltip = new Label(ID_T_SITUATION);
situationTooltip.add(new InfoTooltipBehavior());
add(situationTooltip);
Label channelTooltip = new Label(ID_T_CHANNEL);
channelTooltip.add(new InfoTooltipBehavior());
add(channelTooltip);
Label synchronizeTooltip = new Label(ID_T_SYNCHRONIZE);
synchronizeTooltip.add(new InfoTooltipBehavior());
add(synchronizeTooltip);
Label reconcileTooltip = new Label(ID_T_RECONCILE);
reconcileTooltip.add(new InfoTooltipBehavior());
add(reconcileTooltip);
Label objTemplateTooltip = new Label(ID_T_OBJ_TEMPLATE);
objTemplateTooltip.add(new InfoTooltipBehavior());
add(objTemplateTooltip);
Label actionTooltip = new Label(ID_T_ACTION);
actionTooltip.add(new InfoTooltipBehavior());
add(actionTooltip);
initModals();
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class InformationPanel method initLayout.
private void initLayout() {
Label titleLabel = new Label(ID_TITLE, new LocalizableMessageModel(new IModel<LocalizableMessageType>() {
@Override
public LocalizableMessageType getObject() {
InformationType info = getModelObject();
if (info == null || info.getTitle() == null && info.getLocalizableTitle() == null) {
return new SingleLocalizableMessageType().fallbackMessage("ApprovalStageDefinitionType.additionalInformation");
}
return getLocalizableMessageOrDefault(info.getLocalizableTitle(), info.getTitle());
}
}, this));
titleLabel.add(new VisibleBehaviour(() -> getModelObject() != null));
add(titleLabel);
ListView<InformationPartType> list = new ListView<InformationPartType>(ID_PARTS, new PropertyModel<>(getModel(), InformationType.F_PART.getLocalPart())) {
@Override
protected void populateItem(ListItem<InformationPartType> item) {
InformationPartType part = item.getModelObject();
Label label = new Label(ID_PART, part != null ? WebComponentUtil.resolveLocalizableMessage(getLocalizableMessageOrDefault(part.getLocalizableText(), part.getText()), InformationPanel.this) : "");
if (Boolean.TRUE.equals(part.isHasMarkup())) {
label.setEscapeModelStrings(false);
}
item.add(label);
}
};
add(list);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class ExecuteChangeOptionsPanel method createTracingOptionsPanel.
private void createTracingOptionsPanel() {
List<InlineMenuItem> items = new ArrayList<>();
items.add(new InlineMenuItem(createStringResource("Tracing")) {
@Override
public InlineMenuItemAction initAction() {
return null;
}
});
DropdownButtonDto model = new DropdownButtonDto(null, GuiStyleConstants.CLASS_TRACING_BUTTON_ICON, "Tracing", items);
DropdownButtonPanel dropdownButtonPanel = new DropdownButtonPanel(ID_TRACING, model) {
@Override
protected void populateMenuItem(String componentId, ListItem<InlineMenuItem> menuItem) {
menuItem.add(createTracingRadioChoicesFragment(componentId));
}
@Override
protected String getSpecialButtonClass() {
return "btn-sm btn-default btn-margin-right";
}
@Override
protected String getSpecialDropdownMenuClass() {
return "execute-options radio";
}
@Override
protected String getSpecialLabelClass() {
return "execute-options-label";
}
};
add(dropdownButtonPanel);
dropdownButtonPanel.setOutputMarkupId(true);
dropdownButtonPanel.add(new VisibleBehaviour(this::isTracingEnabled));
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class CorrelationContextPanel method createColumnsForPropertyRow.
private ListView<CorrelationOptionDto> createColumnsForPropertyRow(IModel<CorrelationContextDto> contextModel, ListItem<CorrelationPropertyDefinition> rowItem) {
return new ListView<>(ID_COLUMNS, new PropertyModel<>(contextModel, CorrelationContextDto.F_CORRELATION_OPTIONS)) {
@Override
protected void populateItem(ListItem<CorrelationOptionDto> columnItem) {
CorrelationContextDto contextDto = contextModel.getObject();
CorrelationOptionDto optionDto = columnItem.getModelObject();
CorrelationPropertyDefinition propertyDefinition = rowItem.getModelObject();
CorrelationPropertyValues valuesForOption = optionDto.getPropertyValues(propertyDefinition);
Label label = new Label(ID_COLUMN, valuesForOption.format());
CorrelationOptionDto referenceOption = contextDto.getNewOwnerOption();
if (referenceOption != null && !optionDto.isNewOwner()) {
CorrelationPropertyValues referenceValues = referenceOption.getPropertyValues(propertyDefinition);
Match match = referenceValues.match(valuesForOption);
label.add(AttributeAppender.append("class", match.getCss()));
}
columnItem.add(label);
}
};
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class AssignmentEditorPanel method initAttributesLayout.
private void initAttributesLayout(WebMarkupContainer constructionContainer) {
WebMarkupContainer attributes = new WebMarkupContainer(ID_ATTRIBUTES);
attributes.setOutputMarkupId(true);
attributes.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
AssignmentEditorDto dto = getModel().getObject();
return AssignmentEditorDtoType.CONSTRUCTION.equals(dto.getType());
}
});
attributes.setEnabled(getModel().getObject().isEditable());
constructionContainer.add(attributes);
ListView<ACAttributeDto> attribute = new ListView<>(ID_ATTRIBUTE, attributesModel) {
@Override
protected void populateItem(ListItem<ACAttributeDto> listItem) {
final IModel<ACAttributeDto> attrModel = listItem.getModel();
ACAttributePanel acAttribute = new ACAttributePanel(ID_AC_ATTRIBUTE, attrModel, ignoreMandatoryAttributes());
acAttribute.setRenderBodyOnly(true);
listItem.add(acAttribute);
listItem.setOutputMarkupId(true);
listItem.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
AssignmentEditorDto editorDto = AssignmentEditorPanel.this.getModel().getObject();
if (editorDto.isShowEmpty()) {
return true;
}
ACAttributeDto dto = attrModel.getObject();
return !dto.isEmpty();
}
});
}
};
attributes.add(attribute);
// todo extension
}
Aggregations