com.smartgwt.client.widgets.form.DynamicForm Java Examples

The following examples show how to use com.smartgwt.client.widgets.form.DynamicForm. 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 6 votes vote down vote up
private DynamicForm createModsForm(String editorId) {
    DynamicForm form = null;
    if (ModsCutomEditorType.EDITOR_PAGE.equals(editorId)) {
        form = new PageForm(i18n);
    } else if (ModsCutomEditorType.EDITOR_PERIODICAL.equals(editorId)) {
        form = new PeriodicalForm(i18n);
    } else if (ModsCutomEditorType.EDITOR_MONOGRAPH.equals(editorId)) {
        form = new MonographForm(i18n);
    } else if (ModsCutomEditorType.EDITOR_PERIODICAL_VOLUME.equals(editorId)) {
        form = new PeriodicalVolumeForm(i18n);
    } else if (ModsCutomEditorType.EDITOR_PERIODICAL_ISSUE.equals(editorId)) {
        form = new PeriodicalIssueForm(i18n);
    } else if (ModsCutomEditorType.EDITOR_MONOGRAPH_UNIT.equals(editorId)) {
        form = new MonographUnitForm(i18n);
    }
    return form;
}
 
Example #2
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 #3
Source File: LoginWindow.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private Window createWindow(DynamicForm form) {
    VLayout container = new VLayout();
    container.setMembers(form, createButtons());
    container.setMargin(15);
    Window window = new Window();
    window.setAutoCenter(true);
    window.setAutoSize(true);
    window.setIsModal(true);
    window.addItem(container);
    window.setTitle(i18nSgwt.dialog_LoginTitle());
    window.setShowCloseButton(false);
    window.setShowMinimizeButton(false);
    window.setKeepInParentRect(true);
    window.setShowModalMask(true);
    window.setCanDragReposition(false);
    return window;
}
 
Example #4
Source File: StationSelector.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createInformationFieldForSelectedStation() {
        VLayout layout = new VLayout();
        timeseriesInfoHTMLPane = new HTMLPane();
        phenomenonBox = new SelectItem(i18n.phenomenonLabel());
        phenomenonBox.addChangedHandler(new ChangedHandler() {
			@Override
			public void onChanged(ChangedEvent event) {
				String category = (String) event.getItem().getValue();
				controller.loadTimeseriesByCategory(category);
			}
		});
        DynamicForm form = new DynamicForm();
        form.setItems(phenomenonBox);
//        phenomenonInfoLabel = new Label();
//        phenomenonInfoLabel.setAutoHeight();
        stationInfoLabel = new Label();
        stationInfoLabel.setAutoHeight();
//        layout.addMember(phenomenonInfoLabel);
        layout.addMember(form);
        layout.addMember(stationInfoLabel);
        layout.addMember(timeseriesInfoHTMLPane);
        return layout;
    }
 
Example #5
Source File: DesaExportAction.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private DynamicForm createLogForm() {
    DynamicForm form = new DynamicForm();
    form.setBrowserSpellCheck(false);
    form.setCanEdit(false);
    form.setWidth100();
    form.setHeight("40%");
    TextAreaItem textAreaItem = new TextAreaItem(ExportResourceApi.RESULT_ERROR_LOG);
    textAreaItem.setColSpan("*");
    textAreaItem.setHeight("*");
    textAreaItem.setWrap(TextAreaWrap.OFF);
    textAreaItem.setShowTitle(false);
    textAreaItem.setWidth("*");
    textAreaItem.setCanEdit(false);
    form.setItems(textAreaItem);
    return form;
}
 
