Search in sources :

Example 1 with ObjectTypeGuiDescriptor

use of com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor in project midpoint by Evolveum.

the class WorkItemsPanel method createTypeIconColumn.

public IColumn<WorkItemDto, String> createTypeIconColumn(final boolean object) {
    // true = object, false = target
    return new IconColumn<WorkItemDto>(createStringResource("")) {

        @Override
        protected IModel<String> createIconModel(IModel<WorkItemDto> rowModel) {
            if (getObjectType(rowModel) == null) {
                return null;
            }
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(rowModel);
            String icon = guiDescriptor != null ? guiDescriptor.getBlackIcon() : ObjectTypeGuiDescriptor.ERROR_ICON;
            return new Model<>(icon);
        }

        private ObjectTypeGuiDescriptor getObjectTypeDescriptor(IModel<WorkItemDto> rowModel) {
            return ObjectTypeGuiDescriptor.getDescriptor(ObjectTypes.getObjectTypeFromTypeQName(getObjectType(rowModel)));
        }

        private QName getObjectType(IModel<WorkItemDto> rowModel) {
            return object ? rowModel.getObject().getObjectType() : rowModel.getObject().getTargetType();
        }

        @Override
        public void populateItem(Item<ICellPopulator<WorkItemDto>> item, String componentId, IModel<WorkItemDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(rowModel);
            if (guiDescriptor != null) {
                item.add(AttributeModifier.replace("title", createStringResource(guiDescriptor.getLocalizationKey())));
                item.add(new TooltipBehavior());
            }
        }
    };
}
Also used : PageWorkItem(com.evolveum.midpoint.web.page.admin.workflow.PageWorkItem) Item(org.apache.wicket.markup.repeater.Item) TooltipBehavior(com.evolveum.midpoint.web.util.TooltipBehavior) IModel(org.apache.wicket.model.IModel) IconColumn(com.evolveum.midpoint.web.component.data.column.IconColumn) ObjectTypeGuiDescriptor(com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) WorkItemDto(com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto)

Example 2 with ObjectTypeGuiDescriptor

use of com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor in project midpoint by Evolveum.

the class ActionsExecutedObjectsTableLineDto method getObjectTypeLocalizationKey.

public String getObjectTypeLocalizationKey() {
    ObjectTypes type = ObjectTypes.getObjectTypeFromTypeQName(entry.getObjectType());
    ObjectTypeGuiDescriptor descriptor = ObjectTypeGuiDescriptor.getDescriptor(type);
    if (descriptor != null) {
        return descriptor.getLocalizationKey();
    } else {
        return null;
    }
}
Also used : ObjectTypeGuiDescriptor(com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes)

Example 3 with ObjectTypeGuiDescriptor

use of com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor in project midpoint by Evolveum.

the class QueryBasedHandlerDto method getObjectTypeKey.

public String getObjectTypeKey() {
    QName objectType = taskDto.getExtensionPropertyRealValue(SchemaConstants.MODEL_EXTENSION_OBJECT_TYPE, QName.class);
    ObjectTypeGuiDescriptor descriptor = ObjectTypeGuiDescriptor.getDescriptor(ObjectTypes.getObjectTypeFromTypeQName(objectType));
    return descriptor != null ? descriptor.getLocalizationKey() : null;
}
Also used : QName(javax.xml.namespace.QName) ObjectTypeGuiDescriptor(com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor)

Example 4 with ObjectTypeGuiDescriptor

use of com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor in project midpoint by Evolveum.

the class CertDecisionHelper method createTypeColumn.

