use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class PageBase method initTitleLayout.
private void initTitleLayout(WebMarkupContainer mainHeader) {
WebMarkupContainer pageTitleContainer = new WebMarkupContainer(ID_PAGE_TITLE_CONTAINER);
pageTitleContainer.add(createUserStatusBehaviour());
pageTitleContainer.setOutputMarkupId(true);
mainHeader.add(pageTitleContainer);
WebMarkupContainer pageTitle = new WebMarkupContainer(ID_PAGE_TITLE);
pageTitleContainer.add(pageTitle);
IModel<String> deploymentNameModel = new IModel<>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
DeploymentInformationType info = MidPointApplication.get().getDeploymentInfo();
if (info == null) {
return "";
}
return StringUtils.isEmpty(info.getName()) ? "" : info.getName() + ": ";
}
};
Label deploymentName = new Label(ID_DEPLOYMENT_NAME, deploymentNameModel);
deploymentName.add(new VisibleBehaviour(() -> StringUtils.isNotEmpty(deploymentNameModel.getObject())));
deploymentName.setRenderBodyOnly(true);
pageTitle.add(deploymentName);
Label pageTitleReal = new Label(ID_PAGE_TITLE_REAL, createPageTitleModel());
pageTitleReal.setRenderBodyOnly(true);
pageTitle.add(pageTitleReal);
IModel<List<Breadcrumb>> breadcrumbsModel = new IModel<>() {
private static final long serialVersionUID = 1L;
@Override
public List<Breadcrumb> getObject() {
return getBreadcrumbs();
}
};
ListView<Breadcrumb> breadcrumbs = new ListView<>(ID_BREADCRUMB, breadcrumbsModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<Breadcrumb> item) {
final Breadcrumb dto = item.getModelObject();
AjaxLink<String> bcLink = new AjaxLink<>(ID_BC_LINK) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
redirectBackToBreadcrumb(dto);
}
};
item.add(bcLink);
bcLink.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return dto.isUseLink();
}
});
WebMarkupContainer bcIcon = new WebMarkupContainer(ID_BC_ICON);
bcIcon.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return dto.getIcon() != null && dto.getIcon().getObject() != null;
}
});
bcIcon.add(AttributeModifier.replace("class", dto.getIcon()));
bcLink.add(bcIcon);
Label bcName = new Label(ID_BC_NAME, dto.getLabel());
bcLink.add(bcName);
item.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return dto.isVisible();
}
});
}
};
breadcrumbs.add(new VisibleBehaviour(() -> !isErrorPage()));
mainHeader.add(breadcrumbs);
initCartButton(mainHeader);
}
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) {
Label contextsLabel = new Label("contextsLabel", createStringResource("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<>(item.getModel(), "name")));
item.add(new Label("contextValue", new PropertyModel<>(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 OperationResultPanel method initParams.
private void initParams(WebMarkupContainer operationContent, final IModel<OpResult> model) {
Label paramsLabel = new Label("paramsLabel", createStringResource("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<>(item.getModel(), "name")));
item.add(new Label("paramValue", new PropertyModel<>(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());
subresult.add(new VisibleBehaviour(() -> item.getModel() != null && item.getModelObject() != null));
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 PasswordLimitationsPanel method initLayout.
private void initLayout() {
final WebMarkupContainer validationContainer = new WebMarkupContainer(ID_VALIDATION_CONTAINER) {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !getModelObject().isEmpty();
}
};
validationContainer.setOutputMarkupId(true);
add(validationContainer);
final WebMarkupContainer validationParentContainer = new WebMarkupContainer(ID_VALIDATION_PARENT_ITEMS) {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !getModelObject().isEmpty();
}
};
validationParentContainer.setOutputMarkupId(true);
validationContainer.add(validationParentContainer);
ListView<StringLimitationResult> validationItems = new ListView<>(ID_VALIDATION_ITEMS, getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<StringLimitationResult> item) {
StringLimitationPanel limitationPanel = new StringLimitationPanel(ID_VALIDATION_ITEM, item.getModel());
limitationPanel.setOutputMarkupId(true);
item.add(limitationPanel);
item.add(AttributeModifier.append("class", new IModel<String>() {
@Override
public String getObject() {
return Boolean.TRUE.equals(item.getModelObject().isSuccess()) ? " text-success" : " text-danger";
}
}));
}
};
validationItems.setOutputMarkupId(true);
validationParentContainer.add(validationItems);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class FocusProjectionsTabPanel method initLayout.
private void initLayout() {
IModel<Integer> deadShadows = new ReadOnlyModel<>(() -> countDeadShadows());
Label label = new Label(ID_DEAD_SHADOWS, deadShadows);
label.add(new VisibleBehaviour(() -> deadShadows.getObject() > 0));
add(label);
MultivalueContainerListPanelWithDetailsPanel<ShadowType> multivalueContainerListPanel = new MultivalueContainerListPanelWithDetailsPanel<ShadowType>(ID_SHADOW_TABLE, ShadowType.class) {
private static final long serialVersionUID = 1L;
@Override
protected ISelectableDataProvider<ShadowType, PrismContainerValueWrapper<ShadowType>> createProvider() {
return new ProjectionsListProvider(FocusProjectionsTabPanel.this, getSearchModel(), loadShadowModel()) {
@Override
protected PageStorage getPageStorage() {
PageStorage storage = getSession().getSessionStorage().getPageStorageMap().get(SessionStorage.KEY_FOCUS_PROJECTION_TABLE);
if (storage == null) {
storage = getSession().getSessionStorage().initPageStorage(SessionStorage.KEY_FOCUS_PROJECTION_TABLE);
}
return storage;
}
};
}
@Override
protected void newItemPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation) {
List<QName> supportedTypes = new ArrayList<>(1);
supportedTypes.add(ResourceType.COMPLEX_TYPE);
PageBase pageBase = FocusProjectionsTabPanel.this.getPageBase();
ObjectBrowserPanel<ResourceType> resourceSelectionPanel = new ObjectBrowserPanel<ResourceType>(pageBase.getMainPopupBodyId(), ResourceType.class, supportedTypes, true, pageBase) {
private static final long serialVersionUID = 1L;
@Override
protected void addPerformed(AjaxRequestTarget target, QName type, List<ResourceType> selected) {
FocusProjectionsTabPanel.this.addSelectedAccountPerformed(target, selected);
}
};
resourceSelectionPanel.setOutputMarkupId(true);
pageBase.showMainPopup(resourceSelectionPanel, target);
}
@Override
protected boolean isCreateNewObjectVisible() {
PrismObjectDefinition<F> def = getObjectWrapper().getObject().getDefinition();
PrismReferenceDefinition ref = def.findReferenceDefinition(UserType.F_LINK_REF);
return (ref.canRead() && ref.canAdd());
}
@Override
protected IModel<PrismContainerWrapper<ShadowType>> getContainerModel() {
return null;
}
@Override
protected TableId getTableId() {
return UserProfileStorage.TableId.FOCUS_PROJECTION_TABLE;
}
@Override
protected List<IColumn<PrismContainerValueWrapper<ShadowType>, String>> createDefaultColumns() {
return initBasicColumns();
}
@Override
public void editItemPerformed(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ShadowType>> rowModel, List<PrismContainerValueWrapper<ShadowType>> listItems) {
loadShadowIfNeeded(rowModel, target);
if (listItems != null) {
listItems.forEach(value -> {
if (((ShadowWrapper) value.getParent()).isLoadWithNoFetch()) {
((PageAdminFocus) getPage()).loadFullShadow((PrismObjectValueWrapper) value, target);
}
});
}
super.editItemPerformed(target, rowModel, listItems);
}
@Override
protected Search createSearch(Class<ShadowType> type) {
Search search = super.createSearch(type);
PropertySearchItem<Boolean> defaultDeadItem = search.findPropertySearchItem(ShadowType.F_DEAD);
if (defaultDeadItem != null) {
defaultDeadItem.setVisible(false);
}
addDeadSearchItem(search);
return search;
}
@Override
protected List<SearchItemDefinition> initSearchableItems(PrismContainerDefinition<ShadowType> containerDef) {
List<SearchItemDefinition> defs = new ArrayList<>();
SearchFactory.addSearchRefDef(containerDef, ShadowType.F_RESOURCE_REF, defs, AreaCategoryType.ADMINISTRATION, getPageBase());
SearchFactory.addSearchPropertyDef(containerDef, ShadowType.F_NAME, defs);
SearchFactory.addSearchPropertyDef(containerDef, ShadowType.F_INTENT, defs);
SearchFactory.addSearchPropertyDef(containerDef, ShadowType.F_KIND, defs);
return defs;
}
@Override
protected MultivalueContainerDetailsPanel<ShadowType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<ShadowType>> item) {
return FocusProjectionsTabPanel.this.getMultivalueContainerDetailsPanel(item);
}
};
add(multivalueContainerListPanel);
setOutputMarkupId(true);
}
Aggregations