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

The following examples show how to use com.smartgwt.client.widgets.form.DynamicForm#setWrapItemTitles() . 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: UrnNbnAction.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private DynamicForm createOptionResolver() {
    DynamicForm form = new DynamicForm();
    SelectItem selection = new SelectItem(UrnNbnResourceApi.FIND_RESOLVER_PARAM,
            i18n.UrnNbnAction_Window_Select_Title());
    selection.setRequired(true);
    selection.setOptionDataSource(UrnNbnResolverDataSource.getInstance());
    selection.setValueField(UrnNbnResourceApi.RESOLVER_ID);
    selection.setDisplayField(UrnNbnResourceApi.RESOLVER_NAME);
    selection.setAutoFetchData(true);
    selection.setDefaultToFirstOption(true);
    selection.setWidth(350);
    selection.setAutoFetchData(true);
    form.setFields(selection);
    form.setBrowserSpellCheck(false);
    form.setWrapItemTitles(false);
    form.setTitleOrientation(TitleOrientation.TOP);
    return form;
}
 
Example 2
Source File: DcEditor.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private DynamicForm createFullForm() {
    DynamicForm f = new DynamicForm();
    f.setWidth100();
    f.setNumCols(2);
    f.setBrowserSpellCheck(false);
    f.setWrapItemTitles(false);
    f.setTitleOrientation(TitleOrientation.TOP);
    ArrayList<FormItem> items = new ArrayList<FormItem>();
    addElement(items, DcConstants.CONTRIBUTOR, null, true);
    addElement(items, DcConstants.COVERAGE, null, true);
    addElement(items, DcConstants.CREATOR, null, true);
    addElement(items, DcConstants.DATE, null, true);
    addElement(items, DcConstants.DESCRIPTION, null, true);
    addElement(items, DcConstants.FORMAT, null, true);
    addElement(items, DcConstants.IDENTIFIER, null, true);
    addElement(items, DcConstants.LANGUAGE, null, true);
    addElement(items, DcConstants.PUBLISHER, null, true);
    addElement(items, DcConstants.RELATION, null, true);
    addElement(items, DcConstants.RIGHTS, null, true);
    addElement(items, DcConstants.SOURCE, null, true);
    addElement(items, DcConstants.SUBJECT, null, true);
    addElement(items, DcConstants.TITLE, null, true);
    addElement(items, DcConstants.TYPE, null, true);
    f.setFields(items.toArray(new FormItem[items.size()]));
    return f;
}
 
Example 3
Source File: CopyPageMetadataWidget.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private DynamicForm createForm() {
        DynamicForm form = new DynamicForm();
        form.setWrapItemTitles(false);
//        form.setAutoWidth();
        form.setAutoHeight();
        form.setBrowserSpellCheck(false);
        allowPageIndexes = new CheckboxItem("fillPageIndexes", i18n.PageMetadataEditor_CheckboxPageIndices_Title());
        allowPageIndexes.setStartRow(true);
        allowPageIndexes.setColSpan("*");
        allowPageIndexes.setShowTitle(false);
        allowPageNumbers = new CheckboxItem("fillPageNumbers", i18n.PageMetadataEditor_CheckboxPageNubers_Title());
        allowPageNumbers.setStartRow(true);
        allowPageNumbers.setColSpan("*");
        allowPageNumbers.setShowTitle(false);
        allowPageTypes = new CheckboxItem("fillPageTypes", i18n.PageMetadataEditor_CheckboxPageTypes_Title());
        allowPageTypes.setStartRow(true);
        allowPageTypes.setColSpan("*");
        allowPageTypes.setShowTitle(false);
        form.setFields(allowPageTypes, allowPageIndexes, allowPageNumbers);
        return form;
    }
 
Example 4
Source File: NewDigObject.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createOptionsForm() {
        SelectItem selectModel = new SelectItem(DigitalObjectDataSource.FIELD_MODEL,
                i18n.NewDigObject_OptionModel_Title());
        selectModel.setRequired(true);
        selectModel.setWidth(300);
        // issue 46: always start with empty model
        selectModel.setAllowEmptyValue(true);
        selectModel.setEmptyDisplayValue(ClientUtils.format("<i>&lt;%s&gt;</i>", i18n.NewDigObject_OptionModel_EmptyValue_Title()));
        selectModel.setOptionDataSource(MetaModelDataSource.getInstance());
//        selectModel.setShowOptionsFromDataSource(true);
        selectModel.setValueField(MetaModelDataSource.FIELD_PID);
        selectModel.setDisplayField(MetaModelDataSource.FIELD_DISPLAY_NAME);
        selectModel.setAutoFetchData(true);
        selectModel.setValidators(new CustomValidator() {

            @Override
            protected boolean condition(Object value) {
                boolean valid = getFormItem().getSelectedRecord() != null;
                return valid;
            }
        });

        TextItem newPid = new TextItem(DigitalObjectDataSource.FIELD_PID);
        newPid.setTitle(i18n.NewDigObject_OptionPid_Title());
        newPid.setTooltip(i18n.NewDigObject_OptionPid_Hint());
        newPid.setLength(36 + 5);
        newPid.setWidth((36 + 5) * 8);
        newPid.setValidators(new CustomUUIDValidator(i18n));
        //newPid.setValidators(new RegExpValidator(
        //        "uuid:[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}"));
        DynamicForm form = new DynamicForm();
        form.setWrapItemTitles(false);
        form.setAutoFocus(true);
        form.setNumCols(4);
        form.setBrowserSpellCheck(false);
        form.setFields(selectModel, newPid);
        form.setAutoWidth();
        form.setMargin(4);
        return form;
    }
 
