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

The following examples show how to use com.smartgwt.client.widgets.form.fields.StaticTextItem. 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: WelcomeLayout.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Instantiates a welcome layout.
 */
public WelcomeLayout() {
    super(i18n.welcomeText());
    this.scClassName = "VLayout";
    
    SpacerItem spacerItem = new SpacerItem();
    spacerItem.setHeight(20);

    this.welcomeText = new StaticTextItem("welcomeText");
    this.welcomeText.setShowTitle(false);
    this.welcomeText.setValue("");
    
    this.roleText = new StaticTextItem("roleText");
    this.roleText.setShowTitle(false);
    this.roleText.setValue("");
    
    this.form.setFields(this.headerItem, spacerItem, spacerItem, this.welcomeText, spacerItem, this.roleText);
    // add to mainLayout
    addMember(this.form);
}
 
Example #2
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 #3
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 #4
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 #5
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 #6
Source File: ZonalOCRTemplateSettings.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void prepareForm() {
	form = new DynamicForm();
	form.setWidth100();
	form.setAlign(Alignment.LEFT);
	form.setColWidths("1px, 100%");
	vm = new ValuesManager();
	form.setValuesManager(vm);

	final StaticTextItem fileNameWaring = ItemFactory.newStaticTextItem("fileNameWarning",
			I18N.message("attention"), I18N.message("filenamewarning"));
	fileNameWaring.setRequired(true);

	TextItem name = ItemFactory.newTextItem("name", "name", ocrPanel.getSelectedOcrTemplate().getName());
	name.setRequired(true);
	name.setDisabled(ocrPanel.getSelectedOcrTemplate().getId() != 0L);

	StaticTextItem id = ItemFactory.newStaticTextItem("id", I18N.message("id"),
			"" + ocrPanel.getSelectedOcrTemplate().getId());
	id.setVisible(ocrPanel.getSelectedOcrTemplate().getId() != 0L);

	SpinnerItem batch = ItemFactory.newSpinnerItem("batch", "batch",
			Session.get().getConfigAsInt("zonalocr.batch"));
	batch.setStep(50);
	batch.setMin(1);

	TextAreaItem description = ItemFactory.newTextAreaItem("description", "description",
			ocrPanel.getSelectedOcrTemplate().getDescription());
	description.setHeight(200);

	if (Session.get().isDefaultTenant())
		form.setItems(id, name, description, batch);
	else
		form.setItems(id, name, description);
}
 
Example #7
Source File: EventSubscriptionWindow.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private Canvas createStationInfo() {
    TimeseriesLegendData timeSeries = controller.getTimeSeries();
    StaticTextItem stationName = createStationNameItem(timeSeries);
    StaticTextItem parameter = createPhenomenonItem(timeSeries);
    HeaderItem header = createHeaderItem();
    DynamicForm form = createStationInfoForm();
    form.setFields(header, stationName, parameter);
    return form;
}
 
Example #8
Source File: OverUndershootRuleTemplate.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private StaticTextItem createStaticUnitItem(OverUndershootSelectionData data) {
    StaticTextItem unitItem = new StaticTextItem();
    unitItem.setTitle(i18n.unit());
    unitItem.setTitleOrientation(TOP);
    TimeseriesLegendData unitOfMeasure = controller.getTimeSeries();
    unitItem.setValue(unitOfMeasure.getUnitOfMeasure());
    data.setUnit(unitOfMeasure.getUnitOfMeasure());
    return unitItem;
}
 
Example #9
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 #10
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new StaticTextItem
 * 
 * @param name The item name (mandatory)
 * @param title The item title (mandatory)
 * @param value The item value (optional)
 * 
 * @return the new item
 */
public static StaticTextItem newStaticTextItem(String name, String title, String value) {
	StaticTextItem item = new StaticTextItem();
	if (name.trim().isEmpty())
		item.setShouldSaveValue(false);
	item.setName(filterItemName(name));
	item.setTitle(I18N.message(title));
	if (value != null)
		item.setValue(value);
	else
		item.setValue("");
	item.setWrapTitle(false);
	return item;
}
 
Example #11
Source File: BarcodeTemplateSettings.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void prepareForm() {
	form = new DynamicForm();
	form.setWidth100();
	form.setAlign(Alignment.LEFT);
	form.setColWidths("1px, 100%");
	vm = new ValuesManager();
	form.setValuesManager(vm);

	TextItem name = ItemFactory.newTextItem("name", "name", template.getName());
	name.setRequired(true);
	name.setDisabled(template.getId() != 0L);

	StaticTextItem id = ItemFactory.newStaticTextItem("id", I18N.message("id"), "" + template.getId());
	id.setVisible(template != null && template.getId() != 0L);

	TextAreaItem description = ItemFactory.newTextAreaItem("description", "description", template.getDescription());
	description.setHeight(200);

	// The optional batch
	SpinnerItem batch = ItemFactory.newSpinnerItem("batch", "batch", template.getBatch());
	batch.setRequired(true);
	batch.setMin(1);
	batch.setStep(10);
	batch.setHintStyle("hint");

	// The image threshold
	SpinnerItem resolutionThreshold = ItemFactory.newSpinnerItem("resolutionthreshold",
			I18N.message("resolutionthreshold"), template.getImageThreshold());
	resolutionThreshold.setRequired(true);
	resolutionThreshold.setWrapTitle(false);
	resolutionThreshold.setMin(50);
	resolutionThreshold.setStep(100);
	resolutionThreshold.setHint("pixels");

	if (Session.get().isDefaultTenant() && template.getId() != 0L)
		form.setItems(id, name, description, batch, resolutionThreshold);
	else
		form.setItems(id, name, description);
}
 
