Search in sources :

Example 1 with AttributeAppender

use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.

the class ProcessInstancesPanel method initLayout.

private void initLayout(UserProfileStorage.TableId tableId, int pageSize, View view, final IModel<String> currentInstanceIdModel) {
    BoxedTablePanel<ProcessInstanceDto> table = new BoxedTablePanel<ProcessInstanceDto>(ID_REQUESTS_TABLE, provider, initColumns(view), tableId, pageSize) {

        @Override
        protected Item<ProcessInstanceDto> customizeNewRowItem(Item<ProcessInstanceDto> item, final IModel<ProcessInstanceDto> rowModel) {
            item.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    if (currentInstanceIdModel == null || currentInstanceIdModel.getObject() == null) {
                        return "";
                    }
                    ProcessInstanceDto rowDto = rowModel.getObject();
                    if (currentInstanceIdModel.getObject().equals(rowDto.getProcessInstanceId())) {
                        return "info";
                    } else {
                        return "";
                    }
                }
            }));
            return item;
        }
    };
    table.setOutputMarkupId(true);
    table.setAdditionalBoxCssClasses("without-box-header-top-border");
    add(table);
}
Also used : Item(org.apache.wicket.markup.repeater.Item) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) IModel(org.apache.wicket.model.IModel) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 2 with AttributeAppender

use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.

the class CheckFormGroup method initLayout.

private void initLayout(IModel<String> label, final String tooltipKey, boolean isTooltipInModal, String labelSize, String textSize) {
    WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
    add(labelContainer);
    Label l = new Label(ID_LABEL, label);
    if (StringUtils.isNotEmpty(labelSize)) {
        labelContainer.add(AttributeAppender.prepend("class", labelSize));
    }
    labelContainer.add(l);
    Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
    tooltipLabel.add(new AttributeAppender("data-original-title", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return getString(tooltipKey);
        }
    }));
    tooltipLabel.add(new InfoTooltipBehavior(isTooltipInModal));
    tooltipLabel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return tooltipKey != null;
        }
    });
    tooltipLabel.setOutputMarkupId(true);
    tooltipLabel.setOutputMarkupPlaceholderTag(true);
    labelContainer.add(tooltipLabel);
    WebMarkupContainer checkWrapper = new WebMarkupContainer(ID_CHECK_WRAPPER);
    if (StringUtils.isNotEmpty(textSize)) {
        checkWrapper.add(AttributeAppender.prepend("class", textSize));
    }
    add(checkWrapper);
    CheckBox check = new CheckBox(ID_CHECK, getModel());
    check.setLabel(label);
    checkWrapper.add(check);
}
Also used : InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) CheckBox(org.apache.wicket.markup.html.form.CheckBox) Label(org.apache.wicket.markup.html.basic.Label) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 3 with AttributeAppender

use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.

the class MultipleAssignmentSelector method updateBoxedTablePanelStyles.

private void updateBoxedTablePanelStyles(BoxedTablePanel panel) {
    panel.getDataTableContainer().add(new AttributeAppender("class", " multiple-assignment-selector-table-container"));
    panel.getDataTable().add(new AttributeModifier("class", "multiple-assignment-selector-table"));
    panel.getFooterPaging().getParent().add(new AttributeModifier("class", "multiple-assignment-selector-table-footer"));
}
Also used : AttributeModifier(org.apache.wicket.AttributeModifier) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 4 with AttributeAppender

use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.

the class MultiButtonTable method populateCell.

