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

The following examples show how to use com.smartgwt.client.widgets.form.DynamicForm#setDataSource() . 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: 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 2
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 3
Source File: TextEditor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createForm(TextDataSource dataSource) {
    DynamicForm form = new DynamicForm();
    form.setDataSource(dataSource);
    form.setWidth100();
    form.setHeight100();
    TextAreaItem textAreaItem = new TextAreaItem(TextDataSource.FIELD_CONTENT);
    textAreaItem.setColSpan("*");
    textAreaItem.setHeight("*");
    textAreaItem.setWrap(TextAreaWrap.OFF);
    textAreaItem.setShowTitle(false);
    textAreaItem.setWidth("*");
    form.setFields(textAreaItem);
    return form;
}
 
Example 4
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 5
Source File: WorkflowMaterialView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createFolderForm() {
    DynamicForm form = createExpansionForm();
    TextItem path = new TextItem(WorkflowMaterialDataSource.FIELD_FOLDER_PATH);
    path.setWidth("*");
    form.setDataSource(WorkflowMaterialDataSource.getInstance(),
            path, createNoteItem(), createSaveItem());
    return form;
}
 
Example 6
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 7
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 8
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 9
Source File: DigitalObjectAdministrationEditor.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public PlainEditor(ClientMessages i18n) {
    widget = new VLayout();
    form = new DynamicForm();
    form.setDataSource(DigitalObjectAdministrationDataSource.getInstance());
    form.setBrowserSpellCheck(false);

    TextItem pid = new TextItem(DigitalObjectAdministrationDataSource.FIELD_PID,
            i18n.DigitalObjectEditor_AdministrationEditor_Pid_Title());
    pid.setWidth("*");
    pid.setCanEdit(Boolean.FALSE);
    TextItem model = new TextItem(DigitalObjectAdministrationDataSource.FIELD_MODEL,
            i18n.DigitalObjectEditor_AdministrationEditor_Model_Title());
    model.setCanEdit(Boolean.FALSE);
    TextItem owner = new TextItem(DigitalObjectAdministrationDataSource.FIELD_OWNER,
            i18n.DigitalObjectEditor_AdministrationEditor_Owner_Title());
    owner.setCanEdit(Boolean.FALSE);
    TextItem creationDate = new TextItem(DigitalObjectAdministrationDataSource.FIELD_CREATED,
            i18n.DigitalObjectEditor_AdministrationEditor_Created_Title());
    creationDate.setCanEdit(Boolean.FALSE);
    TextItem modificationDate = new TextItem(DigitalObjectAdministrationDataSource.FIELD_MODIFIED,
            i18n.DigitalObjectEditor_AdministrationEditor_Modified_Title());
    modificationDate.setCanEdit(Boolean.FALSE);

    SelectItem device = new SelectItem(DigitalObjectAdministrationDataSource.FIELD_DEVICE,
            i18n.DigitalObjectEditor_AdministrationEditor_Device_Title());
    device.setWidth(250);
    DeviceDataSource.setOptionDataSource(device);
    device.setAllowEmptyValue(true);
    device.setEmptyDisplayValue(ClientUtils.format("<i>&lt;%s&gt;</i>",
            i18n.DigitalObjectEditor_AdministrationEditor_NoDeviceSelection_Title()));

    TextItem filename = new TextItem(DigitalObjectAdministrationDataSource.FIELD_FILENAME,
            i18n.DigitalObjectEditor_AdministrationEditor_File_Title());
    filename.setWidth("*");
    filename.setCanEdit(Boolean.FALSE);

    TextItem export = new TextItem(DigitalObjectAdministrationDataSource.FIELD_EXPORT,
            i18n.DigitalObjectEditor_AdministrationEditor_Export_Title());
    export.setWidth("*");
    export.setCanEdit(Boolean.FALSE);

    TextItem ndkExport = new TextItem(DigitalObjectAdministrationDataSource.FIELD_NDK_EXPORT,
            i18n.DigitalObjectEditor_AdministrationEditor_Ndk_Export_Title());
    ndkExport.setWidth("*");
    ndkExport.setCanEdit(Boolean.FALSE);

    TextItem archiveExport = new TextItem(DigitalObjectAdministrationDataSource.FIELD_ARCHIVE_EXPORT,
            i18n.DigitalObjectEditor_AdministrationEditor_Archive_Export_Title());
    archiveExport.setWidth("*");
    archiveExport.setCanEdit(Boolean.FALSE);

    TextItem krameriusExport = new TextItem(DigitalObjectAdministrationDataSource.FIELD_KRAMERIUS_EXPORT,
            i18n.DigitalObjectEditor_AdministrationEditor_Kramerius_Export_Title());
    krameriusExport.setWidth("*");
    krameriusExport.setCanEdit(Boolean.FALSE);

    TextItem crossrefExport = new TextItem(DigitalObjectAdministrationDataSource.FIELD_CROSSREF_EXPORT,
            i18n.DigitalObjectEditor_AdministrationEditor_Crossref_Export_Title());
    crossrefExport.setWidth("*");
    crossrefExport.setCanEdit(Boolean.FALSE);

    ComboBoxItem organization = new ComboBoxItem(DigitalObjectAdministrationDataSource.FIELD_ORGANIZATION,
            i18n.UsersView_ListHeader_Organization_Title());
    organization.setWidth(250);
    organization.setValueMap(Organization.getMap());

    ComboBoxItem user = new ComboBoxItem(DigitalObjectAdministrationDataSource.FIELD_USER,
            i18n.UsersView_ListHeader_Proccesor_Title());
    user.setWidth(250);
    user.setOptionDataSource(UserDataSource.getInstance());
    user.setValueField(UserDataSource.FIELD_USERNAME);
    user.setDisplayField(UserDataSource.FIELD_USERNAME);

    ComboBoxItem status = new ComboBoxItem(DigitalObjectAdministrationDataSource.FIELD_STATUS,
            i18n.DigitalObjectEditor_AdministrationEditor_Status_Title());
    status.setWidth(250);
    status.setValueMap(DigitalObjectState.getMap(i18n));

    form.setItems(pid, model, owner, creationDate, modificationDate, device, filename, export,  ndkExport, krameriusExport, archiveExport, crossrefExport, organization, user, status);
    widget.setMembers(form);
}
 
