Search in sources :

Example 81 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class PageConnectorHosts method initConnectorHostsColumns.

private List<IColumn<ConnectorHostType, String>> initConnectorHostsColumns() {
    List<IColumn<ConnectorHostType, String>> columns = new ArrayList<>();
    IColumn column = new CheckBoxHeaderColumn<ConnectorHostType>();
    columns.add(column);
    column = new LinkColumn<SelectableBean<ConnectorHostType>>(createStringResource("pageResources.connector.name"), "name", "value.name") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ConnectorHostType>> rowModel) {
            ConnectorHostType host = rowModel.getObject().getValue();
        // resourceDetailsPerformed(target, host.getOid());
        }
    };
    columns.add(column);
    columns.add(new PropertyColumn(createStringResource("pageResources.connector.hostname"), "value.hostname"));
    columns.add(new PropertyColumn(createStringResource("pageResources.connector.port"), "value.port"));
    columns.add(new PropertyColumn(createStringResource("pageResources.connector.timeout"), "value.timeout"));
    columns.add(new CheckBoxColumn(createStringResource("pageResources.connector.protectConnection"), "value.protectConnection"));
    InlineMenuHeaderColumn menu = new InlineMenuHeaderColumn(initInlineHostsMenu());
    columns.add(menu);
    return columns;
}
Also used : ConnectorHostType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType) InlineMenuHeaderColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuHeaderColumn) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) CheckBoxColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxColumn) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean)

Example 82 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class JasperReportConfigurationPanel method initParameterColumns.

private List<IColumn<JasperReportParameterDto, String>> initParameterColumns() {
    List<IColumn<JasperReportParameterDto, String>> columns = new ArrayList<>();
    IColumn<JasperReportParameterDto, String> column = new CheckBoxHeaderColumn<>();
    columns.add(column);
    // name editing column
    columns.add(buildEditableLinkColumn("JasperReportConfigurationPanel.parameterName", null, "name", true));
    // class editing column
    columns.add(buildEditableLinkColumn("JasperReportConfigurationPanel.parameterClass", null, "typeAsString", true));
    columns.add(buildEditableLinkColumn("JasperReportConfigurationPanel.nestedClass", null, "nestedTypeAsString", true));
    columns.add(new LinkColumn<JasperReportParameterDto>(createStringResource("JasperReportConfigurationPanel.properties")) {

        private static final long serialVersionUID = 1L;

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

        @Override
        protected IModel createLinkModel(IModel<JasperReportParameterDto> rowModel) {
            return createStringResource("JasperReportConfigurationPanel.configure");
        }
    });
    CheckBoxColumn<JasperReportParameterDto> forPrompting = new CheckBoxColumn<JasperReportParameterDto>(createStringResource("JasperReportConfigurationPanel.forPrompting"), "forPrompting") {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<JasperReportParameterDto>> cellItem, String componentId, IModel<JasperReportParameterDto> rowModel) {
            CheckBoxPanel checkBox = new CheckBoxPanel(componentId, new PropertyModel<Boolean>(rowModel, getPropertyExpression()), new Model<>(true));
            cellItem.add(checkBox);
        }
    };
    columns.add(forPrompting);
    return columns;
}
Also used : IModel(org.apache.wicket.model.IModel) ArrayList(java.util.ArrayList) CheckBoxPanel(com.evolveum.midpoint.web.component.data.column.CheckBoxPanel) JasperReportParameterDto(com.evolveum.midpoint.web.page.admin.reports.dto.JasperReportParameterDto) CheckBoxColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxColumn) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Item(org.apache.wicket.markup.repeater.Item) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)

Example 83 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class ObjectListPanel method getCustomColumnsTransformed.

protected List<IColumn<SelectableBean<O>, String>> getCustomColumnsTransformed(List<GuiObjectColumnType> customColumns) {
    List<IColumn<SelectableBean<O>, String>> columns = new ArrayList<IColumn<SelectableBean<O>, String>>();
    if (customColumns == null || customColumns.size() == 0) {
        return columns;
    }
    IColumn<SelectableBean<O>, String> column;
    for (GuiObjectColumnType customColumn : customColumns) {
        if (WebComponentUtil.getElementVisibility(customColumn.getVisibility())) {
            if (customColumns.indexOf(customColumn) == 0) {
                column = createNameColumn(customColumn.getDisplay() != null && customColumn.getDisplay().getLabel() != null ? Model.of(customColumn.getDisplay().getLabel()) : createStringResource(getItemDisplayName(customColumn)), customColumn.getPath().toString());
            } else {
                column = new PropertyColumn(customColumn.getDisplay() != null && customColumn.getDisplay().getLabel() != null ? Model.of(customColumn.getDisplay().getLabel()) : createStringResource(getItemDisplayName(customColumn)), null, SelectableBean.F_VALUE + "." + customColumn.getPath());
            }
            columns.add(column);
        }
    }
    return columns;
}
Also used : IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean)

Example 84 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class FocusTasksTabPanel method initLayout.

private void initLayout(final PageBase page) {
    Label label = new Label(ID_LABEL, new AbstractReadOnlyModel<String>() {

        private static final long serialVersionUID = 1L;

        @Override
        public String getObject() {
            if (taskDtoProvider.size() > 0) {
                return getString("pageAdminFocus.task.descriptionHasTasks");
            } else {
                return getString("pageAdminFocus.task.descriptionNoTasks");
            }
        }
    });
    add(label);
    List<IColumn<TaskDto, String>> taskColumns = initTaskColumns();
    TablePanel taskTable = new TablePanel<TaskDto>(ID_TASK_TABLE, taskDtoProvider, taskColumns);
    add(taskTable);
    taskTable.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return taskDtoProvider.size() > 0;
        }
    });
}
Also used : IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) Label(org.apache.wicket.markup.html.basic.Label) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 85 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn 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

IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)131 ArrayList (java.util.ArrayList)80 IModel (org.apache.wicket.model.IModel)73 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)69 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)43 Label (org.apache.wicket.markup.html.basic.Label)43 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)37 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)36 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)31 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)31 Model (org.apache.wicket.model.Model)22 Item (org.apache.wicket.markup.repeater.Item)19 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)18 List (java.util.List)18 Component (org.apache.wicket.Component)18 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)17 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)17 PropertyModel (org.apache.wicket.model.PropertyModel)15 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)14 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)13