Package org.apache.wicket.markup.html.form

Examples of org.apache.wicket.markup.html.form.Form$FormValidatorRemovedChange


        window.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
        window.setInitialHeight(WIN_HEIGHT);
        window.setInitialWidth(WIN_WIDTH);
        window.setCookieName("view-task-win");

        Form paginatorForm = new Form("PaginatorForm");

        final DropDownChoice rowsChooser = new DropDownChoice(
                "rowsChooser", new PropertyModel(this, "paginatorRows"), prefMan.getPaginatorChoices());

        rowsChooser.add(new AjaxFormComponentUpdatingBehavior("onchange") {

            private static final long serialVersionUID = -1107858522700306810L;

            @Override
            protected void onUpdate(final AjaxRequestTarget target) {
                prefMan.set(getWebRequest(), (WebResponse) getResponse(),
                        Constants.PREF_PROPAGATION_TASKS_PAGINATOR_ROWS, String.valueOf(paginatorRows));

                table = Tasks.updateTaskTable(
                        columns,
                        new TasksProvider<PropagationTaskTO>(restClient, paginatorRows,
                        getId(), PropagationTaskTO.class),
                        container,
                        table == null ? 0 : (int) table.getCurrentPage(),
                        pageRef,
                        restClient);

                target.add(container);
            }
        });

        paginatorForm.add(rowsChooser);
        add(paginatorForm);
    }
View Full Code Here


    private DropDownChoice<Locale> languageSelect;

    public Login(final PageParameters parameters) {
        super(parameters);

        form = new Form("login");

        userIdField = new TextField("userId", new Model());
        userIdField.setMarkupId("userId");
        form.add(userIdField);
View Full Code Here

        approvalContainer.add(approvalTable);
        approvalContainer.setOutputMarkupId(true);

        add(approvalContainer);

        Form approvalPaginatorForm = new Form("approvalPaginatorForm");

        MetaDataRoleAuthorizationStrategy.authorize(approvalPaginatorForm, RENDER, xmlRolesReader.getAllAllowedRoles(
                "Approval", "list"));

        final DropDownChoice rowsChooser = new DropDownChoice("rowsChooser", new PropertyModel(this,
                "approvalPaginatorRows"), prefMan.getPaginatorChoices());

        rowsChooser.add(new AjaxFormComponentUpdatingBehavior("onchange") {

            private static final long serialVersionUID = -1107858522700306810L;

            @Override
            protected void onUpdate(final AjaxRequestTarget target) {
                prefMan.set(getRequest(), getResponse(), Constants.PREF_APPROVAL_PAGINATOR_ROWS, String.valueOf(
                        approvalPaginatorRows));
                approvalTable.setItemsPerPage(approvalPaginatorRows);

                target.add(approvalContainer);
            }
        });

        approvalPaginatorForm.add(rowsChooser);
        add(approvalPaginatorForm);

        editApprovalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
        editApprovalWin.setInitialHeight(APPROVAL_WIN_HEIGHT);
        editApprovalWin.setInitialWidth(APPROVAL_WIN_WIDTH);
View Full Code Here

        userRequestContainer.add(userRequestTable);
        userRequestContainer.setOutputMarkupId(true);

        add(userRequestContainer);

        Form userRequestPaginatorForm = new Form("userRequestPaginatorForm");

        MetaDataRoleAuthorizationStrategy.authorize(userRequestPaginatorForm, RENDER, xmlRolesReader.getAllAllowedRoles(
                "UserRequest", "list"));

        final DropDownChoice rowsChooser = new DropDownChoice("rowsChooser", new PropertyModel(this,
                "userRequestPaginatorRows"), prefMan.getPaginatorChoices());

        rowsChooser.add(new AjaxFormComponentUpdatingBehavior("onchange") {

            private static final long serialVersionUID = -1107858522700306810L;

            @Override
            protected void onUpdate(final AjaxRequestTarget target) {
                prefMan.set(getRequest(), getResponse(), Constants.PREF_USER_REQUEST_PAGINATOR_ROWS, String.valueOf(
                        userRequestPaginatorRows));
                userRequestTable.setItemsPerPage(userRequestPaginatorRows);

                target.add(userRequestContainer);
            }
        });

        userRequestPaginatorForm.add(rowsChooser);
        add(userRequestPaginatorForm);

        editUserRequestWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
        editUserRequestWin.setInitialHeight(USER_REQUEST_WIN_HEIGHT);
        editUserRequestWin.setInitialWidth(USER_REQUESTL_WIN_WIDTH);
View Full Code Here

        });

        Fragment fragment = new Fragment("tablePanel", "bulkAvailable", this);
        add(fragment);

        bulkActionForm = new Form("groupForm");
        fragment.add(bulkActionForm);

        group = new CheckGroup<T>("checkgroup", new ArrayList<T>());
        bulkActionForm.add(group);
