Search in sources :

Example 6 with ItemPanelSettingsBuilder

use of com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder in project midpoint by Evolveum.

the class LoggingConfigurationTabPanel method initLayout.

protected void initLayout() {
    try {
        ItemPanelSettingsBuilder builder = new ItemPanelSettingsBuilder();
        builder.visibilityHandler(itemWrapper -> getLoggingVisibility(itemWrapper.getPath()));
        Panel loggingPanel = getPageBase().initItemPanel(ID_LOGGING, LoggingConfigurationType.COMPLEX_TYPE, getModel(), builder.build());
        add(loggingPanel);
    } catch (SchemaException e) {
        LOGGER.error("Cannot create panel for logging: {}", e.getMessage(), e);
        getSession().error("Cannot create panle for logging");
    }
    PrismContainerWrapperModel<LoggingConfigurationType, ClassLoggerConfigurationType> loggerModel = PrismContainerWrapperModel.fromContainerWrapper(getModel(), LoggingConfigurationType.F_CLASS_LOGGER);
    MultivalueContainerListPanel<ClassLoggerConfigurationType> loggersMultivalueContainerListPanel = new MultivalueContainerListPanel<ClassLoggerConfigurationType>(ID_LOGGERS, ClassLoggerConfigurationType.class) {

        private static final long serialVersionUID = 1L;

        @Override
        protected List<SearchItemDefinition> initSearchableItems(PrismContainerDefinition<ClassLoggerConfigurationType> containerDef) {
            List<SearchItemDefinition> defs = new ArrayList<>();
            SearchFactory.addSearchPropertyDef(containerDef, ClassLoggerConfigurationType.F_APPENDER, defs);
            SearchFactory.addSearchPropertyDef(containerDef, ClassLoggerConfigurationType.F_PACKAGE, defs);
            defs.addAll(SearchFactory.createExtensionDefinitionList(containerDef));
            return defs;
        }

        @Override
        protected void newItemPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation) {
            PrismContainerValue<ClassLoggerConfigurationType> newLogger = loggerModel.getObject().getItem().createNewValue();
            PrismContainerValueWrapper<ClassLoggerConfigurationType> newLoggerWrapper = getLoggersMultivalueContainerListPanel().createNewItemContainerValueWrapper(newLogger, loggerModel.getObject(), target);
            loggerEditPerformed(target, Model.of(newLoggerWrapper), null);
        }

        @Override
        protected boolean isCreateNewObjectVisible() {
            return true;
        }

        @Override
        protected IModel<PrismContainerWrapper<ClassLoggerConfigurationType>> getContainerModel() {
            return loggerModel;
        }

        @Override
        protected String getStorageKey() {
            return SessionStorage.KEY_LOGGING_TAB_LOGGER_TABLE;
        }

        @Override
        protected UserProfileStorage.TableId getTableId() {
            return UserProfileStorage.TableId.LOGGING_TAB_LOGGER_TABLE;
        }

        @Override
        protected List<IColumn<PrismContainerValueWrapper<ClassLoggerConfigurationType>, String>> createDefaultColumns() {
            return initLoggersBasicColumns(loggerModel);
        }

        @Override
        protected void editItemPerformed(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ClassLoggerConfigurationType>> rowModel, List<PrismContainerValueWrapper<ClassLoggerConfigurationType>> listItems) {
            loggerEditPerformed(target, rowModel, listItems);
        }
    };
    add(loggersMultivalueContainerListPanel);
    PrismContainerWrapperModel<LoggingConfigurationType, AppenderConfigurationType> appenderModel = PrismContainerWrapperModel.fromContainerWrapper(getModel(), LoggingConfigurationType.F_APPENDER);
    MultivalueContainerListPanelWithDetailsPanel<AppenderConfigurationType> appendersMultivalueContainerListPanel = new MultivalueContainerListPanelWithDetailsPanel<AppenderConfigurationType>(ID_APPENDERS, AppenderConfigurationType.class) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void newItemPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation) {
            newAppendersClickPerformed(target, appenderModel);
        }

        @Override
        protected boolean isCreateNewObjectVisible() {
            return true;
        }

        @Override
        protected IModel<PrismContainerWrapper<AppenderConfigurationType>> getContainerModel() {
            return appenderModel;
        }

        @Override
        protected boolean isHeaderVisible() {
            return false;
        }

        @Override
        protected String getStorageKey() {
            return SessionStorage.KEY_LOGGING_TAB_APPENDER_TABLE;
        }

        @Override
        protected UserProfileStorage.TableId getTableId() {
            return UserProfileStorage.TableId.LOGGING_TAB_APPENDER_TABLE;
        }

        @Override
        protected List<IColumn<PrismContainerValueWrapper<AppenderConfigurationType>, String>> createDefaultColumns() {
            return initAppendersBasicColumns(appenderModel);
        }

        @Override
        protected MultivalueContainerDetailsPanel<AppenderConfigurationType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<AppenderConfigurationType>> item) {
            return LoggingConfigurationTabPanel.this.getAppendersMultivalueContainerDetailsPanel(item);
        }

        @Override
        protected List<Component> createToolbarButtonsList(String idButton) {
            List<Component> bar = new ArrayList<>();
            // MidpointForm appenderTypeForm = new MidpointForm(ID_CHOICE_APPENDER_TYPE_FORM);
            AjaxSubmitButton newObjectIcon = new AjaxSubmitButton(idButton, new Model<>("<i class=\"fa fa-plus\"></i>")) {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onSubmit(AjaxRequestTarget target) {
                    newItemPerformed(target, null);
                }
            };
            newObjectIcon.add(new VisibleEnableBehaviour() {

                private static final long serialVersionUID = 1L;

                @Override
                public boolean isVisible() {
                    return isCreateNewObjectVisible();
                }

                @Override
                public boolean isEnabled() {
                    return isNewObjectButtonEnabled();
                }
            });
            newObjectIcon.add(AttributeModifier.append("class", createStyleClassModelForNewObjectIcon()));
            // appenderTypeForm.add(newObjectIcon);
            bar.add(newObjectIcon);
            List<QName> appendersChoicesList = new ArrayList<>();
            appendersChoicesList.add(FileAppenderConfigurationType.COMPLEX_TYPE);
            appendersChoicesList.add(SyslogAppenderConfigurationType.COMPLEX_TYPE);
            DropDownChoicePanel<QName> appenderChoice = new DropDownChoicePanel<>(idButton, new Model<>(FileAppenderConfigurationType.COMPLEX_TYPE), Model.ofList(appendersChoicesList), new QNameIChoiceRenderer("LoggingConfigurationTabPanel.appendersChoice"));
            appenderChoice.setOutputMarkupId(true);
            LoggingConfigurationTabPanel.this.appenderChoice = appenderChoice;
            bar.add(appenderChoice);
            // bar.add(appenderTypeForm);
            return bar;
        }
    };
    add(appendersMultivalueContainerListPanel);
    IModel<PrismContainerWrapper<LoggingAuditingConfigurationType>> auditModel = PrismContainerWrapperModel.fromContainerWrapper(getModel(), LoggingConfigurationType.F_AUDITING);
    try {
        Panel auditPanel = getPageBase().initItemPanel(ID_AUDITING, LoggingAuditingConfigurationType.COMPLEX_TYPE, auditModel, new ItemPanelSettingsBuilder().build());
        add(auditPanel);
    } catch (SchemaException e) {
        LOGGER.error("Cannot create panel for auditing: {}", e.getMessage(), e);
        getSession().error("Cannot create panel for auditing.");
    }
    setOutputMarkupId(true);
}
Also used : DropDownChoicePanel(com.evolveum.midpoint.web.component.input.DropDownChoicePanel) QNameIChoiceRenderer(com.evolveum.midpoint.gui.impl.component.input.QNameIChoiceRenderer) ArrayList(java.util.ArrayList) PrismContainerWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation) ItemPanelSettingsBuilder(com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) List(java.util.List) ArrayList(java.util.ArrayList) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) Component(org.apache.wicket.Component) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) IModel(org.apache.wicket.model.IModel) MultivalueContainerListPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanel) QName(javax.xml.namespace.QName) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) MultivalueContainerListPanelWithDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel) MultivalueContainerDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerDetailsPanel) DropDownChoicePanel(com.evolveum.midpoint.web.component.input.DropDownChoicePanel) MultivalueContainerListPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanel) DisplayNamePanel(com.evolveum.midpoint.gui.api.component.DisplayNamePanel) Panel(org.apache.wicket.markup.html.panel.Panel) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) MultivalueContainerListPanelWithDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel) PrismContainerDefinition(com.evolveum.midpoint.prism.PrismContainerDefinition) SearchItemDefinition(com.evolveum.midpoint.web.component.search.SearchItemDefinition) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 7 with ItemPanelSettingsBuilder

