use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class GenericAbstractRoleAssignmentPanel method customPostSearch.
@Override
protected List<PrismContainerValueWrapper<AssignmentType>> customPostSearch(List<PrismContainerValueWrapper<AssignmentType>> assignments) {
if (assignments == null) {
return null;
}
List<PrismContainerValueWrapper<AssignmentType>> resultList = new ArrayList<>();
Task task = getPageBase().createSimpleTask("load assignment targets");
Iterator<PrismContainerValueWrapper<AssignmentType>> assignmentIterator = assignments.iterator();
while (assignmentIterator.hasNext()) {
PrismContainerValueWrapper<AssignmentType> ass = assignmentIterator.next();
AssignmentType assignment = ass.getRealValue();
if (assignment == null || assignment.getTargetRef() == null) {
continue;
}
if (QNameUtil.match(assignment.getTargetRef().getType(), OrgType.COMPLEX_TYPE)) {
PrismObject<OrgType> org = WebModelServiceUtils.loadObject(assignment.getTargetRef(), getPageBase(), task, task.getResult());
if (org != null) {
if (FocusTypeUtil.determineSubTypes(org).contains("access")) {
resultList.add(ass);
}
}
}
}
return resultList;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class LoggingConfigurationTabPanel method initAppendersBasicColumns.
private List<IColumn<PrismContainerValueWrapper<AppenderConfigurationType>, String>> initAppendersBasicColumns(IModel<PrismContainerWrapper<AppenderConfigurationType>> appenderModel) {
List<IColumn<PrismContainerValueWrapper<AppenderConfigurationType>, String>> columns = new ArrayList<>();
columns.add(new CheckBoxHeaderColumn<>());
columns.add(new IconColumn<PrismContainerValueWrapper<AppenderConfigurationType>>(Model.of("")) {
private static final long serialVersionUID = 1L;
@Override
protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<AppenderConfigurationType>> rowModel) {
return GuiDisplayTypeUtil.createDisplayType(WebComponentUtil.createDefaultBlackIcon(SystemConfigurationType.COMPLEX_TYPE));
}
});
columns.add(new PrismPropertyWrapperColumn<AppenderConfigurationType, String>(appenderModel, AppenderConfigurationType.F_NAME, ColumnType.LINK, getPageBase()) {
@Override
protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<AppenderConfigurationType>> rowModel) {
getAppendersMultivalueContainerListPanel().itemDetailsPerformed(target, rowModel);
}
});
columns.add(new PrismPropertyWrapperColumn<AppenderConfigurationType, String>(appenderModel, AppenderConfigurationType.F_PATTERN, ColumnType.VALUE, getPageBase()) {
@Override
public String getCssClass() {
return " col-md-5 ";
}
});
columns.add(new AbstractColumn<PrismContainerValueWrapper<AppenderConfigurationType>, String>(createStringResource("LoggingConfigurationTabPanel.appender.typeColumn")) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<PrismContainerValueWrapper<AppenderConfigurationType>>> item, String componentId, final IModel<PrismContainerValueWrapper<AppenderConfigurationType>> rowModel) {
ItemRealValueModel<AppenderConfigurationType> appender = new ItemRealValueModel<>(rowModel);
String type = "";
if (appender != null && appender.getObject() instanceof FileAppenderConfigurationType) {
type = "File appender";
} else if (appender != null && appender.getObject() instanceof SyslogAppenderConfigurationType) {
type = "Syslog appender";
}
item.add(new Label(componentId, Model.of(type)));
}
});
List<InlineMenuItem> menuActionsList = getAppendersMultivalueContainerListPanel().getDefaultMenuActions();
columns.add(new InlineMenuButtonColumn(menuActionsList, getPageBase()) {
@Override
public String getCssClass() {
return " col-md-1 ";
}
});
return columns;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class LoggingConfigurationTabPanel method initLoggersBasicColumns.
private List<IColumn<PrismContainerValueWrapper<ClassLoggerConfigurationType>, String>> initLoggersBasicColumns(IModel<PrismContainerWrapper<ClassLoggerConfigurationType>> loggersModel) {
List<IColumn<PrismContainerValueWrapper<ClassLoggerConfigurationType>, String>> columns = new ArrayList<>();
columns.add(new CheckBoxHeaderColumn<>());
columns.add(new IconColumn<PrismContainerValueWrapper<ClassLoggerConfigurationType>>(Model.of("")) {
private static final long serialVersionUID = 1L;
@Override
protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<ClassLoggerConfigurationType>> rowModel) {
return GuiDisplayTypeUtil.createDisplayType(WebComponentUtil.createDefaultBlackIcon(SystemConfigurationType.COMPLEX_TYPE));
}
});
columns.add(new PrismPropertyWrapperColumn(loggersModel, ClassLoggerConfigurationType.F_PACKAGE, ColumnType.VALUE, getPageBase()) {
@Override
public String getCssClass() {
return " col-md-5 ";
}
});
columns.add(new PrismPropertyWrapperColumn<>(loggersModel, ClassLoggerConfigurationType.F_LEVEL, ColumnType.VALUE, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(loggersModel, ClassLoggerConfigurationType.F_APPENDER, ColumnType.VALUE, getPageBase()));
List<InlineMenuItem> menuActionsList = getLoggersMultivalueContainerListPanel().getDefaultMenuActions();
columns.add(new InlineMenuButtonColumn(menuActionsList, getPageBase()) {
@Override
public String getCssClass() {
return " col-md-1 ";
}
});
return columns;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class CheckBoxHeaderColumn method onUpdateHeader.
/**
* This method is called after select all checkbox is clicked
* @param target
* @param selected
* @param table
*/
protected void onUpdateHeader(AjaxRequestTarget target, boolean selected, DataTable table) {
IDataProvider provider = table.getDataProvider();
if (!(provider instanceof BaseSortableDataProvider)) {
LOGGER.debug("Select all checkbox work only with {} provider type. Current provider is type of {}.", BaseSortableDataProvider.class.getName(), provider.getClass().getName());
}
// update selected flag in model dto objects based on select all header state
BaseSortableDataProvider baseProvider = (BaseSortableDataProvider) provider;
List<T> objects = baseProvider.getAvailableData();
for (T object : objects) {
if (object instanceof Selectable) {
Selectable selectable = (Selectable) object;
selectable.setSelected(selected);
} else if (object instanceof PrismContainerValueWrapper) {
PrismContainerValueWrapper valueWrapper = (PrismContainerValueWrapper) object;
valueWrapper.setSelected(selected);
}
}
table.visitChildren(SelectableDataTable.SelectableRowItem.class, new IVisitor<SelectableDataTable.SelectableRowItem, Void>() {
@Override
public void component(SelectableDataTable.SelectableRowItem row, IVisit<Void> visit) {
if (row.getOutputMarkupId()) {
// we skip rows that doesn't have outputMarkupId set to true (it would fail)
target.add(row);
}
}
});
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class ResourceSchemaHandlingPanel method initLayout.
protected 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(getObjectWrapperModel(), ItemPath.create(ResourceType.F_SCHEMA_HANDLING, SchemaHandlingType.F_OBJECT_TYPE));
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_SCHEMA_HANDLING;
}
@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;
}
@Override
protected IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String> createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
return new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DISPLAY_NAME, AbstractItemWrapperColumn.ColumnType.LINK, getPageBase()) {
@Override
protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> model) {
itemDetailsPerformed(target, model);
}
};
}
@Override
public void editItemPerformed(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> rowModel, List<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> listItems) {
AbstractPageObjectDetails parent = findParent(AbstractPageObjectDetails.class);
if (parent == null) {
super.editItemPerformed(target, rowModel, listItems);
return;
}
ContainerPanelConfigurationType detailsPanel = new ContainerPanelConfigurationType(getPrismContext());
detailsPanel.setPanelType("schemaHandlingDetails");
PrismContainerValueWrapper<ResourceObjectTypeDefinitionType> objectTypeDef;
if (rowModel != null) {
objectTypeDef = rowModel.getObject();
} else {
objectTypeDef = listItems.iterator().next();
}
// VirtualContainersSpecificationType virtualContainer = new VirtualContainersSpecificationType(getPrismContext());
detailsPanel.setPath(new ItemPathType(objectTypeDef.getPath()));
// detailsPanel.getContainer().add(virtualContainer);
detailsPanel.setIdentifier("schemaHandlingDetails");
DisplayType displayType = new DisplayType();
displayType.setLabel(getObjectTypeDisplayName(objectTypeDef.getNewValue().asContainerable()));
detailsPanel.setDisplay(displayType);
getPageBase().getSessionStorage().setObjectDetailsStorage("details" + parent.getType().getSimpleName(), detailsPanel);
ResourceSchemaHandlingPanel.this.getPanelConfiguration().getPanel().add(detailsPanel);
target.add(parent);
parent.replacePanel(detailsPanel, target);
// super.editItemPerformed(target, rowModel, listItems);
}
};
form.add(objectTypesPanel);
}
Aggregations