com.smartgwt.client.widgets.form.fields.TextItem Java Examples

The following examples show how to use com.smartgwt.client.widgets.form.fields.TextItem. 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: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static TextItem newEmailItem(String name, String title, boolean multiple) {
	TextItem item = new TextItem();
	item.setName(filterItemName(name));
	if (title != null)
		item.setTitle(I18N.message(title));
	else
		item.setShowTitle(false);
	if (multiple)
		item.setValidators(new EmailsValidator());
	else
		item.setValidators(new EmailValidator());
	item.setWrapTitle(false);
	item.setWidth(200);

	return item;
}
 
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: PrinterPublisherFormFactory.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
@Override
public DynamicForm create() {
    DynamicForm form = new DynamicForm();
    form.setNumCols(6);
    TextItem place = new TextItem(ModsCustomDataSource.FIELD_PRINTER_PUBLISHER_PLACE,
            i18n.PeriodicalForm_PrinterPublisherPlace_Title());
    place.setPrompt(i18n.PeriodicalForm_PrinterPublisherPlace_Hint());
    place.setValidators(new StringTrimValidator());
    TextItem name = new TextItem(ModsCustomDataSource.FIELD_PRINTER_PUBLISHER_NAME,
            i18n.PeriodicalForm_PrinterPublisherName_Title());
    name.setPrompt(publisher
            ? i18n.PeriodicalForm_PublisherName_Hint()
            : i18n.PeriodicalForm_PrinterName_Hint());
    name.setValidators(new StringTrimValidator());
    TextItem date = new TextItem(ModsCustomDataSource.FIELD_PRINTER_PUBLISHER_DATE,
            i18n.PeriodicalForm_PrinterPublisherDate_Title());
    date.setValidators(new StringTrimValidator());
    form.setFields(name, place, date);
    return form;
}
 
Example #4
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 #5
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 #6
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 #7
Source File: StringFormFactory.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
@Override
public DynamicForm create() {
    DynamicForm form = new DynamicForm();
    TextItem value = new TextItem(name, title);
    value.setShowTitle(showTitle);
    if (width == Integer.MAX_VALUE) {
        value.setWidth("100%");
        form.setWidth100();
    } else if (width > 0) {
        value.setWidth(width);
    }
    value.setRequired(required);
    value.setValidators(new StringTrimValidator());
    form.setFields(value);
    return form;
}
 
Example #8
Source File: OverUndershootRuleTemplate.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createEntryConditionEditCanvas() {
    StaticTextItem labelItem = createLabelItem(i18n.enterCondition());
    
    OverUndershootSelectionData data = controller.getOverUndershootEntryConditions();
    SelectItem entryOperatorItem = createOperatorItem(data, GREATER_THAN_INT);
    entryOperatorItem.addChangedHandler(createEntryOperatorChangedHandler());
    entryOperatorItem.setWidth(EDIT_ITEMS_WIDTH);

    TextItem entryValueItem = createValueItem();
    entryValueItem.addChangedHandler(createEntryValueChangedHandler());
    entryValueItem.setWidth(EDIT_ITEMS_WIDTH);
    declareAsRequired(entryValueItem);
    
    StaticTextItem entryUnitItem = createStaticUnitItem(data);
    entryUnitItem.setWidth(EDIT_ITEMS_WIDTH);
    
    FormItem[] items = new FormItem[] { labelItem, entryOperatorItem, entryValueItem, entryUnitItem };
    entryConditionForm = assembleEditConditionForm(items);
    return alignVerticalCenter(entryConditionForm);
}
 
Example #9
Source File: CreateSimpleRuleLayout.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private void setEntryOperatorRuleItem() {
    this.entryOperatorItem = new SelectItem();
    this.entryOperatorItem.setWidth(this.entryItemWidth);
    this.entryOperatorItem.setTitle(i18n.operator());
    this.entryOperatorItem.setTitleOrientation(TitleOrientation.TOP);
    this.entryOperatorItem.setValueMap(getMathSymbols());
    this.entryOperatorItem.setDefaultValue(">");
    this.entryOperatorItem.setTextAlign(Alignment.CENTER);
    this.entryOperatorItem.addChangedHandler(new ChangedHandler() {
        public void onChanged(ChangedEvent event) {
            if (exitOperatorItem != null) {
                TextItem exitOperatorTextItem = (TextItem) event.getSource();
                exitOperatorItem.setValue(getInverse(exitOperatorTextItem.getValueAsString()));
            }
        }
    });
}
 