use of com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder in project midpoint by Evolveum.

the class ProfilingConfigurationTabPanel method initLayout.

protected void initLayout() {
    WebMarkupContainer profilingEnabledNote = new WebMarkupContainer(ID_PROFILING_ENABLED_NOTE);
    profilingEnabledNote.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return getPageBase().getMidpointConfiguration().getProfilingMode() == ProfilingMode.OFF;
        }
    });
    add(profilingEnabledNote);
    try {
        ItemPanelSettingsBuilder builder = new ItemPanelSettingsBuilder();
        Panel panel = getPageBase().initItemPanel(ID_PROFILING, ProfilingConfigurationType.COMPLEX_TYPE, getProfilingModel(), builder.build());
        add(panel);
    } catch (SchemaException e) {
        LOGGER.error("Cannot create profiling panel. Reason: {}", e.getMessage(), e);
        getSession().error("Cannot create profiling panel.");
    }
    PrismContainerWrapperModel<LoggingConfigurationType, ClassLoggerConfigurationType> profilingLogger = PrismContainerWrapperModel.fromContainerWrapper(getLoggingModel(), ItemPath.create(ProfilingClassLoggerWrapperFactoryImpl.PROFILING_LOGGER_PATH));
    try {
        ItemPanelSettingsBuilder builder = new ItemPanelSettingsBuilder();
        Panel logger = getPageBase().initItemPanel(ID_PROFILING_LOGGER, ProfilingClassLoggerWrapperFactoryImpl.PROFILING_LOGGER_PATH, profilingLogger, builder.build());
        add(logger);
    } catch (SchemaException e) {
        LOGGER.error("Cannot create profiling panel. Reason: {}", e.getMessage(), e);
        getSession().error("Cannot create profiling panel.");
    }
}
Also used : ItemPanelSettingsBuilder(com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder) ItemHeaderPanel(com.evolveum.midpoint.gui.impl.prism.panel.ItemHeaderPanel) Panel(org.apache.wicket.markup.html.panel.Panel) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) LoggingConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ClassLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 8 with ItemPanelSettingsBuilder

