Search in sources :

Example 51 with TextField

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

the class DirectlyEditablePropertyColumn method createInputPanel.

protected InputPanel createInputPanel(String componentId, final IModel<T> model) {
    TextPanel<?> textPanel = new TextPanel<String>(componentId, new PropertyModel<>(model, getPropertyExpression()));
    // UGLY HACK
    TextField<?> textField = (TextField<?>) textPanel.getBaseFormComponent();
    textField.add(new AjaxFormComponentUpdatingBehavior("blur") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            onBlur(target, model);
        }
    });
    return textPanel;
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) TextPanel(com.evolveum.midpoint.web.component.input.TextPanel) TextField(org.apache.wicket.markup.html.form.TextField)

Example 52 with TextField

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

the class ResourceIterationEditor method initLayout.

protected void initLayout(PageResourceWizard parentPage) {
    loadModel();
    getModel();
    TextField maxIteration = new TextField<>(ID_MAX_ITERATION, new PropertyModel<Integer>(model, IterationSpecificationTypeDto.F_ITERATION + "." + "maxIterations"));
    parentPage.addEditingEnabledBehavior(maxIteration);
    add(maxIteration);
    prepareIterationSubsectionBody(IterationSpecificationType.F_TOKEN_EXPRESSION.getLocalPart(), ID_TOKEN_DESCRIPTION, ID_TOKEN_VARIABLE_LIST, ID_TOKEN_RETURN_MULTIPLICITY, ID_TOKEN_EXPR_TYPE, ID_TOKEN_EXPR, ID_TOKEN_EXPR_LANG, ID_TOKEN_EXPR_POLICY, IterationSpecificationTypeDto.TOKEN_EXPRESSION_PREFIX, ID_TOKEN_LANG_CONTAINER, ID_TOKEN_POLICY_CONTAINER, parentPage);
    prepareIterationSubsectionBody(IterationSpecificationType.F_PRE_ITERATION_CONDITION.getLocalPart(), ID_PRE_DESCRIPTION, ID_PRE_VARIABLE_LIST, ID_PRE_RETURN_MULTIPLICITY, ID_PRE_EXPR_TYPE, ID_PRE_EXPR, ID_PRE_EXPR_LANG, ID_PRE_EXPR_POLICY, IterationSpecificationTypeDto.PRE_EXPRESSION_PREFIX, ID_PRE_LANG_CONTAINER, ID_PRE_POLICY_CONTAINER, parentPage);
    prepareIterationSubsectionBody(IterationSpecificationType.F_POST_ITERATION_CONDITION.getLocalPart(), ID_POST_DESCRIPTION, ID_POST_VARIABLE_LIST, ID_POST_RETURN_MULTIPLICITY, ID_POST_EXPR_TYPE, ID_POST_EXPR, ID_POST_EXPR_LANG, ID_POST_EXPR_POLICY, IterationSpecificationTypeDto.POST_EXPRESSION_PREFIX, ID_POST_LANG_CONTAINER, ID_POST_POLICY_CONTAINER, parentPage);
    Label maxItTooltip = new Label(ID_T_MAX_ITERATION);
    maxItTooltip.add(new InfoTooltipBehavior());
    add(maxItTooltip);
    Label tokenVarTooltip = new Label(ID_T_TOKEN_VAR);
    tokenVarTooltip.add(new InfoTooltipBehavior());
    add(tokenVarTooltip);
    Label tokenMulTooltip = new Label(ID_T_TOKEN_MUL);
    tokenMulTooltip.add(new InfoTooltipBehavior());
    add(tokenMulTooltip);
    Label preVarTooltip = new Label(ID_T_PRE_VAR);
    preVarTooltip.add(new InfoTooltipBehavior());
    add(preVarTooltip);
    Label preMulTooltip = new Label(ID_T_PRE_MUL);
    preMulTooltip.add(new InfoTooltipBehavior());
    add(preMulTooltip);
    Label postVarTooltip = new Label(ID_T_POST_VAR);
    postVarTooltip.add(new InfoTooltipBehavior());
    add(postVarTooltip);
    Label postMulTooltip = new Label(ID_T_POST_MUL);
    postMulTooltip.add(new InfoTooltipBehavior());
    add(postMulTooltip);
    initModals();
}
Also used : InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) Label(org.apache.wicket.markup.html.basic.Label) TextField(org.apache.wicket.markup.html.form.TextField)

Example 53 with TextField

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

the class SearchPanel method initPopover.