Example #6
Source File: ExportAction.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
protected final void dsAddData(DataSource dataSource, Record record, DSCallback dsCallback, DSRequest dsRequest) {
    DynamicForm optionsForm = createOptionsForm();

    if (optionsForm == null) {
        dataSource.addData(record, dsCallback, dsRequest);
        SC.say(i18n.ExportAction_Sent_Msg());
        return;
    }

    Dialog d = new Dialog(i18n.ExportAction_Request_Title());
    d.getDialogContentContainer().addMember(optionsForm);

    IButton okButton = d.addOkButton((ClickEvent eventX) -> {
        setRequestOptions(record);
        dataSource.addData(record, dsCallback, dsRequest);
        d.destroy();
        SC.say(i18n.ExportAction_Sent_Msg());
    });

    d.addCancelButton(() -> d.destroy());
    d.setWidth(400);
    d.show();

    okButton.focus();
}
 
Example #7
Source File: UploadFile.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private DynamicForm createForm() {
    DynamicForm form = new DynamicForm();
    form.setEncoding(Encoding.MULTIPART);
    form.setBrowserSpellCheck(false);
    form.setNumCols(2);
    form.setTitleOrientation(TitleOrientation.TOP);
    form.setCanSubmit(true);

    TextItem mimeItem = new TextItem(FIELD_MIMETYPE,
            i18n.DigitalObjectEditor_MediaEditor_Uploader_Mimetype_Title());
    mimeItem.setWidth(400);
    mimeItem.setColSpan(2);

    TextItem filenameItem = new TextItem(FIELD_FILE,
            i18n.DigitalObjectEditor_MediaEditor_Uploader_Filename_Title());
    filenameItem.setWidth(400);
    filenameItem.setColSpan(2);
    filenameItem.setRequired(Boolean.TRUE);

    HiddenItem pidItem = new HiddenItem(FIELD_PID);
    HiddenItem batchIdItem = new HiddenItem(FIELD_BATCHID);
    form.setFields(filenameItem, mimeItem, pidItem, batchIdItem);
    return form;
}
 
Example #8
Source File: DeviceManager.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private DynamicForm createForm() {
    DynamicForm df = new DynamicForm();
    df.setMargin(4);
    df.setNumCols(1);
    df.setTitleOrientation(TitleOrientation.TOP);
    df.setBrowserSpellCheck(false);
    df.setDataSource(DeviceDataSource.getInstance());
    TextItem fieldId = new TextItem(DeviceDataSource.FIELD_ID);
    fieldId.setWidth(280);
    fieldId.setCanEdit(false);
    fieldId.setReadOnlyDisplay(ReadOnlyDisplayAppearance.STATIC);
    TextItem fieldModel = new TextItem(DeviceDataSource.FIELD_MODEL);
    fieldModel.setCanEdit(false);
    fieldModel.setRequired(true);
    TextItem fieldLabel = new TextItem(DeviceDataSource.FIELD_LABEL);
    fieldLabel.setRequired(true);
    fieldLabel.setWidth("*");
    df.setItems(fieldId, fieldModel,  fieldLabel);
    return df;
}
 
Example #9
Source File: WorkflowMaterialView.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private DynamicForm createPhysicalDocumentForm() {
    DynamicForm form = createExpansionForm();
    TextAreaItem xml = new TextAreaItem(WorkflowMaterialDataSource.FIELD_PHYSICAL_METADATA);
    xml.setWidth("*");
    form.setDataSource(WorkflowMaterialDataSource.getInstance(),
            new TextItem(WorkflowMaterialDataSource.FIELD_PHYSICAL_CATALOG),
            new TextItem(WorkflowMaterialDataSource.FIELD_PHYSICAL_BARCODE),
            new TextItem(WorkflowMaterialDataSource.FIELD_PHYSICAL_FIELD001),
            new TextItem(WorkflowMaterialDataSource.FIELD_PHYSICAL_SIGLA),
            new TextItem(WorkflowMaterialDataSource.FIELD_PHYSICAL_SIGNATURE),
            new TextItem(WorkflowMaterialDataSource.FIELD_PHYSICAL_DETAIL),
            new TextItem(WorkflowMaterialDataSource.FIELD_PHYSICAL_ISSUE),
            new TextItem(WorkflowMaterialDataSource.FIELD_PHYSICAL_VOLUME),
            new TextItem(WorkflowMaterialDataSource.FIELD_PHYSICAL_YEAR),
            new TextItem(WorkflowMaterialDataSource.FIELD_PHYSICAL_RDCZID),
            createNoteItem(),
            xml,
            createSaveItem());
    return form;
}
 
