Search in sources :

Example 21 with ItemWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper in project midpoint by Evolveum.

the class DynamicFieldGroupPanel method findItemWrapper.

@NotNull
private ItemWrapper<?, ?> findItemWrapper(AbstractFormItemType formField, PrismObjectWrapper<O> objectWrapper) {
    ItemPath path = GuiImplUtil.getItemPath(formField);
    if (path == null) {
        getSession().error("Bad form item definition. It has to contain reference to the real attribute");
        LOGGER.error("Bad form item definition. It has to contain reference to the real attribute");
        throw new RestartResponseException(getPageBase());
    }
    ItemWrapper<?, ?> itemWrapper;
    try {
        itemWrapper = objectWrapper.findItem(path, ItemWrapper.class);
    } catch (SchemaException e) {
        getSession().error("Bad form item definition. No attribute with path: " + path + " was found");
        LOGGER.error("Bad form item definition. No attribute with path: " + path + " was found");
        throw new RestartResponseException(getPageBase());
    }
    if (itemWrapper == null) {
        getSession().error("Bad form item definition. No attribute with path: " + path + " was found");
        LOGGER.error("Bad form item definition. No attribute with path: " + path + " was found");
        throw new RestartResponseException(getPageBase());
    }
    return itemWrapper;
}
Also used : ItemWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) RestartResponseException(org.apache.wicket.RestartResponseException) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) NotNull(org.jetbrains.annotations.NotNull)

Example 22 with ItemWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper in project midpoint by Evolveum.

the class WrapperTestUtil method assertPropertyWrapper.

public static <C extends Containerable, T> void assertPropertyWrapper(PrismContainerValueWrapper<C> containerWrapper, ItemPath itemPath, T... expectedValues) throws SchemaException {
    ItemWrapper itemWrapper = containerWrapper.findItem(itemPath, ItemWrapper.class);
    assertNotNull("No item wrapper for path " + itemPath + " in " + containerWrapper, itemWrapper);
    assertPropertyWrapper(containerWrapper, itemWrapper, itemPath.lastName(), expectedValues);
}
Also used : ItemWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper)

Example 23 with ItemWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper in project midpoint by Evolveum.

the class WrapperTestUtil method assertPropertyWrapperByName.

// todo better name
public static <C extends Containerable, T> void assertPropertyWrapperByName(PrismContainerValueWrapper<C> containerWrapper, ItemName itemName, T... expectedValues) throws SchemaException {
    ItemWrapper itemWrapper = containerWrapper.findItem(itemName, ItemWrapper.class);
    assertNotNull("No item wrapper " + itemName + " in " + containerWrapper, itemWrapper);
    assertPropertyWrapper(containerWrapper, itemWrapper, itemName, expectedValues);
}
Also used : ItemWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper)

Aggregations

ItemWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper)23 ArrayList (java.util.ArrayList)9 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)8 PanelTab (com.evolveum.midpoint.gui.api.component.tabs.PanelTab)7 SingleContainerPanel (com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel)7 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)6 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)6 DisplayNamePanel (com.evolveum.midpoint.gui.api.component.DisplayNamePanel)5 MultivalueContainerDetailsPanel (com.evolveum.midpoint.gui.impl.component.MultivalueContainerDetailsPanel)5 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)5 ItemVisibility (com.evolveum.midpoint.web.component.prism.ItemVisibility)5 QName (javax.xml.namespace.QName)5 PrismContainerWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper)4 List (java.util.List)4 IModel (org.apache.wicket.model.IModel)4 ResourceAttributePanel (com.evolveum.midpoint.gui.impl.prism.panel.ResourceAttributePanel)3 WrapperContext (com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext)2 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)2 PrismContainerValueWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper)2 Task (com.evolveum.midpoint.task.api.Task)2