Search in sources :

Example 1 with LoggingComponentType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingComponentType in project midpoint by Evolveum.

the class SubSystemLoggerDetailsPanel method createDisplayNamePanel.

@Override
protected DisplayNamePanel<SubSystemLoggerConfigurationType> createDisplayNamePanel(String displayNamePanelId) {
    // so far no display name panel needed
    DisplayNamePanel d = new DisplayNamePanel<>(displayNamePanelId, Model.of(getModelObject().getRealValue())) {

        @Override
        protected IModel<String> createHeaderModel() {
            return createStringResource("SubSystemLoggerConfigurationType.label");
        }

        @Override
        protected IModel<String> getDescriptionLabelModel() {
            return () -> {
                LoggingComponentType component = getModelObject().getComponent();
                return component != null ? component.value() : null;
            };
        }

        @Override
        protected WebMarkupContainer createTypeImagePanel(String idTypeImage) {
            WebMarkupContainer c = new WebMarkupContainer(idTypeImage);
            c.setVisible(false);
            return c;
        }
    };
    return d;
}
Also used : DisplayNamePanel(com.evolveum.midpoint.gui.api.component.DisplayNamePanel) LoggingComponentType(com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingComponentType) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 2 with LoggingComponentType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingComponentType in project midpoint by Evolveum.

the class LoggingPackageWrapperFactoryImpl method getPredefinedValues.

public LookupTableType getPredefinedValues(PrismProperty<T> item, WrapperContext wrapperContext) {
    LookupTableType lookupTable = new LookupTableType();
    List<LookupTableRowType> list = lookupTable.createRowList();
    List<StandardLoggerType> standardLoggers = EnumUtils.getEnumList(StandardLoggerType.class);
    for (StandardLoggerType standardLogger : standardLoggers) {
        LookupTableRowType row = new LookupTableRowType();
        row.setKey(standardLogger.getValue());
        row.setValue(standardLogger.getValue());
        PolyStringType label = new PolyStringType("StandardLoggerType." + standardLogger.name());
        PolyStringTranslationType translation = new PolyStringTranslationType();
        translation.setKey("StandardLoggerType." + standardLogger.name());
        label.setTranslation(translation);
        row.setLabel(label);
        list.add(row);
    }
    List<LoggingComponentType> componentLoggers = EnumUtils.getEnumList(LoggingComponentType.class);
    for (LoggingComponentType componentLogger : componentLoggers) {
        LookupTableRowType row = new LookupTableRowType();
        String value = ComponentLoggerType.getPackageByValue(componentLogger);
        row.setKey(value);
        row.setValue(value);
        PolyStringType label = new PolyStringType("LoggingComponentType." + componentLogger.name());
        PolyStringTranslationType translation = new PolyStringTranslationType();
        translation.setKey("LoggingComponentType." + componentLogger.name());
        label.setTranslation(translation);
        row.setLabel(label);
        list.add(row);
    }
    return lookupTable;
}
Also used : StandardLoggerType(com.evolveum.midpoint.gui.impl.page.admin.configuration.component.StandardLoggerType) PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) LoggingComponentType(com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingComponentType) LookupTableRowType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType) LookupTableType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType) PolyStringTranslationType(com.evolveum.prism.xml.ns._public.types_3.PolyStringTranslationType)

Example 3 with LoggingComponentType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingComponentType in project midpoint by Evolveum.

the class LoggingConfigPanel method initLoggerColumns.