public <T extends CertCaseOrWorkItemDto> IColumn<T, String> createTypeColumn(final WhichObject which, final PageBase page) {
    IColumn column;
    column = new IconColumn<CertCaseOrWorkItemDto>(page.createStringResource("")) {

        @Override
        protected DisplayType getIconDisplayType(IModel<CertCaseOrWorkItemDto> rowModel) {
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(which, rowModel);
            String icon = guiDescriptor != null ? guiDescriptor.getBlackIcon() : ObjectTypeGuiDescriptor.ERROR_ICON;
            return GuiDisplayTypeUtil.createDisplayType(icon);
        }

        private ObjectTypeGuiDescriptor getObjectTypeDescriptor(WhichObject which, IModel<CertCaseOrWorkItemDto> rowModel) {
            QName targetType = rowModel.getObject().getObjectType(which);
            return ObjectTypeGuiDescriptor.getDescriptor(ObjectTypes.getObjectTypeFromTypeQName(targetType));
        }

        @Override
        public void populateItem(Item<ICellPopulator<CertCaseOrWorkItemDto>> item, String componentId, IModel<CertCaseOrWorkItemDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(which, rowModel);
            if (guiDescriptor != null) {
                item.add(AttributeModifier.replace("title", page.createStringResource(guiDescriptor.getLocalizationKey())));
                item.add(new TooltipBehavior());
            }
        }
    };
    return column;
}
Also used : DisplayType(com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType) QName(javax.xml.namespace.QName) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) CertCaseOrWorkItemDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseOrWorkItemDto) TooltipBehavior(com.evolveum.midpoint.web.util.TooltipBehavior) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ObjectTypeGuiDescriptor(com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor)

Example 5 with ObjectTypeGuiDescriptor

use of com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor in project midpoint by Evolveum.

the class ProcessInstancesPanel method createTypeIconColumn.

public IColumn<ProcessInstanceDto, String> createTypeIconColumn(final boolean object) {
    // true = object, false = target
    return new IconColumn<ProcessInstanceDto>(createStringResource("")) {

        @Override
        protected DisplayType getIconDisplayType(IModel<ProcessInstanceDto> rowModel) {
            if (getObjectType(rowModel) == null) {
                return GuiDisplayTypeUtil.createDisplayType("");
            }
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(rowModel);
            String icon = guiDescriptor != null ? guiDescriptor.getBlackIcon() : ObjectTypeGuiDescriptor.ERROR_ICON;
            return GuiDisplayTypeUtil.createDisplayType(icon);
        }

        private ObjectTypeGuiDescriptor getObjectTypeDescriptor(IModel<ProcessInstanceDto> rowModel) {
            QName type = getObjectType(rowModel);
            return ObjectTypeGuiDescriptor.getDescriptor(ObjectTypes.getObjectTypeFromTypeQName(type));
        }

        private QName getObjectType(IModel<ProcessInstanceDto> rowModel) {
            return object ? rowModel.getObject().getObjectType() : rowModel.getObject().getTargetType();
        }

        @Override
        public void populateItem(Item<ICellPopulator<ProcessInstanceDto>> item, String componentId, IModel<ProcessInstanceDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            ObjectTypeGuiDescriptor guiDescriptor = getObjectTypeDescriptor(rowModel);
            if (guiDescriptor != null) {
                item.add(AttributeModifier.replace("title", createStringResource(guiDescriptor.getLocalizationKey())));
                item.add(new TooltipBehavior());
            }
        }
    };
}
Also used : Item(org.apache.wicket.markup.repeater.Item) TooltipBehavior(com.evolveum.midpoint.web.util.TooltipBehavior) IModel(org.apache.wicket.model.IModel) IconColumn(com.evolveum.midpoint.web.component.data.column.IconColumn) QName(javax.xml.namespace.QName) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) ObjectTypeGuiDescriptor(com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor)

Aggregations

ObjectTypeGuiDescriptor (com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor)11 TooltipBehavior (com.evolveum.midpoint.web.util.TooltipBehavior)4 QName (javax.xml.namespace.QName)4 IModel (org.apache.wicket.model.IModel)4 ObjectTypes (com.evolveum.midpoint.schema.constants.ObjectTypes)3 IconColumn (com.evolveum.midpoint.web.component.data.column.IconColumn)2 DisplayType (com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType)2 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)2 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)2 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)2 Label (org.apache.wicket.markup.html.basic.Label)2 Item (org.apache.wicket.markup.repeater.Item)2 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)2 SceneItemValue (com.evolveum.midpoint.model.api.visualizer.SceneItemValue)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 DateLabelComponent (com.evolveum.midpoint.web.component.DateLabelComponent)1 AjaxLinkPanel (com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel)1 ImagePanel (com.evolveum.midpoint.web.component.data.column.ImagePanel)1