Java Code Examples for com.smartgwt.client.widgets.form.DynamicForm#setWidth()
The following examples show how to use
com.smartgwt.client.widgets.form.DynamicForm#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: AttributeSetPropertiesPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
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: ExportAction.java From proarc with GNU General Public License v3.0 | 6 votes |
private final DynamicForm createOptionsForm() { DynamicForm f = new DynamicForm(); f.setAutoHeight(); f.setLayoutAlign(Alignment.CENTER); f.setWidth(350); formItems = createExportFormOptions(); if (formItems == null || formItems.isEmpty()) { return null; } FormItem fields[] = new FormItem[formItems.size()]; for (int i = 0; i < formItems.size(); i++) { fields[i] = formItems.get(i); formItems.get(i); } f.setFields(fields); return f; }
Example 3
Source File: LoginWindow.java From proarc with GNU General Public License v3.0 | 5 votes |
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 4
Source File: NewIssueEditor.java From proarc with GNU General Public License v3.0 | 5 votes |
private DynamicForm createForm() { DataSource ds = new DataSource(); ds.setClientOnly(true); DataSourceIntegerField fDays = new DataSourceIntegerField( DigitalObjectResourceApi.DIGITALOBJECT_SERIES_DAYS_INCLUDED_PARAM); fDays.setMultiple(true); DataSourceDateField fDateFrom = new DataSourceDateField( DigitalObjectResourceApi.DIGITALOBJECT_SERIES_DATE_FROM_PARAM); DataSourceDateField fDateTo = new DataSourceDateField( DigitalObjectResourceApi.DIGITALOBJECT_SERIES_DATE_TO_PARAM); DataSourceIntegerField fPartNumberFrom = new DataSourceIntegerField( DigitalObjectResourceApi.DIGITALOBJECT_SERIES_PARTNUMBER_FROM_PARAM); ds.setFields(fDateFrom, fDateTo, fDays, fPartNumberFrom); DynamicForm df = new DynamicForm(); df.setWidth(200); df.setItemHoverWidth(200); df.setWrapItemTitles(false); df.setSaveOnEnter(true); IntegerItem partNumberStart = createPartName(fPartNumberFrom.getName()); DateRangeValidator dateRangeValidator = new DateRangeValidator(); DateItem dateStart = createDateFrom(fDateFrom.getName(), dateRangeValidator); DateItem dateEnd = new DateItem(fDateTo.getName(), i18n.NewIssueEditor_dateTo_Title()); dateEnd.setTooltip(i18n.NewIssueEditor_dateTo_Hint()); dateEnd.setUseTextField(true); dateEnd.setValidators(dateRangeValidator); dateEnd.setStartDate(new Date(1900 - 1900, 1, 1)); SelectItem issueDays = createDayChooser(fDays.getName()); df.setDataSource(ds, partNumberStart, dateStart, dateEnd, issueDays); return df; }
Example 5
Source File: CreateComplexRuleLayout.java From SensorWebClient with GNU General Public License v2.0 | 5 votes |
private HLayout createSingle(String ruleName){ this.singleCount++; DynamicForm block1 = new DynamicForm(); block1.setWidth("50%"); block1.setNumCols(1); DynamicForm block2 = new DynamicForm(); block2.setWidth("50%"); block2.setNumCols(1); SelectItem rule1Item = new SelectItem(); rule1Item.setShowTitle(false); rule1Item.setValueMap(this.rulesHashMap); rule1Item.setWidth(this.selectItemWidth); if (ruleName != null) { rule1Item.setValue(ruleName); } SpacerItem spacerItem = new SpacerItem(); spacerItem.setShowTitle(false); spacerItem.setHeight(20); block2.setFields(rule1Item); HLayout layout = new HLayout(); layout.setWidth(200); layout.setHeight(25); layout.addMember(block1); layout.addMember(block2); // save tree this.tempTree = this.rootTree; Tree right = new Tree(rule1Item, null, null); this.rootTree = new Tree(this.singleOperator, this.tempTree, right); return layout; }
Example 6
Source File: SetPassword.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public SetPassword(final long userId) { super(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("changepassword")); setWidth(300); setHeight(140); setIsModal(true); setShowModalMask(true); centerInPage(); setAutoSize(true); final ValuesManager vm = new ValuesManager(); final DynamicForm form = new DynamicForm(); form.setValuesManager(vm); form.setWidth(350); MatchesFieldValidator equalsValidator = new MatchesFieldValidator(); equalsValidator.setOtherField(NEWPASSWORDAGAIN); equalsValidator.setErrorMessage(I18N.message("passwordnotmatch")); LengthRangeValidator sizeValidator = new LengthRangeValidator(); sizeValidator.setErrorMessage( I18N.message("errorfieldminlenght", Integer.toString(Session.get().getUser().getPasswordMinLenght()))); sizeValidator.setMin(Session.get().getUser().getPasswordMinLenght()); PasswordItem newPass = new PasswordItem(); newPass.setName(NEWPASSWORD); newPass.setTitle(I18N.message(NEWPASSWORD)); newPass.setRequired(true); newPass.setAutoComplete(AutoComplete.NONE); newPass.setValidators(equalsValidator, sizeValidator); PasswordItem newPassAgain = new PasswordItem(); newPassAgain.setName(NEWPASSWORDAGAIN); newPassAgain.setTitle(I18N.message(NEWPASSWORDAGAIN)); newPassAgain.setAutoComplete(AutoComplete.NONE); newPassAgain.setWrapTitle(false); newPassAgain.setRequired(true); final CheckboxItem notify = ItemFactory.newCheckbox(NOTIFY, "notifycredentials"); notify.setValue(false); final ButtonItem apply = new ButtonItem(); apply.setTitle(I18N.message("apply")); apply.setAutoFit(true); apply.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { vm.validate(); if (!vm.hasErrors()) { apply.setDisabled(true); SecurityService.Instance.get().changePassword(Session.get().getUser().getId(), userId, null, vm.getValueAsString(NEWPASSWORD), notify.getValueAsBoolean(), new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { SC.warn(caught.getMessage()); apply.setDisabled(false); } @Override public void onSuccess(Integer ret) { apply.setDisabled(false); if (ret.intValue() > 0) { // Alert the user and maintain the popup // opened if (ret == 1) Log.warn(I18N.message("wrongpassword"), null); else if (ret == 2) Log.warn(I18N.message("passwdnotnotified"), null); else Log.warn(I18N.message("genericerror"), null); } SetPassword.this.destroy(); } }); } } }); form.setFields(newPass, newPassAgain, notify, apply); addItem(form); }
Example 7
Source File: ReplicateUserSettings.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public ReplicateUserSettings(List<Long> userIds, final UsersPanel panel) { super(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("replicatesettings")); setIsModal(true); setShowModalMask(true); centerInPage(); setAutoSize(true); final ValuesManager vm = new ValuesManager(); final DynamicForm form = new DynamicForm(); form.setValuesManager(vm); form.setWidth(350); SelectItem masterUser = ItemFactory.newUserSelector("user", "masteruser", null, true); masterUser.setHint(I18N.message("masteruserhint")); final CheckboxItem userInterface = ItemFactory.newCheckbox("userinterface", "userinterface"); userInterface.setValue(true); final CheckboxItem groups = ItemFactory.newCheckbox("groups", "groups"); groups.setValue(false); final ButtonItem confirm = new ButtonItem(); confirm.setTitle(I18N.message("confirm")); confirm.setAutoFit(true); confirm.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { vm.validate(); if (!vm.hasErrors()) { long masterUserId = Long.parseLong(vm.getValueAsString("user")); ContactingServer.get().show(); SecurityService.Instance.get().replicateUsersSettings(masterUserId, userIds.toArray(new Long[0]), userInterface.getValueAsBoolean(), groups.getValueAsBoolean(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { ContactingServer.get().hide(); Log.serverError(caught); } @Override public void onSuccess(Void arg0) { ContactingServer.get().hide(); Log.info(I18N.message("userssaved")); destroy(); panel.refresh(); } }); } } }); form.setFields(masterUser, userInterface, groups, confirm); addItem(form); }
Example 8
Source File: TwoFactorsAuthenticationSettings.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
private void init(GUIParameter[] parameters) { DynamicForm form = new DynamicForm(); form.setWidth(1); form.setValuesManager(vm); form.setTitleOrientation(TitleOrientation.LEFT); form.setNumCols(1); Map<String, String> settings = Util.convertToMap(parameters); final RadioGroupItem enable2fa = ItemFactory.newBooleanSelector("enable2fa", I18N.message("enable2fa")); enable2fa.setValue("true".equals(settings.get("enabled")) ? "yes" : "no"); enable2fa.setWrapTitle(false); enable2fa.setWrap(false); enable2fa.setRequired(true); enable2fa.setDisabled(Session.get().isDemo()); form.setFields(enable2fa); /* * GoogleAuthenticator section */ DynamicForm googleForm = new DynamicForm(); googleForm.setValuesManager(vm); googleForm.setTitleOrientation(TitleOrientation.TOP); googleForm.setIsGroup(true); googleForm.setGroupTitle("Google Authenticator"); googleForm.setNumCols(1); final RadioGroupItem enableGoolge = ItemFactory.newBooleanSelector("enableGoolge", I18N.message("enablegoogleauthenticator")); enableGoolge.setValue("true".equals(settings.get(Constants.TWOFA_GOOGLE_AUTHENTICATOR + ".enabled")) ? "yes" : "no"); enableGoolge.setWrapTitle(false); enableGoolge.setWrap(false); enableGoolge.setRequired(true); enableGoolge.setDisabled(Session.get().isDemo()); googleForm.setFields(enableGoolge); /* * Yubikey section */ DynamicForm yubikeyForm = new DynamicForm(); yubikeyForm.setValuesManager(vm); yubikeyForm.setTitleOrientation(TitleOrientation.TOP); yubikeyForm.setIsGroup(true); yubikeyForm.setGroupTitle("YubiKey"); yubikeyForm.setNumCols(1); final RadioGroupItem enableYubikey = ItemFactory.newBooleanSelector("enableYubikey", I18N.message("enableyubikey")); enableYubikey.setValue("true".equals(settings.get("yubikey.enabled")) ? "yes" : "no"); enableYubikey.setWrapTitle(false); enableYubikey.setWrap(false); enableYubikey.setRequired(true); enableYubikey.setDisabled(Session.get().isDemo()); yubikeyForm.setFields(enableYubikey); IButton save = new IButton(); save.setTitle(I18N.message("save")); save.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (vm.validate()) { String tenant = Session.get().getTenantName(); final List<GUIParameter> params = new ArrayList<GUIParameter>(); params.add(new GUIParameter(tenant + ".2fa.enabled", vm.getValueAsString("enable2fa").equals("yes") ? "true" : "false")); params.add(new GUIParameter(tenant + ".2fa." + Constants.TWOFA_GOOGLE_AUTHENTICATOR + ".enabled", vm.getValueAsString("enableGoolge").equals("yes") ? "true" : "false")); params.add(new GUIParameter(tenant + ".2fa." + Constants.TWOFA_YUBIKEY + ".enabled", vm.getValueAsString("enableYubikey").equals("yes") ? "true" : "false")); SettingService.Instance.get().saveSettings(params.toArray(new GUIParameter[0]), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Void arg) { Session.get().updateConfig(params); Log.info(I18N.message("settingssaved"), null); } }); } } }); VLayout panel = new VLayout(); panel.setWidth100(); panel.setMembers(form, googleForm, yubikeyForm); body.setMembers(panel); addMember(save); }
Example 9
Source File: SaveDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public SaveDialog() { super(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("savesearch")); setWidth(350); setHeight(100); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); setPadding(5); setAutoSize(true); final ValuesManager vm = new ValuesManager(); final DynamicForm form = new DynamicForm(); form.setValuesManager(vm); form.setWidth(350); form.setMargin(5); TextItem name = ItemFactory.newTextItem("name", "name", null); name.setRequired(true); name.setValidators(new SimpleTextValidator()); name.setWidth(100); TextItem description = ItemFactory.newTextItem("description", "description", null); description.setWidth(300); ButtonItem save = new ButtonItem(); save.setTitle(I18N.message("save")); save.setAutoFit(true); save.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { vm.validate(); if (!vm.hasErrors()) { final GUISearchOptions options = Search.get().getOptions(); options.setName(vm.getValueAsString("name")); options.setDescription(vm.getValueAsString("description")); SearchService.Instance.get().save(Search.get().getOptions(), new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Boolean b) { if (!b) SC.warn(I18N.message("duplicateelement")); else { SavedSearchesPanel.get().addEntry( vm.getValueAsString("name"), vm.getValueAsString("description"), options.getType() == GUISearchOptions.TYPE_FULLTEXT ? I18N.message("fulltext") : I18N.message("parametric")); destroy(); } } }); } } }); form.setFields(name, description, save); addItem(form); }
Example 10
Source File: ChangePassword.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public ChangePassword() { super(); GUIUser user = Session.get().getUser(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("changepassword")); setWidth(300); setIsModal(true); setShowModalMask(true); centerInPage(); setAutoSize(true); final ValuesManager vm = new ValuesManager(); final DynamicForm form = new DynamicForm(); form.setValuesManager(vm); form.setWidth(350); form.setMargin(5); PasswordItem password = new PasswordItem(); password.setName(PASSWORD); password.setTitle(I18N.message(PASSWORD)); password.setRequired(true); MatchesFieldValidator equalsValidator = new MatchesFieldValidator(); equalsValidator.setOtherField(NEWPASSWORDAGAIN); equalsValidator.setErrorMessage(I18N.message("passwordnotmatch")); LengthRangeValidator sizeValidator = new LengthRangeValidator(); sizeValidator .setErrorMessage(I18N.message("errorfieldminlenght", Integer.toString(user.getPasswordMinLenght()))); sizeValidator.setMin(user.getPasswordMinLenght()); PasswordItem newPass = new PasswordItem(); newPass.setName(NEWPASSWORD); newPass.setTitle(I18N.message(NEWPASSWORD)); newPass.setRequired(true); newPass.setValidators(equalsValidator, sizeValidator); PasswordItem newPassAgain = new PasswordItem(); newPassAgain.setName(NEWPASSWORDAGAIN); newPassAgain.setTitle(I18N.message(NEWPASSWORDAGAIN)); newPassAgain.setWrapTitle(false); newPassAgain.setRequired(true); final ButtonItem apply = new ButtonItem(); apply.setTitle(I18N.message("apply")); apply.setAutoFit(true); apply.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { vm.validate(); if (!vm.hasErrors()) { if (vm.getValueAsString(PASSWORD).equals(vm.getValueAsString(NEWPASSWORD))) { Map<String, String> errors = new HashMap<String, String>(); errors.put(NEWPASSWORD, I18N.message("useanotherpassword")); vm.setErrors(errors, true); return; } apply.setDisabled(true); SecurityService.Instance.get().changePassword(user.getId(), user.getId(), vm.getValueAsString(PASSWORD), vm.getValueAsString(NEWPASSWORD), false, new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { apply.setDisabled(false); SC.warn(caught.getMessage()); } @Override public void onSuccess(Integer ret) { apply.setDisabled(false); if (ret.intValue() > 0) { // Alert the user and maintain the popup // opened if (ret == 1) SC.warn(I18N.message("wrongpassword")); else if (ret == 2) SC.warn(I18N.message("passwdnotnotified")); else SC.warn(I18N.message("genericerror")); } else { SC.say(I18N.message("yourpasswordhaschanged")); Log.info(I18N.message("event.user.passwordchanged"), null); } // Close the popup ChangePassword.this.destroy(); } }); } } }); form.setFields(password, newPass, newPassAgain, apply); addItem(form); }
Example 11
Source File: FolderExtendedPropertiesPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public FolderExtendedPropertiesPanel(GUIFolder folder, ChangedHandler changedHandler, ChangedHandler templateChangedHandler) { super(folder, changedHandler); setWidth100(); setHeight100(); setMembersMargin(1); RadioGroupItem locked = ItemFactory.newBooleanSelector("locked", "templatelocked"); locked.setValue(folder.getTemplateLocked() == 1 ? "yes" : "no"); locked.addChangedHandler(changedHandler); locked.setEndRow(true); ButtonItem applyMetadata = new ButtonItem(I18N.message("applytosubfolders")); applyMetadata.setAutoFit(true); applyMetadata.setEndRow(true); applyMetadata.setDisabled(!folder.isWrite()); applyMetadata.setColSpan(1); applyMetadata.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { ContactingServer.get().show(); FolderService.Instance.get().applyMetadata(folder.getId(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { ContactingServer.get().hide(); Log.serverError(caught); } @Override public void onSuccess(Void v) { ContactingServer.get().hide(); } }); } }); form1 = new DynamicForm(); form1.setWidth(200); form1.setNumCols(1); form1.setTitleOrientation(TitleOrientation.TOP); form1.setItems(locked, applyMetadata); propertiesPanel = new ExtendedPropertiesPanel(folder, changedHandler, templateChangedHandler, folder.isWrite(), false, true); setMembers(form1, propertiesPanel); }
Example 12
Source File: ExternalAppsPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
private Tab prepareExternalCall(GUIParameter[] settings) { VLayout pane = new VLayout(); Tab extCall = new Tab(); extCall.setTitle(I18N.message("externalcall")); DynamicForm extCallForm = new DynamicForm(); extCallForm.setWidth(400); extCallForm.setIsGroup(true); extCallForm.setNumCols(2); extCallForm.setPadding(2); extCallForm.setGroupTitle(I18N.message("externalcall")); extCallForm.setValuesManager(vm); extCallForm.setTitleOrientation(TitleOrientation.LEFT); final RadioGroupItem extCallEnabled = ItemFactory.newBooleanSelector("extCallEnabled", "enabled"); extCallEnabled.setRequired(true); extCallEnabled.setRedrawOnChange(true); extCallEnabled.setValue("no"); TextItem extCallName = ItemFactory.newTextItem("extCallName", I18N.message("name"), null); TextItem extCallBaseUrl = ItemFactory.newTextItem("extCallBaseUrl", I18N.message("baseurl"), null); extCallBaseUrl.setWidth(300); TextItem extCallSuffix = ItemFactory.newTextItem("extCallSuffix", I18N.message("suffix"), null); extCallSuffix.setWidth(300); TextItem extCallWindow = ItemFactory.newTextItem("extCallWindow", I18N.message("targetwindow"), "_blank"); extCallForm.setItems(extCallEnabled, extCallName, extCallBaseUrl, extCallSuffix, extCallWindow); // Use a second form to group the parameters section DynamicForm parametersForm = new DynamicForm(); parametersForm.setWidth(400); parametersForm.setIsGroup(true); parametersForm.setGroupTitle(I18N.message("parameters")); parametersForm.setNumCols(4); extCallForm.setPadding(2); parametersForm.setValuesManager(vm); extCallParamUser = ItemFactory.newCheckbox("extCallParamUser", "user"); extCallParamTitle = ItemFactory.newCheckbox("extCallParamTitle", "filename"); parametersForm.setItems(extCallParamUser, extCallParamTitle); pane.setMembers(extCallForm, parametersForm); extCall.setPane(pane); String tenant = Session.get().getTenantName(); for (GUIParameter s : settings) { if ((tenant + ".extcall.enabled").equals(s.getName())) extCallEnabled.setValue("true".equals(s.getValue()) ? "yes" : "no"); else if ((tenant + ".extcall.name").equals(s.getName())) extCallName.setValue(s.getValue()); else if ((tenant + ".extcall.baseurl").equals(s.getName())) extCallBaseUrl.setValue(s.getValue()); else if ((tenant + ".extcall.suffix").equals(s.getName())) extCallSuffix.setValue(s.getValue()); else if ((tenant + ".extcall.window").equals(s.getName())) extCallWindow.setValue(s.getValue()); else if ((tenant + ".extcall.params").equals(s.getName())) { String[] tokens = s.getValue().split(","); for (String param : tokens) { if ("user".equals(param.trim())) extCallParamUser.setValue("true"); else if ("filename".equals(param.trim())) extCallParamTitle.setValue("true"); } } } return extCall; }
Example 13
Source File: SystemMenu.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
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", "", "© " + 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 14
Source File: CreateComplexRuleLayout.java From SensorWebClient with GNU General Public License v2.0 | 4 votes |
private void addSingle(String op, String ruleName){ // get all members from mainLayout and clear the layout Canvas[] members = this.ruleBlockLayout.getMembers(); this.ruleBlockLayout.removeMembers(this.ruleBlockLayout.getMembers()); LinkedHashMap<String, String> operatorHashMap = getLogicalOperators(); VLayout v2 = new VLayout(); v2.setWidth("70%"); v2.addMember(members[0]); v2.addMember(createSingle(ruleName)); DynamicForm block1 = new DynamicForm(); block1.setWidth("30%"); block1.setNumCols(1); this.singleOperator = new SelectItem(); this.singleOperator.setShowTitle(false); this.singleOperator.setWidth(this.operatorWidth); this.singleOperator.setValueMap(operatorHashMap); this.singleOperator.setTextAlign(Alignment.CENTER); if (op != null) { this.singleOperator.setValue(op); } else { this.singleOperator.setValue(LogicalOperator.AND.toString()); } SpacerItem spacerItem = new SpacerItem(); spacerItem.setShowTitle(false); spacerItem.setHeight(20); block1.setFields(spacerItem, spacerItem, this.singleOperator); HLayout layout = new HLayout(); layout.setWidth(200); layout.setHeight(25); layout.setEdgeMarginSize(1); layout.setEdgeSize(2); layout.setShowEdges(true); layout.addMember(block1); layout.addMember(v2); this.ruleBlockLayout.addMember(layout); }