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

The following examples show how to use com.smartgwt.client.widgets.form.DynamicForm#setUseAllDataSourceFields() . 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: MonographUnitForm.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public MonographUnitForm(final ClientMessages i18n) {
    setWidth100();
    setHeight100();
    setTitleOrientation(TitleOrientation.TOP);
    setNumCols(1);

    // identifiers
    final RepeatableFormItem identifiers = new RepeatableFormItem(ModsCustomDataSource.FIELD_IDENTIFIERS,
            i18n.MonographUnitForm_Identifiers_Title());
    identifiers.setDataSource(IdentifierDataSource.getInstance());
    identifiers.setValidators(
            new IdentifiersValidator(i18n, Arrays.asList(IdentifierDataSource.TYPE_UUID)));
    DynamicForm identifierForm = new DynamicForm();
    identifierForm.setUseAllDataSourceFields(true);
    identifierForm.setNumCols(4);
    identifiers.setFormPrototype(identifierForm);
    identifiers.setEndRow(true);
    identifiers.setColSpan("2");

    TextItem unitNumber = new TextItem(ModsCustomDataSource.FIELD_MONOGRAPHUNIT_NUMBER);
    unitNumber.setTitle(i18n.MonographUnitForm_UnitNumber_Title());
    unitNumber.setRequired(true);
    unitNumber.setValidators(new IsIntegerValidator());

    TextAreaItem note = new TextAreaItem(ModsCustomDataSource.FIELD_NOTE, i18n.MonographUnitForm_Note_Title());
    note.setWidth("*");
    note.setHeight("*");
    note.setColSpan("*");

    setFields(unitNumber, identifiers, note);
}
 
Example 2
Source File: RepeatableFormItem.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public DynamicForm create() {
    final DynamicForm form = new DynamicForm();
    form.setNumCols(formPrototype.getNumCols());
    form.setDataSource(dataSource);
    if (formPrototype.getUseAllDataSourceFields()) {
        form.setUseAllDataSourceFields(true);
    }
    return form;
}
 
Example 3
Source File: PeriodicalVolumeForm.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public PeriodicalVolumeForm(ClientMessages i18n) {
    setWidth100();
    setHeight100();
    setTitleOrientation(TitleOrientation.TOP);
    setNumCols(1);

    TextItem volumeNumber = new TextItem(ModsCustomDataSource.FIELD_PER_VOLUME_NUMBER,
            i18n.PeriodicalVolumeForm_Number_Title());
    volumeNumber.setRequired(true);
    // javascript regexp ^([1-9]\d{0,4}(-[1-9]\d{0,4})?)$
    volumeNumber.setValidators(new StringTrimValidator(), new RegExpValidator("^([1-9]\\d{0,4}(-[1-9]\\d{0,4})?)$"));
    TextItem date = new TextItem(ModsCustomDataSource.FIELD_PER_VOLUME_YEAR,
            i18n.PeriodicalVolumeForm_Date_Title());
    date.setRequired(true);
    // issue 43; see https://docs.google.com/document/d/1zSriHPdnUY5d_tKv0M8a6nEym560DKh2H6XZ24tGAEw/edit?pli=1
    // javascript regexp ^([1-9]\d{3}(-[1-9]\d{3})?)$
    date.setValidators(new StringTrimValidator(), new RegExpValidator("^([1-9]\\d{3}(-[1-9]\\d{3})?)$"));
    date.setEndRow(true);

    // identifiers
    final RepeatableFormItem identifiers = new RepeatableFormItem(ModsCustomDataSource.FIELD_IDENTIFIERS,
            i18n.PeriodicalVolumeForm_Identifiers_Title());
    identifiers.setDataSource(IdentifierDataSource.getInstance());
    identifiers.setValidators(
            new IdentifiersValidator(i18n, Arrays.asList(IdentifierDataSource.TYPE_UUID)));
    DynamicForm identifierForm = new DynamicForm();
    identifierForm.setUseAllDataSourceFields(true);
    identifierForm.setNumCols(4);
    identifiers.setFormPrototype(identifierForm);
    identifiers.setEndRow(true);
    identifiers.setColSpan("2");

    TextAreaItem note = new TextAreaItem(ModsCustomDataSource.FIELD_NOTE,
            i18n.PeriodicalVolumeForm_Note_Title());
    note.setWidth("*");
    note.setHeight("*");
    note.setColSpan("*");

    setFields(volumeNumber, date, identifiers, note);
}
 