Example 5
Source File: WorkflowTaskFormView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createParameterForm(Record[] records) {
    if (records == null || records.length == 0) {
        return createDefaultParameterForm();
    }
    DynamicForm df = new DynamicForm();
    df.setUseFlatFields(true);
    df.setWrapItemTitles(false);
    df.setTitleOrientation(TitleOrientation.TOP);
    df.setNumCols(3);
    df.setColWidths("*", "*", "*");
    df.setItemHoverWidth(300);
    FormItem[] items = new FormItem[records.length];
    Record values = new Record();
    for (int i = 0; i < records.length; i++) {
        Record record = records[i];
        ValueType valueType = ValueType.fromString(
                record.getAttribute(WorkflowModelConsts.PARAMETER_VALUETYPE));
        DisplayType displayType = DisplayType.fromString(
                record.getAttribute(WorkflowModelConsts.PARAMETER_DISPLAYTYPE));
        displayType = valueType == ValueType.DATETIME ? DisplayType.DATETIME : displayType;

        String paramName = record.getAttribute(WorkflowParameterDataSource.FIELD_NAME);
        String fieldName = "f" + i;
        items[i] = createFormItem(record, valueType, displayType);
        items[i].setName(fieldName);
        // use dataPath to solve cases where the valid JSON name is not a valid javascript ID (param.id).
        items[i].setDataPath("/" + paramName);
        items[i].setTitle(record.getAttribute(WorkflowModelConsts.PARAMETER_PROFILELABEL));
        items[i].setTooltip(record.getAttribute(WorkflowModelConsts.PARAMETER_PROFILEHINT));
        Object val = getParameterValue(record, valueType, displayType);
        if (val != null) {
            values.setAttribute(paramName, val);
        }
    }
    df.setItems(items);
    df.editRecord(values);
    df.addItemChangedHandler(itemChangedHandler);
    return df;
}
 
Example 6
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 7
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 8
Source File: SystemMenu.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void addInformations() {
	DynamicForm form1 = new DynamicForm();
	form1.setWidth(300);
	form1.setColWidths(1, "*");

	StaticTextItem productName = ItemFactory.newStaticTextItem("productName", "",
			"<b>" + Session.get().getInfo().getBranding().getProductName() + "</b>");
	productName.setShouldSaveValue(false);
	productName.setShowTitle(false);
	productName.setWrapTitle(false);
	productName.setWrap(false);
	productName.setEndRow(true);

	StaticTextItem version = ItemFactory.newStaticTextItem("version", "",
			I18N.message("version") + " " + Session.get().getInfo().getRelease());
	version.setShouldSaveValue(false);
	version.setShowTitle(false);
	version.setWrap(false);
	version.setEndRow(true);

	StaticTextItem vendor = ItemFactory.newStaticTextItem("vendor", "",
			"&copy; " + Session.get().getInfo().getBranding().getVendor());
	vendor.setShouldSaveValue(false);
	vendor.setShowTitle(false);
	vendor.setEndRow(true);

	String userno = Session.get().getInfo().getUserNo();
	String installationId = Session.get().getInfo().getInstallationId();

	DynamicForm form2 = new DynamicForm();
	form2.setAlign(Alignment.LEFT);
	form2.setTitleOrientation(TitleOrientation.TOP);
	form2.setColWidths(1);
	form2.setWrapItemTitles(false);
	form2.setNumCols(1);

	LinkItem support = new LinkItem();
	support.setName(I18N.message("support"));
	support.setLinkTitle(Session.get().getInfo().getBranding().getSupport());

	String mailTo = "mailto:" + Session.get().getInfo().getBranding().getSupport() + "?subject="
			+ Session.get().getInfo().getBranding().getProductName() + " Support - ";
	if (userno != null)
		mailTo += "UserNo(" + userno + ")";
	else
		mailTo += "ID(" + Session.get().getInfo().getInstallationId() + ")";
	support.setValue(mailTo);
	support.setRequired(true);
	support.setShouldSaveValue(false);

	StaticTextItem installationID = ItemFactory.newStaticTextItem("installid", "installid", installationId);
	installationID.setWidth(250);
	installationID.setRequired(true);
	installationID.setShouldSaveValue(false);
	installationID.setWrap(true);
	installationID.setWrapTitle(false);

	StaticTextItem usernoItem = ItemFactory.newStaticTextItem("userno", "userno", userno);
	usernoItem.setWidth(250);
	usernoItem.setRequired(true);
	usernoItem.setShouldSaveValue(false);
	usernoItem.setWrap(true);
	usernoItem.setWrapTitle(false);

	StaticTextItem hostName = ItemFactory.newStaticTextItem("hostname", "hostname",
			Session.get().getInfo().getHostName());
	hostName.setWidth(250);
	hostName.setRequired(true);
	hostName.setShouldSaveValue(false);
	hostName.setWrap(true);
	hostName.setWrapTitle(false);
	hostName.setVisible(!Session.get().isDemo());

	form1.setItems(productName, version, vendor);

	if (userno != null)
		form2.setItems(support, usernoItem, installationID, hostName);
	else
		form2.setItems(support, installationID, hostName);

	if (!Session.get().isDemo()) {
		addMember(form1);
		addMember(form2);
	}
}
 