Example 10
Source File: WorkflowTaskFormView.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
private Widget createForm() {
    taskForm = new DynamicForm();
    taskForm.setDataSource(WorkflowTaskDataSource.getInstance());
    taskForm.setNumCols(3);
    taskForm.setColWidths("*", "*", "*");
    taskForm.setTitleOrientation(TitleOrientation.TOP);
    taskForm.setItemHoverWidth(300);

    StaticTextItem jobLabel = new StaticTextItem(WorkflowTaskDataSource.FIELD_JOB_LABEL);
    jobLabel.setColSpan("*");
    jobLabel.setWidth("*");
    jobLabel.setShowTitle(false);
    jobLabel.setReadOnlyTextBoxStyle(Editor.CSS_HEADER_INSIDE_FORM);
    jobLabel.setTextBoxStyle(Editor.CSS_HEADER_INSIDE_FORM);

    final SelectItem owner = new SelectItem(WorkflowTaskDataSource.FIELD_OWNER);
    owner.setOptionDataSource(UserDataSource.getInstance());
    owner.setValueField(UserDataSource.FIELD_ID);
    owner.setDisplayField(UserDataSource.FIELD_USERNAME);
    owner.setWidth("*");
   // owner.setValidators(new RequiredIfValidator(requiredFunc));

    TextAreaItem note = new TextAreaItem(WorkflowTaskDataSource.FIELD_NOTE);
    note.setStartRow(true);
    note.setColSpan("*");
    note.setWidth("*");

    // title tooltip is broken in SmartGWT 4.0
    final FormItemIcon taskHelpIcon = new FormItemIcon();
    taskHelpIcon.setSrc("[SKIN]/actions/help.png");
    taskHelpIcon.setTabIndex(-1);
    taskHelpIcon.setNeverDisable(true);
    taskHelpIcon.setShowIfCondition(new FormItemIfFunction() {

        @Override
        public boolean execute(FormItem item, Object value, DynamicForm form) {
            String hint = taskForm.getValueAsString(WorkflowTaskDataSource.FIELD_HINT);
            taskHelpIcon.setPrompt(hint);
            return hint != null;
        }
    });
    TextItem label = new TextItem(WorkflowTaskDataSource.FIELD_LABEL);
    label.setWidth("*");
    label.setIcons(taskHelpIcon);

    stateItem = new SelectItem(WorkflowTaskDataSource.FIELD_STATE);
    stateItem.addChangedHandler(new ChangedHandler() {

        @Override
        public void onChanged(ChangedEvent event) {
            owner.redraw();
            paramForm.markForRedraw();
        }
    });

    taskForm.setFields(jobLabel,
            label,
            owner,
            stateItem,
            new TextItem(WorkflowTaskDataSource.FIELD_CREATED),
            new TextItem(WorkflowTaskDataSource.FIELD_MODIFIED),
            new SelectItem(WorkflowTaskDataSource.FIELD_PRIORITY),
            note);
    return taskForm;
}