private List<IColumn<LoggerConfiguration, String>> initLoggerColumns() {
    List<IColumn<LoggerConfiguration, String>> columns = new ArrayList<>();
    IColumn column = new CheckBoxHeaderColumn<LoggerConfiguration>();
    columns.add(column);
    //name editing column
    columns.add(new EditableLinkColumn<LoggerConfiguration>(createStringResource("LoggingConfigPanel.logger"), "name") {

        @Override
        protected Component createInputPanel(String componentId, final IModel<LoggerConfiguration> model) {
            if (model.getObject() instanceof StandardLogger) {
                DropDownChoicePanel dropDownChoicePanel = new DropDownChoicePanel(componentId, new PropertyModel(model, "logger"), WebComponentUtil.createReadonlyModelFromEnum(StandardLoggerType.class), new EnumChoiceRenderer<StandardLoggerType>());
                FormComponent<StandardLoggerType> input = dropDownChoicePanel.getBaseFormComponent();
                input.add(new NotNullValidator<StandardLoggerType>("logger.emptyLogger"));
                input.add(new AttributeAppender("style", "width: 100%"));
                input.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
                addAjaxFormComponentUpdatingBehavior(input);
                return dropDownChoicePanel;
            } else if (model.getObject() instanceof ComponentLogger) {
                DropDownChoicePanel dropDownChoicePanel = new DropDownChoicePanel(componentId, new PropertyModel(model, "component"), WebComponentUtil.createReadonlyModelFromEnum(LoggingComponentType.class), new EnumChoiceRenderer<LoggingComponentType>());
                FormComponent<LoggingComponentType> input = dropDownChoicePanel.getBaseFormComponent();
                input.add(new NotNullValidator<LoggingComponentType>("logger.emptyLogger"));
                input.add(new AttributeAppender("style", "width: 100%"));
                input.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
                addAjaxFormComponentUpdatingBehavior(input);
                return dropDownChoicePanel;
            } else {
                TextPanel textPanel = new TextPanel<>(componentId, new PropertyModel<String>(model, getPropertyExpression()));
                FormComponent input = textPanel.getBaseFormComponent();
                addAjaxFormComponentUpdatingBehavior(input);
                input.add(new AttributeAppender("style", "width: 100%"));
                input.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
                input.add(new NotNullValidator<StandardLoggerType>("message.emptyString"));
                return textPanel;
            }
        }

        @Override
        public void onClick(AjaxRequestTarget target, IModel<LoggerConfiguration> rowModel) {
            loggerEditPerformed(target, rowModel);
        }
    });
    //level editing column
    columns.add(new EditableLinkColumn<LoggerConfiguration>(createStringResource("LoggingConfigPanel.loggersLevel"), "level") {

        @Override
        protected Component createInputPanel(String componentId, IModel<LoggerConfiguration> model) {
            DropDownChoicePanel dropDownChoicePanel = new DropDownChoicePanel(componentId, new PropertyModel(model, getPropertyExpression()), WebComponentUtil.createReadonlyModelFromEnum(LoggingLevelType.class));
            FormComponent<LoggingLevelType> input = dropDownChoicePanel.getBaseFormComponent();
            input.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
            input.add(new NotNullValidator<LoggingLevelType>("message.emptyLevel"));
            addAjaxFormComponentUpdatingBehavior(input);
            return dropDownChoicePanel;
        }

        @Override
        public void onClick(AjaxRequestTarget target, IModel<LoggerConfiguration> rowModel) {
            loggerEditPerformed(target, rowModel);
        }

        @Override
        protected IModel<String> createLinkModel(IModel<LoggerConfiguration> rowModel) {
            LoggerConfiguration configuration = rowModel.getObject();
            return WebComponentUtil.createLocalizedModelForEnum(configuration.getLevel(), getPageBase());
        }
    });
    //appender editing column
    columns.add(new EditableLinkColumn<LoggerConfiguration>(createStringResource("LoggingConfigPanel.loggersAppender"), "appenders") {

        @Override
        protected IModel<String> createLinkModel(IModel<LoggerConfiguration> rowModel) {
            final LoggerConfiguration configuration = rowModel.getObject();
            if (configuration.getAppenders().isEmpty()) {
                return createStringResource("LoggingConfigPanel.appenders.Inherit");
            } else {
                return new LoadableModel<String>() {

                    @Override
                    protected String load() {
                        StringBuilder builder = new StringBuilder();
                        for (String appender : configuration.getAppenders()) {
                            if (configuration.getAppenders().indexOf(appender) != 0) {
                                builder.append(", ");
                            }
                            builder.append(appender);
                        }
                        return builder.toString();
                    }
                };
            }
        }

        @Override
        protected InputPanel createInputPanel(String componentId, IModel<LoggerConfiguration> model) {
            IModel<Map<String, String>> options = new Model(null);
            Map<String, String> optionsMap = new HashMap<String, String>();
            optionsMap.put("nonSelectedText", createStringResource("LoggingConfigPanel.appenders.Inherit").getString());
            options.setObject(optionsMap);
            ListMultipleChoicePanel panel = new ListMultipleChoicePanel<>(componentId, new PropertyModel<List<String>>(model, getPropertyExpression()), createNewLoggerAppendersListModel(), new StringChoiceRenderer(null), options);
            FormComponent<AppenderConfigurationType> input = panel.getBaseFormComponent();
            input.add(new EmptyOnChangeAjaxFormUpdatingBehavior());
            addAjaxFormComponentUpdatingBehavior(input);
            return panel;
        }

        public void onClick(AjaxRequestTarget target, IModel<LoggerConfiguration> rowModel) {
            loggerEditPerformed(target, rowModel);
        }
    });
    return columns;
}
Also used : FormComponent(org.apache.wicket.markup.html.form.FormComponent) DropDownChoicePanel(com.evolveum.midpoint.web.component.input.DropDownChoicePanel) EnumChoiceRenderer(org.apache.wicket.markup.html.form.EnumChoiceRenderer) ArrayList(java.util.ArrayList) TextPanel(com.evolveum.midpoint.web.component.input.TextPanel) ListMultipleChoicePanel(com.evolveum.midpoint.web.component.input.ListMultipleChoicePanel) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) Component(org.apache.wicket.Component) FormComponent(org.apache.wicket.markup.html.form.FormComponent) AttributeAppender(org.apache.wicket.behavior.AttributeAppender) LoggerConfiguration(com.evolveum.midpoint.web.page.admin.configuration.dto.LoggerConfiguration) StandardLoggerType(com.evolveum.midpoint.web.page.admin.configuration.dto.StandardLoggerType) StandardLogger(com.evolveum.midpoint.web.page.admin.configuration.dto.StandardLogger) IModel(org.apache.wicket.model.IModel) InputPanel(com.evolveum.midpoint.web.component.prism.InputPanel) PropertyModel(org.apache.wicket.model.PropertyModel) NotNullValidator(com.evolveum.midpoint.web.component.input.validator.NotNullValidator) ComponentLogger(com.evolveum.midpoint.web.page.admin.configuration.dto.ComponentLogger) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) StringChoiceRenderer(com.evolveum.midpoint.web.component.input.StringChoiceRenderer) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) LoggingComponentType(com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingComponentType) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

