use of com.evolveum.midpoint.web.component.MultiFunctinalButtonDto in project midpoint by Evolveum.
the class PageCreateFromTemplate method loadButtonDescriptions.
protected LoadableModel<MultiFunctinalButtonDto> loadButtonDescriptions() {
return new LoadableModel<>(false) {
@Override
protected MultiFunctinalButtonDto load() {
List<CompositedIconButtonDto> additionalButtons = new ArrayList<>();
Collection<CompiledObjectCollectionView> compiledObjectCollectionViews = getCompiledGuiProfile().findAllApplicableArchetypeViews(getType(), OperationTypeType.ADD);
if (CollectionUtils.isNotEmpty(compiledObjectCollectionViews)) {
compiledObjectCollectionViews.forEach(collection -> {
CompositedIconButtonDto buttonDesc = new CompositedIconButtonDto();
buttonDesc.setCompositedIcon(createCompositedIcon(collection));
buttonDesc.setOrCreateDefaultAdditionalButtonDisplayType(collection.getDisplay());
buttonDesc.setCollectionView(collection);
additionalButtons.add(buttonDesc);
});
}
if (isGenericNewButtonVisible()) {
CompositedIconButtonDto defaultButton = new CompositedIconButtonDto();
DisplayType defaultButtonDisplayType = getDefaultButtonDisplayType();
defaultButton.setAdditionalButtonDisplayType(defaultButtonDisplayType);
CompositedIconBuilder defaultButtonIconBuilder = new CompositedIconBuilder();
defaultButtonIconBuilder.setBasicIcon(WebComponentUtil.getIconCssClass(defaultButtonDisplayType), IconCssStyle.IN_ROW_STYLE).appendColorHtmlValue(WebComponentUtil.getIconColor(defaultButtonDisplayType));
defaultButton.setCompositedIcon(defaultButtonIconBuilder.build());
additionalButtons.add(defaultButton);
}
MultiFunctinalButtonDto multifunctionalButton = new MultiFunctinalButtonDto();
multifunctionalButton.setAdditionalButtons(additionalButtons);
return multifunctionalButton;
}
};
}
use of com.evolveum.midpoint.web.component.MultiFunctinalButtonDto in project midpoint by Evolveum.
the class AbstractRoleMemberPanel method initMemberTable.
private <AH extends AssignmentHolderType> void initMemberTable(Form<?> form) {
WebMarkupContainer memberContainer = new WebMarkupContainer(ID_CONTAINER_MEMBER);
memberContainer.setOutputMarkupId(true);
memberContainer.setOutputMarkupPlaceholderTag(true);
form.add(memberContainer);
// TODO QName defines a relation value which will be used for new member creation
MainObjectListPanel<AH> childrenListPanel = new MainObjectListPanel<>(ID_MEMBER_TABLE, getDefaultObjectTypeClass(), getSearchOptions()) {
private static final long serialVersionUID = 1L;
@Override
protected UserProfileStorage.TableId getTableId() {
return AbstractRoleMemberPanel.this.getTableId(getComplexTypeQName());
}
@Override
protected List<IColumn<SelectableBean<AH>, String>> createDefaultColumns() {
List<IColumn<SelectableBean<AH>, String>> columns = super.createDefaultColumns();
columns.add(createRelationColumn());
return columns;
}
@Override
protected boolean isObjectDetailsEnabled(IModel<SelectableBean<AH>> rowModel) {
if (rowModel == null || rowModel.getObject() == null || rowModel.getObject().getValue() == null) {
return false;
}
Class<?> objectClass = rowModel.getObject().getValue().getClass();
return WebComponentUtil.hasDetailsPage(objectClass);
}
@Override
protected boolean showNewObjectCreationPopup() {
return CollectionUtils.isNotEmpty(getNewObjectReferencesList(getObjectCollectionView(), null));
}
@Override
protected List<Component> createToolbarButtonsList(String buttonId) {
List<Component> buttonsList = super.createToolbarButtonsList(buttonId);
AjaxIconButton assignButton = createAssignButton(buttonId);
buttonsList.add(1, assignButton);
return buttonsList;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return createRowActions();
}
@Override
protected String getStorageKey() {
return AbstractRoleMemberPanel.this.createStorageKey();
}
protected PageStorage getPageStorage(String storageKey) {
return getSession().getSessionStorage().getPageStorageMap().get(storageKey);
}
@Override
protected Search<AH> createSearch(Class<AH> type) {
return createMemberSearch(type);
}
@Override
protected SelectableBeanObjectDataProvider<AH> createProvider() {
SelectableBeanObjectDataProvider<AH> provider = createSelectableBeanObjectDataProvider(() -> getCustomizedQuery(getSearchModel().getObject()), null);
provider.setIsMemberPanel(true);
provider.addQueryVariables(ExpressionConstants.VAR_PARENT_OBJECT, AbstractRoleMemberPanel.this.getModelObject());
return provider;
}
@Override
public void refreshTable(AjaxRequestTarget target) {
if (getSearchModel().isAttached() && getSearchModel().getObject() != null && getSearchModel().getObject().isTypeChanged()) {
clearCache();
}
if (reloadPageOnRefresh()) {
throw new RestartResponseException(getPage().getClass());
} else {
super.refreshTable(target);
}
}
@Override
protected List<ObjectReferenceType> getNewObjectReferencesList(CompiledObjectCollectionView collectionView, AssignmentObjectRelation relation) {
List<ObjectReferenceType> refList = super.getNewObjectReferencesList(collectionView, relation);
if (refList == null) {
refList = new ArrayList<>();
}
if (relation != null && CollectionUtils.isNotEmpty(relation.getArchetypeRefs())) {
refList.addAll(relation.getArchetypeRefs());
}
ObjectReferenceType membershipRef = new ObjectReferenceType();
membershipRef.setOid(AbstractRoleMemberPanel.this.getModelObject().getOid());
membershipRef.setType(AbstractRoleMemberPanel.this.getModelObject().asPrismObject().getComplexTypeDefinition().getTypeName());
membershipRef.setRelation(relation != null && CollectionUtils.isNotEmpty(relation.getRelations()) ? relation.getRelations().get(0) : null);
refList.add(membershipRef);
return refList;
}
@Override
protected LoadableModel<MultiFunctinalButtonDto> loadButtonDescriptions() {
return loadMultiFunctionalButtonModel(true);
}
@Override
protected String getTitleForNewObjectButton() {
return createStringResource("TreeTablePanel.menu.createMember").getString();
}
};
childrenListPanel.setOutputMarkupId(true);
memberContainer.add(childrenListPanel);
}
use of com.evolveum.midpoint.web.component.MultiFunctinalButtonDto in project midpoint by Evolveum.
the class AbstractRoleMemberPanel method initMemberTable.
private <AH extends AssignmentHolderType> void initMemberTable(Form<?> form) {
WebMarkupContainer memberContainer = new WebMarkupContainer(ID_CONTAINER_MEMBER);
memberContainer.setOutputMarkupId(true);
memberContainer.setOutputMarkupPlaceholderTag(true);
form.add(memberContainer);
// TODO QName defines a relation value which will be used for new member creation
MainObjectListPanel<AH> childrenListPanel = new MainObjectListPanel<>(ID_MEMBER_TABLE, getDefaultObjectTypeClass(), getSearchOptions(), getPanelConfiguration()) {
private static final long serialVersionUID = 1L;
@Override
protected UserProfileStorage.TableId getTableId() {
return AbstractRoleMemberPanel.this.getTableId(getComplexTypeQName());
}
@Override
protected List<IColumn<SelectableBean<AH>, String>> createDefaultColumns() {
List<IColumn<SelectableBean<AH>, String>> columns = super.createDefaultColumns();
columns.add(createRelationColumn());
return columns;
}
@Override
protected boolean isObjectDetailsEnabled(IModel<SelectableBean<AH>> rowModel) {
if (rowModel == null || rowModel.getObject() == null || rowModel.getObject().getValue() == null) {
return false;
}
Class<?> objectClass = rowModel.getObject().getValue().getClass();
return WebComponentUtil.hasDetailsPage(objectClass);
}
@Override
protected List<Component> createToolbarButtonsList(String buttonId) {
List<Component> buttonsList = super.createToolbarButtonsList(buttonId);
AjaxIconButton assignButton = createAssignButton(buttonId);
buttonsList.add(1, assignButton);
return buttonsList;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return createRowActions();
}
@Override
protected String getStorageKey() {
return AbstractRoleMemberPanel.this.createStorageKey();
}
protected PageStorage getPageStorage(String storageKey) {
return getSession().getSessionStorage().getPageStorageMap().get(storageKey);
}
@Override
protected Search<AH> createSearch(Class<AH> type) {
return createMemberSearch(type);
}
@Override
protected SelectableBeanObjectDataProvider<AH> createProvider() {
SelectableBeanObjectDataProvider<AH> provider = createSelectableBeanObjectDataProvider(() -> getCustomizedQuery(getSearchModel().getObject()), null);
provider.addQueryVariables(ExpressionConstants.VAR_PARENT_OBJECT, AbstractRoleMemberPanel.this.getModelObject());
return provider;
}
@Override
public void refreshTable(AjaxRequestTarget target) {
if (getSearchModel().isAttached() && getSearchModel().getObject() != null && getSearchModel().getObject().isTypeChanged()) {
clearCache();
}
if (reloadPageOnRefresh()) {
throw new RestartResponseException(getPage().getClass());
} else {
super.refreshTable(target);
}
}
@Override
protected boolean showNewObjectCreationPopup() {
return CollectionUtils.isNotEmpty(getNewObjectReferencesList(getObjectCollectionView(), null));
}
@Override
protected List<ObjectReferenceType> getNewObjectReferencesList(CompiledObjectCollectionView collectionView, AssignmentObjectRelation relation) {
List<ObjectReferenceType> refList = super.getNewObjectReferencesList(collectionView, relation);
if (refList == null) {
refList = new ArrayList<>();
}
if (relation != null && CollectionUtils.isNotEmpty(relation.getArchetypeRefs())) {
refList.addAll(relation.getArchetypeRefs());
}
ObjectReferenceType membershipRef = new ObjectReferenceType();
membershipRef.setOid(AbstractRoleMemberPanel.this.getModelObject().getOid());
membershipRef.setType(AbstractRoleMemberPanel.this.getModelObject().asPrismObject().getComplexTypeDefinition().getTypeName());
membershipRef.setRelation(relation != null && CollectionUtils.isNotEmpty(relation.getRelations()) ? relation.getRelations().get(0) : null);
refList.add(membershipRef);
return refList;
}
@Override
protected LoadableModel<MultiFunctinalButtonDto> loadButtonDescriptions() {
return loadMultiFunctionalButtonModel(true);
}
@Override
public ContainerPanelConfigurationType getPanelConfiguration() {
return AbstractRoleMemberPanel.this.getPanelConfiguration();
}
@Override
protected String getTitleForNewObjectButton() {
return createStringResource("TreeTablePanel.menu.createMember").getString();
}
};
childrenListPanel.setOutputMarkupId(true);
memberContainer.add(childrenListPanel);
}
use of com.evolveum.midpoint.web.component.MultiFunctinalButtonDto in project midpoint by Evolveum.
the class CreateTemplatePanel method loadButtonDescriptions.
protected LoadableModel<MultiFunctinalButtonDto> loadButtonDescriptions() {
return new LoadableModel<>(false) {
@Override
protected MultiFunctinalButtonDto load() {
List<CompositedIconButtonDto> additionalButtons = new ArrayList<>();
Collection<CompiledObjectCollectionView> compiledObjectCollectionViews = findAllApplicableArchetypeViews();
if (CollectionUtils.isNotEmpty(compiledObjectCollectionViews)) {
compiledObjectCollectionViews.forEach(collection -> {
CompositedIconButtonDto buttonDesc = new CompositedIconButtonDto();
buttonDesc.setCompositedIcon(createCompositedIcon(collection));
buttonDesc.setOrCreateDefaultAdditionalButtonDisplayType(collection.getDisplay());
buttonDesc.setCollectionView(collection);
additionalButtons.add(buttonDesc);
});
}
MultiFunctinalButtonDto multifunctionalButton = new MultiFunctinalButtonDto();
multifunctionalButton.setAdditionalButtons(additionalButtons);
return multifunctionalButton;
}
};
}
use of com.evolveum.midpoint.web.component.MultiFunctinalButtonDto in project midpoint by Evolveum.
the class AbstractRoleMemberPanel method loadMultiFunctionalButtonModel.
protected LoadableModel<MultiFunctinalButtonDto> loadMultiFunctionalButtonModel(boolean useDefaultObjectRelations) {
return new LoadableModel<>(false) {
@Override
protected MultiFunctinalButtonDto load() {
MultiFunctinalButtonDto multiFunctinalButtonDto = new MultiFunctinalButtonDto();
DisplayType mainButtonDisplayType = getCreateMemberButtonDisplayType();
CompositedIconBuilder builder = new CompositedIconBuilder();
Map<IconCssStyle, IconType> layerIcons = WebComponentUtil.createMainButtonLayerIcon(mainButtonDisplayType);
for (Map.Entry<IconCssStyle, IconType> icon : layerIcons.entrySet()) {
builder.appendLayerIcon(icon.getValue(), icon.getKey());
}
CompositedIconButtonDto mainButton = createCompositedIconButtonDto(mainButtonDisplayType, null, builder.build());
multiFunctinalButtonDto.setMainButton(mainButton);
List<AssignmentObjectRelation> loadedRelations = loadMemberRelationsList();
if (CollectionUtils.isEmpty(loadedRelations) && useDefaultObjectRelations) {
loadedRelations.addAll(getDefaultNewMemberRelations());
}
List<CompositedIconButtonDto> additionalButtons = new ArrayList<>();
if (CollectionUtils.isNotEmpty(loadedRelations)) {
List<AssignmentObjectRelation> relations = WebComponentUtil.divideAssignmentRelationsByAllValues(loadedRelations);
relations.forEach(relation -> {
DisplayType additionalButtonDisplayType = GuiDisplayTypeUtil.getAssignmentObjectRelationDisplayType(getPageBase(), relation, "abstractRoleMemberPanel.menu.createMember");
CompositedIconButtonDto buttonDto = createCompositedIconButtonDto(additionalButtonDisplayType, relation, createCompositedIcon(relation, additionalButtonDisplayType));
additionalButtons.add(buttonDto);
});
}
multiFunctinalButtonDto.setAdditionalButtons(additionalButtons);
return multiFunctinalButtonDto;
}
};
}
Aggregations