Example 9
Source File: WorkflowNewJobView.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
private Widget createOptionForm() {
        final SelectItem profile = createProfileSelector();
        profile.addChangedHandler(changedEvent -> fetchModelMenu(changedEvent.getItem().getSelectedRecord()));

        TextItem metadata = new TextItem(WorkflowResourceApi.NEWJOB_METADATA, "Metadata");
        metadata.setShowTitle(false);
        metadata.setCanEdit(false);
        metadata.setStartRow(true);
        metadata.setReadOnlyDisplay(ReadOnlyDisplayAppearance.STATIC);
        // show empty value instead of XML
        metadata.setEditorValueFormatter(new FormItemValueFormatter() {

            @Override
            public String formatValue(Object value, Record record, DynamicForm form, FormItem item) {
                return "";
            }
        });

//        HiddenItem catalog = new HiddenItem(WorkflowResourceApi.NEWJOB_CATALOGID);
//        catalog.setRequired(true);
//        catalog.setRequiredMessage("Nejsou vybrána žádná metadata!");

        optionForm = new DynamicForm();
        optionForm.setAutoWidth();
        optionForm.setWrapItemTitles(false);
        optionForm.setTitleOrientation(TitleOrientation.TOP);
        optionForm.setItems(profile, metadata);
        // XXX HiddenValidationErrorsHandler does not work in smartgwt 4.0
//        optionForm.addHiddenValidationErrorsHandler(new HiddenValidationErrorsHandler() {
//
//            @Override
//            public void onHiddenValidationErrors(HiddenValidationErrorsEvent event) {
//                event.cancel();
//                String[] profileErrors = optionForm.getFieldErrors(profile.getName());
//                ArrayList<String> result = new ArrayList<String>();
//                result.addAll(Arrays.asList(profileErrors));
//                Map<?,?> errors = event.getErrors();
//                for (Entry<? extends Object, ? extends Object> entrySet : errors.entrySet()) {
//                    StringBuilder sb = new StringBuilder();
//                    Object key = entrySet.getKey();
//                    Object value = entrySet.getValue();
//                    result.add(String.valueOf(key) + " - " + String.valueOf(value));
//                }
//                System.out.println("## onHiddenValidationErrors. origErr: " + profileErrors +
//                        "\n event.err: " + errors + "\n result: " + result);
//                optionForm.setFieldErrors(profile.getName(), result.toArray(new String[result.size()]), true);
//            }
//        });
        return optionForm;
    }
 
Example 10
Source File: ImportSourceChooser.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
private DynamicForm createOptionsForm() {
    DynamicForm form = new DynamicForm();
    form.setNumCols(10);
    form.setGroupTitle(i18n.ImportSourceChooser_Options_Title());
    form.setIsGroup(true);
    form.setWrapItemTitles(false);

    final CheckboxItem cbiPageIndexes = new CheckboxItem(ImportBatchDataSource.FIELD_INDICES,
            i18n.ImportSourceChooser_OptionPageIndices_Title());
    cbiPageIndexes.setValue(true);

    final SelectItem selectScanner = createScannerSelection();
    final SelectItem selectProfile = ProfileChooser.createProfileSelection(ProfileGroup.IMPORTS, i18n);
    selectProfile.setName(ImportBatchDataSource.FIELD_PROFILE_ID);
    selectProfile.addChangedHandler(new ChangedHandler() {

        @Override
        public void onChanged(ChangedEvent event) {
            String profile = getImportProfile();
            Criteria criteria = new Criteria();
            if (profile != null) {
                criteria.addCriteria(ImportTreeDataSource.FIELD_PROFILE, profile);
            }
            treeGrid.setCriteria(criteria);
            boolean isArchive= BatchRecord.isArchive(profile);
            boolean isKramerius = BatchRecord.isKramerius(profile);
            selectScanner.setRequired(!isArchive);
            if (isKramerius) {
                selectScanner.show();
                cbiPageIndexes.hide();
            } else if (isArchive) {
                selectScanner.hide();
                cbiPageIndexes.hide();
            } else {
                selectScanner.show();
                cbiPageIndexes.show();
            }
        }
    });

    form.setFields(selectProfile, selectScanner, cbiPageIndexes);
    return form;
}