Example #10
Source File: FormGenerator.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
@Override
        public Object parseValue(String value, DynamicForm form, FormItem item) {
//            ClientUtils.severe(LOG, "parse: value: %s", value);
            Object result = null;
            if (value != null && !value.isEmpty()) {
                try {
                    Date date = displayFormat.parse(value);
                    result = ISO_FORMAT.format(date);
                } catch (IllegalArgumentException ex) {
                    String toString = String.valueOf(value);
                    LOG.log(Level.WARNING, toString, ex);
                    result = null;
                }
            }
            return result;
        }
 
Example #11
Source File: FormGenerator.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private RepeatableFormItem createNestedCustomFormItem(final Field f, final String lang) {
    RepeatableFormItem rfi = new RepeatableFormItem(f, new FormWidgetFactory() {

        @Override
        public DynamicForm create() {
            throw new UnsupportedOperationException();
        }

        @Override
        public FormWidget createFormWidget(Field formField) {
            DynamicForm df = createNestedForm(f, lang);
            ValuesManager vm = new ValuesManager();
            vm.addMember(df);
            return customizeNestedForm(new FormWidget(df, vm), f);
        }
    });
    oneRow(rfi);
    return rfi;
}
 
Example #12
Source File: OldPrintForms.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
public DynamicForm getForm(MetaModelRecord model) {
    String modelId = model.getId();
    Form f;
    if ("model:oldprintvolume".equals(modelId)) {
        f = new OldPrintVolumeForm().build();
        f.setItemWidth("800");
    } else if ("model:oldprintsupplement".equals(modelId)) {
        f = new OldPrintSupplementForm().build();
    } else if ("model:oldprintpage".equals(modelId)) {
        //return new PageForm(i18n, BundleName.MODS_OLDPRINT_PAGE_TYPES);
        return new PageForm(i18n);
    } else if ("model:oldprintmonographtitle".equals(modelId)) {
        f = new OldPrintMonographTitleForm().build();
    } else if ("model:oldprintchapter".equals(modelId)) {
        f = new OldPrintChapterForms().build();
    } else {
        return null;
    }
    return new NdkFormGenerator(f, activeLocale).generateForm();
}
 
Example #13
Source File: DigitalObjectChildrenEditor.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private DynamicForm createParamsForm() {
    ClientMessages i18n = GWT.create(ClientMessages.class);
    DynamicForm f = new DynamicForm();
    f.setAutoHeight();

    TextItem newPid = new TextItem(DigitalObjectDataSource.FIELD_PID);

    newPid.setTitle(i18n.NewDigObject_OptionPid_Title());
    newPid.setTooltip(i18n.NewDigObject_OptionPid_Hint());
    newPid.setRequired(true);
    newPid.setLength(36 + 5);
    newPid.setWidth((36 + 5) * 8);
    newPid.setValidators(new CustomUUIDValidator(i18n));
    f.setFields(newPid);
    f.setAutoFocus(true);
    return f;
}
 
Example #14
Source File: AttributeSetPropertiesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
protected void addMetadata() {
	form1 = new DynamicForm();
	form1.setNumCols(1);
	form1.setValuesManager(vm);
	form1.setTitleOrientation(TitleOrientation.LEFT);

	StaticTextItem id = ItemFactory.newStaticTextItem("id", "id", Long.toString(attributeSet.getId()));
	id.setDisabled(true);

	TextItem name = ItemFactory.newSimpleTextItem("name", I18N.message("name"), attributeSet.getName());
	name.setRequired(true);
	name.setDisabled(attributeSet.isReadonly());
	if (!attributeSet.isReadonly())
		name.addChangedHandler(changedHandler);

	TextAreaItem description = ItemFactory.newTextAreaItem("description", "description",
			attributeSet.getDescription());
	description.setDisabled(attributeSet.isReadonly());

	if (!attributeSet.isReadonly())
		description.addChangedHandler(changedHandler);

	form1.setItems(id, name, description);

	form1.setWidth(200);
}
 
