com.smartgwt.client.widgets.Button Java Examples
The following examples show how to use
com.smartgwt.client.widgets.Button.
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: EditingTabSet.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public EditingTabSet(ClickHandler saveHandler, ClickHandler cancelHandler) { saveButton = new Button(I18N.message("save")); saveButton.setAutoFit(true); saveButton.setMargin(2); saveButton.addClickHandler(saveHandler); saveButton.setLayoutAlign(VerticalAlignment.CENTER); cancelButton = new Button(I18N.message("cancel")); cancelButton.setAutoFit(true); cancelButton.setMargin(2); cancelButton.setLayoutAlign(VerticalAlignment.CENTER); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hideSave(); } }); if (cancelHandler != null) cancelButton.addClickHandler(cancelHandler); savePanel = new HLayout(); savePanel.setHeight(20); savePanel.setMembersMargin(5); savePanel.setStyleName("warn"); savePanel.setMembers(saveButton, cancelButton); savePanel.hide(); setTabBarControls(savePanel, TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER); }
Example #2
Source File: Wizard.java From proarc with GNU General Public License v3.0 | 5 votes |
private void setButton(Button btn, boolean show, String title) { if (show) { btn.show(); btn.setTitle(title); } else { btn.hide(); } }
Example #3
Source File: ShareFileDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public ShareFileDialog(boolean export) { super(); this.export = export; setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("sharefile")); setWidth(350); setHeight(300); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); setPadding(3); VLayout content = new VLayout(); content.setTop(10); content.setWidth100(); content.setHeight100(); content.setMembersMargin(3); tree = new ShareFileTree(export); tree.setWidth100(); tree.setHeight100(); VLayout buttons = new VLayout(); buttons.setWidth100(); buttons.setHeight(30); Button select = new Button(I18N.message("select")); select.setAutoFit(true); select.setMargin(1); select.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (ShareFileDialog.this.export) onExport(); else onImport(); } }); buttons.setMembers(select); content.setMembers(tree, buttons); addItem(content); }
Example #4
Source File: TemplateDetailsPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public TemplateDetailsPanel(TemplatesPanel panel) { super(); this.templatesPanel = panel; setHeight100(); setWidth100(); setMembersMargin(10); Button saveButton = new Button(I18N.message("save")); saveButton.setAutoFit(true); saveButton.setMargin(2); saveButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onSave(); } }); saveButton.setLayoutAlign(VerticalAlignment.CENTER); HTMLPane spacer = new HTMLPane(); spacer.setContents("<div> </div>"); spacer.setWidth("70%"); spacer.setOverflow(Overflow.HIDDEN); tabSet = new EditingTabSet(new ClickHandler() { @Override public void onClick(ClickEvent event) { onSave(); } }, new ClickHandler() { @Override public void onClick(ClickEvent event) { if (template.getId() != 0) { TemplateService.Instance.get().getTemplate(template.getId(), new AsyncCallback<GUITemplate>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(GUITemplate template) { setTemplate(template); } }); } else { setTemplate(new GUITemplate()); } } }); tabSet.setTabBarPosition(Side.TOP); tabSet.setTabBarAlign(Side.LEFT); tabSet.setWidth100(); tabSet.setHeight100(); Tab propertiesTab = new Tab(I18N.message("properties")); propertiesTabPanel = new HLayout(); propertiesTabPanel.setWidth100(); propertiesTabPanel.setHeight100(); propertiesTab.setPane(propertiesTabPanel); tabSet.addTab(propertiesTab); addMember(tabSet); }
Example #5
Source File: InheritRightsDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public InheritRightsDialog(final FolderSecurityPanel panel) { super(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("inheritrights")); setWidth(250); setHeight(270); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); setPadding(3); VLayout content = new VLayout(); content.setTop(10); content.setWidth100(); content.setHeight100(); content.setMembersMargin(3); final TreeGrid folders = new FolderTree(); folders.setWidth100(); folders.setHeight100(); VLayout buttons = new VLayout(); buttons.setWidth100(); buttons.setHeight(30); Button inheritRights = new Button(I18N.message("inheritrights")); inheritRights.setAutoFit(true); inheritRights.setMargin(1); inheritRights.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { LD.ask(I18N.message("inheritrights"), I18N.message("inheritrightsask", new String[] { FolderNavigator.get().getSelectedRecord().getAttributeAsString("name"), folders.getSelectedRecord().getAttributeAsString("name") }), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { FolderService.Instance.get() .inheritRights( panel.getFolder().getId(), Long.parseLong(folders.getSelectedRecord().getAttributeAsString( "folderId")), new AsyncCallback<GUIFolder>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); destroy(); } @Override public void onSuccess(GUIFolder arg) { panel.refresh(arg); destroy(); } }); } destroy(); } }); } }); buttons.setMembers(inheritRights); content.setMembers(folders, buttons); addItem(content); }
Example #6
Source File: CreateAliasDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public CreateAliasDialog() { super(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("createalias")); setWidth(470); setHeight(280); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); setPadding(3); VLayout content = new VLayout(); content.setTop(10); content.setWidth100(); content.setHeight100(); content.setMembersMargin(3); final TreeGrid folders = new FolderTree(); folders.setWidth100(); folders.setHeight100(); HLayout buttons = new HLayout(); buttons.setWidth100(); buttons.setHeight(30); Button create = new Button(I18N.message("create")); create.setAutoFit(true); create.setMargin(1); create.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { FolderNavigator.get().createAlias( Long.parseLong(folders.getSelectedRecord().getAttributeAsString("folderId"))); destroy(); } }); buttons.setMembers(create); content.setMembers(folders, buttons); addItem(content); }
Example #7
Source File: MoveDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public MoveDialog() { super(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("move")); setWidth(250); setHeight(270); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); setPadding(3); VLayout content = new VLayout(); content.setTop(10); content.setWidth100(); content.setHeight100(); content.setMembersMargin(3); final TreeGrid folders = new FolderTree(); folders.setWidth100(); folders.setHeight100(); VLayout buttons = new VLayout(); buttons.setWidth100(); buttons.setHeight(30); Button move = new Button(I18N.message("move")); move.setAutoFit(true); move.setMargin(1); move.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { String shownName = FolderNavigator.get().getSelectedRecord().getAttributeAsString("name"); long[] selection = FolderNavigator.get().getSelectedIds(); if (selection.length > 1) shownName = selection.length + " " + I18N.message("folders").toLowerCase(); LD.ask(I18N.message("move"), I18N.message("moveask", new String[] { shownName, folders.getSelectedRecord().getAttributeAsString("name") }), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { FolderNavigator.get() .moveTo(Long.parseLong(folders.getSelectedRecord().getAttributeAsString( "folderId"))); } destroy(); } }); } }); buttons.setMembers(move); content.setMembers(folders, buttons); addItem(content); }
Example #8
Source File: ApplyTemplateDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public ApplyTemplateDialog() { super(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("applytemplate")); setAutoSize(true); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); VLayout content = new VLayout(); content.setWidth100(); content.setHeight100(); content.setMembersMargin(2); final TreeGrid folders = new FolderTree(); folders.setWidth100(); folders.setHeight100(); final boolean inheritOptionEnabled = "true".equals(Session.get().getInfo() .getConfig("gui.security.inheritoption")); final DynamicForm form = new DynamicForm(); CheckboxItem inheritSecurity = new CheckboxItem(); inheritSecurity.setName("inheritSecurity"); inheritSecurity.setTitle(I18N.message("inheritparentsec")); form.setItems(inheritSecurity); SelectItem templateSelector = ItemFactory.newFolderTemplateSelector(); if (inheritOptionEnabled) form.setItems(templateSelector, inheritSecurity); Button apply = new Button(I18N.message("apply")); apply.setAutoFit(true); apply.setMargin(1); apply.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (!form.validate()) return; final TreeNode selectedNode = (TreeNode) FolderNavigator.get().getSelectedRecord(); final long folderId = Long.parseLong(selectedNode.getAttributeAsString("folderId")); long templateId = Long.parseLong(form.getValueAsString("foldertemplate")); FolderService.Instance.get().applyTemplate(folderId, templateId, inheritOptionEnabled && "true".equals(form.getValueAsString("inheritSecurity")), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Void arg0) { FolderNavigator.get().getTree().reloadChildren(selectedNode); Log.info(I18N.message("templateapplied"), null); destroy(); } }); } }); content.setMembers(form, apply); addItem(content); }
Example #9
Source File: ZohoDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public ZohoDialog(boolean export) { super(); this.export = export; setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("zoho")); setWidth(350); setHeight(300); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); setPadding(3); VLayout content = new VLayout(); content.setTop(10); content.setWidth100(); content.setHeight100(); content.setMembersMargin(3); tree = new ZohoTree(export); tree.setWidth100(); tree.setHeight100(); VLayout buttons = new VLayout(); buttons.setWidth100(); buttons.setHeight(30); Button select = new Button(I18N.message("select")); select.setAutoFit(true); select.setMargin(1); select.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (ZohoDialog.this.export) onExport(); else onImport(); } }); buttons.setMembers(select); content.setMembers(tree, buttons); addItem(content); }
Example #10
Source File: DropboxDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public DropboxDialog(boolean export) { super(); this.export = export; setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("dropbox")); setWidth(350); setHeight(300); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); setPadding(3); VLayout content = new VLayout(); content.setTop(10); content.setWidth100(); content.setHeight100(); content.setMembersMargin(3); tree = new DropboxTree(export); tree.setWidth100(); tree.setHeight100(); VLayout buttons = new VLayout(); buttons.setWidth100(); buttons.setHeight(30); Button select = new Button(I18N.message("select")); select.setAutoFit(true); select.setMargin(1); select.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (DropboxDialog.this.export) onExport(); else onImport(); } }); buttons.setMembers(select); content.setMembers(tree, buttons); addItem(content); }
Example #11
Source File: ErrorHandler.java From proarc with GNU General Public License v3.0 | 4 votes |
/** * Notifies user about error. * @param msg simple client message * @param detailMsg detail response message; can be HTML * @param debugInfo request details, URL, ... */ private void warn(String msg, String detailMsg, String debugInfo) { if (msg == null) { msg = i18n.ErrorHandler_UnexpectedError_Msg(); } SmartGwtMessages sgi18n = ClientUtils.createSmartGwtMessages(); boolean allowDetail = !msg.equals(detailMsg); final Dialog d = new Dialog(); d.setTitle(sgi18n.dialog_WarnTitle()); d.setIsModal(true); d.setAutoSize(Boolean.FALSE); d.setMessage(msg); d.setIcon("[SKIN]warn.png"); d.setCanDragResize(true); d.setCanDragReposition(Boolean.TRUE); d.setKeepInParentRect(Boolean.TRUE); // d.setShowMaximizeButton(Boolean.TRUE); d.setMinMemberSize(50); Button details = new Button(i18n.ErrorHandler_ButtonDetalis_Title()); details.setVisible(allowDetail); d.setButtons(Dialog.OK, details); if (allowDetail) { Canvas errorPane = new Canvas(); errorPane.setOverflow(Overflow.AUTO); errorPane.setWidth100(); errorPane.setHeight100(); errorPane.setContents(detailMsg); errorPane.setCanSelectText(true); Canvas debugInfoPane = new Canvas(); debugInfoPane.setWidth100(); debugInfoPane.setAutoHeight(); debugInfoPane.setContents(debugInfo); debugInfoPane.setCanSelectText(true); final VLayout detailPane = new VLayout(4); detailPane.setLayoutMargin(4); detailPane.setGroupTitle(i18n.ErrorHandler_ButtonDetalis_Title()); detailPane.setIsGroup(true); detailPane.setVisible(false); detailPane.addMember(errorPane); detailPane.addMember(debugInfoPane); detailPane.setWidth100(); detailPane.setHeight100(); d.addItem(detailPane); details.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) { if (detailPane.isVisible()) { d.restore(); } else { d.maximize(); } detailPane.setVisible(!detailPane.isVisible()); } }); } d.show(); }