use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class DropdownButtonPanel method initLayout.
private void initLayout(DropdownButtonDto model) {
Label info = new Label(ID_INFO, model.getInfo());
add(info);
Label label = new Label(ID_LABEL, model.getLabel());
add(label);
WebMarkupContainer icon = new WebMarkupContainer(ID_ICON);
icon.add(AttributeModifier.append("class", model.getIcon()));
add(icon);
ListView<InlineMenuItem> li = new ListView<InlineMenuItem>(ID_MENU_ITEM, new Model((Serializable) model.getMenuItems())) {
@Override
protected void populateItem(ListItem<InlineMenuItem> item) {
initMenuItem(item);
}
};
add(li);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class OperationResultPanel method initParams.
private void initParams(WebMarkupContainer operationContent, final IModel<OpResult> model, Page parentPage) {
Label paramsLabel = new Label("paramsLabel", parentPage.getString("FeedbackAlertMessageDetails.params"));
paramsLabel.setOutputMarkupId(true);
paramsLabel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return CollectionUtils.isNotEmpty(model.getObject().getParams());
}
});
operationContent.add(paramsLabel);
ListView<Param> params = new ListView<Param>(ID_PARAMS, createParamsModel(model)) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<Param> item) {
item.add(new Label("paramName", new PropertyModel<Object>(item.getModel(), "name")));
item.add(new Label("paramValue", new PropertyModel<Object>(item.getModel(), "value")));
}
};
params.setOutputMarkupId(true);
params.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return CollectionUtils.isNotEmpty(model.getObject().getParams());
}
});
operationContent.add(params);
ListView<OpResult> subresults = new ListView<OpResult>("subresults", createSubresultsModel(model)) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<OpResult> item) {
Panel subresult = new OperationResultPanel("subresult", item.getModel(), getPage());
subresult.setOutputMarkupId(true);
item.add(subresult);
}
};
subresults.setOutputMarkupId(true);
subresults.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return CollectionUtils.isNotEmpty(model.getObject().getSubresults());
}
});
operationContent.add(subresults);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class OperationResultPanel method initContexts.
private void initContexts(WebMarkupContainer operationContent, final IModel<OpResult> model, Page parentPage) {
Label contextsLabel = new Label("contextsLabel", parentPage.getString("FeedbackAlertMessageDetails.contexts"));
contextsLabel.setOutputMarkupId(true);
contextsLabel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return CollectionUtils.isNotEmpty(model.getObject().getContexts());
}
});
operationContent.add(contextsLabel);
ListView<Context> contexts = new ListView<Context>("contexts", createContextsModel(model)) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<Context> item) {
item.add(new Label("contextName", new PropertyModel<Object>(item.getModel(), "name")));
item.add(new Label("contextValue", new PropertyModel<Object>(item.getModel(), "value")));
}
};
contexts.setOutputMarkupId(true);
contexts.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return CollectionUtils.isNotEmpty(model.getObject().getContexts());
}
});
operationContent.add(contexts);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class FocusProjectionsTabPanel method initLayout.
private void initLayout(final PageBase page) {
final WebMarkupContainer shadows = new WebMarkupContainer(ID_SHADOWS);
shadows.setOutputMarkupId(true);
add(shadows);
InlineMenu accountMenu = new InlineMenu(ID_SHADOW_MENU, new Model((Serializable) createShadowMenu()));
accountMenu.setVisible(!getObjectWrapper().isReadonly());
shadows.add(accountMenu);
final ListView<FocusSubwrapperDto<ShadowType>> projectionList = new ListView<FocusSubwrapperDto<ShadowType>>(ID_SHADOW_LIST, projectionModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<FocusSubwrapperDto<ShadowType>> item) {
PackageResourceReference packageRef;
final FocusSubwrapperDto<ShadowType> dto = item.getModelObject();
final PropertyModel<ObjectWrapper<F>> objectWrapperModel = new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object");
final Panel shadowPanel;
if (dto.isLoadedOK()) {
packageRef = new PackageResourceReference(ImgResources.class, ImgResources.HDD_PRISM);
shadowPanel = new PrismObjectPanel<F>(ID_SHADOW, new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object"), packageRef, getMainForm(), getPageBase());
} else {
shadowPanel = new SimpleErrorPanel<ShadowType>(ID_SHADOW, item.getModel()) {
private static final long serialVersionUID = 1L;
@Override
public void onShowMorePerformed(AjaxRequestTarget target) {
OperationResult fetchResult = dto.getResult();
if (fetchResult != null) {
showResult(fetchResult);
target.add(page.getFeedbackPanel());
}
}
};
}
shadowPanel.setOutputMarkupId(true);
shadowPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
FocusSubwrapperDto<ShadowType> shadowWrapperDto = item.getModelObject();
ObjectWrapper<ShadowType> shadowWrapper = shadowWrapperDto.getObject();
return !shadowWrapper.isMinimalized();
}
});
item.add(shadowPanel);
CheckTableHeader<F> shadowHeader = new CheckTableHeader<F>(ID_SHADOW_HEADER, objectWrapperModel) {
private static final long serialVersionUID = 1L;
@Override
protected void onClickPerformed(AjaxRequestTarget target) {
super.onClickPerformed(target);
onExpandCollapse(target, item.getModel());
target.add(shadows);
}
};
if (item.getModel().getObject().getStatus().equals(UserDtoStatus.DELETE)) {
shadowHeader.add(new AttributeModifier("class", "box-header with-border delete"));
}
item.add(shadowHeader);
}
};
AjaxCheckBox accountCheckAll = new AjaxCheckBox(ID_SHADOW_CHECK_ALL, new Model()) {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
for (FocusSubwrapperDto<ShadowType> dto : projectionList.getModelObject()) {
if (dto.isLoadedOK()) {
ObjectWrapper<ShadowType> accModel = dto.getObject();
accModel.setSelected(getModelObject());
}
}
target.add(shadows);
}
};
shadows.add(accountCheckAll);
shadows.add(projectionList);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class ActionsExecutedInformationPanel method initLayout.
protected void initLayout() {
WebMarkupContainer tableLinesContainer = new WebMarkupContainer(ID_OBJECTS_TABLE_LINES_CONTAINER);
ListView tableLines = new ListView<ActionsExecutedObjectsTableLineDto>(ID_OBJECTS_TABLE_LINES, new AbstractReadOnlyModel<List<ActionsExecutedObjectsTableLineDto>>() {
@Override
public List<ActionsExecutedObjectsTableLineDto> getObject() {
final ActionsExecutedInformationDto modelObject = getModelObject();
if (modelObject == null) {
return new ArrayList<>();
}
if (showResultingActionsOnly) {
return modelObject.getUniqueObjectsTableLines();
} else {
return modelObject.getObjectsTableLines();
}
}
}) {
protected void populateItem(final ListItem<ActionsExecutedObjectsTableLineDto> item) {
item.add(new Label(ID_OBJECT_TYPE, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
String key = item.getModelObject().getObjectTypeLocalizationKey();
if (key != null) {
return createStringResource(key).getString();
} else {
return item.getModelObject().getObjectType().getLocalPart();
}
}
}));
item.add(new Label(ID_OPERATION, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return createStringResource(item.getModelObject().getOperation()).getString();
}
}));
item.add(new Label(ID_CHANNEL, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
String channel = item.getModelObject().getChannel();
if (channel != null && !channel.isEmpty()) {
String key = "Channel." + channel;
return createStringResource(key).getString();
} else {
return "";
}
}
}));
item.add(new Label(ID_SUCCESS_COUNT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_SUCCESS_COUNT)));
item.add(new Label(ID_LAST_SUCCESS_OBJECT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_LAST_SUCCESS_OBJECT)));
item.add(new Label(ID_LAST_SUCCESS_TIMESTAMP, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_LAST_SUCCESS_TIMESTAMP)));
item.add(new Label(ID_FAILURE_COUNT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_FAILURE_COUNT)));
}
};
tableLinesContainer.add(tableLines);
tableLinesContainer.setOutputMarkupId(true);
add(tableLinesContainer);
final Label showResultingActionsOnlyLabel = new Label(ID_SHOW_RESULTING_ACTIONS_ONLY_LABEL, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return showResultingActionsOnly ? createStringResource("ActionsExecutedInformationPanel.showingResultingActionsOnly").getString() : createStringResource("ActionsExecutedInformationPanel.showingAllActions").getString();
}
});
showResultingActionsOnlyLabel.setOutputMarkupId(true);
add(showResultingActionsOnlyLabel);
add(new AjaxFallbackLink<String>(ID_SHOW_RESULTING_ACTIONS_ONLY_LINK) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
showResultingActionsOnly = !showResultingActionsOnly;
ajaxRequestTarget.add(ActionsExecutedInformationPanel.this);
}
});
add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject() != null;
}
});
}
Aggregations