Example #10
Source File: SensorLossRuleTemplate.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createEditConditionCanvas() {
        StaticTextItem label = createLabelItem(i18n.sensorFailure());

        SelectItem unitItem = createUnitsItem();
        unitItem.addChangedHandler(createEntryUnitChangedHandler());
        unitItem.setValueMap(createTimeunitsMap());
        unitItem.setWidth(2 * EDIT_ITEMS_WIDTH);
        
        TextItem valueItem = createValueItem();
        valueItem.addChangedHandler(createValueChangedHandler());
        valueItem.setWidth(EDIT_ITEMS_WIDTH);
        valueItem.setRequired(true);
//        valueItem.setKeyPressFilter("[0-9]+(\\.|,)[0-9]+");
        
        FormItem[] formItems = new FormItem[] { label, unitItem, valueItem };
        conditionForm = assembleEditConditionForm(formItems);
        return alignVerticalCenter(conditionForm);
    }
 
Example #11
Source File: RegisterLayout.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private void createEmailTextInputs() {
    this.emailItem = new TextItem();
    this.emailItem.setName("email");
    this.emailItem.setLength(250);

    this.verifyEmailItem = new TextItem();
    this.verifyEmailItem.setName("verifyEmail");
    this.verifyEmailItem.setTitle(i18n.emailAgain());
    this.verifyEmailItem.setRequired(true);
    this.verifyEmailItem.setLength(250);

    MatchesFieldValidator matchesValidatorEmail = new MatchesFieldValidator();
    matchesValidatorEmail.setOtherField("email");
    matchesValidatorEmail.setErrorMessage(i18n.emailDoNotMatch());
    this.verifyEmailItem.setValidators(matchesValidatorEmail);
}
 
Example #12
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 #13
Source File: ImportSettingsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public ImportSettingsPanel(GUIArchive archive, ChangedHandler changedHandler) {
	this.archive = archive;

	form.setValuesManager(vm);
	form.setTitleOrientation(TitleOrientation.TOP);

	TextItem description = ItemFactory.newTextItem("description", "description", archive.getDescription());
	description.addChangedHandler(changedHandler);
	description.setDisabled(archive.getStatus() != GUIArchive.STATUS_OPENED);

	RadioGroupItem importTemplates = ItemFactory.newBooleanSelector("importtemplates", "importtemplates");
	importTemplates.setValue(archive.getImportTemplate() == 1 ? "yes" : "no");
	importTemplates.addChangedHandler(changedHandler);
	importTemplates.setDisabled(archive.getStatus() != GUIArchive.STATUS_OPENED);

	SelectItem options = ItemFactory.newImportCustomIds();
	options.setWidth(200);
	options.setValue(Integer.toString(archive.getImportCustomId()));
	options.addChangedHandler(changedHandler);
	options.setDisabled(archive.getStatus() != GUIArchive.STATUS_OPENED);

	form.setFields(description, importTemplates, options);

	addMember(form);
}
 
Example #14
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 #15
Source File: DigitalObjectSearchView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private static TextItem createAdvancedItem(String name, String title, FormItemIfFunction showIf) {
    TextItem item = new TextItem(name, title);
    if (showIf != null) {
        item.setShowIfCondition(showIf);
    }
    item.setWidth("100%");
    item.setColSpan(3);
    item.setValidators(new LengthRangeValidator() {{ setMax(1000); }});
    return item;
}
 
Example #16
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 #17
Source File: Setup.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Prepares the registration form
 */
