use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class MultiValueDropDownPanel method initLayout.
private void initLayout(final boolean nullValid, 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) {
DropDownChoice choice = new DropDownChoice<>(ID_INPUT, createDropDownItemModel(item.getModel()), createChoiceList(), createRenderer());
choice.setNullValid(nullValid);
choice.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
item.add(choice);
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);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class MultiValueTextPanel method initLayout.
private void initLayout(final NonEmptyModel<Boolean> readOnlyModel, final boolean emptyStringToNull) {
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(WebComponentUtil.visibleIfFalse(readOnlyModel));
placeholderAdd.add(new AttributeAppender("class", new IModel<String>() {
@Override
public String getObject() {
if (buttonsDisabled()) {
return " " + CSS_DISABLED;
}
return "";
}
}));
placeholderAdd.setOutputMarkupId(true);
placeholderAdd.setOutputMarkupPlaceholderTag(true);
placeholderContainer.add(placeholderAdd);
ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {
@Override
protected void populateItem(final ListItem<T> item) {
TextField text = new TextField<>(ID_TEXT, createTextModel(item.getModel()));
text.add(new AjaxFormComponentUpdatingBehavior("blur") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
T updatedValue = (T) text.getConvertedInput();
List<T> modelObject = MultiValueTextPanel.this.getModelObject();
modelObject.set(item.getIndex(), updatedValue);
modelObjectUpdatePerformed(target, modelObject);
}
});
text.add(AttributeAppender.replace("placeholder", createEmptyItemPlaceholder()));
text.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
text.setConvertEmptyInputStringToNull(emptyStringToNull);
item.add(text);
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);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class ReportMainPanel method createObjectListForColumns.
private WebMarkupContainer createObjectListForColumns(String panelId, PageAdminObjectDetails<ReportType> parentPage) {
return new BasicMultivalueContainerListPanel<>(panelId, GuiObjectColumnType.class) {
@Override
protected MultivalueContainerDetailsPanel<GuiObjectColumnType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<GuiObjectColumnType>> item) {
return createDetailsPanelForColumn(ID_ITEM_DETAILS, item);
}
@Override
protected String getContainerNameForNewButton() {
return getPageBase().createStringResource("GuiObjectListViewType.column").getString();
}
@Override
protected IModel<PrismContainerWrapper<GuiObjectColumnType>> getContainerModel() {
return PrismContainerWrapperModel.fromContainerWrapper(ReportMainPanel.this.getObjectModel(), ItemPath.create(ReportType.F_OBJECT_COLLECTION, ObjectCollectionReportEngineConfigurationType.F_VIEW, GuiObjectListViewType.F_COLUMN));
}
@Override
protected Component createHeader(String headerId) {
Label label = new Label(headerId, getPageBase().createStringResource("EngineReportTabPanel.columns"));
label.add(AttributeAppender.append("style", "padding-bottom:10px; font-size: 16px; font-weight: 600; color: #3c8dbc;"));
return label;
}
@Override
protected List<IColumn<PrismContainerValueWrapper<GuiObjectColumnType>, String>> createDefaultColumns() {
return createColumnsForColumns(parentPage);
}
};
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class TestConnectionMessagesPanel method initLayout.
private void initLayout() {
setOutputMarkupId(true);
WebMarkupContainer messagesPanel = new WebMarkupContainer(ID_MESSAGES_PANEL);
messagesPanel.setOutputMarkupId(true);
add(messagesPanel);
ListView<ConnectorStruct> connectorView = new ListView<ConnectorStruct>(ID_CONNECTOR_MESSAGES_PANEL, connectorResourceResults) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<ConnectorStruct> item) {
Label connectorNameLabel = new Label(ID_CONNECTOR_NAME, item.getModelObject().connectorName);
item.add(connectorNameLabel);
RepeatingView connectorResultView = new RepeatingView(ID_CONNECTOR_MESSAGES);
List<OpResult> resultsDto = item.getModelObject().connectorResultsDto;
if (resultsDto != null) {
initResultsPanel(connectorResultView, resultsDto, parentPage);
}
item.add(connectorResultView);
}
};
messagesPanel.add(connectorView);
RepeatingView resultView = new RepeatingView(ID_RESOURCE_MESSAGES);
if (modelResourceResults.getObject() != null) {
initResultsPanel(resultView, modelResourceResults.getObject(), parentPage);
}
resultView.setOutputMarkupId(true);
messagesPanel.add(resultView);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class InternalsTracesPanel method onInitialize.
protected void onInitialize() {
super.onInitialize();
setOutputMarkupId(true);
Form form = new MidpointForm<>(ID_FORM);
form.setOutputMarkupId(true);
add(form);
ListView<InternalOperationClasses> tracesTable = new ListView<InternalOperationClasses>(ID_TRACES_TABLE, Arrays.asList(InternalOperationClasses.values())) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<InternalOperationClasses> item) {
InternalOperationClasses operationClass = item.getModelObject();
CheckFormGroup checkFormGroup = new CheckFormGroup(ID_TRACE_TOGGLE, new PropertyModel<>(tracesMap, operationClass.getKey()), createStringResource("InternalOperationClasses." + operationClass.getKey()), LABEL_SIZE, INPUT_SIZE);
item.add(checkFormGroup);
}
};
form.add(tracesTable);
AjaxSubmitButton update = new AjaxSubmitButton(ID_UPDATE_TRACES, createStringResource("PageBase.button.update")) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target) {
updateTraces(target);
}
@Override
protected void onError(AjaxRequestTarget target) {
target.add(getPageBase().getFeedbackPanel());
}
};
form.add(update);
}
Aggregations