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

The following examples show how to use com.smartgwt.client.widgets.form.DynamicForm#setSaveOnEnter() . 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: ModsCustomEditor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createCustomForm(MetaModelRecord model) {
    String metadataFormat = model.getMetadataFormat();
    DynamicForm form = null;
    if (ModsConstants.NS.equals(metadataFormat)) {
        form = new NdkForms(i18n).getForm(model);
        if (NdkPlugin.MODEL_NDK_PAGE.equals(model.getId())) {
            form.setSaveOnEnter(true);
        }
        if (form == null) {
            form = new BornDigitalForms(i18n).getForm(model, getFormPrefix());
        }
        if (form == null) {
            form = new ChronicleForms(i18n).getForm(model, getFormPrefix());
        }
        if (form == null) {
            form = new OldPrintForms(i18n).getForm(model);
        }
        if (form == null) {
            form = new CollectionOfClippingsForms(i18n).getForm(model, getFormPrefix());
        }
        if (form == null) {
            // obsolete K4 forms as a fallback
            form = createModsForm(model.getEditorId());
        }
    } else if (DcConstants.NS_OAIDC.equals(metadataFormat)) {
        form = new DcEditor(i18n, model).getForm();
    } else if ("http://www.mvcr.cz/nsesss/v2".equals(metadataFormat)) {
        form = new NsesssV2Form(i18n, model).getForm();
    }
    if (form == null) {
        ClientUtils.warning(LOG, "Unknown model editor: %s, editor: %s, format: %s",
                model.getId(), model.getEditorId(), metadataFormat);
    }
    return form;
}
 
Example 2
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 3
Source File: WorkflowJobView.java    From proarc with GNU General Public License v3.0 5 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(3);
    // ????
    return form;
}
 
Example 4
Source File: WorkflowTasksView.java    From proarc with GNU General Public License v3.0 5 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(3);
    // ????
    return form;
}
 
Example 5
Source File: NewIssueEditor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createForm() {
    DataSource ds = new DataSource();
    ds.setClientOnly(true);
    DataSourceIntegerField fDays = new DataSourceIntegerField(
            DigitalObjectResourceApi.DIGITALOBJECT_SERIES_DAYS_INCLUDED_PARAM);
    fDays.setMultiple(true);
    DataSourceDateField fDateFrom = new DataSourceDateField(
            DigitalObjectResourceApi.DIGITALOBJECT_SERIES_DATE_FROM_PARAM);
    DataSourceDateField fDateTo = new DataSourceDateField(
            DigitalObjectResourceApi.DIGITALOBJECT_SERIES_DATE_TO_PARAM);
    DataSourceIntegerField fPartNumberFrom = new DataSourceIntegerField(
            DigitalObjectResourceApi.DIGITALOBJECT_SERIES_PARTNUMBER_FROM_PARAM);
    ds.setFields(fDateFrom, fDateTo, fDays, fPartNumberFrom);

    DynamicForm df = new DynamicForm();
    df.setWidth(200);
    df.setItemHoverWidth(200);
    df.setWrapItemTitles(false);
    df.setSaveOnEnter(true);

    IntegerItem partNumberStart = createPartName(fPartNumberFrom.getName());

    DateRangeValidator dateRangeValidator = new DateRangeValidator();
    DateItem dateStart = createDateFrom(fDateFrom.getName(), dateRangeValidator);

    DateItem dateEnd = new DateItem(fDateTo.getName(), i18n.NewIssueEditor_dateTo_Title());
    dateEnd.setTooltip(i18n.NewIssueEditor_dateTo_Hint());
    dateEnd.setUseTextField(true);
    dateEnd.setValidators(dateRangeValidator);
    dateEnd.setStartDate(new Date(1900 - 1900, 1, 1));

    SelectItem issueDays = createDayChooser(fDays.getName());

    df.setDataSource(ds, partNumberStart, dateStart, dateEnd, issueDays);
    return df;
}
 
Example 6
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 7
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;
}