use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class MultivalueContainerListPanelWithDetailsPanel method initDetailsPanel.
protected void initDetailsPanel() {
WebMarkupContainer details = new WebMarkupContainer(ID_DETAILS);
details.setOutputMarkupId(true);
details.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return itemDetailsVisible;
}
});
add(details);
ListView<PrismContainerValueWrapper<C>> itemDetailsView = new ListView<>(MultivalueContainerListPanelWithDetailsPanel.ID_ITEMS_DETAILS, () -> detailsPanelItemsList) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<PrismContainerValueWrapper<C>> item) {
MultivalueContainerDetailsPanel<C> detailsPanel = getMultivalueContainerDetailsPanel(item);
item.add(detailsPanel);
detailsPanel.setOutputMarkupId(true);
}
};
itemDetailsView.setOutputMarkupId(true);
details.add(itemDetailsView);
WebMarkupContainer buttonsContainer = new WebMarkupContainer(ID_BUTTONS_PANEL);
buttonsContainer.add(new VisibleBehaviour(this::isButtonPanelVisible));
details.add(buttonsContainer);
AjaxButton doneButton = new AjaxButton(ID_DONE_BUTTON, createStringResource("MultivalueContainerListPanel.doneButton")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
itemDetailsVisible = false;
refreshTable(ajaxRequestTarget);
ajaxRequestTarget.add(MultivalueContainerListPanelWithDetailsPanel.this);
}
};
buttonsContainer.add(doneButton);
AjaxButton cancelButton = new AjaxButton(ID_CANCEL_BUTTON, createStringResource("MultivalueContainerListPanel.cancelButton")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
itemDetailsVisible = false;
cancelItemDetailsPerformed(ajaxRequestTarget);
ajaxRequestTarget.add(MultivalueContainerListPanelWithDetailsPanel.this);
ajaxRequestTarget.add(getPageBase().getFeedbackPanel());
}
};
buttonsContainer.add(cancelButton);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class MappingColumnPanel method initLayout.
private void initLayout() {
ListView<PrismContainerValueWrapper<MappingType>> mappings = new ListView<>(ID_MAPPINGS, new PropertyModel<>(getModel(), "values")) {
@Override
protected void populateItem(ListItem<PrismContainerValueWrapper<MappingType>> item) {
Label label = new Label(ID_MAPPING, WebComponentUtil.createMappingDescription(item.getModel()));
label.add(AttributeAppender.append("class", createEnabledDisabledStyles(item.getModelObject())));
item.add(label);
}
};
add(mappings);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class MultiValueChoosePanel method initLayout.
private void initLayout(final IModel<List<T>> chosenValues, final List<PrismReferenceValue> filterValues, final boolean required, final boolean multiselect) {
AjaxLink<String> addButton = new AjaxLink<String>(ID_ADD_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
editValuePerformed(chosenValues.getObject(), filterValues, target, multiselect);
}
};
addButton.setOutputMarkupPlaceholderTag(true);
add(addButton);
ListView<T> selectedRowsList = new ListView<T>(ID_SELECTED_ROWS, chosenValues) {
@Override
protected void populateItem(ListItem<T> item) {
WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
textWrapper.setOutputMarkupPlaceholderTag(true);
// was value
TextField<String> text = new TextField<>(ID_TEXT, createTextModel(item.getModel()));
text.add(new AjaxFormComponentUpdatingBehavior("blur") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
}
});
text.setRequired(required);
text.setEnabled(false);
text.setOutputMarkupPlaceholderTag(true);
textWrapper.add(text);
FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
feedback.setOutputMarkupPlaceholderTag(true);
textWrapper.add(feedback);
initButtons(item, item);
item.add(textWrapper);
}
};
selectedRowsList.setReuseItems(true);
add(selectedRowsList);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class MultiValueObjectChoosePanel method initMultiValuesListPanel.
private void initMultiValuesListPanel() {
ListView<R> multiValuesPanel = new ListView<R>(ID_MULTI_SHADOW_REF_VALUE, MultiValueObjectChoosePanel.this.getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<R> item) {
ValueChoosePanel<R> valueChoosePanel = new ValueChoosePanel<R>(ID_REFERENCE_VALUE_INPUT, item.getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected ObjectFilter createCustomFilter() {
return MultiValueObjectChoosePanel.this.createCustomFilter();
}
@Override
public List<QName> getSupportedTypes() {
return MultiValueObjectChoosePanel.this.getSupportedTypes();
}
@Override
protected <O extends ObjectType> void choosePerformedHook(AjaxRequestTarget target, O object) {
chooseObjectPerformed(target, object);
}
};
valueChoosePanel.setOutputMarkupId(true);
item.add(valueChoosePanel);
WebMarkupContainer buttonsContainer = new WebMarkupContainer(ID_BUTTONS_CONTAINER);
buttonsContainer.setOutputMarkupId(true);
item.add(buttonsContainer);
AjaxButton addButton = new AjaxButton(ID_ADD_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
emptyObjectPanelDisplay = true;
target.add(MultiValueObjectChoosePanel.this);
// MultiValueObjectChoosePanel.this.getModelObject().add(null);
}
};
addButton.setOutputMarkupId(true);
addButton.add(new EnableBehaviour(() -> item.getModelObject() != null));
buttonsContainer.add(addButton);
AjaxLink<Void> removeButton = new AjaxLink<Void>(ID_REMOVE_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
MultiValueObjectChoosePanel.this.getModelObject().remove(item.getModelObject());
target.add(MultiValueObjectChoosePanel.this);
}
};
removeButton.setOutputMarkupId(true);
removeButton.add(new EnableBehaviour(() -> item.getModelObject() != null));
buttonsContainer.add(removeButton);
}
};
multiValuesPanel.add(new VisibleBehaviour(() -> !isEmptyModel()));
multiValuesPanel.setOutputMarkupId(true);
add(multiValuesPanel);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class MultiValueAutoCompleteTextPanel method initLayout.
private void initLayout(final boolean inputEnabled, final NonEmptyModel<Boolean> readOnlyModel) {
WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
placeholderContainer.setOutputMarkupPlaceholderTag(true);
placeholderContainer.setOutputMarkupPlaceholderTag(true);
placeholderContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModel().getObject().isEmpty();
}
});
add(placeholderContainer);
AjaxLink<Void> placeholderAdd = new AjaxLink<Void>(ID_PLACEHOLDER_ADD) {
@Override
public void onClick(AjaxRequestTarget target) {
addValuePerformed(target);
}
};
placeholderAdd.add(new AttributeAppender("class", new IModel<String>() {
@Override
public String getObject() {
if (buttonsDisabled()) {
return " " + CSS_DISABLED;
}
return "";
}
}));
placeholderAdd.setOutputMarkupId(true);
placeholderAdd.setOutputMarkupPlaceholderTag(true);
placeholderAdd.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
placeholderContainer.add(placeholderAdd);
ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {
@Override
protected void populateItem(final ListItem<T> item) {
AutoCompleteSettings autoCompleteSettings = new AutoCompleteSettings();
autoCompleteSettings.setShowListOnEmptyInput(true);
autoCompleteSettings.setMaxHeightInPx(200);
AutoCompleteTextField<String> autoCompleteEditor = new AutoCompleteTextField<String>(ID_TEXT, createTextModel(item.getModel()), autoCompleteSettings) {
@Override
protected Iterator<String> getChoices(String input) {
return createAutoCompleteObjectList(input);
}
};
autoCompleteEditor.add(createAutoCompleteValidator());
autoCompleteEditor.add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
}
});
item.add(autoCompleteEditor);
autoCompleteEditor.add(AttributeAppender.replace("placeholder", createEmptyItemPlaceholder()));
if (!inputEnabled) {
autoCompleteEditor.add(new AttributeModifier("disabled", "disabled"));
}
item.add(autoCompleteEditor);
WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
item.add(buttonGroup);
initButtons(buttonGroup, item, readOnlyModel);
}
};
repeater.setOutputMarkupId(true);
repeater.setOutputMarkupPlaceholderTag(true);
repeater.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !getModel().getObject().isEmpty();
}
});
add(repeater);
}
Aggregations