Java Code Examples for com.smartgwt.client.widgets.form.fields.StaticTextItem#setWidth()

The following examples show how to use com.smartgwt.client.widgets.form.fields.StaticTextItem#setWidth() . 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: 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 2
Source File: OverUndershootRuleTemplate.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createExitConditionEditCanvas() {
    StaticTextItem labelItem = createLabelItem(i18n.exitCondition());

    OverUndershootSelectionData data = controller.getOverUndershootExitConditions();
    exitOperatorItem = createOperatorItem(data, LESS_THAN_OR_EQUAL_TO_INT);
    exitOperatorItem.addChangedHandler(createExitOperatorChangedHandler());
    exitOperatorItem.setWidth(EDIT_ITEMS_WIDTH);

    exitValueItem = createValueItem();
    exitValueItem.addChangedHandler(createExitValueChangedHandler());
    exitValueItem.setWidth(EDIT_ITEMS_WIDTH);
    declareAsRequired(exitValueItem);

    StaticTextItem exitUnitItem = createStaticUnitItem(data);
    exitUnitItem.setWidth(EDIT_ITEMS_WIDTH);
    
    FormItem[] items = new FormItem[] { labelItem, exitOperatorItem, exitValueItem, exitUnitItem };
    exitConditionForm = assembleEditConditionForm(items);
    return alignVerticalCenter(exitConditionForm);
}
 
Example 3
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 4
Source File: SystemMenu.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void addInformations() {
	DynamicForm form1 = new DynamicForm();
	form1.setWidth(300);
	form1.setColWidths(1, "*");

	StaticTextItem productName = ItemFactory.newStaticTextItem("productName", "",
			"<b>" + Session.get().getInfo().getBranding().getProductName() + "</b>");
	productName.setShouldSaveValue(false);
	productName.setShowTitle(false);
	productName.setWrapTitle(false);
	productName.setWrap(false);
	productName.setEndRow(true);

	StaticTextItem version = ItemFactory.newStaticTextItem("version", "",
			I18N.message("version") + " " + Session.get().getInfo().getRelease());
	version.setShouldSaveValue(false);
	version.setShowTitle(false);
	version.setWrap(false);
	version.setEndRow(true);

	StaticTextItem vendor = ItemFactory.newStaticTextItem("vendor", "",
			"&copy; " + Session.get().getInfo().getBranding().getVendor());
	vendor.setShouldSaveValue(false);
	vendor.setShowTitle(false);
	vendor.setEndRow(true);

	String userno = Session.get().getInfo().getUserNo();
	String installationId = Session.get().getInfo().getInstallationId();

	DynamicForm form2 = new DynamicForm();
	form2.setAlign(Alignment.LEFT);
	form2.setTitleOrientation(TitleOrientation.TOP);
	form2.setColWidths(1);
	form2.setWrapItemTitles(false);
	form2.setNumCols(1);

	LinkItem support = new LinkItem();
	support.setName(I18N.message("support"));
	support.setLinkTitle(Session.get().getInfo().getBranding().getSupport());

	String mailTo = "mailto:" + Session.get().getInfo().getBranding().getSupport() + "?subject="
			+ Session.get().getInfo().getBranding().getProductName() + " Support - ";
	if (userno != null)
		mailTo += "UserNo(" + userno + ")";
	else
		mailTo += "ID(" + Session.get().getInfo().getInstallationId() + ")";
	support.setValue(mailTo);
	support.setRequired(true);
	support.setShouldSaveValue(false);

	StaticTextItem installationID = ItemFactory.newStaticTextItem("installid", "installid", installationId);
	installationID.setWidth(250);
	installationID.setRequired(true);
	installationID.setShouldSaveValue(false);
	installationID.setWrap(true);
	installationID.setWrapTitle(false);

	StaticTextItem usernoItem = ItemFactory.newStaticTextItem("userno", "userno", userno);
	usernoItem.setWidth(250);
	usernoItem.setRequired(true);
	usernoItem.setShouldSaveValue(false);
	usernoItem.setWrap(true);
	usernoItem.setWrapTitle(false);

	StaticTextItem hostName = ItemFactory.newStaticTextItem("hostname", "hostname",
			Session.get().getInfo().getHostName());
	hostName.setWidth(250);
	hostName.setRequired(true);
	hostName.setShouldSaveValue(false);
	hostName.setWrap(true);
	hostName.setWrapTitle(false);
	hostName.setVisible(!Session.get().isDemo());

	form1.setItems(productName, version, vendor);

	if (userno != null)
		form2.setItems(support, usernoItem, installationID, hostName);
	else
		form2.setItems(support, installationID, hostName);

	if (!Session.get().isDemo()) {
		addMember(form1);
		addMember(form2);
	}
}
 
Example 5
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;
}
 
Example 6
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));
}