Example #12
Source File: UserDataSource.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public UserDataSource() {
    setID(ID);

    ClientMessages i18n = GWT.create(ClientMessages.class);

    setDataURL(RestConfig.URL_USER);

    DataSourceIntegerField userId = new DataSourceIntegerField(FIELD_ID);
    userId.setPrimaryKey(true);
    userId.setCanEdit(false);
    userId.setHidden(true);
    userId.setTitle(i18n.UsersView_ListHeader_Id_Title());

    DataSourceTextField userName = new DataSourceTextField(FIELD_USERNAME);
    userName.setCanEdit(false);
    userName.setRequired(true);
    userName.setReadOnlyEditorProperties(new StaticTextItem());
    userName.setTitle(i18n.UsersView_ListHeader_Username_Title());
    userName.setPrompt(i18n.UsersView_ListHeader_Username_Hint());

    DataSourcePasswordField passwd = new DataSourcePasswordField(FIELD_PASSWORD);
    passwd.setHidden(true);
    passwd.setTitle(i18n.UsersView_ListHeader_Password_Title());

    DataSourceTextField surname = new DataSourceTextField(UserResourceApi.USER_SURNAME);
    surname.setRequired(true);
    surname.setTitle(i18n.UsersView_ListHeader_Surname_Title());

    DataSourceTextField forename = new DataSourceTextField(UserResourceApi.USER_FORENAME);
    forename.setTitle(i18n.UsersView_ListHeader_Forename_Title());

    DataSourceTextField organization = new DataSourceTextField(UserResourceApi.USER_ORGANIZATION);
    organization.setTitle(i18n.UsersView_ListHeader_Organization_Title());
    organization.setValueMap(Organization.getMap());
    organization.setReadOnlyEditorProperties(new StaticTextItem());

    DataSourceTextField role = new DataSourceTextField(UserResourceApi.USER_ROLE);
    role.setTitle(i18n.UsersView_ListHeader_Role_Title());
    role.setValueMap(UserRole.getMap());
    role.setReadOnlyEditorProperties(new StaticTextItem());

    DataSourceTextField email = new DataSourceTextField(UserResourceApi.USER_EMAIL);
    email.setTitle(i18n.UsersView_ListHeader_Email_Title());

    DataSourceTextField home = new DataSourceTextField(UserResourceApi.USER_HOME);
    home.setCanEdit(false);
    home.setReadOnlyEditorProperties(new StaticTextItem());
    home.setHidden(true);
    home.setTitle(i18n.UsersView_ListHeader_Home_Title());

    DataSourceDateTimeField created = new DataSourceDateTimeField(UserResourceApi.USER_CREATED);
    created.setCanEdit(false);
    created.setTitle(i18n.UsersView_ListHeader_Created_Title());
    created.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);

    DataSourceTextField remoteName = new DataSourceTextField(UserResourceApi.USER_REMOTENAME);
    remoteName.setTitle(i18n.UsersView_ListHeader_RemoteName_Title());
    remoteName.setCanEdit(false);
    remoteName.setHidden(true);

    DataSourceTextField remoteType = new DataSourceTextField(UserResourceApi.USER_REMOTETYPE);
    remoteType.setTitle(i18n.UsersView_ListHeader_RemoteType_Title());
    remoteType.setCanEdit(false);
    remoteType.setHidden(true);

    setFields(userId, userName, passwd, surname, forename, organization, role, email, created, remoteName, remoteType, home);

    setOperationBindings(RestConfig.createAddOperation(), RestConfig.createUpdateOperation());
    setRequestProperties(RestConfig.createRestRequest(getDataFormat()));
}
 
Example #13
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 #14
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));
}
 
