use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper in project midpoint by Evolveum.
the class ResourceSchemaHandlingPanel method createMultivalueContainerDetailsPanel.
private MultivalueContainerDetailsPanel<ResourceObjectTypeDefinitionType> createMultivalueContainerDetailsPanel(String panelId, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> model) {
return new MultivalueContainerDetailsPanel<>(panelId, model, true) {
@Override
protected ItemVisibility getBasicTabVisibity(ItemWrapper<?, ?> itemWrapper) {
if (itemWrapper instanceof PrismContainerWrapper) {
return ItemVisibility.HIDDEN;
}
return ItemVisibility.AUTO;
}
@Override
@NotNull
protected List<ITab> createTabs() {
List<ITab> tabs = new ArrayList<>();
tabs.add(new PanelTab(createStringResource("ResourceSchemaHandlingPanel.tab.attributes")) {
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ResourceAttributePanel(panelId, PrismContainerWrapperModel.fromContainerValueWrapper(getModel(), ResourceObjectTypeDefinitionType.F_ATTRIBUTE), getPanelConfiguration());
}
});
return tabs;
}
@Override
protected DisplayNamePanel<ResourceObjectTypeDefinitionType> createDisplayNamePanel(String displayNamePanelId) {
return new DisplayNamePanel<>(displayNamePanelId, new ItemRealValueModel<>(getModel())) {
@Override
protected IModel<String> createHeaderModel() {
return new ReadOnlyModel<>(() -> loadHeaderModel(getModelObject()));
}
@Override
protected IModel<List<String>> getDescriptionLabelsModel() {
return new ReadOnlyModel<>(() -> loadDescriptionModel(getModelObject()));
}
};
}
};
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper in project midpoint by Evolveum.
the class InducedEntitlementsPanel method getConstructionAssociationPanel.
// @Override
// protected Panel getBasicContainerPanel(String idPanel, IModel<PrismContainerValueWrapper<AssignmentType>> model) {
// return getConstructionAssociationPanel(idPanel, model);
// }
private ConstructionAssociationPanel getConstructionAssociationPanel(String idPanel, IModel<PrismContainerValueWrapper<AssignmentType>> model) {
IModel<PrismContainerWrapper<ConstructionType>> constructionModel = PrismContainerWrapperModel.fromContainerValueWrapper(model, AssignmentType.F_CONSTRUCTION);
ConstructionAssociationPanel constructionDetailsPanel = new ConstructionAssociationPanel(idPanel, constructionModel);
constructionDetailsPanel.setOutputMarkupId(true);
return constructionDetailsPanel;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper in project midpoint by Evolveum.
the class AssignmentPanel method initLayout.
private void initLayout() {
MultivalueContainerListPanelWithDetailsPanel<AssignmentType> multivalueContainerListPanel = new MultivalueContainerListPanelWithDetailsPanel<>(ID_ASSIGNMENTS, AssignmentType.class) {
private static final long serialVersionUID = 1L;
@Override
protected boolean isCreateNewObjectVisible() {
return isNewObjectButtonVisible(getFocusObject());
}
@Override
protected IModel<PrismContainerWrapper<AssignmentType>> getContainerModel() {
return AssignmentPanel.this.getModel();
}
@Override
protected void cancelItemDetailsPerformed(AjaxRequestTarget target) {
AssignmentPanel.this.cancelAssignmentDetailsPerformed(target);
}
protected List<IColumn<PrismContainerValueWrapper<AssignmentType>, String>> createDefaultColumns() {
if (AssignmentPanel.this.getModelObject() == null) {
return new ArrayList<>();
}
return initBasicColumns();
}
@Override
protected List<Component> createToolbarButtonsList(String idButton) {
List<Component> bar = new ArrayList<>();
AjaxIconButton newObjectButton = new AjaxIconButton(idButton, new Model<>(GuiStyleConstants.EVO_ASSIGNMENT_ICON), createStringResource("MainObjectListPanel.newObject")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
newAssignmentClickPerformed(target);
}
};
newObjectButton.add(AttributeAppender.append("class", "btn btn-default btn-sm"));
bar.add(newObjectButton);
newObjectButton.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return isNewObjectButtonVisible(getFocusObject());
}
@Override
public boolean isEnabled() {
return !isAssignmentsLimitReached();
}
});
return bar;
}
@Override
public void deleteItemPerformed(AjaxRequestTarget target, List<PrismContainerValueWrapper<AssignmentType>> toDeleteList) {
int countAddedAssignments = 0;
for (PrismContainerValueWrapper<AssignmentType> assignment : toDeleteList) {
if (ValueStatus.ADDED.equals(assignment.getStatus())) {
countAddedAssignments++;
}
}
boolean isLimitReached = isAssignmentsLimitReached(toDeleteList.size() - countAddedAssignments, true);
if (isLimitReached) {
warn(getParentPage().getString("AssignmentPanel.assignmentsLimitReachedWarning", assignmentsRequestsLimit));
target.add(getPageBase().getFeedbackPanel());
return;
}
super.deleteItemPerformed(target, toDeleteList);
}
@Override
protected AssignmentListProvider createProvider() {
PageStorage pageStorage = getPageStorage(getAssignmentsTabStorageKey());
return createAssignmentProvider(pageStorage, getSearchModel(), loadValuesModel());
}
@Override
protected MultivalueContainerDetailsPanel<AssignmentType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<AssignmentType>> item) {
return createMultivalueContainerDetailsPanel(item);
}
@Override
protected UserProfileStorage.TableId getTableId() {
return AssignmentPanel.this.getTableId();
}
@Override
protected List<SearchItemDefinition> initSearchableItems(PrismContainerDefinition<AssignmentType> containerDef) {
return createSearchableItems(containerDef);
}
@Override
public void refreshTable(AjaxRequestTarget ajaxRequestTarget) {
super.refreshTable(ajaxRequestTarget);
AssignmentPanel.this.refreshTable(ajaxRequestTarget);
}
@Override
protected boolean isCollectionViewPanel() {
return config != null && config.getListView() != null;
}
@Override
protected CompiledObjectCollectionView getObjectCollectionView() {
if (config == null) {
return super.getObjectCollectionView();
}
GuiObjectListViewType listView = config.getListView();
if (listView == null) {
return null;
}
CollectionRefSpecificationType collectionRefSpecificationType = listView.getCollection();
if (collectionRefSpecificationType == null) {
return null;
}
Task task = getPageBase().createSimpleTask("Compile collection");
OperationResult result = task.getResult();
try {
return getPageBase().getModelInteractionService().compileObjectCollectionView(collectionRefSpecificationType, AssignmentType.class, task, result);
} catch (Throwable e) {
e.printStackTrace();
}
return null;
}
};
multivalueContainerListPanel.add(new VisibleBehaviour(() -> getModel() != null && getModelObject() != null));
add(multivalueContainerListPanel);
setOutputMarkupId(true);
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper in project midpoint by Evolveum.
the class FocusTriggersTabPanel method initLayout.
private void initLayout() {
PrismContainerWrapperModel<F, TriggerType> triggersModel = PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), FocusType.F_TRIGGER);
MultivalueContainerListPanel<TriggerType> multivalueContainerListPanel = new MultivalueContainerListPanel<TriggerType>(ID_TRIGGERS_PANEL, TriggerType.class) {
private static final long serialVersionUID = 1L;
@Override
protected boolean isCreateNewObjectVisible() {
return false;
}
@Override
protected IModel<PrismContainerWrapper<TriggerType>> getContainerModel() {
return triggersModel;
}
@Override
protected boolean isHeaderVisible() {
return false;
}
@Override
protected String getStorageKey() {
return SessionStorage.KEY_TRIGGERS_TAB;
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TRIGGERS_TAB_TABLE;
}
@Override
protected List<IColumn<PrismContainerValueWrapper<TriggerType>, String>> createDefaultColumns() {
return createTriggersColumns();
}
@Override
protected void editItemPerformed(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<TriggerType>> rowModel, List<PrismContainerValueWrapper<TriggerType>> listItems) {
}
};
multivalueContainerListPanel.add(new VisibleBehaviour(() -> triggersModel != null && triggersModel.getObject() != null));
add(multivalueContainerListPanel);
setOutputMarkupId(true);
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper in project midpoint by Evolveum.
the class ResourceSchemaHandlingTabPanel method initLayout.
private void initLayout() {
MidpointForm<?> form = new MidpointForm<>(ID_FORM);
add(form);
MultivalueContainerListPanelWithDetailsPanel<ResourceObjectTypeDefinitionType> objectTypesPanel = new MultivalueContainerListPanelWithDetailsPanel<>(ID_TABLE, ResourceObjectTypeDefinitionType.class) {
@Override
protected MultivalueContainerDetailsPanel<ResourceObjectTypeDefinitionType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> item) {
return createMultivalueContainerDetailsPanel(ID_ITEM_DETAILS, item.getModel());
}
@Override
protected boolean isCreateNewObjectVisible() {
return false;
}
@Override
protected IModel<PrismContainerWrapper<ResourceObjectTypeDefinitionType>> getContainerModel() {
return PrismContainerWrapperModel.fromContainerWrapper(ResourceSchemaHandlingTabPanel.this.getModel(), SchemaHandlingType.F_OBJECT_TYPE);
}
@Override
protected UserProfileStorage.TableId getTableId() {
return null;
}
@Override
protected List<IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String>> createDefaultColumns() {
List<IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String>> columns = new ArrayList<>();
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DISPLAY_NAME, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_KIND, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_INTENT, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DEFAULT, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DESCRIPTION, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
List<InlineMenuItem> menuActionsList = getMultivalueContainerListPanel().getDefaultMenuActions();
columns.add(new InlineMenuButtonColumn(menuActionsList, getPageBase()) {
private static final long serialVersionUID = 1L;
@Override
public String getCssClass() {
return " col-md-1 ";
}
});
return columns;
}
};
form.add(objectTypesPanel);
}
Aggregations