Example #15
Source File: AutomationDialog.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private Tab prepareScriptTab() {
	scriptForm = new DynamicForm();
	scriptForm.setWidth100();
	scriptForm.setHeight100();
	scriptForm.setTitleOrientation(TitleOrientation.TOP);
	scriptForm.setNumCols(1);

	final TextAreaItem automation = ItemFactory.newTextAreaItemForAutomation("automation", "automation", null, null,
			false);
	automation.setShowTitle(false);
	automation.setStartRow(false);
	automation.setRequired(true);
	automation.setWidth("*");
	automation.setHeight("*");
	scriptForm.setItems(automation);

	Tab tab = new Tab(I18N.message("script"));
	tab.setPane(scriptForm);
	return tab;
}
 
Example #16
Source File: UsersView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm getNewProfileEditor() {
    if (newEditor == null) {
        newEditor = getProfileEditor(null);
    }
    newEditor.clearErrors(true);
    newEditor.editNewRecord();
    return newEditor;
}
 
Example #17
Source File: IdentifierDataSource.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected boolean condition(Object value) {
    boolean valid = true;
    if (value instanceof String) {
        String svalue = (String) value;
        svalue = svalue.trim();
        setResultingValue(svalue);
        FormItem fi = getFormItem();
        DynamicForm form = fi.getForm();
        String type = form.getValueAsString(FIELD_TYPE);
        if (TYPE_UUID.equals(type)) {
            if (!RE_UUID.test(svalue)) {
                valid = false;
                setErrorMessage(i18n.Validation_Invalid_UUID_Msg());
            }
        } else if (TYPE_ISSN.equals(type)) {
            if (!RE_ISSN.test(svalue)) {
                valid = false;
                setErrorMessage(i18n.Validation_Invalid_ISSN_Msg());
            }
        } else if (TYPE_ISBN.equals(type)) {
            if (!RE_ISBN.test(svalue)) {
                valid = false;
                setErrorMessage(i18n.Validation_Invalid_ISBN_Msg());
            }
        } else if (TYPE_CCNB.equals(type)) {
            if (!RE_CCNB.test(svalue)) {
                valid = false;
                setErrorMessage(i18n.Validation_Invalid_CCNB_Msg());
            }
        } else if (svalue.isEmpty()) {
            valid = false;
            setErrorMessage(i18nSmartGwt.validator_requiredField());
        }
    } else {
        valid = false;
        setErrorMessage(i18nSmartGwt.validator_requiredField());
    }
    return valid;
}
 
Example #18
Source File: WorkflowTaskFormView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createDefaultParameterForm() {
        DynamicForm df = new DynamicForm();
//            StaticTextItem msg = new StaticTextItem();
//            msg.setShowTitle(false);
//            msg.setValue("No parameter!");
//            df.setItems(msg);
        return df;
    }
 
Example #19
Source File: NdkFormGenerator.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public RepeatableFormItem createNestedFormItem(final Field f, final String lang) {
    if (f.getMember(HIDDEN_FIELDS_NAME) == null) {
        f.getFields().add(new FieldBuilder(HIDDEN_FIELDS_NAME)
                .setTitle("Hodnoty mimo NDK - " + f.getName())
                .setMaxOccurrences(1).setType(Field.TEXT)
                .setReadOnly(true)
                .setHidden(true)
                .createField());
    }
    RepeatableFormItem rfi = new RepeatableFormItem(f, new FormWidgetFactory() {

        @Override
        public DynamicForm create() {
            throw new UnsupportedOperationException();
        }

        @Override
        public FormWidget createFormWidget(Field formField) {
            DynamicForm df = createNestedForm(f, lang);
            ValuesManager vm = new ValuesManager();
            vm.addMember(df);
            return customizeNestedForm(new FormWidget(df, vm), f);
        }
    });
    rfi.setPrompt(f.getHint(lang));
    oneRow(rfi);
    return rfi;
}
 
