Search in sources :

Example 6 with DropDownFormGroup

use of com.evolveum.midpoint.web.component.form.DropDownFormGroup in project midpoint by Evolveum.

the class ObjectPolicyPanel method initLayout.

//	public void updateModel(AjaxRequestTarget target, ObjectPolicyConfigurationTypeDto config) {
//		model.setObject(new ObjectPolicyDialogDto(config, getPageBase()));
//		target.add(getContent());
//	}
public void initLayout() {
    Form form = new Form(ID_FORM);
    form.setOutputMarkupId(true);
    add(form);
    DropDownFormGroup type = new DropDownFormGroup<>(ID_TYPE, new PropertyModel<QName>(model, ObjectPolicyDialogDto.F_TYPE), createTypeChoiceList(), new QNameChoiceRenderer(), createStringResource("ObjectPolicyDialog.type"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(type);
    type.getInput().setNullValid(false);
    type.getInput().setRequired(true);
    TextField<String> fieldSubtype = new TextField<>(ID_SUBTYPE, new PropertyModel<String>(model, ObjectPolicyDialogDto.F_SUBTYPE));
    form.add(fieldSubtype);
    form.add(fieldSubtype);
    DropDownFormGroup template = new DropDownFormGroup<>(ID_OBJECT_TEMPLATE, new PropertyModel<ObjectTemplateConfigTypeReferenceDto>(model, ObjectPolicyDialogDto.F_TEMPLATE_REF), createObjectTemplateList(), new ChoiceableChoiceRenderer<ObjectTemplateConfigTypeReferenceDto>(), createStringResource("ObjectPolicyDialog.template"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(template);
    template.getInput().setNullValid(false);
    template.getInput().setRequired(true);
    ListView repeater = new ListView<PropertyConstraintTypeDto>(ID_REPEATER, new PropertyModel<List<PropertyConstraintTypeDto>>(model, ObjectPolicyDialogDto.F_PROPERTY_LIST)) {

        @Override
        protected void populateItem(final ListItem item) {
            WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
            textWrapper.add(AttributeAppender.prepend("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    if (item.getIndex() > 0) {
                        return OFFSET_CLASS + " " + CLASS_MULTI_VALUE;
                    }
                    return null;
                }
            }));
            item.add(textWrapper);
            TextField property = new TextField<>(ID_PROPERTY, new PropertyModel<String>(item.getModel(), PropertyConstraintTypeDto.F_PROPERTY_PATH));
            property.add(new AjaxFormComponentUpdatingBehavior("blur") {

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            });
            property.add(AttributeAppender.replace("placeholder", createStringResource("ObjectPolicyDialog.property.placeholder")));
            textWrapper.add(property);
            CheckBox oidBound = new CheckBox(ID_OID_BOUND, new PropertyModel<Boolean>(item.getModel(), PropertyConstraintTypeDto.F_OID_BOUND));
            oidBound.add(AttributeModifier.replace("title", createStringResource("ObjectPolicyDialog.label.oidBound.help")));
            textWrapper.add(oidBound);
            WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
            buttonGroup.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    if (item.getIndex() > 0) {
                        return CLASS_MULTI_VALUE;
                    }
                    return null;
                }
            }));
            item.add(buttonGroup);
            initButtons(buttonGroup, item);
        }
    };
    form.add(repeater);
    AjaxSubmitButton cancel = new AjaxSubmitButton(ID_BUTTON_CANCEL, createStringResource("ObjectPolicyDialog.button.cancel")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            cancelPerformed(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            cancelPerformed(target);
        }
    };
    form.add(cancel);
    AjaxSubmitButton save = new AjaxSubmitButton(ID_BUTTON_SAVE, createStringResource("ObjectPolicyDialog.button.save")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            savePerformed(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.add(form);
        }
    };
    form.add(save);
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Form(org.apache.wicket.markup.html.form.Form) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ListView(org.apache.wicket.markup.html.list.ListView) TextField(org.apache.wicket.markup.html.form.TextField) ArrayList(java.util.ArrayList) List(java.util.List) AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) QNameChoiceRenderer(com.evolveum.midpoint.web.component.input.QNameChoiceRenderer) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) DropDownFormGroup(com.evolveum.midpoint.web.component.form.DropDownFormGroup) QName(javax.xml.namespace.QName) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectTemplateConfigTypeReferenceDto(com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectTemplateConfigTypeReferenceDto) CheckBox(org.apache.wicket.markup.html.form.CheckBox) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 7 with DropDownFormGroup

use of com.evolveum.midpoint.web.component.form.DropDownFormGroup in project midpoint by Evolveum.

