Java Code Examples for com.smartgwt.client.widgets.form.fields.TextItem#addChangedHandler()

The following examples show how to use com.smartgwt.client.widgets.form.fields.TextItem#addChangedHandler() . 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: 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 2
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 3
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 4
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 5
Source File: AutomationRoutineProperties.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void refresh() {
	vm.clearValues();
	vm.clearErrors(false);

	if (formsContainer.getMembers() != null)
		formsContainer.removeMembers(formsContainer.getMembers());

	DynamicForm form2 = new DynamicForm();
	form2.setWidth100();
	form2.setTitleOrientation(TitleOrientation.TOP);
	form2.setValuesManager(vm);
	form2.setNumCols(1);

	final TextAreaItem automation = ItemFactory.newTextAreaItemForAutomation("automation", "automation",
			routine.getAutomation(), changedHandler, false);
	automation.setStartRow(false);
	automation.setRequired(true);
	automation.setWidth("*");

	form2.setItems(automation);

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

	TextItem name = ItemFactory.newSimpleTextItem("name", I18N.message("name"), routine.getName());
	name.addChangedHandler(changedHandler);
	name.setDisabled(routine.getId() != 0L);

	TextItem description = ItemFactory.newTextItem("description", I18N.message("description"),
			routine.getDescription());
	description.addChangedHandler(changedHandler);
	description.setWidth(200);

	form1.setItems(name, description);

	formsContainer.setMembers(form1, form2);
}
 
Example 6
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 7
Source File: TemplatePropertiesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected void prepareTemplateForm() {
	templateForm = new DynamicForm();
	templateForm.setNumCols(1);
	templateForm.setValuesManager(vm);
	templateForm.setTitleOrientation(TitleOrientation.LEFT);

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

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

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

	PickerIcon computeStat = new PickerIcon(PickerIconName.REFRESH, new FormItemClickHandler() {
		public void onFormItemClick(final FormItemIconClickEvent event) {
			event.getItem().setValue(I18N.message("computing") + "...");
			TemplateService.Instance.get().countDocuments(template.getId(), new AsyncCallback<Long>() {

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

				@Override
				public void onSuccess(Long count) {
					event.getItem().setValue(Util.formatLong(count));
				}
			});
		}
	});
	computeStat.setPrompt(I18N.message("calculatestats"));

	StaticTextItem docs = ItemFactory.newStaticTextItem("docs", "documents", "-");
	docs.setIconHSpace(2);
	docs.setIconWidth(16);
	docs.setIconHeight(16);
	docs.setIcons(computeStat);
	docs.setWidth("1%");

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

	templateForm.setItems(id, name, description, docs);

	container.addMember(templateForm);
}
 
Example 8
Source File: RetentionPolicyDetailsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void refresh() {

		/*
		 * Prepare the standard properties tab
		 */
		if (tabSet != null) {
			tabSet.hideSave();
			removeMember(tabSet);
		}

		tabSet = new EditingTabSet(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				onSave();
			}
		}, new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				if (policy.getId() != 0) {
					RetentionPoliciesService.Instance.get().getPolicy(policy.getId(),
							new AsyncCallback<GUIRetentionPolicy>() {
								@Override
								public void onFailure(Throwable caught) {
									Log.serverError(caught);
								}

								@Override
								public void onSuccess(GUIRetentionPolicy policy) {
									setPolicy(policy);
								}
							});
				} else {
					GUIRetentionPolicy newsPolicy = new GUIRetentionPolicy();
					setPolicy(newsPolicy);
				}
				tabSet.hideSave();
			}
		});

		Tab propertiesTab = new Tab(I18N.message("properties"));
		propertiesTabPanel = new HLayout();
		propertiesTabPanel.setWidth100();
		propertiesTabPanel.setHeight100();
		propertiesTab.setPane(propertiesTabPanel);
		tabSet.addTab(propertiesTab);

		addMember(tabSet);

		ChangedHandler changedHandler = new ChangedHandler() {
			@Override
			public void onChanged(ChangedEvent event) {
				onModified();
			}
		};

		form = new DynamicForm();
		form.setNumCols(2);
		form.setTitleOrientation(TitleOrientation.TOP);

		TextItem name = ItemFactory.newSimpleTextItem("name", "name", policy.getName());
		name.addChangedHandler(changedHandler);
		name.setWidth(200);
		name.setRequired(true);

		IntegerItem days = ItemFactory.newIntegerItem("days", "retentiondays", policy.getRetentionDays());
		days.addChangedHandler(changedHandler);
		days.setWidth(100);
		days.setRequired(true);

		SelectItem dateOption = ItemFactory.newRetentionDateOption(policy.getDateOption());
		dateOption.addChangedHandler(changedHandler);

		SelectItem template = ItemFactory.newTemplateSelector(true, policy.getTemplateId());
		template.addChangedHandler(changedHandler);

		folder = new FolderSelector(null, true);
		folder.setFolder(policy.getFolderId(), policy.getFolderName());
		folder.addFolderChangeListener(RetentionPolicyDetailsPanel.this);

		SelectItem action = ItemFactory.newRetentionAction(policy.getAction());
		action.addChangedHandler(changedHandler);

		form.setItems(name, days, dateOption, template, action, folder);

		propertiesTab.setPane(form);
	}
 