private Tab setupRegistration(final ValuesManager vm) {
	Tab registrationTab = new Tab();
	registrationTab.setTitle(I18N.message("registration"));

	TextItem regName = ItemFactory.newTextItem(REG_NAME, "name", null);
	regName.setWrapTitle(false);
	regName.setWidth(300);

	TextItem regOrganization = ItemFactory.newTextItem(REG_ORGANIZATION, "organization", null);
	regOrganization.setWrapTitle(false);
	regOrganization.setWidth(300);

	TextItem regWebsite = ItemFactory.newTextItem(REG_WEBSITE, "website", null);
	regWebsite.setWrapTitle(false);
	regWebsite.setWidth(300);

	TextItem regEmail = ItemFactory.newEmailItem(REG_EMAIL, "email", false);
	regEmail.setWrapTitle(false);
	regEmail.setWidth(300);

	SelectItem languageItem = ItemFactory.newLanguageSelector(LANGUAGE, false, true);
	languageItem.setTitle(I18N.message("language"));
	languageItem.setRequired(true);

	final DynamicForm regForm = new DynamicForm();
	regForm.setID("regForm");
	regForm.setValuesManager(vm);
	regForm.setFields(languageItem, regName, regEmail, regOrganization, regWebsite);

	registrationTab.setPane(regForm);
	return registrationTab;
}
 
Example #18
Source File: OverUndershootRuleTemplate.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private ChangedHandler createEntryValueChangedHandler() {
    return new ChangedHandler() {
        @Override
        public void onChanged(ChangedEvent event) {
            TextItem valueItem = (TextItem) event.getSource();
            String value = valueItem.getValueAsString();
            controller.getOverUndershootEntryConditions().setValue(value);
            
            exitValueItem.setValue(value);
            // setting exit value does not invoke ChangedHandler :(
            controller.getOverUndershootExitConditions().setValue(value);
        }
    };
}
 
Example #19
Source File: OverUndershootRuleTemplate.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private ChangedHandler createExitValueChangedHandler() {
    return new ChangedHandler() {
        @Override
        public void onChanged(ChangedEvent event) {
            TextItem valueItem = (TextItem) event.getSource();
            String value = valueItem.getValueAsString();
            controller.getOverUndershootExitConditions().setValue(value);
        }
    };
}
 
Example #20
Source File: SubscriptionTemplate.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
protected TextItem createValueItem() { 
    TextItem valueItem = new TextItem();
    valueItem.setTitle(i18n.value());
    valueItem.setTitleOrientation(TOP);
    valueItem.setKeyPressFilter("[0-9\\.\\-]");
    return valueItem;
}
 
Example #21
Source File: LoginLayout.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private void initUserLogin() {
    new LoginLayoutEventBroker(this);
    TextItem userNameItem = createUserNameItem();
    PasswordItem passwordItem = createPasswordItem();
    ButtonItem loginButton = createLoginButton();
    LinkItem registerLink = createRegisterLink();
    LinkItem forgotPasswordLink = createForgotPasswordLink();
    form.setFields(headerItem, userNameItem, passwordItem, loginButton, registerLink, forgotPasswordLink);
    addMember(form);
}
 
Example #22
Source File: CreateSimpleRuleLayout.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private void setEntryValueItem() {
    this.entryValueItem = new TextItem();
    this.entryValueItem.setWidth(this.entryItemWidth);
    this.entryValueItem.setTitle(i18n.value());
    this.entryValueItem.setTitleOrientation(TitleOrientation.TOP);
    this.entryValueItem.setKeyPressFilter("[0-9]");
}
 
Example #23
Source File: CreateSimpleRuleLayout.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private void setCountItem() {
    this.countItem = new TextItem();
    this.countItem.setWidth(this.entryItemWidth);
    this.countItem.setTitle(i18n.count());
    this.countItem.setTitleOrientation(TitleOrientation.TOP);
    this.countItem.setKeyPressFilter("[0-9]");
}
 
Example #24
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 #25
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 #26
Source File: DcEditor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private void updateProfile(DynamicForm form, FormItem item, Field profile) {
            if (profile != null) {
                Boolean hidden = profile.getHidden();
                form.setVisible(hidden == null || !hidden);
                String title = profile.getTitle(null);
                if (title != null) {
                    if (title.isEmpty()) {
                        item.setShowTitle(false);
                    }
                    item.setTitle(title);
                }
                String hint = profile.getHint(null);
                if (hint != null) {
                    item.setPrompt(hint);
                }
                item.setRequired(profile.getRequired());
                String width = profile.getWidth();
                if (width != null) {
                    item.setWidth(width);
                }
                Integer length = profile.getLength();
                if (length != null && item instanceof TextItem) {
                    ((TextItem) item).setLength(length);
                }
                LinkedHashMap<String, String> valueMap = profile.getValueMap();
                if (valueMap != null) {
//                    System.out.println("DCE.updateProfile.valueMap: " + valueMap);
                    item.setValueMap(valueMap);
                }
            }
        }
 
