use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class AssignmentEditorPanel method showEmptyPerformed.
private void showEmptyPerformed(AjaxRequestTarget target) {
AssignmentEditorDto dto = AssignmentEditorPanel.this.getModel().getObject();
dto.setShowEmpty(!dto.isShowEmpty());
WebMarkupContainer parent = (WebMarkupContainer) get(createComponentPath(ID_BODY, ID_CONSTRUCTION_CONTAINER));
target.add(parent.get(ID_ATTRIBUTES), parent.get(createComponentPath(ID_SHOW_EMPTY, ID_SHOW_EMPTY_LABEL)), getPageBase().getFeedbackPanel());
}
use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class LockoutStatusPanel method initLayout.
private void initLayout(final IModel<LockoutStatusType> model) {
WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER);
add(container);
Label label = new Label(ID_LABEL, new IModel<String>() {
@Override
public String getObject() {
LockoutStatusType object = model != null ? model.getObject() : null;
String labelValue = object == null ? ((PageBase) getPage()).createStringResource("LockoutStatusType.UNDEFINED").getString() : WebComponentUtil.createLocalizedModelForEnum(object, getLabel()).getObject();
if (!isInitialState) {
labelValue += " " + ((PageBase) getPage()).createStringResource("LockoutStatusPanel.changesSaving").getString();
}
return labelValue;
}
@Override
public void setObject(String s) {
}
@Override
public void detach() {
}
});
label.setOutputMarkupId(true);
container.add(label);
AjaxButton button = new AjaxButton(ID_BUTTON, getButtonModel()) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
PrismPropertyValue oldValue = (PrismPropertyValue) valueWrapper.getOldValue();
if (!isInitialState) {
model.setObject(initialValue);
oldValue.setValue(initialValue);
valueWrapper.setStatus(ValueStatus.NOT_CHANGED);
} else {
model.setObject(LockoutStatusType.NORMAL);
if (oldValue.getValue() != null) {
oldValue.setValue(null);
}
}
isInitialState = !isInitialState;
ajaxRequestTarget.add(getButton());
ajaxRequestTarget.add(getLabel());
}
};
button.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return true;
}
});
button.setOutputMarkupId(true);
container.add(button);
}
use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class AssignmentCatalogPanel method initLayout.
private void initLayout() {
initModels();
initProvider();
setOutputMarkupId(true);
initHeaderPanel();
WebMarkupContainer panelContainer = new WebMarkupContainer(ID_CATALOG_ITEMS_PANEL_CONTAINER);
panelContainer.setOutputMarkupId(true);
add(panelContainer);
addOrReplaceLayout(null, panelContainer);
}
use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class AssignmentCatalogPanel method addOrReplaceLayout.
public void addOrReplaceLayout(AjaxRequestTarget target, WebMarkupContainer panelContainer) {
WebMarkupContainer treePanelContainer = new WebMarkupContainer(ID_TREE_PANEL_CONTAINER);
treePanelContainer.setOutputMarkupId(true);
panelContainer.addOrReplace(treePanelContainer);
if (AssignmentViewType.ROLE_CATALOG_VIEW.equals(AssignmentViewType.getViewTypeFromSession(pageBase)) && StringUtils.isNotEmpty(rootOid)) {
// not let tree panel initializing in case of empty role catalog oid
OrgTreePanel treePanel = new OrgTreePanel(ID_TREE_PANEL, Model.of(rootOid), false, "AssignmentShoppingCartPanel.treeTitle") {
private static final long serialVersionUID = 1L;
@Override
protected void selectTreeItemPerformed(SelectableBean<OrgType> selected, AjaxRequestTarget target) {
AssignmentCatalogPanel.this.selectTreeItemPerformed(selected, target);
}
protected List<InlineMenuItem> createTreeMenu() {
return new ArrayList<>();
}
@Override
protected List<InlineMenuItem> createTreeChildrenMenu(OrgType org) {
return new ArrayList<>();
}
@Override
protected OrgTreeStateStorage getOrgTreeStateStorage() {
return getRoleCatalogStorage();
}
};
treePanel.setOutputMarkupId(true);
treePanelContainer.add(new AttributeAppender("class", "col-md-3"));
treePanelContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !isCatalogOidEmpty();
}
});
treePanelContainer.addOrReplace(treePanel);
} else {
WebMarkupContainer treePanel = new WebMarkupContainer(ID_TREE_PANEL);
treePanel.setVisible(false);
treePanel.setOutputMarkupId(true);
treePanelContainer.addOrReplace(treePanel);
}
WebMarkupContainer catalogItemsPanelContainer = new WebMarkupContainer(ID_CATALOG_ITEMS_PANEL_CONTAINER);
catalogItemsPanelContainer.setOutputMarkupId(true);
panelContainer.addOrReplace(catalogItemsPanelContainer);
String assignmentsOwnerName = getRoleCatalogStorage().getAssignmentsUserOwner() != null ? getRoleCatalogStorage().getAssignmentsUserOwner().getName().getOrig() : "";
Label assignmentsOwnerLabel = new Label(ID_ASSIGNMENTS_OWNER_NAME, createStringResource("AssignmentCatalogPanel.assignmentsOwner", assignmentsOwnerName));
assignmentsOwnerLabel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return AssignmentViewType.USER_TYPE.equals(getRoleCatalogStorage().getViewType());
}
});
catalogItemsPanelContainer.add(assignmentsOwnerLabel);
CatalogItemsPanel catalogItemsPanel;
if (AssignmentViewType.USER_TYPE.equals(viewModel.getObject())) {
PrismObject<UserType> assignmentsOwner = getRoleCatalogStorage().getAssignmentsUserOwner();
listProviderData = new ArrayList<>();
if (assignmentsOwner != null) {
List<AssignmentType> assignments = assignmentsOwner.asObjectable().getAssignment();
for (AssignmentType assignment : assignments) {
if (assignment.getTargetRef() == null || !UserType.COMPLEX_TYPE.equals(assignment.getTargetRef().getType())) {
assignment.setId(null);
listProviderData.add(new AssignmentEditorDto(UserDtoStatus.MODIFY, assignment, pageBase));
}
}
Collections.sort(listProviderData);
}
ListDataProvider listDataProvider = new ListDataProvider(this, Model.ofList(listProviderData));
catalogItemsPanel = new CatalogItemsPanel(ID_CATALOG_ITEMS_PANEL, pageBase, itemsPerRow, listDataProvider);
} else {
catalogItemsPanel = new CatalogItemsPanel(ID_CATALOG_ITEMS_PANEL, selectedTreeItemOidModel, pageBase, itemsPerRow, objectProvider);
}
if (AssignmentViewType.ROLE_CATALOG_VIEW.equals(AssignmentViewType.getViewTypeFromSession(pageBase))) {
catalogItemsPanelContainer.add(new AttributeAppender("class", "col-md-9"));
} else {
catalogItemsPanelContainer.add(new AttributeAppender("class", "col-md-12"));
}
catalogItemsPanel.setOutputMarkupId(true);
catalogItemsPanelContainer.addOrReplace(catalogItemsPanel);
}
use of org.apache.wicket.markup.html.WebMarkupContainer 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<ACAttributeDto>(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