Example 4
Source File: NdkAudioPageForm.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
/**
     * Create a new form.
     * @param i18n I18N
     * @param typeValueMapId {@link ValueMapDataSource#getOptionDataSource}
     *          reference to bundle with page types.
     */
    public NdkAudioPageForm(ClientMessages i18n, String typeValueMapId) {
        // save on Enter is supposed mainly for ImportBatchItemEditor
        // see submit handler in ModsMultiEditor
        setSaveOnEnter(true);
        setWidth100();
        setHeight100();
        setTitleOrientation(TitleOrientation.TOP);

        TextItem pageType = new TextItem(ModsCustomDataSource.FIELD_PAGE_TYPE);
        pageType.setTitle(i18n.PageForm_PageType_Title());
        pageType.setEndRow(true);
        pageType.setRequired(true);
        pageType.setReadOnly();
        pageType.disable();

        IntegerItem pageIndex = new IntegerItem(ModsCustomDataSource.FIELD_PAGE_INDEX);
        pageIndex.setTitle(i18n.PageForm_PageIndex_Title());
        pageIndex.setValidators(new IsIntegerValidator());
        pageIndex.setRequired(true);
        pageIndex.setEndRow(true);

        TextItem pageNumber = new TextItem(ModsCustomDataSource.FIELD_PAGE_NUMBER);
        pageNumber.setTitle(i18n.PageForm_PageNumber_Title());
        pageNumber.setEndRow(true);
        pageNumber.setRequired(true);
        pageNumber.setValidators(new StringTrimValidator());
//        pageNumber.setLength(5);

        final RepeatableFormItem identifiers = new RepeatableFormItem(ModsCustomDataSource.FIELD_IDENTIFIERS,
                i18n.PageForm_Identifiers_Title());
        identifiers.setDataSource(IdentifierDataSource.getInstance());
        identifiers.setRequired(true);
        identifiers.setValidators(
                new IdentifiersValidator(i18n, Arrays.asList(IdentifierDataSource.TYPE_UUID)));
        DynamicForm identifierForm = new DynamicForm();
        identifierForm.setUseAllDataSourceFields(true);
        identifierForm.setNumCols(4);
        identifiers.setFormPrototype(identifierForm);
        identifiers.setEndRow(true);
        identifiers.setColSpan("3");

//        TextAreaItem note = new AutoFitTextAreaItem(ModsCustomDataSource.FIELD_NOTE, "Note");
        TextAreaItem note = new TextAreaItem(ModsCustomDataSource.FIELD_NOTE, i18n.PageForm_Note_Title());
        note.setWidth("*");
        //https://github.com/proarc/proarc/issues/645 GWT v.6.0-p20161023 form draw issue
        note.setHeight("*");
        note.setColSpan("*");

        setFields(pageType, pageIndex, pageNumber, identifiers, note);

        IntegerRangeValidator integerRangeValidator = new IntegerRangeValidator();
        integerRangeValidator.setMin(0);
        integerRangeValidator.setMax(Integer.MAX_VALUE);

        pageIndex.setValidators(integerRangeValidator);
    }
 
Example 5
Source File: PeriodicalIssueForm.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public PeriodicalIssueForm(ClientMessages i18n) {
    setWidth100();
    setHeight100();
    setTitleOrientation(TitleOrientation.TOP);
    setNumCols(1);

    ComboBoxItem issueSequenceNumber = new ComboBoxItem(ModsCustomDataSource.FIELD_PER_ISSUE_NUMBER_SORTING,
            i18n.PeriodicalIssueForm_NumberSorting_Title());
    issueSequenceNumber.setRequired(true);
    issueSequenceNumber.setValidators(new StringTrimValidator(), new RegExpValidator(
            "^([1-9]\\d{0,4}(-[1-9]\\d{0,4})?|mimořádné|zvláštní|na ukázku)$"));
    issueSequenceNumber.setValueMap("mimořádné", "na ukázku", "zvláštní");
    issueSequenceNumber.setHideEmptyPickList(true);

    TextItem date = new TextItem(ModsCustomDataSource.FIELD_PER_ISSUE_DATE, i18n.PeriodicalIssueForm_Date_Title());
    date.setRequired(true);
    // issue 43, see https://docs.google.com/document/d/1zSriHPdnUY5d_tKv0M8a6nEym560DKh2H6XZ24tGAEw/edit?pli=1
    // YYYY|YYYY-YYYY|MM.YYYY|MM.-MM.YYYY|DD.MM.YYYY|DD.-DD.MM.YYYY
    // javascript regex ^([1-9]\d{3}(-[1-9]\d{3})?|(1\d|[1-9])\.(-(1\d|[1-9])\.)?[1-9]\d{3}|([123]\d|[1-9])\.(1\d|[1-9])\.(-([123]\d|[1-9])\.(1\d|[1-9])\.)?[1-9]\d{3})$
    date.setValidators(new StringTrimValidator(), new RegExpValidator(
            "^([1-9]\\d{3}(-[1-9]\\d{3})?|(1\\d|[1-9])\\.(-(1\\d|[1-9])\\.)?[1-9]\\d{3}|([123]\\d|[1-9])\\.(1\\d|[1-9])\\.(-([123]\\d|[1-9])\\.(1\\d|[1-9])\\.)?[1-9]\\d{3})$"));

    // identifiers
    final RepeatableFormItem identifiers = new RepeatableFormItem(ModsCustomDataSource.FIELD_IDENTIFIERS,
            i18n.PeriodicalIssueForm_Identifiers_Title());
    identifiers.setDataSource(IdentifierDataSource.getInstance());
    identifiers.setValidators(
            new IdentifiersValidator(i18n, Arrays.asList(IdentifierDataSource.TYPE_UUID)));
    DynamicForm identifierForm = new DynamicForm();
    identifierForm.setUseAllDataSourceFields(true);
    identifierForm.setNumCols(4);
    identifiers.setFormPrototype(identifierForm);
    identifiers.setEndRow(true);
    identifiers.setColSpan("2");

    TextAreaItem note = new TextAreaItem(ModsCustomDataSource.FIELD_NOTE, i18n.PeriodicalIssueForm_Note_Title());
    note.setWidth("*");
    note.setHeight("*");
    note.setColSpan("*");

    setFields(issueSequenceNumber, date, identifiers, note);
}
 
