Java Code Examples for com.smartgwt.client.widgets.form.DynamicForm#addSubmitValuesHandler()

The following examples show how to use com.smartgwt.client.widgets.form.DynamicForm#addSubmitValuesHandler() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoginWindow.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createForm() {
    DynamicForm f = new DynamicForm();
    f.setWidth(400);
    f.setBrowserSpellCheck(false);
    f.setNumCols(1);
    f.setTitleOrientation(TitleOrientation.TOP);
    f.setSaveOnEnter(true);

    TextItem user = new TextItem(USERNAME, i18nSgwt.dialog_UserNameTitle());
    user.setRequired(true);
    user.setWidth("*");
    user.setReadOnlyDisplay(ReadOnlyDisplayAppearance.STATIC);

    PasswordItem passwd = new PasswordItem(PASSWORD, i18nSgwt.dialog_PasswordTitle());
    passwd.setRequired(true);
    passwd.setWidth("*");

    TextItem producerCode = new TextItem(PRODUCER_CODE, i18n.LoginWindow_ProducerCode());
    producerCode.setWidth("*");
    producerCode.setReadOnlyDisplay(ReadOnlyDisplayAppearance.STATIC);

    StaticTextItem error = new StaticTextItem(ERROR);
    error.setShowTitle(false);
    error.setShowErrorText(true);

    f.setItems(user, producerCode, passwd, error);
    f.addSubmitValuesHandler(new SubmitValuesHandler() {

        @Override
        public void onSubmitValues(SubmitValuesEvent event) {
            submitCredentials();
        }
    });
    return f;
}
 
Example 2
Source File: WorkflowMaterialView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createExpansionForm() {
    DynamicForm form = new DynamicForm();
    form.setDataSource(WorkflowMaterialDataSource.getInstance());
    form.addSubmitValuesHandler(new SubmitValuesHandler() {

        @Override
        public void onSubmitValues(SubmitValuesEvent event) {
            save(event.getForm());
        }
    });
    return form;
}
 
Example 3
Source File: PageMetadataEditor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createForm() {
        DynamicForm form = new DynamicForm();
        form.setWrapItemTitles(false);
//        form.setAutoWidth();
        form.setAutoHeight();
        form.setBrowserSpellCheck(false);
        form.setSaveOnEnter(true);
        form.addSubmitValuesHandler(formSubmitHandler);
        return form;
    }
 
Example 4
Source File: DigitalObjectSearchView.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
private DynamicForm createFilter() {
    DynamicForm form = new DynamicForm();
    form.setBrowserSpellCheck(false);
    form.setValidateOnExit(true);
    form.setSaveOnEnter(true);
    form.setAutoHeight();
    form.setWidth100();
    form.setNumCols(6);

    final RadioGroupItem filterType = new RadioGroupItem(DigitalObjectResourceApi.SEARCH_TYPE_PARAM);
    filterType.setVertical(false);
    filterType.setShowTitle(false);
    filterType.setWrap(false);
    // setRedrawOnChange(true) enforces evaluation of other FormItem.setShowIfCondition
    filterType.setRedrawOnChange(true);
    filterType.setColSpan(5);
    final LinkedHashMap<String, String> filterMap = new LinkedHashMap<String, String>();
    filterMap.put(FILTER_ALPHABETICAL, i18n.DigitalObjectSearchView_FilterGroupAlphabetical_Title());
    filterMap.put(FILTER_LAST_CREATED, i18n.DigitalObjectSearchView_FilterGroupLastCreated_Title());
    filterMap.put(FILTER_LAST_MODIFIED, i18n.DigitalObjectSearchView_FilterGroupLastModified_Title());
    if (!Editor.getInstance().hasPermission("proarc.permission.repository.search.groupOwner")) {
        filterMap.put(FILTER_PHRASE, i18n.DigitalObjectSearchView_FilterGroupPhrase_Title());
    }
    filterMap.put(FILTER_QUERY, i18n.DigitalObjectSearchView_FilterGroupAdvanced_Title());
    if (Editor.getInstance().hasPermission("proarc.permission.admin")) {
        filterMap.put(FILTER_DELETED, i18n.DigitalObjectSearchView_FilterGroupDeleted_Title());
    }
    filterType.setValueMap(filterMap);
    filterType.setValue(FILTER_LAST_CREATED);

    FormItemIfFunction showIfAdvanced = new StringMatchFunction(filterType, FILTER_QUERY, FILTER_DELETED);
    FormItemIfFunction showIfPhrase = new StringMatchFunction(filterType, FILTER_PHRASE);
    FormItemIfFunction showIfCreatedModifiedQuery = new StringMatchFunction(filterType, FILTER_LAST_CREATED, FILTER_LAST_MODIFIED, FILTER_QUERY, FILTER_DELETED, FILTER_ALPHABETICAL);
    FormItemIfFunction showIfAplhabetical = new StringMatchFunction(filterType, FILTER_LAST_CREATED, FILTER_LAST_MODIFIED, FILTER_ALPHABETICAL);

    final TextItem phrase = createAdvancedItem(DigitalObjectResourceApi.SEARCH_PHRASE_PARAM,
            i18n.DigitalObjectSearchView_FilterPhrase_Title(), showIfPhrase);
    phrase.setValidators(new RequiredIfValidator(new RequiredIfFunction() {

        @Override
        public boolean execute(FormItem formItem, Object value) {
            return FILTER_PHRASE.equals(filterType.getValueAsString());
        }
    }), new LengthRangeValidator() {{
        setMax(1000);
    }});

    SubmitItem submit = new SubmitItem("search", i18n.DigitalObjectSearchView_FilterSearchButton_Title());

    form.setFields(filterType, createSpacerItem("100%", null),
            phrase,
            createAdvancedItem(DigitalObjectResourceApi.SEARCH_QUERY_TITLE_PARAM,
                    i18n.DigitalObjectSearchView_FilterAdvancedTitle_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced),
            createAdvancedItem(DigitalObjectResourceApi.SEARCH_QUERY_IDENTIFIER_PARAM,
                    i18n.DigitalObjectSearchView_FilterAdvancedIdentifier_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced),
            createAdvancedItem(DigitalObjectResourceApi.SEARCH_QUERY_CREATOR_PARAM,
                    i18n.DigitalObjectSearchView_FilterAdvancedCreator_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced),
            createAdvancedItem(DigitalObjectResourceApi.SEARCH_QUERY_LABEL_PARAM,
                    i18n.DigitalObjectSearchView_FilterAdvancedLabel_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced),
            createAdvancedItem(DigitalObjectResourceApi.SEARCH_OWNER_PARAM,
                    i18n.DigitalObjectSearchView_FilterAdvancedOwner_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced),
            createModelItem(i18n.DigitalObjectSearchView_FilterAdvancedModel_Title(), showIfCreatedModifiedQuery),
            createSortItem(i18n.DigitalObjectSearchView_FilterSort_Title(), showIfAplhabetical),
            createRememberModelItem(i18n.DigitalObjectSearchView_FilterAdvancedModel_Remember_Title(), showIfCreatedModifiedQuery),
            createSpacerItem("100%", showIfCreatedModifiedQuery),
            submit);
    
    form.addSubmitValuesHandler(new SubmitValuesHandler() {

        @Override
        public void onSubmitValues(SubmitValuesEvent event) {
            if (filters.validate(false)) {
                filter();
            }
        }
    });
    return form;
}