Example #27
Source File: LoginWindow.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createForm() {
    DynamicForm f = new DynamicForm();
    f.setWidth(400);
    f.setBrowserSpellCheck(false);
    f.setNumCols(1);
    f.setTitleOrientation(TitleOrientation.TOP);
    f.setSaveOnEnter(true);

    TextItem user = new TextItem(USERNAME, i18nSgwt.dialog_UserNameTitle());
    user.setRequired(true);
    user.setWidth("*");
    user.setReadOnlyDisplay(ReadOnlyDisplayAppearance.STATIC);

    PasswordItem passwd = new PasswordItem(PASSWORD, i18nSgwt.dialog_PasswordTitle());
    passwd.setRequired(true);
    passwd.setWidth("*");

    TextItem producerCode = new TextItem(PRODUCER_CODE, i18n.LoginWindow_ProducerCode());
    producerCode.setWidth("*");
    producerCode.setReadOnlyDisplay(ReadOnlyDisplayAppearance.STATIC);

    StaticTextItem error = new StaticTextItem(ERROR);
    error.setShowTitle(false);
    error.setShowErrorText(true);

    f.setItems(user, producerCode, passwd, error);
    f.addSubmitValuesHandler(new SubmitValuesHandler() {

        @Override
        public void onSubmitValues(SubmitValuesEvent event) {
            submitCredentials();
        }
    });
    return f;
}
 
Example #28
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static TextItem newTextItemForAutomation(String name, String title, String value, ChangedHandler handler) {
	TextItem item = newTextItem(name, title, value);
	appendAutomationEditorIcon(item, handler, false);
	if (handler != null)
		item.addChangedHandler(handler);
	return item;
}
 
Example #29
Source File: FormGenerator.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public TextItem getTextFormItem(Field f, String lang) {
    TextItem item = new TextItem(f.getName(), f.getTitle(activeLocale));
    item.setLength(f.getLength() != null ? f.getLength() : defaultTextLength);
    item.setWidth(defaultWidth);
    item.setReadOnlyDisplay(ReadOnlyDisplayAppearance.STATIC);
    item.setDefaultValue(f.getDefaultValue());
    return item;
}
 
Example #30
Source File: IdentifierDataSource.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public IdentifierDataSource() {
    setID(ID);
    ClientMessages i18n = GWT.create(ClientMessages.class);
    SmartGwtMessages i18nSmartGwt = ClientUtils.createSmartGwtMessages();

    DataSourceField type = new DataSourceField(FIELD_TYPE, FieldType.TEXT,
            i18n.PageForm_IdentifierType_Title());
    type.setRequired(Boolean.TRUE);

    ComboBoxItem typeEditor = new ComboBoxItem(IdentifierDataSource.FIELD_TYPE);
    LocalizationDataSource.setOptionDataSource(typeEditor, BundleName.MODS_IDENTIFIER_TYPES);
    typeEditor.setType("comboBox");
    typeEditor.setCharacterCasing(CharacterCasing.LOWER);
    typeEditor.setBrowserSpellCheck(Boolean.FALSE);
    type.setEditorType(typeEditor);

    DataSourceField value = new DataSourceField(FIELD_VALUE, FieldType.TEXT,
            i18n.PageForm_IdentifierValue_Title());
    value.setRequired(Boolean.TRUE);
    TextItem valueEditor = new TextItem(IdentifierDataSource.FIELD_VALUE);
    valueEditor.setWidth("250");
    valueEditor.setBrowserSpellCheck(Boolean.FALSE);
    valueEditor.setRequired(Boolean.TRUE);
    valueEditor.setValidators(new IdentifierValidator(i18n, i18nSmartGwt));
    value.setEditorType(valueEditor);

    DataSourceField object = new DataSourceField(FIELD_VALUE, FieldType.ANY);
    object.setHidden(true);
    setFields(type, value);
    setClientOnly(true);
    setCacheAllData(true);
}