Example 9
Source File: PageMetadataEditor.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
private void createPageNumberUi() {
    formPageNumber = createForm();

    allowPageNumbers = new CheckboxItem("fillPageNumbers", i18n.PageMetadataEditor_CheckboxPageNubers_Title());
    allowPageNumbers.setStartRow(true);
    allowPageNumbers.setColSpan("*");
    allowPageNumbers.setShowTitle(false);

    PageNumberChangeHandler pageNumberChangeHandler = new PageNumberChangeHandler();

    integerStartValidator = new IntegerRangeValidator();
    integerStartValidator.setMin(0);
    integerStartValidator.setMax(1000000);
    romanStartValidator = new RegExpValidator(
            "^[1-9][0-9]{0,6}$"
            + "|^[mM]{0,6}([cC][mM]|[cC][dD]|[dD]?[cC]{0,3})([xX][cC]|[xX][lL]|[lL]?[xX]{0,3})([iI][xX]|[iI][vV]|[vV]?[iI]{0,3})$");
    alphabetStartValidator = new RegExpValidator("^[a-zA-Z]{0,6}$");
    numberStartRequired = new RequiredIfValidator(new RequiredIfFunction() {

        @Override
        public boolean execute(FormItem formItem, Object value) {
            return true;
        }
    });
    numberStart = new TextItem("numberStart", i18n.PageMetadataEditor_NumberStartValue_Title());
    numberStart.addChangedHandler(pageNumberChangeHandler);

    prefix = new TextItem("prefix", i18n.PageMetadataEditor_NumberPrefix_Title());
    prefix.setLength(20);
    prefix.addChangedHandler(pageNumberChangeHandler);

    suffix = new TextItem("suffix", i18n.PageMetadataEditor_NumberSuffix_Title());
    suffix.setLength(20);
    suffix.addChangedHandler(pageNumberChangeHandler);

    integerIncrementValidator = new IntegerRangeValidator();
    integerIncrementValidator.setMin(-1000);
    integerIncrementValidator.setMax(1000);
    numberIncrement = new IntegerItem("numberIncrement", i18n.PageMetadataEditor_NumberIncrement_Title());
    numberIncrement.addChangedHandler(pageNumberChangeHandler);
    numberIncrement.setRequired(true);
    numberIncrement.setValidators(integerIncrementValidator);

    numberExample = new StaticTextItem("numberExample", i18n.PageMetadataEditor_NumberPreview_Title());
    numberExample.setClipValue(true);
    numberExample.setWidth(120); // enforce clip value

    seriesType = new SelectItem("seriesType", i18n.PageMetadataEditor_NumberSeriesType_Title());
    seriesType.setValueMap(ARABIC_SERIES, ROMAN_UPPER_SERIES,
            ROMAN_LOWER_SERIES, ALPHABET_UPPER_SERIES, ALPHABET_LOWER_SERIES);
    seriesType.setDefaultValue(ARABIC_SERIES);
    seriesType.setValue(ARABIC_SERIES);
    seriesType.addChangedHandler(new ChangedHandler() {

        @Override
        public void onChanged(ChangedEvent event) {
            setSequenceType(seriesType.getValueAsString());
        }
    });

    allowPageNumbers.addChangedHandler(new DisableStateHandler(
            prefix, numberStart, numberIncrement, suffix, seriesType, numberExample));
}