use of com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder in project midpoint by Evolveum.

the class SystemConfigPanel method initLayout.

protected void initLayout() {
    try {
        ItemPanelSettingsBuilder builder = new ItemPanelSettingsBuilder().visibilityHandler(this::getBasicTabVisibity);
        Panel panel = getPageBase().initItemPanel(ID_SYSTEM_CONFIG, SystemConfigurationType.COMPLEX_TYPE, getModel(), builder.build());
        add(panel);
    } catch (SchemaException e) {
        LOGGER.error("Cannot create basic panel for system configuration.");
        getSession().error("Cannot create basic panel for system configuration.");
    }
}
Also used : ItemPanelSettingsBuilder(com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder) ItemHeaderPanel(com.evolveum.midpoint.gui.impl.prism.panel.ItemHeaderPanel) Panel(org.apache.wicket.markup.html.panel.Panel) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) SchemaException(com.evolveum.midpoint.util.exception.SchemaException)

Example 9 with ItemPanelSettingsBuilder

use of com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder in project midpoint by Evolveum.

the class AssignmentHolderTypeDetailsTabPanel method initLayout.

private void initLayout() {
    try {
        ItemPanelSettingsBuilder builder = new ItemPanelSettingsBuilder().visibilityHandler(w -> ItemVisibility.AUTO);
        builder.headerVisibility(false);
        Panel main = getPageBase().initItemPanel(ID_MAIN_PANEL, getObjectWrapper().getTypeName(), PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), ItemPath.EMPTY_PATH), builder.build());
        add(main);
        Panel activation = getPageBase().initItemPanel(ID_ACTIVATION_PANEL, ActivationType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), FocusType.F_ACTIVATION), builder.build());
        add(activation);
        Panel password = getPageBase().initItemPanel(ID_PASSWORD_PANEL, PasswordType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), ItemPath.create(UserType.F_CREDENTIALS, CredentialsType.F_PASSWORD)), builder.build());
        add(password);
    } catch (SchemaException e) {
        LOGGER.error("Could not create focus details panel. Reason: {}", e.getMessage(), e);
    }
}
Also used : ItemPanelSettingsBuilder(com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder) Panel(org.apache.wicket.markup.html.panel.Panel) RefreshableTabPanel(com.evolveum.midpoint.web.page.admin.server.RefreshableTabPanel) SchemaException(com.evolveum.midpoint.util.exception.SchemaException)