Example #15
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 #16
Source File: UpdatePanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onDraw() {
	if (!Feature.enabled(Feature.UPDATES)) {
		setMembers(new FeatureDisabled(Feature.UPDATES));
		return;
	}

	ContactingServer.get().show();
	UpdateService.Instance.get().checkUpdate(Session.get().getInfo().getUserNo(),
			Session.get().getInfo().getRelease(), new AsyncCallback<GUIParameter[]>() {
				@Override
				public void onFailure(Throwable caught) {
					ContactingServer.get().hide();
					Log.serverError(caught);
					onUpdateUnavailable();
				}

				@Override
				public void onSuccess(GUIParameter[] parameters) {
					ContactingServer.get().hide();

					if (parameters != null) {
						DynamicForm form = new DynamicForm();
						form.setWidth(300);
						form.setTitleOrientation(TitleOrientation.LEFT);

						StaticTextItem name = ItemFactory.newStaticTextItem("name", "name",
								Util.getValue("name", parameters));
						name.setRequired(true);

						StaticTextItem date = ItemFactory.newStaticTextItem("date", "date",
								Util.getValue("date", parameters));
						date.setRequired(true);

						StaticTextItem size = ItemFactory.newStaticTextItem("size", "size",
								Util.formatSize(Long.parseLong(Util.getValue("size", parameters))));
						size.setRequired(true);

						StaticTextItem target = ItemFactory.newStaticTextItem("target", "updatesto",
								Util.getValue("target", parameters));
						target.setRequired(true);

						form.setItems(name, date, size, target);

						Label message = new Label();
						message.setContents(I18N.message("updatepackagefound"));
						message.setWrap(false);
						message.setAlign(Alignment.LEFT);
						message.setStyleName("updateavailable");
						message.setLayoutAlign(Alignment.LEFT);
						message.setLayoutAlign(VerticalAlignment.TOP);
						message.setHeight(20);

						VLayout download = prepareDownloadProgress(parameters);

						VLayout infoPanel = new VLayout();
						infoPanel.setMembersMargin(10);
						infoPanel.setMembers(form, download);

						HLayout body = new HLayout();
						body.setWidth100();
						body.setMembersMargin(50);
						notesPanel.setWidth100();
						body.setMembers(infoPanel, notesPanel);

						setMembers(message, body);
					} else {
						onUpdateUnavailable();
					}
				}
			});
}
 
Example #17
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 #18
Source File: EventSubscriptionWindow.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
private StaticTextItem createStationNameItem(TimeseriesLegendData timeSeries) {
    StaticTextItem stationName = new StaticTextItem();
    stationName.setTitle(i18n.station());
    stationName.setValue(timeSeries.getStationName());
    return stationName;
}
 
Example #19
Source File: EventSubscriptionWindow.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
private StaticTextItem createPhenomenonItem(TimeseriesLegendData timeSeries) {
    StaticTextItem parameter = new StaticTextItem();
    parameter.setTitle(i18n.phenomenon());
    parameter.setValue(timeSeries.getPhenomenonId());
    return parameter;
}
 
Example #20
Source File: SubscriptionTemplate.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
protected StaticTextItem createLabelItem(String labelText) {
    StaticTextItem labelItem = new StaticTextItem();
    labelItem.setTitle(labelText);
    labelItem.setValue("");
    return labelItem;
}
 
Example #21
Source File: GoogleAuthenticatorSetup.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void init(String account, String key, String qrUrl) {
	// Prepare the form with account informations
	StaticTextItem accountItem = ItemFactory.newStaticTextItem("account", I18N.message("account"), account);
	accountItem.setWrap(false);
	accountItem.setWrapTitle(false);

	StaticTextItem keyItem = ItemFactory.newStaticTextItem("key", I18N.message("key"), key);
	keyItem.setWrap(false);
	keyItem.setWrapTitle(false);

	DynamicForm form = new DynamicForm();
	form.setTitleOrientation(TitleOrientation.LEFT);
	form.setItems(accountItem, keyItem);

	Label formTitle = new Label("<b>" + I18N.message(Constants.TWOFA_GOOGLE_AUTHENTICATOR+".hint1") + "</b>");
	formTitle.setWrap(true);
	formTitle.setMinWidth(250);

	VLayout formLayout = new VLayout();
	formLayout.setMembersMargin(2);
	formLayout.setMembers(formTitle, form);
	formLayout.setAlign(VerticalAlignment.TOP);

	// Prepare the QR Code
	HTMLFlow qrCode = new HTMLFlow("<img width='200' height='200' src='" + qrUrl + "'/>");
	qrCode.setOverflow(Overflow.VISIBLE);

	Label qrCodeTitle = new Label("<b>" + I18N.message(Constants.TWOFA_GOOGLE_AUTHENTICATOR+".hint2") + "</b>");
	qrCodeTitle.setWrap(true);
	qrCodeTitle.setMinWidth(250);

	VLayout qrCodeLayout = new VLayout();
	qrCodeLayout.setWidth100();
	qrCodeLayout.setHeight100();
	qrCodeLayout.setMembers(qrCodeTitle, qrCode);

	VLayout separator = new VLayout();
	separator.setWidth(20);

	HLayout body = new HLayout();
	body.setMembersMargin(2);
	body.setMembers(formLayout, separator, qrCodeLayout);

	setMembers(body);
}