protected void populateCell(WebMarkupContainer cellContainer, final AssignmentEditorDto assignment) {
    AjaxLink inner = new AjaxLink(ID_INNER) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            targetObjectDetailsPerformed(assignment, ajaxRequestTarget);
        }
    };
    inner.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return isMultiUserRequest() || canAssign(assignment);
        }
    });
    cellContainer.add(inner);
    Label nameLabel = new Label(ID_INNER_LABEL, assignment.getName());
    inner.add(nameLabel);
    Label descriptionLabel = new Label(ID_INNER_DESCRIPTION, assignment.getTargetRef() != null ? assignment.getTargetRef().getDescription() : "");
    descriptionLabel.setOutputMarkupId(true);
    inner.add(descriptionLabel);
    AjaxLink detailsLink = new AjaxLink(ID_DETAILS_LINK) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            assignmentDetailsPerformed(assignment, ajaxRequestTarget);
        }
    };
    detailsLink.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return isMultiUserRequest() || canAssign(assignment);
        }
    });
    cellContainer.add(detailsLink);
    Label detailsLinkLabel = new Label(ID_DETAILS_LINK_LABEL, pageBase.createStringResource("MultiButtonPanel.detailsLink"));
    detailsLinkLabel.setRenderBodyOnly(true);
    detailsLink.add(detailsLinkLabel);
    AjaxLink detailsLinkIcon = new AjaxLink(ID_DETAILS_LINK_ICON) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
        }
    };
    detailsLinkIcon.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return isMultiUserRequest() || canAssign(assignment);
        }
    });
    detailsLink.add(detailsLinkIcon);
    AjaxLink addToCartLink = new AjaxLink(ID_ADD_TO_CART_LINK) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            addAssignmentPerformed(assignment, ajaxRequestTarget);
        }
    };
    addToCartLink.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return isMultiUserRequest() || canAssign(assignment);
        }
    });
    cellContainer.add(addToCartLink);
    AjaxLink addToCartLinkIcon = new AjaxLink(ID_ADD_TO_CART_LINK_ICON) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
        }
    };
    addToCartLinkIcon.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return isMultiUserRequest() || canAssign(assignment);
        }
    });
    addToCartLink.add(addToCartLinkIcon);
    WebMarkupContainer icon = new WebMarkupContainer(ID_TYPE_ICON);
    icon.add(new AttributeAppender("class", getIconClass(assignment.getType())));
    cellContainer.add(icon);
    WebMarkupContainer alreadyAssignedIcon = new WebMarkupContainer(ID_ALREADY_ASSIGNED_ICON);
    alreadyAssignedIcon.add(new AttributeAppender("title", getAlreadyAssignedIconTitleModel(assignment)));
    alreadyAssignedIcon.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return !isMultiUserRequest() && assignment.isAlreadyAssigned();
        }
    });
    cellContainer.add(alreadyAssignedIcon);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Label(org.apache.wicket.markup.html.basic.Label) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 5 with AttributeAppender

use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.

the class MultiButtonTable method initLayout.

private void initLayout() {
    itemsCount = getModel() != null ? (getModel().getObject() != null ? getModel().getObject().size() : 0) : 0;
    RepeatingView rows = new RepeatingView(ID_ROW);
    rows.setOutputMarkupId(true);
    if (itemsCount > 0 && itemsPerRow > 0) {
        int index = 0;
        List<AssignmentEditorDto> assignmentsList = getModelObject();
        long rowCount = itemsCount % itemsPerRow == 0 ? (itemsCount / itemsPerRow) : (itemsCount / itemsPerRow + 1);
        for (int rowNumber = 0; rowNumber < rowCount; rowNumber++) {
            WebMarkupContainer rowContainer = new WebMarkupContainer(rows.newChildId());
            rows.add(rowContainer);
            RepeatingView columns = new RepeatingView(ID_CELL);
            columns.setOutputMarkupId(true);
            rowContainer.add(columns);
            for (int colNumber = 0; colNumber < itemsPerRow; colNumber++) {
                WebMarkupContainer colContainer = new WebMarkupContainer(columns.newChildId());
                columns.add(colContainer);
                WebMarkupContainer itemButtonContainer = new WebMarkupContainer(ID_ITEM_BUTTON_CONTAINER);
                itemButtonContainer.setOutputMarkupId(true);
                itemButtonContainer.add(new AttributeAppender("class", getBackgroundClass(assignmentsList.get(index))));
                colContainer.add(itemButtonContainer);
                populateCell(itemButtonContainer, assignmentsList.get(index));
                index++;
                if (index >= assignmentsList.size()) {
                    break;
                }
            }
        }
    }
    add(rows);
}
Also used : RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Aggregations

AttributeAppender (org.apache.wicket.behavior.AttributeAppender)65 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)34 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)32 IModel (org.apache.wicket.model.IModel)32 Label (org.apache.wicket.markup.html.basic.Label)31 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)28 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)19 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)10 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)8 ListItem (org.apache.wicket.markup.html.list.ListItem)8 ArrayList (java.util.ArrayList)7 List (java.util.List)7 ListView (org.apache.wicket.markup.html.list.ListView)7 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)6 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)6 AttributeModifier (org.apache.wicket.AttributeModifier)6 Component (org.apache.wicket.Component)6 Model (org.apache.wicket.model.Model)6 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)5 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)5