Example 10 with ItemPanelSettingsBuilder

use of com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder in project midpoint by Evolveum.

the class AbstractObjectTabPanel method addPrismPropertyPanel.

protected Panel addPrismPropertyPanel(MarkupContainer parentComponent, String id, QName typeName, ItemPath propertyPath) {
    try {
        ItemPanelSettingsBuilder settingsBuilder = new ItemPanelSettingsBuilder();
        settingsBuilder.visibilityHandler(wrapper -> ItemVisibility.AUTO);
        Panel panel = getPageBase().initItemPanel(id, typeName, PrismPropertyWrapperModel.fromContainerWrapper(getObjectWrapperModel(), propertyPath), settingsBuilder.build());
        parentComponent.add(panel);
        return panel;
    } catch (SchemaException e) {
        LOGGER.error("Cannot create panel for {}", typeName, e);
        getSession().error("Cannot create panel for " + typeName + ", reason: " + e.getMessage());
    }
    return null;
}
Also used : ItemPanelSettingsBuilder(com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder) Panel(org.apache.wicket.markup.html.panel.Panel) SchemaException(com.evolveum.midpoint.util.exception.SchemaException)

Aggregations

ItemPanelSettingsBuilder (com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder)10 Panel (org.apache.wicket.markup.html.panel.Panel)10 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)9 BasePanel (com.evolveum.midpoint.gui.api.component.BasePanel)7 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)4 ItemHeaderPanel (com.evolveum.midpoint.gui.impl.prism.panel.ItemHeaderPanel)3 List (java.util.List)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 DisplayNamePanel (com.evolveum.midpoint.gui.api.component.DisplayNamePanel)2 WebComponentUtil (com.evolveum.midpoint.gui.api.util.WebComponentUtil)2 ItemPanelSettings (com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettings)2 ItemVisibility (com.evolveum.midpoint.web.component.prism.ItemVisibility)2 ArrayList (java.util.ArrayList)2 Component (org.apache.wicket.Component)2 IModel (org.apache.wicket.model.IModel)2 PanelTab (com.evolveum.midpoint.gui.api.component.tabs.PanelTab)1 PrismObjectWrapperFactory (com.evolveum.midpoint.gui.api.factory.wrapper.PrismObjectWrapperFactory)1 WrapperContext (com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext)1 com.evolveum.midpoint.gui.api.prism.wrapper (com.evolveum.midpoint.gui.api.prism.wrapper)1