LoggingComponentType (com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingComponentType)3 DisplayNamePanel (com.evolveum.midpoint.gui.api.component.DisplayNamePanel)1 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 StandardLoggerType (com.evolveum.midpoint.gui.impl.page.admin.configuration.component.StandardLoggerType)1 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)1 DropDownChoicePanel (com.evolveum.midpoint.web.component.input.DropDownChoicePanel)1 ListMultipleChoicePanel (com.evolveum.midpoint.web.component.input.ListMultipleChoicePanel)1 StringChoiceRenderer (com.evolveum.midpoint.web.component.input.StringChoiceRenderer)1 TextPanel (com.evolveum.midpoint.web.component.input.TextPanel)1 NotNullValidator (com.evolveum.midpoint.web.component.input.validator.NotNullValidator)1 InputPanel (com.evolveum.midpoint.web.component.prism.InputPanel)1 ComponentLogger (com.evolveum.midpoint.web.page.admin.configuration.dto.ComponentLogger)1 LoggerConfiguration (com.evolveum.midpoint.web.page.admin.configuration.dto.LoggerConfiguration)1 StandardLogger (com.evolveum.midpoint.web.page.admin.configuration.dto.StandardLogger)1 StandardLoggerType (com.evolveum.midpoint.web.page.admin.configuration.dto.StandardLoggerType)1 LookupTableRowType (com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType)1 LookupTableType (com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType)1 PolyStringTranslationType (com.evolveum.prism.xml.ns._public.types_3.PolyStringTranslationType)1 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)1 ArrayList (java.util.ArrayList)1