private void initPopover() {
    WebMarkupContainer popover = new WebMarkupContainer(ID_POPOVER);
    popover.setOutputMarkupId(true);
    add(popover);
    final WebMarkupContainer propList = new WebMarkupContainer(ID_PROP_LIST);
    propList.setOutputMarkupId(true);
    popover.add(propList);
    ListView properties = new ListView<SearchItemDefinition>(ID_PROPERTIES, new PropertyModel<>(moreDialogModel, MoreDialogDto.F_PROPERTIES)) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final ListItem<SearchItemDefinition> item) {
            CheckBox check = new CheckBox(ID_CHECK, new PropertyModel<>(item.getModel(), SearchItemDefinition.F_SELECTED));
            check.add(new AjaxFormComponentUpdatingBehavior("change") {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                // nothing, just update model.
                }
            });
            item.add(check);
            AjaxLink<Void> propLink = new AjaxLink<Void>(ID_PROP_LINK) {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    addOneItemPerformed(item.getModelObject(), target);
                }
            };
            item.add(propLink);
            Label name = new Label(ID_PROP_NAME, new PropertyModel<>(item.getModel(), SearchItemDefinition.F_NAME));
            name.setRenderBodyOnly(true);
            propLink.add(name);
            Label help = new Label(ID_HELP);
            IModel<String> helpModel = new PropertyModel<>(item.getModel(), SearchItemDefinition.F_HELP);
            help.add(AttributeModifier.replace("title", createStringResource(helpModel.getObject() != null ? helpModel.getObject() : "")));
            help.add(new InfoTooltipBehavior() {

                @Override
                public String getDataPlacement() {
                    return "left";
                }
            });
            help.add(new VisibleBehaviour(() -> StringUtils.isNotEmpty(helpModel.getObject())));
            item.add(help);
            item.add(new VisibleEnableBehaviour() {

                private static final long serialVersionUID = 1L;

                @Override
                public boolean isVisible() {
                    SearchItemDefinition property = item.getModelObject();
                    Search<C> search = SearchPanel.this.getModelObject();
                    if (!search.getAvailableDefinitions().contains(property)) {
                        return false;
                    }
                    for (SearchItem searchItem : search.getItems()) {
                        if (searchItem.getDefinition().equals(property)) {
                            return false;
                        }
                        if (searchItem instanceof PropertySearchItem) {
                            ItemPath propertyPath = property.getPath();
                            if (propertyPath != null && QNameUtil.match(propertyPath.lastName(), ((PropertySearchItem) searchItem).getPath().lastName())) {
                                return false;
                            }
                        }
                    }
                    MoreDialogDto dto = moreDialogModel.getObject();
                    String nameFilter = dto.getNameFilter();
                    String propertyName = property.getName().toLowerCase();
                    if (StringUtils.isNotEmpty(nameFilter) && !propertyName.contains(nameFilter.toLowerCase())) {
                        return false;
                    }
                    return true;
                }
            });
        }
    };
    propList.add(properties);
    TextField<?> addText = new TextField<>(ID_ADD_TEXT, new PropertyModel<>(moreDialogModel, MoreDialogDto.F_NAME_FILTER));
    addText.add(WebComponentUtil.preventSubmitOnEnterKeyDownBehavior());
    popover.add(addText);
    addText.add(new AjaxFormComponentUpdatingBehavior("keyup") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(propList);
        }
    });
    popover.add(addText);
    AjaxButton add = new AjaxButton(ID_ADD, createStringResource("SearchPanel.add")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            addItemPerformed(target);
        }
    };
    popover.add(add);
    AjaxButton close = new AjaxButton(ID_CLOSE, createStringResource("SearchPanel.close")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            closeMorePopoverPerformed(target);
        }
    };
    popover.add(close);
}
Also used : VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AbstractRoleCompositedSearchItem(com.evolveum.midpoint.web.page.admin.roles.AbstractRoleCompositedSearchItem) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) ListView(org.apache.wicket.markup.html.list.ListView) TextField(org.apache.wicket.markup.html.form.TextField) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) PropertyModel(org.apache.wicket.model.PropertyModel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) CheckBox(org.apache.wicket.markup.html.form.CheckBox) ListItem(org.apache.wicket.markup.html.list.ListItem) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 54 with TextField

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

the class TextPopupPanel method initLayout.

private void initLayout() {
    final TextField input = initTextField();
    input.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    input.setOutputMarkupId(true);
    add(input);
}
Also used : EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) AutoCompleteTextField(org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField) TextField(org.apache.wicket.markup.html.form.TextField)

Example 55 with TextField

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

the class BrowserPopupPanel method initLayout.

private void initLayout() {
    IModel value = new PropertyModel(getModel(), SearchValue.F_LABEL);
    TextField input = new TextField(ID_BROWSER_INPUT, value);
    add(input);
    AjaxLink<Void> browse = new AjaxLink<Void>(ID_BROWSE) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            browsePerformed(target);
        }
    };
    add(browse);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) PropertyModel(org.apache.wicket.model.PropertyModel) TextField(org.apache.wicket.markup.html.form.TextField) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink)

Aggregations

TextField (org.apache.wicket.markup.html.form.TextField)61 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)37 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)30 Label (org.apache.wicket.markup.html.basic.Label)25 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)20 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)20 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)18 ListItem (org.apache.wicket.markup.html.list.ListItem)15 ListView (org.apache.wicket.markup.html.list.ListView)15 IModel (org.apache.wicket.model.IModel)14 ArrayList (java.util.ArrayList)13 PropertyModel (org.apache.wicket.model.PropertyModel)13 ComponentFeedbackMessageFilter (org.apache.wicket.feedback.ComponentFeedbackMessageFilter)11 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)11 FeedbackPanel (org.apache.wicket.markup.html.panel.FeedbackPanel)11 List (java.util.List)10 CheckBox (org.apache.wicket.markup.html.form.CheckBox)10 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)9 Form (org.apache.wicket.markup.html.form.Form)9 EmptyOnBlurAjaxFormUpdatingBehaviour (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour)6