use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.
the class PageCertDefinitions method initLayout.
private void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<AccessCertificationDefinitionType> mainPanel = new MainObjectListPanel<AccessCertificationDefinitionType>(ID_TABLE, AccessCertificationDefinitionType.class, null) {
private static final long serialVersionUID = 1L;
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_CERT_DEFINITIONS_PANEL;
}
@Override
protected IColumn<SelectableBean<AccessCertificationDefinitionType>, String> createCheckboxColumn() {
return null;
}
@Override
public void objectDetailsPerformed(AjaxRequestTarget target, AccessCertificationDefinitionType service) {
PageCertDefinitions.this.detailsPerformed(target, service);
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return PageCertDefinitions.this.createInlineMenu();
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation, CompiledObjectCollectionView collectionView) {
navigateToNext(PageCertDefinition.class);
}
};
mainPanel.setOutputMarkupId(true);
mainPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_CERT_DEF_BOX_CSS_CLASSES);
mainForm.add(mainPanel);
}
use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.
the class AssignmentPopup method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
Form form = new Form(ID_FORM);
form.setOutputMarkupId(true);
add(form);
MultiCompositedButtonPanel newObjectIcon = new MultiCompositedButtonPanel(ID_COMPOSITED_BUTTONS, createNewButtonDescriptionModel()) {
@Override
protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
Form form = (Form) AssignmentPopup.this.get(ID_FORM);
AssignmentPopup.this.getModelObject().setSelectionVisible(false);
addOrReplaceTabPanels(form, relationSpec);
target.add(form);
}
};
form.add(newObjectIcon);
newObjectIcon.add(new VisibleBehaviour(() -> getModelObject() != null && getModelObject().isSelectionVisible()));
addOrReplaceTabPanels(form, null);
MessagePanel warningMessage = new MessagePanel(ID_WARNING_MESSAGE, MessagePanel.MessagePanelType.WARN, getWarningMessageModel());
warningMessage.setOutputMarkupId(true);
warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null));
add(warningMessage);
form.add(createCancelButton());
form.add(createAddButton());
form.add(createBackButton());
}
use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.
the class MainObjectListPanel method createNewObjectButton.
private Component createNewObjectButton(String buttonId) {
DisplayType newObjectButtonDisplayType = getNewObjectButtonStandardDisplayType();
CompositedIconBuilder builder = new CompositedIconBuilder();
builder.setBasicIcon(WebComponentUtil.getIconCssClass(newObjectButtonDisplayType), IconCssStyle.IN_ROW_STYLE).appendColorHtmlValue(WebComponentUtil.getIconColor(newObjectButtonDisplayType));
CompiledObjectCollectionView view = getObjectCollectionView();
if (ObjectCollectionViewUtil.isArchetypedCollectionView(view)) {
IconType plusIcon = new IconType();
plusIcon.setCssClass(GuiStyleConstants.CLASS_ADD_NEW_OBJECT);
plusIcon.setColor("green");
builder.appendLayerIcon(plusIcon, LayeredIconCssStyle.BOTTOM_RIGHT_STYLE);
}
String iconTitle = WebComponentUtil.getDisplayTypeTitle(newObjectButtonDisplayType);
AjaxCompositedIconButton createNewObjectButton = new AjaxCompositedIconButton(buttonId, builder.build(), createStringResource(StringUtils.isEmpty(iconTitle) ? "MainObjectListPanel.newObject" : iconTitle)) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
if (isCollectionViewPanelForCompiledView()) {
CompiledObjectCollectionView collectionView = getObjectCollectionView();
// HACK TODO clenup and think about generic mechanism for this
if (isCollectionViewWithoutMorePossibleNewType(collectionView)) {
newObjectPerformed(target, null, collectionView);
return;
}
}
if (!showNewObjectCreationPopup()) {
newObjectPerformed(target, null, getObjectCollectionView());
return;
}
NewObjectCreationPopup buttonsPanel = new NewObjectCreationPopup(getPageBase().getMainPopupBodyId(), new PropertyModel<>(loadButtonDescriptions(), MultiFunctinalButtonDto.F_ADDITIONAL_BUTTONS)) {
private static final long serialVersionUID = 1L;
@Override
protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
getPageBase().hideMainPopup(target);
MainObjectListPanel.this.newObjectPerformed(target, relationSpec, collectionViews);
}
};
getPageBase().showMainPopup(buttonsPanel, target);
}
};
createNewObjectButton.add(new VisibleBehaviour(this::isCreateNewObjectEnabled));
createNewObjectButton.add(AttributeAppender.append("class", "btn btn-default btn-sm"));
return createNewObjectButton;
}
use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.
the class NewObjectCreationPopup method initLayout.
private void initLayout() {
MultiCompositedButtonPanel buttonPanel = new MultiCompositedButtonPanel(ID_NEW_OBJECT_SELECTION_BUTTON_PANEL, getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
NewObjectCreationPopup.this.buttonClickPerformed(target, relationSpec, collectionViews, page);
}
};
buttonPanel.setOutputMarkupId(true);
add(buttonPanel);
AjaxButton cancel = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("PageBase.button.cancel")) {
@Override
public void onClick(AjaxRequestTarget target) {
cancelPerformed(target);
}
};
add(cancel);
}
use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.
the class FocusProjectionsPanel method initLayout.
protected void initLayout() {
IModel<Integer> deadShadows = new ReadOnlyModel<>(this::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, getPanelConfiguration()) {
private static final long serialVersionUID = 1L;
@Override
protected ISelectableDataProvider<ShadowType, PrismContainerValueWrapper<ShadowType>> createProvider() {
return new ProjectionsListProvider(FocusProjectionsPanel.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 = Arrays.asList(ResourceType.COMPLEX_TYPE);
PageBase pageBase = FocusProjectionsPanel.this.getPageBase();
ObjectBrowserPanel<ResourceType> resourceSelectionPanel = new ObjectBrowserPanel<>(pageBase.getMainPopupBodyId(), ResourceType.class, supportedTypes, true, pageBase) {
private static final long serialVersionUID = 1L;
@Override
protected void addPerformed(AjaxRequestTarget target, QName type, List<ResourceType> selected) {
FocusProjectionsPanel.this.addSelectedAccountPerformed(target, selected);
target.add(getPageBase().getFeedbackPanel());
}
};
resourceSelectionPanel.setOutputMarkupId(true);
pageBase.showMainPopup(resourceSelectionPanel, target);
}
@Override
protected boolean isCreateNewObjectVisible() {
PrismObjectDefinition<F> def = FocusProjectionsPanel.this.getObjectWrapperModel().getObject().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 TableId.FOCUS_PROJECTION_TABLE;
}
@Override
protected List<IColumn<PrismContainerValueWrapper<ShadowType>, String>> createDefaultColumns() {
return initBasicColumns();
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return createShadowMenu();
}
@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()) {
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 FocusProjectionsPanel.this.getMultivalueContainerDetailsPanel(item);
}
};
add(multivalueContainerListPanel);
setOutputMarkupId(true);
}
Aggregations