Example #20
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 #21
Source File: DigitalObjectDataSource.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public static DynamicForm createDeleteOptionsForm() {
    if (!Editor.getInstance().hasPermission("proarc.permission.admin")) {
        return null;
    }
    ClientMessages i18n = GWT.create(ClientMessages.class);
    DynamicForm f = new DynamicForm();
    BooleanItem opPermanently = new BooleanItem(DigitalObjectResourceApi.DELETE_PURGE_PARAM,
            i18n.DigitalObjectDeleteAction_OptionPermanently_Title());
    opPermanently.setTooltip(i18n.DigitalObjectDeleteAction_OptionPermanently_Hint());
    f.setFields(opPermanently);
    f.setAutoHeight();
    return f;
}
 
Example #22
Source File: PatchPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void displayNotes(String fileName) {
	UpdateService.Instance.get().getPatchNotes(fileName, new AsyncCallback<String[]>() {

		@Override
		public void onFailure(Throwable caught) {
			Log.serverError(caught);
		}

		@Override
		public void onSuccess(String[] infos) {
			DynamicForm form = new DynamicForm();
			form.setTitleOrientation(TitleOrientation.TOP);
			form.setColWidths("*");
			form.setNumCols(1);

			TextAreaItem changelog = ItemFactory.newTextAreaItem("changelog", "changelog", infos[0]);
			changelog.setWidth("100%");
			changelog.setHeight(220);

			TextAreaItem patchNotes = ItemFactory.newTextAreaItem("patchnotes", "patchnotes", infos[1]);
			patchNotes.setWidth("100%");
			patchNotes.setHeight(220);

			form.setItems(patchNotes, changelog);

			notesPanel.addMember(form);
		}
	});
}
 
Example #23
Source File: ComparatorAssociationsDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ComparatorAssociationsDialog(final ListGrid srcGrid) {
	this.srcGrid = srcGrid;

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("associations"));
	setWidth(320);
	setHeight(360);

	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();

	comparator = ItemFactory.newComparatorSelector();
	comparator.setWidth(290);
	comparator.setRequired(true);
	comparator.setValue(DEFAULT_COMPARATOR);
	comparator.addChangedHandler(new ChangedHandler() {

		@Override
		public void onChanged(ChangedEvent event) {
			refresh();
		}
	});

	DynamicForm form = new DynamicForm();
	form.setTitleOrientation(TitleOrientation.TOP);
	form.setNumCols(1);
	form.setItems(comparator);

	addItem(form);

	refresh();
}
 
Example #24
Source File: WorkflowMaterialView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createDigitalDocumentForm() {
    DynamicForm form = createExpansionForm();
    TextItem pid = new TextItem(WorkflowMaterialDataSource.FIELD_DIGITAL_PID);
    pid.setWidth("*");
    form.setDataSource(WorkflowMaterialDataSource.getInstance(),
            pid, createNoteItem(), createSaveItem());
    return form;
}
 
Example #25
Source File: NdkForms.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public DynamicForm getForm(MetaModelRecord model) {
    String modelId = model.getId();
    if (NdkPlugin.MODEL_PAGE.equals(modelId)) {
        return new PageForm(i18n);
    } else if ("model:ndkaudiopage".equals(modelId)) {
        return new NdkAudioPageForm(i18n, BundleName.MODS_AUDIO_PAGE_TYPES);
    //} else if (NdkPlugin.MODEL_NDK_PAGE.equals(modelId)) {
    //    return new NdkPageForm(i18n);
    }

    return mappers.get(modelId) == null ? null : new NdkFormGenerator(mappers.get(modelId).get(), activeLocale).generateForm();
}
 