Example 6
Source File: PageForm.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
/**
     * Create a new form.
     * @param i18n I18N
     * @param typeValueMapId {@link ValueMapDataSource#getOptionDataSource}
     *          reference to bundle with page types.
     */
    public PageForm(ClientMessages i18n, String typeValueMapId) {
        // save on Enter is supposed mainly for ImportBatchItemEditor
        // see submit handler in ModsMultiEditor
        setSaveOnEnter(true);
        setWidth100();
        setHeight100();
        setTitleOrientation(TitleOrientation.TOP);
        SelectItem pageType = new SelectItem(ModsCustomDataSource.FIELD_PAGE_TYPE, i18n.PageForm_PageType_Title());
        pageType.setOptionDataSource(ValueMapDataSource.getInstance().getOptionDataSource(typeValueMapId));
        pageType.setValueField(BundleValue.KEY);
        pageType.setDisplayField(BundleValue.VALUE);
        pageType.setDefaultValue(ModsCustomDataSource.getDefaultPageType());
        pageType.setWidth(200);
        pageType.setEndRow(true);

        IntegerItem pageIndex = new IntegerItem(ModsCustomDataSource.FIELD_PAGE_INDEX);
        pageIndex.setTitle(i18n.PageForm_PageIndex_Title());
        pageIndex.setValidators(new IsIntegerValidator());
        pageIndex.setRequired(true);
        pageIndex.setEndRow(true);

        TextItem pageNumber = new TextItem(ModsCustomDataSource.FIELD_PAGE_NUMBER);
        pageNumber.setTitle(i18n.PageForm_PageNumber_Title());
        pageNumber.setEndRow(true);
        pageNumber.setRequired(true);
        pageNumber.setValidators(new StringTrimValidator());
//        pageNumber.setLength(5);

        final RepeatableFormItem identifiers = new RepeatableFormItem(ModsCustomDataSource.FIELD_IDENTIFIERS,
                i18n.PageForm_Identifiers_Title());
        identifiers.setDataSource(IdentifierDataSource.getInstance());
        identifiers.setRequired(true);
        identifiers.setValidators(
                new IdentifiersValidator(i18n, Arrays.asList(IdentifierDataSource.TYPE_UUID)));
        DynamicForm identifierForm = new DynamicForm();
        identifierForm.setUseAllDataSourceFields(true);
        identifierForm.setNumCols(4);
        identifiers.setFormPrototype(identifierForm);
        identifiers.setEndRow(true);
        identifiers.setColSpan("3");

//        TextAreaItem note = new AutoFitTextAreaItem(ModsCustomDataSource.FIELD_NOTE, "Note");
        TextAreaItem note = new TextAreaItem(ModsCustomDataSource.FIELD_NOTE, i18n.PageForm_Note_Title());
        note.setWidth("*");
        //https://github.com/proarc/proarc/issues/645 GWT v.6.0-p20161023 form draw issue
        note.setHeight("*");
        note.setColSpan("*");

        setFields(pageType, pageIndex, pageNumber, identifiers, note);

        IntegerRangeValidator integerRangeValidator = new IntegerRangeValidator();
        integerRangeValidator.setMin(0);
        integerRangeValidator.setMax(Integer.MAX_VALUE);

        pageIndex.setValidators(integerRangeValidator);
    }