View Full Code Here

            final PageReference pageRef) {

        this.reportletConf = reportletConf;
        this.pageRef = pageRef;

        Form form = new Form("form");
        add(form);

        propertiesContainer = new WebMarkupContainer("container");
        propertiesContainer.setOutputMarkupId(true);
        form.add(propertiesContainer);

        name = new AjaxTextFieldPanel("name", "name", this.reportletConf == null
                ? new Model()
                : new PropertyModel<String>(this.reportletConf, "name"));
        name.setOutputMarkupId(true);
        name.addRequiredLabel();
        form.add(name);

        final AjaxDropDownChoicePanel<String> reportletClass = new AjaxDropDownChoicePanel<String>("reportletClass",
                "reportletClass", new IModel<String>() {

            private static final long serialVersionUID = -2316468110411802130L;

            @Override
            public String getObject() {
                return ReportletConfModalPage.this.reportletConf == null
                        ? null
                        : ReportletConfModalPage.this.reportletConf.getClass().getName();
            }

            @Override
            public void setObject(final String object) {
                try {
                    Class<?> reportletClass = Class.forName(object);
                    ReportletConfModalPage.this.reportletConf = (AbstractReportletConf) reportletClass.newInstance();
                    propertiesContainer.replace(buildPropView());
                } catch (Exception e) {
                    LOG.error("Cannot find or initialize {}", object, e);
                }
            }

            @Override
            public void detach() {
            }
        });
        reportletClass.setStyleSheet("long_dynamicsize");
        reportletClass.setChoices(restClient.getReportletConfClasses());
        ((DropDownChoice) reportletClass.getField()).setNullValid(true);
        reportletClass.addRequiredLabel();
        reportletClass.getField().add(new AjaxFormComponentUpdatingBehavior("onchange") {

            private static final long serialVersionUID = 5538299138211283825L;

            @Override
            protected void onUpdate(final AjaxRequestTarget target) {
                ((DropDownChoice) reportletClass.getField()).setNullValid(false);
                target.add(reportletClass.getField());
                target.add(propertiesContainer);
            }
        });
        form.add(reportletClass);

        propertiesContainer.add(buildPropView());

        final AjaxButton submit = new AjaxButton("apply", new ResourceModel("apply")) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                final BeanWrapper wrapper = PropertyAccessorFactory
                        .forBeanPropertyAccess(ReportletConfModalPage.this.reportletConf);
                wrapper.setPropertyValue("name", name.getField().getInput());

                // Iterate over properties in order to find UserSearchPanel instances and manually update
                // this.reportletConf with select search criteria - this is needed because UserSearchPanel
                // does not comply with usual Wicket model paradigm.
                for (Iterator<Component> itor = ReportletConfModalPage.this.propView.visitChildren(); itor.hasNext();) {
                    Component component = itor.next();
                    if (component instanceof UserSearchPanel) {
                        // using component.getDefaultModelObjectAsString() to fetch field name (set above)
                        wrapper.setPropertyValue(component.getDefaultModelObjectAsString(),
                                ((UserSearchPanel) component).buildSearchCond());
                    }
                }

                ((ReportModalPage) pageRef.getPage())
                        .setModalReportletConf(ReportletConfModalPage.this.reportletConf);
                window.close(target);
            }

            @Override
            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
                target.add(feedbackPanel);
            }
        };
        form.add(submit);

        final AjaxButton cancel = new ClearIndicatingAjaxButton("cancel", new ResourceModel("cancel"), pageRef) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
                window.close(target);
            }
        };

        cancel.setDefaultFormProcessing(false);
        form.add(cancel);
    }
View Full Code Here

                createLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Users", "create"));
        add(createLink);

        setWindowClosedReloadCallback(editModalWin);

        final Form searchForm = new Form("searchForm");
        add(searchForm);

        final UserSearchPanel searchPanel = new UserSearchPanel("searchPanel");
        searchForm.add(searchPanel);

        final ClearIndicatingAjaxButton searchButton =
                new ClearIndicatingAjaxButton("search", new ResourceModel("search"), getPageReference()) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
                final NodeCond searchCond = searchPanel.buildSearchCond();
                LOG.debug("Node condition " + searchCond);

                doSearch(target, searchCond, searchResult);

                Session.get().getFeedbackMessages().clear();
                target.add(searchPanel.getSearchFeedback());
            }

            @Override
            protected void onError(final AjaxRequestTarget target, final Form<?> form) {

                target.add(searchPanel.getSearchFeedback());
            }
        };

        searchForm.add(searchButton);
        searchForm.setDefaultButton(searchButton);
    }
