Java Code Examples for com.smartgwt.client.widgets.form.fields.SelectItem#setAllowEmptyValue()

The following examples show how to use com.smartgwt.client.widgets.form.fields.SelectItem#setAllowEmptyValue() . 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: DigitalObjectAdministrationEditor.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
public BatchEditor(ClientMessages i18n) {
    widget = new VLayout();
    form = new DynamicForm();
    form.setBrowserSpellCheck(false);

    TextItem owner = new TextItem(DigitalObjectAdministrationDataSource.FIELD_OWNER);
    owner.setCanEdit(Boolean.FALSE);

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

    form.setItems(device);
    widget.setMembers(form);
}
 
Example 2
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static SelectItem newDashletSelector(String name, String title) {
	SelectItem select = new SelectItem(filterItemName(name), title);
	select.setAllowEmptyValue(false);
	select.setOptionDataSource(new DashletsDS());
	select.setPickListWidth(200);
	select.setDisplayField("title");
	select.setValueField("name");

	return select;
}
 
Example 3
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 4
Source File: DigitalObjectSearchView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private FormItem createSortItem(String title, FormItemIfFunction showIf) {
    SelectItem item = new SelectItem(DigitalObjectResourceApi.SEARCH_SORT_PARAM, title);
    item.setWidth(300);
    item.setAllowEmptyValue(false);
    LinkedHashMap<String, String> valueMap = new LinkedHashMap();
    valueMap.put("asc", i18n.DigitalObjectSearchView_FilterAsc_Title());
    valueMap.put("desc", i18n.DigitalObjectSearchView_FilterDesc_Title());
    item.setDefaultValue("desc");
    item.setValueMap(valueMap);
    if (showIf != null) {
        item.setShowIfCondition(showIf);
    }
    return item;
}
 
Example 5
Source File: DigitalObjectSearchView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private SelectItem createModelItem(String title, FormItemIfFunction showIf) {
        SelectItem item = new SelectItem(DigitalObjectResourceApi.SEARCH_QUERY_MODEL_PARAM, title);
        item.setWidth(300);
        item.setAllowEmptyValue(true);
        item.setEmptyDisplayValue("<i>" + i18nSmartGwt.filterBuilder_matchAllTitle() + "</i>");
        // see setFilterModel
//        item.setValue("model:periodical");
//        item.setDefaultToFirstOption(true);
        if (showIf != null) {
            item.setShowIfCondition(showIf);
        }
        return item;
    }
 
Example 6
Source File: ImportSourceChooser.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private SelectItem createScannerSelection() {
    final SelectItem selectScanner = new SelectItem(ImportBatchDataSource.FIELD_DEVICE,
            i18n.ImportSourceChooser_OptionScanner_Title());
    DeviceDataSource.setOptionDataSource(selectScanner);
    selectScanner.setAllowEmptyValue(true);
    selectScanner.setEmptyDisplayValue(
            ClientUtils.format("<i>&lt;%s&gt;</i>", i18n.NewDigObject_OptionModel_EmptyValue_Title()));
    selectScanner.setRequired(true);
    selectScanner.setWidth(300);
    selectScanner.addDataArrivedHandler(new DataArrivedHandler() {

        @Override
        public void onDataArrived(DataArrivedEvent event) {
            if (event.getStartRow() == 0) {
                ResultSet data = event.getData();
                int length = data.getLength();
                if (length == 1) {
                    // issue 190: select in case of single device
                    Record device = data.get(0);
                    String deviceId = device.getAttribute(DeviceDataSource.FIELD_ID);
                    selectScanner.setValue(deviceId);
                    selectScanner.setDefaultValue(deviceId);
                }
            }
        }
    });
    return selectScanner;
}
 
Example 7
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 8
Source File: WorkflowNewJobView.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
private SelectItem createProfileSelector() {
    final SelectItem profile = new SelectItem(WorkflowResourceApi.NEWJOB_PROFILE, i18n.WorkflowJob_NewJobView_Field_Profile_Title());
    profile.setOptionDataSource(WorkflowProfileDataSource.getInstance());
    profile.setValueField(WorkflowProfileDataSource.FIELD_ID);
    profile.setDisplayField(WorkflowProfileDataSource.FIELD_LABEL);
    profile.setOptionCriteria(new Criteria(WorkflowProfileDataSource.FIELD_DISABLED, Boolean.FALSE.toString()));
    profile.setFilterLocally(true);
    profile.setRequired(true);
    profile.setWidth(300);
    profile.setAllowEmptyValue(true);
    ListGrid profilePickListProperties = new ListGrid();
    profilePickListProperties.setCanHover(true);
    profilePickListProperties.setShowHover(true);
    profilePickListProperties.setHoverWidth(300);
    profilePickListProperties.setHoverCustomizer(new HoverCustomizer() {

        @Override
        public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
            String hint = record.getAttribute(WorkflowProfileDataSource.FIELD_HINT);
            return hint;
        }
    });
    profile.setPickListProperties(profilePickListProperties);
    profile.addDataArrivedHandler(new DataArrivedHandler() {

        @Override
        public void onDataArrived(DataArrivedEvent event) {
            if (event.getStartRow() == 0) {
                ResultSet data = event.getData();
                int length = data.getLength();
                if (length == 1) {
                    Record r = data.get(0);
                    String profileId = r.getAttribute(WorkflowProfileDataSource.FIELD_ID);
                    profile.setValue(profileId);
                    profile.setDefaultValue(profileId);

                    fetchModelMenu(r); // fill up model menu on init
                }
            }
        }
    });
    return profile;
}
 
Example 9
Source File: NdkFormGenerator.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
@Override
public SelectItem getSelectItem(Field f, String lang) {
    SelectItem item = super.getSelectItem(f, lang);
    item.setAllowEmptyValue(true);
    return item;
}