Example #26
Source File: WorkflowMaterialView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm bindExpansinonForm(final DynamicForm form, final Record record) {
    form.addDrawHandler(new DrawHandler() {

        @Override
        public void onDraw(DrawEvent event) {
            form.editRecord(record);
        }
    });
    return form;
}
 
Example #27
Source File: RepeatableForm.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public boolean validate(boolean showError) {
    boolean valid = true;
    for (Row row : activeRows) {
        ValuesManager vm = row.getForm();
        for (DynamicForm df : vm.getMembers()) {
            valid &= showError ? df.validate() : df.valuesAreValid(false);
        }
    }
    return valid;
}
 
Example #28
Source File: ZohoCheckin.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ZohoCheckin(final GUIDocument document, final ZohoEditor parentDialog) {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("checkin"));
	setWidth(400);
	setHeight(140);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setMembersMargin(2);

	DynamicForm form = new DynamicForm();
	vm = new ValuesManager();
	form.setValuesManager(vm);

	BooleanItem versionItem = new BooleanItem();
	versionItem.setName("majorversion");
	versionItem.setTitle(I18N.message("majorversion"));

	TextItem commentItem = ItemFactory.newTextItem("comment", "comment", null);
	commentItem.setRequired(true);
	commentItem.setWidth(240);

	checkin = new SubmitItem();
	checkin.setTitle(I18N.message("checkin"));
	checkin.setAlign(Alignment.RIGHT);
	checkin.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onCheckin(document, parentDialog);
		}
	});

	form.setItems(versionItem, commentItem, checkin);

	addItem(form);
}
 
Example #29
Source File: TextContentCreate.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public TextContentCreate() {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("createtextcontent"));
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	setAutoSize(true);
	centerInPage();

	DynamicForm form = new DynamicForm();
	vm = new ValuesManager();
	form.setValuesManager(vm);
	form.setTitleOrientation(TitleOrientation.TOP);
	form.setNumCols(1);

	TextItem filename = ItemFactory.newTextItem("filename", "filename", null);
	filename.setRequired(true);
	filename.setWidth(200);

	SelectItem template = ItemFactory.newTemplateSelector(true, null);

	create = new SubmitItem();
	create.setTitle(I18N.message("create"));
	create.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onCreate();
		}
	});

	form.setItems(filename, template, create);

	addItem(form);
}
 
Example #30
Source File: DownloadTicketDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void prepareForm() {
	form = new DynamicForm();
	form.setAlign(Alignment.LEFT);
	form.setNumCols(4);

	SelectItem type = ItemFactory.newAliasTypeSelector();
	type.setName("type");
	type.setValue("");
	type.setEndRow(true);
	type.setColSpan(4);
	type.setWrapTitle(false);

	DateItem date = ItemFactory.newDateItem("date", I18N.message("expireson"));
	date.setEndRow(true);
	date.setColSpan(4);
	date.setWrapTitle(false);

	SpinnerItem maxDownloads = ItemFactory.newSpinnerItem("maxDownloads", I18N.message("maxdownloads"),
			(Integer) null);
	maxDownloads.setEndRow(true);
	maxDownloads.setColSpan(4);
	maxDownloads.setWrapTitle(false);
	maxDownloads.setRequired(false);
	maxDownloads.setMin(0);

	SpinnerItem duedateTimeItem = ItemFactory.newSpinnerItem("duedateNumber", I18N.message("expiresin"), 24);
	duedateTimeItem.setWrapTitle(false);
	duedateTimeItem.setDefaultValue(24);
	duedateTimeItem.setMin(0);
	SelectItem duedateTime = ItemFactory.newDueTimeSelector("duedateTime", "");
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("hour", I18N.message("hours"));
	map.put("day", I18N.message("ddays"));
	duedateTime.setValueMap(map);
	duedateTime.setValue("hour");

	form.setItems(type, duedateTimeItem, duedateTime, date, maxDownloads);
}