use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class TestWrapperDelta method createDummyResourceAssignment.
private PrismContainerValue<AssignmentType> createDummyResourceAssignment(PrismObjectWrapper<UserType> objectWrapper, int existingAssignments, Task task, OperationResult result) throws Exception {
PrismContainerWrapper<AssignmentType> assignment = objectWrapper.findContainer(UserType.F_ASSIGNMENT);
assertNotNull("unexpected null assignment wrapper", assignment);
assertEquals("Unexpected values for assignment " + assignment.getValues().size(), existingAssignments, assignment.getValues().size());
ModelServiceLocator locator = getServiceLocator(task);
PrismContainerValue<AssignmentType> newAssignment = assignment.getItem().createNewValue();
AssignmentType newAssignmentType = newAssignment.asContainerable();
ConstructionType constructionType = new ConstructionType(locator.getPrismContext());
constructionType.setResourceRef(ObjectTypeUtil.createObjectRef(resourceDummy, locator.getPrismContext()));
constructionType.setKind(ShadowKindType.ACCOUNT);
constructionType.setIntent("default");
newAssignmentType.setConstruction(constructionType);
PrismContainerValue<AssignmentType> newAssignmentClone = newAssignment.clone();
WrapperContext ctx = new WrapperContext(task, result);
PrismContainerValueWrapper vw = locator.createValueWrapper(assignment, newAssignment, ValueStatus.ADDED, ctx);
assignment.getValues().add(vw);
return newAssignmentClone;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class ListMappingPanel method initLayout.
private void initLayout() {
MultivalueContainerListPanelWithDetailsPanel<MappingType> table = new MultivalueContainerListPanelWithDetailsPanel<MappingType>(ID_TABLE, MappingType.class) {
@Override
protected MultivalueContainerDetailsPanel<MappingType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<MappingType>> item) {
return new MultivalueContainerDetailsPanel<>(MultivalueContainerListPanelWithDetailsPanel.ID_ITEM_DETAILS, item.getModel(), true) {
@Override
protected DisplayNamePanel<MappingType> createDisplayNamePanel(String displayNamePanelId) {
ItemRealValueModel<MappingType> displayNameModel = new ItemRealValueModel<>(item.getModel());
return new DisplayNamePanel<>(displayNamePanelId, displayNameModel) {
@Override
protected IModel<String> createHeaderModel() {
IModel<String> headerModel = super.createHeaderModel();
if (StringUtils.isEmpty(headerModel.getObject())) {
return getPageBase().createStringResource("feedbackMessagePanel.message.undefined");
}
return headerModel;
}
};
}
@Override
protected ItemVisibility getBasicTabVisibity(ItemWrapper<?, ?> itemWrapper) {
if (itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, MappingType.F_METADATA_MAPPING))) {
return ItemVisibility.HIDDEN;
}
return ItemVisibility.AUTO;
}
};
}
@Override
protected boolean isCreateNewObjectVisible() {
return true;
}
@Override
protected IModel<PrismContainerWrapper<MappingType>> getContainerModel() {
return ListMappingPanel.this.getModel();
}
@Override
protected UserProfileStorage.TableId getTableId() {
return null;
}
@Override
protected List<IColumn<PrismContainerValueWrapper<MappingType>, String>> createDefaultColumns() {
List<IColumn<PrismContainerValueWrapper<MappingType>, String>> columns = new ArrayList<>();
columns.add(new PrismPropertyWrapperColumn<>(ListMappingPanel.this.getModel(), MappingType.F_DESCRIPTION, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(ListMappingPanel.this.getModel(), MappingType.F_ENABLED, AbstractItemWrapperColumn.ColumnType.VALUE, getPageBase()));
columns.add(new AbstractColumn<>(createStringResource("ListMappingPanel.mappingDescription")) {
@Override
public void populateItem(Item<ICellPopulator<PrismContainerValueWrapper<MappingType>>> cellItem, String componentId, IModel<PrismContainerValueWrapper<MappingType>> rowModel) {
cellItem.add(new Label(componentId, WebComponentUtil.createMappingDescription(rowModel)));
}
});
List<InlineMenuItem> items = new ArrayList<>();
InlineMenuItem item = new InlineMenuItem(createStringResource("pageAdminFocus.button.delete")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
deleteItemPerformed(target, getPerformedSelectedItems(getRowModel()));
}
};
}
};
items.add(item);
item = new ButtonInlineMenuItem(createStringResource("PageBase.button.edit")) {
private static final long serialVersionUID = 1L;
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_EDIT_MENU_ITEM);
}
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
editItemPerformed(target, getRowModel(), getSelectedItems());
target.add(getFeedbackPanel());
}
};
}
};
items.add(item);
columns.add(new InlineMenuButtonColumn(items, getPageBase()) {
@Override
public String getCssClass() {
return "col-xs-1";
}
});
return columns;
}
@Override
protected IColumn<PrismContainerValueWrapper<MappingType>, String> createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
return new PrismPropertyWrapperColumn<>(ListMappingPanel.this.getModel(), MappingType.F_NAME, AbstractItemWrapperColumn.ColumnType.LINK, getPageBase()) {
@Override
protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<MappingType>> model) {
itemDetailsPerformed(target, model);
}
};
}
@Override
protected IColumn<PrismContainerValueWrapper<MappingType>, String> createCheckboxColumn() {
return new CheckBoxHeaderColumn<>();
}
@Override
protected PrismContainerDefinition<MappingType> getTypeDefinitionForSearch() {
return getPrismContext().getSchemaRegistry().findContainerDefinitionByType(MappingType.COMPLEX_TYPE);
}
};
add(table);
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class ProvenanceMetadataPanel method createAcquisitionPanel.
private WebMarkupContainer createAcquisitionPanel(IModel<PrismContainerWrapper<ProvenanceAcquisitionType>> listPropertyModel) {
WebMarkupContainer container = new WebMarkupContainer(ID_ACQUISITION_HEADER);
ListView<PrismContainerValueWrapper<ProvenanceAcquisitionType>> acquisition = new ListView<PrismContainerValueWrapper<ProvenanceAcquisitionType>>(ID_ACQUISITIONS, new PropertyModel<>(listPropertyModel, "values")) {
@Override
protected void populateItem(ListItem<PrismContainerValueWrapper<ProvenanceAcquisitionType>> listItem) {
ProvenanceAcquisitionHeaderPanel panel = new ProvenanceAcquisitionHeaderPanel(ID_ACQUISITION, new ItemRealValueModel<>(listItem.getModel()));
panel.setOutputMarkupId(true);
listItem.add(panel);
}
};
container.add(acquisition);
return container;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class MultivalueContainerListPanelWithDetailsPanel method initDetailsPanel.
protected void initDetailsPanel() {
WebMarkupContainer details = new WebMarkupContainer(ID_DETAILS);
details.setOutputMarkupId(true);
details.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return itemDetailsVisible;
}
});
add(details);
ListView<PrismContainerValueWrapper<C>> itemDetailsView = new ListView<>(MultivalueContainerListPanelWithDetailsPanel.ID_ITEMS_DETAILS, () -> detailsPanelItemsList) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<PrismContainerValueWrapper<C>> item) {
MultivalueContainerDetailsPanel<C> detailsPanel = getMultivalueContainerDetailsPanel(item);
item.add(detailsPanel);
detailsPanel.setOutputMarkupId(true);
}
};
itemDetailsView.setOutputMarkupId(true);
details.add(itemDetailsView);
WebMarkupContainer buttonsContainer = new WebMarkupContainer(ID_BUTTONS_PANEL);
buttonsContainer.add(new VisibleBehaviour(this::isButtonPanelVisible));
details.add(buttonsContainer);
AjaxButton doneButton = new AjaxButton(ID_DONE_BUTTON, createStringResource("MultivalueContainerListPanel.doneButton")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
itemDetailsVisible = false;
refreshTable(ajaxRequestTarget);
ajaxRequestTarget.add(MultivalueContainerListPanelWithDetailsPanel.this);
}
};
buttonsContainer.add(doneButton);
AjaxButton cancelButton = new AjaxButton(ID_CANCEL_BUTTON, createStringResource("MultivalueContainerListPanel.cancelButton")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
itemDetailsVisible = false;
cancelItemDetailsPerformed(ajaxRequestTarget);
ajaxRequestTarget.add(MultivalueContainerListPanelWithDetailsPanel.this);
ajaxRequestTarget.add(getPageBase().getFeedbackPanel());
}
};
buttonsContainer.add(cancelButton);
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class MappingColumnPanel method initLayout.
private void initLayout() {
ListView<PrismContainerValueWrapper<MappingType>> mappings = new ListView<>(ID_MAPPINGS, new PropertyModel<>(getModel(), "values")) {
@Override
protected void populateItem(ListItem<PrismContainerValueWrapper<MappingType>> item) {
Label label = new Label(ID_MAPPING, WebComponentUtil.createMappingDescription(item.getModel()));
label.add(AttributeAppender.append("class", createEnabledDisabledStyles(item.getModelObject())));
item.add(label);
}
};
add(mappings);
}
Aggregations