View Full Code Here

     * @param createFlag true for CREATE and false for UPDATE operation
     */
    public ConfigurationModalPage(final PageReference pageRef, final ModalWindow window,
            final ConfigurationTO configurationTO, final boolean createFlag) {

        Form form = new Form("form", new CompoundPropertyModel(configurationTO));

        final AjaxTextFieldPanel key = new AjaxTextFieldPanel("key", "key", new PropertyModel(configurationTO, "key"));
        form.add(key);
        key.setEnabled(createFlag);
        key.addRequiredLabel();

        final AjaxTextFieldPanel value = new AjaxTextFieldPanel("value", "value", new PropertyModel(configurationTO,
                "value"));
        form.add(value);

        submit = new IndicatingAjaxButton("apply", new Model<String>(getString("submit"))) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                try {
                    if (createFlag) {
                        configurationsRestClient.createConfiguration(configurationTO);
                    } else {
                        configurationsRestClient.updateConfiguration(configurationTO);
                    }

                    Configuration callerPage = (Configuration) pageRef.getPage();
                    callerPage.setModalResult(true);

                    window.close(target);
                } catch (SyncopeClientCompositeErrorException e) {
                    if (createFlag) {
                        error(getString("error_insert"));
                    } else {
                        error(getString("error_updating"));
                    }
                    target.add(feedbackPanel);
                    LOG.error("While creating or updating configuration {}", configurationTO, e);
                }
            }

            @Override
            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
                target.add(feedbackPanel);
            }
        };

        final IndicatingAjaxButton cancel = new IndicatingAjaxButton("cancel", new ResourceModel("cancel")) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                window.close(target);
            }

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

        cancel.setDefaultFormProcessing(false);
        form.add(cancel);

        String allowedRoles = createFlag
                ? xmlRolesReader.getAllAllowedRoles("Configuration", "create")
                : xmlRolesReader.getAllAllowedRoles("Configuration", "update");

        MetaDataRoleAuthorizationStrategy.authorize(submit, ENABLE, allowedRoles);

        form.add(submit);

        add(form);
    }
View Full Code Here

        if (schema == null) {
            schema = new VirtualSchemaTO();
        }

        final Form schemaForm = new Form("form");

        schemaForm.setModel(new CompoundPropertyModel(schema));

        final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", getString("name"), new PropertyModel<String>(
                schema, "name"));
        name.addRequiredLabel();

        name.setEnabled(createFlag);

        final AjaxCheckBoxPanel readonly = new AjaxCheckBoxPanel("readonly", getString("readonly"),
                new PropertyModel<Boolean>(schema, "readonly"));

        final AjaxButton submit = new IndicatingAjaxButton("apply", new ResourceModel("submit")) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form form) {
                VirtualSchemaTO schemaTO = (VirtualSchemaTO) form.getDefaultModelObject();
                try {
                    if (createFlag) {
                        restClient.createVirtualSchema(kind, schemaTO);
                    } else {
                        restClient.updateVirtualSchema(kind, schemaTO);
                    }
                    if (pageRef.getPage() instanceof BasePage) {
                        ((BasePage) pageRef.getPage()).setModalResult(true);
                    }

                    window.close(target);
                } catch (SyncopeClientCompositeErrorException e) {
                    error(getString("error") + ":" + e.getMessage());
                    target.add(feedbackPanel);
                }
            }

            @Override
            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
                target.add(feedbackPanel);
            }
        };

        final AjaxButton cancel = new IndicatingAjaxButton("cancel", new ResourceModel("cancel")) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                window.close(target);
            }
        };

        cancel.setDefaultFormProcessing(false);

        String allowedRoles;

        if (createFlag) {
            allowedRoles = xmlRolesReader.getAllAllowedRoles("Schema", "create");
        } else {
            allowedRoles = xmlRolesReader.getAllAllowedRoles("Schema", "update");
        }

        MetaDataRoleAuthorizationStrategy.authorize(submit, ENABLE, allowedRoles);

        schemaForm.add(name);
        schemaForm.add(readonly);

        schemaForm.add(submit);
        schemaForm.add(cancel);

        add(schemaForm);
    }
View Full Code Here

            }
        };

        cancel.setDefaultFormProcessing(false);

        Form form = new Form("form");
        form.add(propView);
        form.add(userDetails);
        form.add(submit);
        form.add(cancel);

        MetaDataRoleAuthorizationStrategy.authorize(form, ENABLE, xmlRolesReader.getAllAllowedRoles("Approval",
                "submit"));

        editUserWin = new ModalWindow("editUserWin");
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.form.Form$FormValidatorRemovedChange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.