use of com.evolveum.midpoint.gui.api.component.MainObjectListPanel 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.gui.api.component.MainObjectListPanel 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.gui.api.component.MainObjectListPanel in project midpoint by Evolveum.
the class PageCreatedReports method initLayout.
private void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<ReportDataType> table = new MainObjectListPanel<ReportDataType>(ID_TABLE, ReportDataType.class) {
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ReportDataType object) {
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_CREATED_REPORTS_PANEL;
}
@Override
protected ISelectableDataProvider<ReportDataType, SelectableBean<ReportDataType>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> appendTypeFilter(), (sortParam) -> PageCreatedReports.this.createCustomOrdering(sortParam));
}
// @Override
// protected ObjectQuery getCustomizeContentQuery() {
// return appendTypeFilter();
// }
//
// @Override
// protected List<ObjectOrdering> createObjectOrderings(SortParam<String> sortParam) {
// return PageCreatedReports.this.createCustomOrdering(sortParam);
// }
// @Override
// protected ISelectableDataProvider<ReportDataType, SelectableBean<ReportDataType>> createProvider() {
// PageStorage storage = getObjectListPanel().getPageStorage();
// SelectableBeanObjectDataProvider<ReportDataType> provider = new SelectableBeanObjectDataProvider<ReportDataType>(
// getPageBase(), getSearchModel(), null) {
// private static final long serialVersionUID = 1L;
//
// @Override
// protected PageStorage getPageStorage() {
// return storage;
// }
//
// @NotNull
// @Override
// protected List<ObjectOrdering> createObjectOrderings(SortParam<String> sortParam) {
// return PageCreatedReports.this.createCustomOrdering(sortParam);
// }
//
// @Override
// protected ObjectQuery getCustomizeContentQuery() {
// return appendTypeFilter();
// }
// };
// provider.setCompiledObjectCollectionView(getObjectCollectionView());
// provider.setOptions(createOptions());
// return provider;
// }
@Override
protected List<InlineMenuItem> createInlineMenu() {
return initInlineMenu();
}
@Override
protected boolean isCreateNewObjectEnabled() {
return false;
}
@Override
protected boolean isObjectDetailsEnabled(IModel<SelectableBean<ReportDataType>> rowModel) {
return false;
}
@Override
protected List<IColumn<SelectableBean<ReportDataType>, String>> createDefaultColumns() {
return PageCreatedReports.this.initColumns();
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
String reportName = reportTypeMal.get(getReportType());
List<String> values = new ArrayList<>(reportTypeMal.values());
DropDownChoicePanel<String> reportTypeSelect = new DropDownChoicePanel<>(ID_REPORT_TYPE_SELECT, Model.of(reportName), Model.ofList(values), StringChoiceRenderer.simple(), true);
reportTypeSelect.getBaseFormComponent().add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
table.refreshTable(target);
}
});
reportTypeSelect.setOutputMarkupId(true);
mainForm.add(reportTypeSelect);
ajaxDownloadBehavior = new AjaxDownloadBehaviorFromStream() {
private static final long serialVersionUID = 1L;
@Override
protected InputStream initStream() {
return createReport();
}
@Override
public String getFileName() {
return getReportFileName();
}
};
mainForm.add(ajaxDownloadBehavior);
}
use of com.evolveum.midpoint.gui.api.component.MainObjectListPanel in project midpoint by Evolveum.
the class PageObjectCollections method initLayout.
private void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<ObjectCollectionType> table = new MainObjectListPanel<ObjectCollectionType>(ID_TABLE, ObjectCollectionType.class) {
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_OBJECTS_COLLECTION;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
List<InlineMenuItem> menu = new ArrayList<>();
menu.add(createDeleteInlineMenu());
return menu;
}
@Override
protected List<IColumn<SelectableBean<ObjectCollectionType>, String>> createDefaultColumns() {
return ColumnUtils.getDefaultObjectColumns();
}
@Override
protected String getNothingSelectedMessage() {
return getString("pageObjectCollections.message.nothingSelected");
}
@Override
protected String getConfirmMessageKeyForSingleObject() {
return "pageObjectCollections.message.confirmationMessageForMultipleObject";
}
@Override
protected String getConfirmMessageKeyForMultiObject() {
return "pageObjectCollections.message.confirmationMessageForSingleObject";
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
}
use of com.evolveum.midpoint.gui.api.component.MainObjectListPanel in project midpoint by Evolveum.
the class PageResources method initLayout.
protected void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<ResourceType> table = new MainObjectListPanel<ResourceType>(ID_TABLE, ResourceType.class, getQueryOptions()) {
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ResourceType object) {
clearSessionStorageForResourcePage();
super.objectDetailsPerformed(target, object);
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_RESOURCES;
}
@Override
protected List<IColumn<SelectableBean<ResourceType>, String>> createDefaultColumns() {
return PageResources.this.initResourceColumns();
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return PageResources.this.createRowMenuItems();
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
table.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_RESOURCE_BOX_CSS_CLASSES);
}
Aggregations