the class ReportConfigurationPanel method initLayout.

protected void initLayout() {
    TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<String>(getModel(), ID_NAME), createStringResource("ObjectType.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
    add(name);
    TextAreaFormGroup description = new TextAreaFormGroup(ID_DESCRIPTION, new PropertyModel<String>(getModel(), ID_DESCRIPTION), createStringResource("ObjectType.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    add(description);
    IModel choices = WebComponentUtil.createReadonlyModelFromEnum(ExportType.class);
    IChoiceRenderer renderer = new EnumChoiceRenderer();
    DropDownFormGroup exportType = new DropDownFormGroup(ID_EXPORT_TYPE, new PropertyModel<ExportType>(getModel(), ReportDto.F_EXPORT_TYPE), choices, renderer, createStringResource("ReportType.export"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
    add(exportType);
    TextFormGroup virtualizerKickOn = null;
    DropDownFormGroup virtualizer = new DropDownFormGroup(ID_VIRTUALIZER, new PropertyModel<String>(getModel(), ReportDto.F_VIRTUALIZER), createVirtualizerListModel(), new ChoiceRenderer<String>(), createStringResource("ReportType.virtualizer"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    //virtualizer.add(new VirtualizerAjaxFormUpdatingBehaviour(virtualizerKickOn));
    add(virtualizer);
    virtualizerKickOn = new TextFormGroup(ID_VIRTUALIZER_KICKON, new PropertyModel<String>(getModel(), ReportDto.F_VIRTUALIZER_KICKON), createStringResource("ReportType.virtualizerKickOn"), ID_LABEL_SIZE, "col-md-4", false);
    add(virtualizerKickOn);
    TextFormGroup maxPages = new TextFormGroup(ID_MAXPAGES, new PropertyModel<String>(getModel(), ReportDto.F_MAXPAGES), createStringResource("ReportType.maxPages"), ID_LABEL_SIZE, "col-md-4", false);
    add(maxPages);
    TextFormGroup timeout = new TextFormGroup(ID_TIMEOUT, new PropertyModel<String>(getModel(), ReportDto.F_TIMEOUT), createStringResource("ReportType.timeout"), ID_LABEL_SIZE, "col-md-4", false);
    add(timeout);
}
Also used : IChoiceRenderer(org.apache.wicket.markup.html.form.IChoiceRenderer) TextFormGroup(com.evolveum.midpoint.web.component.form.TextFormGroup) IModel(org.apache.wicket.model.IModel) DropDownFormGroup(com.evolveum.midpoint.web.component.form.DropDownFormGroup) EnumChoiceRenderer(org.apache.wicket.markup.html.form.EnumChoiceRenderer) ExportType(com.evolveum.midpoint.xml.ns._public.common.common_3.ExportType) PropertyModel(org.apache.wicket.model.PropertyModel) TextAreaFormGroup(com.evolveum.midpoint.web.component.form.TextAreaFormGroup)

Example 8 with DropDownFormGroup

use of com.evolveum.midpoint.web.component.form.DropDownFormGroup in project midpoint by Evolveum.

the class UserReportConfigPanel method initLayout.

private void initLayout(final Component component) {
    TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<String>(getModel(), UserReportDto.F_NAME), createStringResource("ObjectType.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
    add(name);
    TextFormGroup description = new TextFormGroup(ID_DESCRIPTION, new PropertyModel<String>(getModel(), UserReportDto.F_DESCRIPTION), createStringResource("ObjectType.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
    add(description);
    IModel choices = WebComponentUtil.createReadonlyModelFromEnum(ExportType.class);
    IChoiceRenderer renderer = new EnumChoiceRenderer();
    DropDownFormGroup exportType = new DropDownFormGroup(ID_EXPORT_TYPE, new PropertyModel<ExportType>(getModel(), UserReportDto.F_EXPORT_TYPE), choices, renderer, createStringResource("UserReportConfigPanel.exportFileType"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    add(exportType);
    DateFormGroup dateFrom = new DateFormGroup(ID_DATE_FROM, new PropertyModel<XMLGregorianCalendar>(getModel(), UserReportDto.F_FROM_GREG), createStringResource("UserReportConfigPanel.dateFrom"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    add(dateFrom);
    DateFormGroup dateTo = new DateFormGroup(ID_DATE_TO, new PropertyModel<XMLGregorianCalendar>(getModel(), UserReportDto.F_TO_GREG), createStringResource("UserReportConfigPanel.dateTo"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    add(dateTo);
}
Also used : IChoiceRenderer(org.apache.wicket.markup.html.form.IChoiceRenderer) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) TextFormGroup(com.evolveum.midpoint.web.component.form.TextFormGroup) IModel(org.apache.wicket.model.IModel) DropDownFormGroup(com.evolveum.midpoint.web.component.form.DropDownFormGroup) EnumChoiceRenderer(org.apache.wicket.markup.html.form.EnumChoiceRenderer) ExportType(com.evolveum.midpoint.xml.ns._public.common.common_3.ExportType) DateFormGroup(com.evolveum.midpoint.web.component.form.DateFormGroup)

Example 9 with DropDownFormGroup

use of com.evolveum.midpoint.web.component.form.DropDownFormGroup in project midpoint by Evolveum.

the class ChooseFocusTypeAndRelationDialogPanel method initLayout.

private void initLayout() {
    MessagePanel warningMessage = new MessagePanel(ID_WARNING_FEEDBACK, MessagePanel.MessagePanelType.WARN, getWarningMessageModel());
    warningMessage.setOutputMarkupId(true);
    warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null));
    add(warningMessage);
    DropDownFormGroup<QName> type = new DropDownFormGroup<>(ID_OBJECT_TYPE, Model.of(getDefaultObjectType()), Model.ofList(getSupportedObjectTypes()), new QNameObjectTypeChoiceRenderer(), createStringResource("chooseFocusTypeAndRelationDialogPanel.type"), "chooseFocusTypeAndRelationDialogPanel.tooltip.type", "col-md-4", "col-md-8", true);
    type.getInput().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    type.setOutputMarkupId(true);
    type.add(new VisibleBehaviour(this::isFocusTypeSelectorVisible));
    add(type);
    IModel<Map<String, String>> options = new Model(null);
    options.setObject(new HashMap<>());
    ListMultipleChoicePanel<QName> relation = new ListMultipleChoicePanel<>(ID_RELATION, Model.ofList(getDefaultRelations()), new ListModel<>(getSupportedRelations()), WebComponentUtil.getRelationChoicesRenderer(getPageBase()), options);
    relation.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    relation.setOutputMarkupId(true);
    add(relation);
    WebMarkupContainer relationRequired = new WebMarkupContainer(ID_RELATION_REQUIRED);
    relationRequired.add(new VisibleBehaviour((this::isRelationRequired)));
    add(relationRequired);
    Label label = new Label(ID_INFO_MESSAGE, getModel());
    label.add(new VisibleBehaviour(() -> getModel() != null && getModelObject() != null));
    add(label);
    AjaxButton confirmButton = new AjaxButton(ID_BUTTON_OK, createStringResource("Button.ok")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            DropDownFormGroup<QName> type = getTypePanel(getParent());
            QName typeChosen = type.getModelObject();
            ListMultipleChoicePanel<QName> relation = getRelationPanel(getParent());
            Collection<QName> relationChosen = relation.getModelObject();
            if (relationChosen.contains(PrismConstants.Q_ANY)) {
                relationChosen = getSupportedRelations();
            }
            ChooseFocusTypeAndRelationDialogPanel.this.okPerformed(typeChosen, relationChosen, target);
            getPageBase().hideMainPopup(target);
        }
    };
    add(confirmButton);
    AjaxButton cancelButton = new AjaxButton(ID_CANCEL_OK, createStringResource("Button.cancel")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            getPageBase().hideMainPopup(target);
        }
    };
    add(cancelButton);
    AjaxButton configuredButton = new AjaxButton(ID_CONFIGURE_TASK, new StringResourceModel("ConfigureTaskConfirmationPanel.configure", this, null)) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            DropDownFormGroup<QName> type = getTypePanel(getParent());
            QName typeChosen = type.getModelObject();
            ListMultipleChoicePanel<QName> relation = getRelationPanel(getParent());
            Collection<QName> relationChosen = relation.getModelObject();
            PrismObject<TaskType> task = getTask(typeChosen, relationChosen, target);
            if (task == null) {
                return;
            }
            ((PageBase) getPage()).hideMainPopup(target);
            WebComponentUtil.dispatchToObjectDetailsPage(task, true, ChooseFocusTypeAndRelationDialogPanel.this);
        }
    };
    configuredButton.add(new VisibleBehaviour(this::isTaskConfigureButtonVisible));
    add(configuredButton);
}
Also used : DropDownFormGroup(com.evolveum.midpoint.web.component.form.DropDownFormGroup) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) QName(javax.xml.namespace.QName) Label(org.apache.wicket.markup.html.basic.Label) ListMultipleChoicePanel(com.evolveum.midpoint.web.component.input.ListMultipleChoicePanel) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) EmptyOnChangeAjaxFormUpdatingBehavior(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) StringResourceModel(org.apache.wicket.model.StringResourceModel) IModel(org.apache.wicket.model.IModel) ListModel(org.apache.wicket.model.util.ListModel) Model(org.apache.wicket.model.Model) MessagePanel(com.evolveum.midpoint.gui.api.component.result.MessagePanel) StringResourceModel(org.apache.wicket.model.StringResourceModel) QNameObjectTypeChoiceRenderer(com.evolveum.midpoint.web.component.input.QNameObjectTypeChoiceRenderer)

Example 10 with DropDownFormGroup

use of com.evolveum.midpoint.web.component.form.DropDownFormGroup in project midpoint by Evolveum.

the class ExpressionVariableEditorDialog method initLayout.

public void initLayout(WebMarkupContainer content) {
    Form form = new MidpointForm(ID_MAIN_FORM);
    form.setOutputMarkupId(true);
    content.add(form);
    // TODO - shouldn't this be some AutoCompleteField? If yer, where do we
    // get value?
    TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<>(model, ExpressionVariableDefinitionTypeDto.F_VARIABLE + ".name.localPart"), createStringResource("ExpressionVariableEditor.label.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(name);
    TextAreaFormGroup description = new TextAreaFormGroup(ID_DESCRIPTION, new PropertyModel<>(model, ExpressionVariableDefinitionTypeDto.F_VARIABLE + ".description"), createStringResource("ExpressionVariableEditor.label.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(description);
    TextFormGroup path = new TextFormGroup(ID_PATH, new PropertyModel<>(model, ExpressionVariableDefinitionTypeDto.F_PATH), createStringResource("ExpressionVariableEditor.label.path"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(path);
    DropDownFormGroup objectReference = new DropDownFormGroup<>(ID_OBJECT_REFERENCE, new PropertyModel<>(model, ExpressionVariableDefinitionTypeDto.F_VARIABLE + ".objectRef"), new IModel<List<ObjectReferenceType>>() {

        @Override
        public List<ObjectReferenceType> getObject() {
            return WebModelServiceUtils.createObjectReferenceList(ObjectType.class, getPageBase(), objectMap);
        }
    }, new ObjectReferenceChoiceRenderer(objectMap), createStringResource("ExpressionVariableEditor.label.objectRef"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(objectReference);
    TextAreaFormGroup value = new TextAreaFormGroup(ID_VALUE, new PropertyModel<>(model, ExpressionVariableDefinitionTypeDto.F_VALUE), createStringResource("ExpressionVariableEditor.label.value"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(value);
    AjaxSubmitButton cancel = new AjaxSubmitButton(ID_BUTTON_CANCEL, createStringResource("ExpressionVariableEditor.button.cancel")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            cancelPerformed(target);
        }
    };
    form.add(cancel);
    AjaxSubmitButton save = new AjaxSubmitButton(ID_BUTTON_SAVE, createStringResource("ExpressionVariableEditor.button.apply")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            savePerformed(target);
        }
    };
    form.add(save);
}
Also used : ObjectReferenceChoiceRenderer(com.evolveum.midpoint.web.component.input.ObjectReferenceChoiceRenderer) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) TextFormGroup(com.evolveum.midpoint.web.component.form.TextFormGroup) DropDownFormGroup(com.evolveum.midpoint.web.component.form.DropDownFormGroup) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) TextAreaFormGroup(com.evolveum.midpoint.web.component.form.TextAreaFormGroup) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

DropDownFormGroup (com.evolveum.midpoint.web.component.form.DropDownFormGroup)13 IModel (org.apache.wicket.model.IModel)8 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)7 TextFormGroup (com.evolveum.midpoint.web.component.form.TextFormGroup)6 IChoiceRenderer (org.apache.wicket.markup.html.form.IChoiceRenderer)5 ExportType (com.evolveum.midpoint.xml.ns._public.common.common_3.ExportType)4 List (java.util.List)4 PrismObject (com.evolveum.midpoint.prism.PrismObject)3 TextAreaFormGroup (com.evolveum.midpoint.web.component.form.TextAreaFormGroup)3 ArrayList (java.util.ArrayList)3 QName (javax.xml.namespace.QName)3 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 Label (org.apache.wicket.markup.html.basic.Label)3 Form (org.apache.wicket.markup.html.form.Form)3 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)2 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)2 DateFormGroup (com.evolveum.midpoint.web.component.form.DateFormGroup)2 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)2 EmptyOnChangeAjaxFormUpdatingBehavior (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior)2