Java Code Examples for com.smartgwt.client.widgets.IButton#setTitle()
The following examples show how to use
com.smartgwt.client.widgets.IButton#setTitle() .
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: OwnRulesListGrid.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
private Canvas createPublishRuleButton(final ListGridRecord ruleRecord) { IButton publishButton = new IButton(i18n.publishButton()); publishButton.setShowDown(false); publishButton.setShowRollOver(false); publishButton.setLayoutAlign(Alignment.CENTER); publishButton.setHeight(16); publishButton.setAutoFit(true); final boolean published = ruleRecord.getAttributeAsBoolean(PUBLISHED); if (published) { publishButton.setTitle(i18n.unpublishButton()); publishButton.setPrompt(i18n.cancelPublication()); } else { publishButton.setTitle(i18n.publishButton()); publishButton.setPrompt(i18n.publishThisRule()); } publishButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { String ruleName = ruleRecord.getAttribute(NAME); EventBus.getMainEventBus().fireEvent(new PublishRuleEvent(currentSession(), ruleName, !published, "USER")); } }); return publishButton; }
Example 2
Source File: FirewallPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public FirewallPanel() { setWidth100(); setMembersMargin(5); setMargin(5); init(); Tab tab = new Tab(); tab.setTitle(I18N.message("firewall")); tab.setPane(form); TabSet tabs = new TabSet(); tabs.setWidth100(); tabs.setHeight100(); tabs.setTabs(tab); IButton save = new IButton(); save.setAutoFit(true); save.setTitle(I18N.message("save")); save.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onSave(); } }); setMembers(tabs, save); }
Example 3
Source File: BruteForcePanel.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public BruteForcePanel() { super("bruteforceprevention"); IButton save = new IButton(); save.setAutoFit(true); save.setTitle(I18N.message("save")); save.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onSave(); } }); addMember(save); SettingService.Instance.get().loadSettingsByNames( new String[] { "throttle.enabled", "throttle.username.max", "throttle.username.wait", "throttle.username.wait", "throttle.ip.max", "throttle.ip.wait" }, new AsyncCallback<GUIParameter[]>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(GUIParameter[] params) { Map<String, String> p = new HashMap<String, String>(); for (GUIParameter par : params) p.put(par.getName(), par.getValue()); initForm(p); } }); }
Example 4
Source File: FillForm.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public FillForm(GUIDocument frm) { setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("form") + " - " + Util.getBaseName(frm.getFileName())); setWidth(500); setHeight(400); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); IButton save = new IButton(); save.setTitle(I18N.message("save")); save.setAutoFit(true); save.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) { onSave(); } }); HLayout buttonsBar = new HLayout(); buttonsBar.setWidth100(); buttonsBar.setHeight(25); buttonsBar.setMembers(save); propertiesPanel = new ExtendedPropertiesPanel(frm, null, true, true, false); VLayout layout = new VLayout(); layout.setMargin(3); layout.setMembersMargin(3); layout.setMembers(propertiesPanel, buttonsBar); addItem(layout); }
Example 5
Source File: Setup.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
private void initGUI(final GUIInfo info) { WindowUtils.setTitle(info.getBranding().getProductName() + " " + info.getRelease() + (info.getLicensee() != null ? " - " + I18N.message("licensedto") + ": " + info.getLicensee() : "")); WindowUtils.setFavicon(info); // Prepare a value manager that will include all forms spanned in each // tab vm = new ValuesManager(); // Create all the tabs each one for a specific setup step tabs = new TabSet(); tabs.setWidth(600); tabs.setHeight(250); Tab registrationTab = setupRegistration(vm); Tab repositoryTab = setupRepository(vm, info); Tab databaseTab = setupDatabase(vm, info); tabs.setTabs(registrationTab, repositoryTab, databaseTab); // This is the button used to confirm each step submit = new IButton(); submit.setTitle(I18N.message("next")); submit.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { onSubmit(info); } }); // Prepare the heading panel with Logo and Title // Prepare the logo image to be shown inside the login form Label header = new Label(I18N.message("setup")); header.setStyleName("setupHeader"); header.setIcon(info.getBranding().getLogoSrc()); header.setIconWidth(205); header.setIconHeight(40); header.setHeight(45); // Prepare a panel to layout setup components VLayout layout = new VLayout(); layout.setHeight(500); layout.setWidth(400); layout.setMembersMargin(5); layout.addMember(header); layout.addMember(tabs); layout.addMember(submit); // Panel for horizontal centering VLayout vPanel = new VLayout(); vPanel.setDefaultLayoutAlign(Alignment.CENTER); vPanel.setWidth100(); vPanel.setHeight(300); vPanel.addMember(layout); RootPanel.get().add(vPanel); // Remove the loading frame RootPanel.getBodyElement().removeChild(RootPanel.get("loadingwrapper-setup").getElement()); }
Example 6
Source File: AntivirusPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
private void initGUI(GUIParameter[] settings) { final DynamicForm form = new DynamicForm(); form.setTitleOrientation(TitleOrientation.LEFT); form.setAlign(Alignment.LEFT); RadioGroupItem enabled = ItemFactory.newBooleanSelector("enabled", I18N.message("enabled")); enabled.setWrapTitle(false); enabled.setRequired(true); TextItem command = ItemFactory.newTextItem("command", "ClamAV", null); command.setWidth(400); TextItem includes = ItemFactory.newTextItem("includes", "include", null); includes.setWidth(400); TextItem excludes = ItemFactory.newTextItem("excludes", "exclude", null); excludes.setWidth(400); TextItem timeout = ItemFactory.newSpinnerItem("timeout", "timeout", (Integer) null); timeout.setHint(I18N.message("seconds")); for (GUIParameter setting : settings) { if ((Session.get().getTenantName() + ".antivirus.enabled").equals(setting.getName())) enabled.setValue("true".equals(setting.getValue()) ? "yes" : "no"); else if ("antivirus.command".equals(setting.getName())) command.setValue(setting.getValue()); else if ((Session.get().getTenantName() + ".antivirus.excludes").equals(setting.getName())) excludes.setValue(setting.getValue()); else if ((Session.get().getTenantName() + ".antivirus.includes").equals(setting.getName())) includes.setValue(setting.getValue()); else if ((Session.get().getTenantName() + ".antivirus.timeout").equals(setting.getName())) timeout.setValue(Integer.parseInt(setting.getValue())); } IButton save = new IButton(); save.setTitle(I18N.message("save")); save.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (form.validate()) { GUIParameter[] params = new GUIParameter[Session.get().isDefaultTenant() ? 4 : 3]; params[0] = new GUIParameter(Session.get().getTenantName() + ".antivirus.enabled", "" + ("yes".equals(form.getValueAsString("enabled")))); params[1] = new GUIParameter(Session.get().getTenantName() + ".antivirus.excludes", form.getValueAsString("excludes").trim()); params[2] = new GUIParameter(Session.get().getTenantName() + ".antivirus.includes", form.getValueAsString("includes").trim()); params[3] = new GUIParameter(Session.get().getTenantName() + ".antivirus.timeout", form.getValueAsString("timeout").trim()); if (Session.get().isDefaultTenant()) params[4] = new GUIParameter("antivirus.command", form.getValueAsString("command").trim()); SettingService.Instance.get().saveSettings(params, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Void ret) { Log.info(I18N.message("settingssaved"), null); } }); } } }); if (Session.get().isDefaultTenant()) form.setFields(enabled, command, includes, excludes, timeout); else form.setFields(enabled, includes, excludes, timeout); Tab tab = new Tab(); tab.setTitle(I18N.message("antivirus")); tab.setPane(form); TabSet tabs = new TabSet(); tabs.setWidth100(); tabs.setHeight100(); tabs.setTabs(tab); setMembers(tabs, save); }
Example 7
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 8
Source File: TagsSettingsPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onDraw() { DynamicForm parametersForm = new DynamicForm(); parametersForm.setValuesManager(vm); parametersForm.setTitleOrientation(TitleOrientation.LEFT); parametersForm.setNumCols(2); parametersForm.setColWidths(1, "*"); parametersForm.setPadding(5); SelectItem mode = ItemFactory.newTagInputMode("mode", "inputmode"); SpinnerItem maxsize = ItemFactory.newSpinnerItem("maxsize", I18N.message("maxsize"), (Long) null); maxsize.setRequired(true); SpinnerItem minsize = ItemFactory.newSpinnerItem("minsize", I18N.message("minsize"), (Long) null); minsize.setRequired(true); SpinnerItem cloudElements = ItemFactory.newSpinnerItem("cloudElements", I18N.message("tagcloudelements"), (Long) null); cloudElements.setRequired(true); cloudElements.setWrapTitle(false); TextItem vocabulary = ItemFactory.newTextItem("vocabulary", I18N.message("vocabulary"), null); vocabulary.setRequired(true); vocabulary.setWidth(300); parametersForm.setItems(mode, maxsize, minsize, cloudElements, vocabulary); addMember(parametersForm); for (GUIParameter p : settings) { if (p.getName().endsWith("tag.mode")) mode.setValue(p.getValue()); if (p.getName().endsWith("tag.maxsize")) maxsize.setValue(p.getValue()); if (p.getName().endsWith("tag.minsize")) minsize.setValue(p.getValue()); if (p.getName().endsWith("tag.vocabulary")) vocabulary.setValue(p.getValue()); if (p.getName().endsWith("tagcloud.maxtags")) cloudElements.setValue(p.getValue()); } IButton save = new IButton(); save.setTitle(I18N.message("save")); save.addClickHandler(new ClickHandler() { @SuppressWarnings("unchecked") public void onClick(ClickEvent event) { final Map<String, Object> values = (Map<String, Object>) vm.getValues(); if (vm.validate()) { List<GUIParameter> params = new ArrayList<GUIParameter>(); params.add(new GUIParameter(Session.get().getTenantName() + ".tag.mode", values.get("mode") .toString())); params.add(new GUIParameter(Session.get().getTenantName() + ".tag.maxsize", values.get("maxsize") .toString())); params.add(new GUIParameter(Session.get().getTenantName() + ".tag.minsize", values.get("minsize") .toString())); params.add(new GUIParameter(Session.get().getTenantName() + ".tag.vocabulary", values.get( "vocabulary").toString())); params.add(new GUIParameter(Session.get().getTenantName() + ".tagcloud.maxtags", values.get( "cloudElements").toString())); 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 ret) { Session.get() .getInfo() .setConfig(Session.get().getTenantName() + ".tag.mode", values.get("mode").toString()); Session.get() .getInfo() .setConfig(Session.get().getTenantName() + ".tag.maxsize", values.get("maxsize").toString()); Session.get() .getInfo() .setConfig(Session.get().getTenantName() + ".tag.minsize", values.get("minsize").toString()); Session.get() .getInfo() .setConfig(Session.get().getTenantName() + ".tagcloud.maxtags", values.get("cloudElements").toString()); Log.info(I18N.message("settingssaved"), null); } }); } } }); addMember(save); }
Example 9
Source File: ParametersPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public ParametersPanel(GUIParameter[] settings) { super("parameters"); this.settings = settings; setWidth100(); setHeight100(); setMembersMargin(5); setMargin(5); DynamicForm form = new DynamicForm(); form.setValuesManager(vm); form.setTitleOrientation(TitleOrientation.TOP); form.setNumCols(4); form.setColWidths(100, 100, 100, 100); TextItem[] items = new TextItem[settings.length]; int i = 0; for (GUIParameter parameter : settings) { TextItem item = ItemFactory.newTextItem(parameter.getName(), parameter.getName(), parameter.getValue()); items[i] = item; i++; } form.setItems(items); IButton save = new IButton(); save.setTitle(I18N.message("save")); save.addClickHandler(new ClickHandler() { @SuppressWarnings("unchecked") public void onClick(ClickEvent event) { Map<String, Object> values = (Map<String, Object>) vm.getValues(); if (vm.validate()) { for (GUIParameter param : ParametersPanel.this.settings) { param.setValue((String) values.get(ItemFactory.filterItemName(param.getName()))); Session.get().getInfo().setConfig(param.getName(), param.getValue()); } SettingService.Instance.get().saveSettings(ParametersPanel.this.settings, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Void ret) { Log.info(I18N.message("settingssaved"), null); } }); } } }); save.setDisabled(Session.get().isDemo() && Session.get().getUser().getId() == 1); body.setMembers(form); addMember(save); }