Search in sources :

Example 11 with AjaxCheckBox

use of org.apache.wicket.ajax.markup.html.form.AjaxCheckBox in project midpoint by Evolveum.

the class AssignmentEditorPanel method initHeaderRow.

protected void initHeaderRow() {
    AjaxCheckBox selected = new AjaxCheckBox(ID_SELECTED, new PropertyModel<>(getModel(), AssignmentEditorDto.F_SELECTED)) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
        // do we want to update something?
        }
    };
    selected.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !getModel().getObject().isSimpleView();
        }
    });
    headerRow.add(selected);
    WebMarkupContainer typeImage = new WebMarkupContainer(ID_TYPE_IMAGE);
    typeImage.add(AttributeModifier.append("class", createImageTypeModel(getModel())));
    headerRow.add(typeImage);
    Label errorIcon = new Label(ID_ERROR_ICON);
    errorIcon.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return !isTargetValid();
        }
    });
    headerRow.add(errorIcon);
    AjaxLink name = new AjaxLink(ID_NAME) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            nameClickPerformed(target);
        }
    };
    headerRow.add(name);
    AjaxLink errorLink = new AjaxLink(ID_BUTTON_SHOW_MORE) {

        private static final long serialVersionUID = 1L;

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

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return !isTargetValid();
        }
    });
    headerRow.add(errorLink);
    Label nameLabel = new Label(ID_NAME_LABEL, createAssignmentNameLabelModel(false));
    nameLabel.setOutputMarkupId(true);
    name.add(nameLabel);
    Label activation = new Label(ID_ACTIVATION, createActivationModel());
    headerRow.add(activation);
    ToggleIconButton expandButton = new ToggleIconButton(ID_EXPAND, GuiStyleConstants.CLASS_ICON_EXPAND, GuiStyleConstants.CLASS_ICON_COLLAPSE) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            nameClickPerformed(target);
        }

        @Override
        public boolean isOn() {
            return !AssignmentEditorPanel.this.getModelObject().isMinimized();
        }
    };
    expandButton.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !getModel().getObject().isSimpleView();
        }
    });
    headerRow.add(expandButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ToggleIconButton(com.evolveum.midpoint.gui.api.component.togglebutton.ToggleIconButton) Label(org.apache.wicket.markup.html.basic.Label) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 12 with AjaxCheckBox

use of org.apache.wicket.ajax.markup.html.form.AjaxCheckBox in project midpoint by Evolveum.

the class AssignmentTablePanel method initLayout.

private void initLayout(IModel<String> labelText) {
    final WebMarkupContainer assignments = new WebMarkupContainer(ID_ASSIGNMENTS);
    assignments.setOutputMarkupId(true);
    add(assignments);
    Label label = new Label(ID_HEADER, labelText);
    assignments.add(label);
    InlineMenu assignmentMenu = new InlineMenu(ID_MENU, new Model((Serializable) createAssignmentMenu()));
    assignmentMenu.setVisible(getAssignmentMenuVisibility());
    assignments.add(assignmentMenu);
    ListView<AssignmentEditorDto> list = new ListView<AssignmentEditorDto>(ID_LIST, getModel()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<AssignmentEditorDto> item) {
            AssignmentTablePanel.this.populateAssignmentDetailsPanel(item);
        }
    };
    list.setOutputMarkupId(true);
    assignments.add(list);
    AjaxCheckBox checkAll = new AjaxCheckBox(ID_CHECK_ALL, new Model()) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            List<AssignmentEditorDto> assignmentEditors = getAssignmentModel().getObject();
            for (AssignmentEditorDto dto : assignmentEditors) {
                dto.setSelected(this.getModelObject());
            }
            target.add(assignments);
        }
    };
    checkAll.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            int count = 0;
            for (AssignmentEditorDto dto : getModelObject()) {
                if (dto.isSimpleView()) {
                    count++;
                }
            }
            if (count == getModelObject().size()) {
                return false;
            } else {
                return true;
            }
        }
    });
    assignments.add(checkAll);
}
Also used : Serializable(java.io.Serializable) Label(org.apache.wicket.markup.html.basic.Label) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ListView(org.apache.wicket.markup.html.list.ListView) InlineMenu(com.evolveum.midpoint.web.component.menu.cog.InlineMenu) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) ListItem(org.apache.wicket.markup.html.list.ListItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 13 with AjaxCheckBox

use of org.apache.wicket.ajax.markup.html.form.AjaxCheckBox in project midpoint by Evolveum.

the class PageResourceEdit method initLayout.

private void initLayout() {
    Form mainForm = new Form(ID_MAIN_FORM);
    add(mainForm);
    final IModel<Boolean> editable = new LoadableModel<Boolean>(false) {

        @Override
        protected Boolean load() {
            return !isEditing();
        }
    };
    mainForm.add(new AjaxCheckBox(ID_EDIT, editable) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            editPerformed(target, editable.getObject());
        }
    });
    AceEditor editor = new AceEditor(ID_ACE_EDITOR, new PropertyModel<String>(model, ObjectViewDto.F_XML));
    editor.setReadonly(new LoadableModel<Boolean>(false) {

        @Override
        protected Boolean load() {
            return isEditing();
        }
    });
    mainForm.add(editor);
    initButtons(mainForm);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Form(org.apache.wicket.markup.html.form.Form) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) AceEditor(com.evolveum.midpoint.web.component.AceEditor)

Example 14 with AjaxCheckBox

use of org.apache.wicket.ajax.markup.html.form.AjaxCheckBox in project midpoint by Evolveum.

the class PrismOptionButtonPanel method initLayout.

private void initLayout(final IModel<ObjectWrapper> model) {
    AjaxCheckBox check = new AjaxCheckBox("check", new PropertyModel<Boolean>(model, "selected")) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            PrismOptionButtonPanel.this.checkBoxOnUpdate(target);
        }
    };
    check.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return model.getObject().isSelectable();
        }
    });
    check.setOutputMarkupId(true);
    add(check);
    initButtons(model);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Aggregations

AjaxCheckBox (org.apache.wicket.ajax.markup.html.form.AjaxCheckBox)14 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)13 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)10 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)8 Label (org.apache.wicket.markup.html.basic.Label)8 PropertyModel (org.apache.wicket.model.PropertyModel)5 ToggleIconButton (com.evolveum.midpoint.gui.api.component.togglebutton.ToggleIconButton)3 List (java.util.List)3 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)3 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 DateInput (com.evolveum.midpoint.web.component.DateInput)2 InlineMenu (com.evolveum.midpoint.web.component.menu.cog.InlineMenu)2 EmptyOnBlurAjaxFormUpdatingBehaviour (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour)2 ScheduleValidator (com.evolveum.midpoint.web.page.admin.server.dto.ScheduleValidator)2 StartEndDateValidator (com.evolveum.midpoint.web.page.admin.server.dto.StartEndDateValidator)2 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)2 Serializable (java.io.Serializable)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2