List of usage examples for com.google.gwt.user.client.ui HorizontalPanel HorizontalPanel
public HorizontalPanel()
From source file:ch.heftix.mailxel.client.ConfigGrid.java
License:Open Source License
public ConfigGrid(final MailServiceAsync mailxelService, final MailxelPanel mailxelPanel) { this.mailxelService = mailxelService; this.mailxelPanel = mailxelPanel; lbu.add("Production", LOGConstants.PRODUCTION); lbu.add("Test", LOGConstants.TEST); lbu.add("Development", LOGConstants.DEV); lBUAddressDisplay.add("Shortname", AddressTOUtil.DISPLAY_SHORTNAME); lBUAddressDisplay.add("Name", AddressTOUtil.DISPLAY_NAME); lBUAddressDisplay.add("Address", AddressTOUtil.DISPLAY_ADDRESS); // save/*www . ja v a 2 s . c o m*/ HorizontalPanel toolbar = new HorizontalPanel(); Image save = new Image("img/save.png"); save.setTitle("Save"); save.setStylePrimaryName("mailxel-toolbar-item"); save.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { final ConfigTO cTO = new ConfigTO(); cTO.localstore = textBoxes[1][ILOCALSTORE].getText(); cTO.me = textBoxes[1][IME].getText(); cTO.replyAddressDisplayType = lBUAddressDisplay.getSelectedValue().intValue(); cTO.sentHandlingBCC = checkBoxes[1][SH_BCC].getValue(); cTO.sentHandlingStoreLocally = checkBoxes[1][SH_COPY_LOCAL].getValue(); cTO.sentHandlingCopySent = checkBoxes[1][SH_COPY_SENT].getValue(); cTO.sentHandlingCopyAccountName = textBoxes[1][SH_COPY_SENT_ACCOUNT].getText(); cTO.sentHandlingCopyFolderName = textBoxes[1][SH_COPY_SENT_FOLDER].getText(); String tmp = textBoxes[1][IMAXSEARCHROWS].getText(); cTO.maxSearchRows = ListUtil.parse(tmp, 50); tmp = textBoxes[1][IMAXADDRESSSUGGESTROWS].getText(); cTO.maxAddressSuggestions = ListUtil.parse(tmp, 10); cTO.logConfiguration = lbu.getSelectedValue().intValue(); cTO.replyAddressDisplayType = lBUAddressDisplay.getSelectedValue().intValue(); cTO.displayTime = checkBoxes[1][SH_DISPLAY_TIME].getValue(); cTO.explcitWildcards = checkBoxes[1][SH_EXPLICIT_WILDCARDS].getValue(); tmp = textBoxes[1][SH_MAX_MAIL_DOWNLOAD_PER_FOLDER].getText(); cTO.maxMailDownloadsPerFolder = ListUtil.parse(tmp, 100); tmp = textBoxes[1][SH_MAILDOWNLOAD_DELAY].getText(); cTO.downloadMailDelay = ListUtil.parse(tmp, 0); int col = 3; cTO.smtpHost = textBoxes[col][IHOST].getText(); cTO.smtpPort = textBoxes[col][IPORT].getText(); cTO.smtpUser = textBoxes[col][IUSER].getText(); List<AccountConfigTO> accounts = new ArrayList<AccountConfigTO>(); List<String> accountNames = new ArrayList<String>(); int numAccounts = textBoxes.length - 4; for (int i = 0; i < numAccounts; i++) { col++; String accountName = textBoxes[col][INAME].getText(); AccountConfigTO aTO = new AccountConfigTO(); aTO.name = accountName; aTO.server = textBoxes[col][IHOST].getText(); aTO.protocol = textBoxes[col][IPROTOCOL].getText(); aTO.isSSL = checkBoxes[col][ISSL].getValue(); aTO.port = textBoxes[col][IPORT].getText(); aTO.scannedfolders = ListUtil.getFromComaSeparated(textBoxes[col][IFOLDERS].getText()); aTO.excludedfolders = ListUtil.getFromComaSeparated(textBoxes[col][IEXCLUDE].getText()); aTO.user = textBoxes[col][IUSER].getText(); aTO.reorgRules = ListUtil.getFromComaSeparated(textBoxes[col][IREORGRULE].getText()); accountNames.add(accountName); accounts.add(aTO); } String[] aNames = new String[accountNames.size()]; accountNames.toArray(aNames); cTO.accountNames = aNames; AccountConfigTO[] aTOs = new AccountConfigTO[accounts.size()]; accounts.toArray(aTOs); cTO.accounts = aTOs; final StatusItem si = mailxelPanel.statusStart("saving configuration"); mailxelService.saveConfig(cTO, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { si.error(caught); } public void onSuccess(Void result) { si.done(); mailxelPanel.setConfig(cTO); // mailxelPanel.closeTab(ConfigGrid.this); } }); } }); Image addAccount = new Image("img/server_add.png"); addAccount.setTitle("New Account"); addAccount.setStylePrimaryName("mailxel-toolbar-item"); addAccount.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { grid.clear(); ConfigTO cTO = mailxelPanel.getConfig(); addNewAccount(cTO); fillGrid(cTO); } }); ColumnFormatter cf = grid.getColumnFormatter(); cf.setStylePrimaryName(0, "col-bg"); RowFormatter rf = grid.getRowFormatter(); for (int i = 1; i < INUMROWS; i = i + 2) { rf.setStylePrimaryName(i, "row-bg"); } toolbar.add(save); toolbar.add(addAccount); toolbar.add(status); add(toolbar); add(grid); ConfigTO cTO = mailxelPanel.getConfig(); fillGrid(cTO); }
From source file:ch.heftix.mailxel.client.IconOverviewGrid.java
License:Open Source License
public IconOverviewGrid(final MailServiceAsync mailxelService, final MailxelPanel mailxelPanel) { HorizontalPanel toolbar = new HorizontalPanel(); // Image addQuery = new Image("img/plus.png"); // addQuery.setTitle("New Query"); // addQuery.setStylePrimaryName("mailxel-toolbar-item"); // addQuery.addClickHandler(new ClickHandler() { ////from ww w .j a v a2s . c o m // public void onClick(ClickEvent sender) { // MessageQueryTO mqTO = new MessageQueryTO(); // mqTO.id = MessageQueryTO.NEW_ID; // mqTO.name = "new query"; // queries.add(mqTO); // updateGrid(queries); // MessageQueryEditGrid dg = new MessageQueryEditGrid(mailxelService, // mailxelPanel, mqTO); // mailxelPanel.addTab(dg, "new message query"); // } // }); // // toolbar.add(addQuery); add(toolbar); final TextBox query = new TextBox(); query.setWidth("400px"); // header grid.setText(LABEL_ROW, 0, "Id"); grid.setText(LABEL_ROW, 1, "Icon"); grid.setText(LABEL_ROW, 2, "Name"); final MailxelAsyncCallback<List<IconTO>> callback = new MailxelAsyncCallback<List<IconTO>>() { private StatusItem si = null; public void setStatusItem(StatusItem statusItem) { this.si = statusItem; } public void onSuccess(List<IconTO> result) { icons = result; int row = updateGrid(result); si.done("found " + Integer.toString(row - FIRST_PAYLOAD_ROW) + " icons.", 0); } public void onFailure(Throwable caught) { si.error(caught); } }; final KeyPressHandler kbla = new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (KeyCodes.KEY_ENTER == event.getCharCode()) { String snTxt = UIUtil.trimNull(query.getText()); StatusItem si = mailxelPanel.statusStart("icon search"); callback.setStatusItem(si); mailxelService.searchIcons(snTxt, callback); } } }; query.addKeyPressHandler(kbla); grid.setWidget(HEADER_ROW_1, 2, query); grid.addClickHandler(new ClickHandler() { public void onClick(ClickEvent clickEvent) { Cell cell = grid.getCellForEvent(clickEvent); final int row = cell.getRowIndex(); // row >= FIRST_PAYLOAD_ROW: skip header if (row >= FIRST_PAYLOAD_ROW) { IconTO icon = icons.get(row - FIRST_PAYLOAD_ROW); } } }); add(grid); }
From source file:ch.heftix.mailxel.client.MailDetailGrid.java
License:Open Source License
private void initWidgets() { clear();/*from w w w .j ava 2s . c o m*/ // bodyPanel = new TabPanel(); grid = new FlexTable(); categoryHistory = new FlexTable(); attachementBar = new AttachmentBar(mailxelService); bodyArea = new OrgTextArea(); bodyArea.setCharacterWidth(80); bodyArea.setVisibleLines(25); bodyArea.setReadOnly(true); HorizontalPanel toolbar = new HorizontalPanel(); toolbar.add(fwd); toolbar.add(replyAll); toolbar.add(reply); toolbar.add(new Label(" ")); toolbar.add(categorizationToolbar); toolbar.add(new Label(" ")); add(toolbar); add(grid); contentTabPanel = new OnDemandTabPanel(); contentTabPanel.add(bodyArea, "mail"); add(contentTabPanel); add(categoryHistory); }
From source file:ch.heftix.mailxel.client.MailSendGrid.java
License:Open Source License
public MailSendGrid(final MailServiceAsync mailxelService, final MailxelPanel mailxelPanel, final MailTO mailTO, final char type) { this.mailxelService = mailxelService; this.mailxelPanel = mailxelPanel; cTO = mailxelPanel.getConfig();//from w ww. ja v a 2s . c o m HorizontalPanel toolbar = new HorizontalPanel(); final Image addAttachement = new Image("img/add-attachment.png"); addAttachement.setTitle("Add Attachement"); addAttachement.setStylePrimaryName("mailxel-toolbar-item"); addAttachement.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { final PopupPanel pup = new PopupPanel(true); HorizontalPanel hp = new HorizontalPanel(); final TextBox tb = new TextBox(); tb.setWidth("300px"); hp.add(tb); // final FileUpload upload = new FileUpload(); // hp.add(upload); Button b = new Button(); b.setText("Add"); b.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { // String name = upload.getFilename(); // // upload.g String name = tb.getText(); if (null != name) { name = name.trim(); if (name.length() > 0) { AttachmentTO aTO = new AttachmentTO(); aTO.name = name; attachmentBar.addCheckableAttachement(aTO); pup.hide(); } } } }); hp.add(b); pup.add(hp); int x = addAttachement.getAbsoluteLeft(); int y = addAttachement.getAbsoluteTop(); pup.setPopupPosition(x, y); pup.show(); } }); final Image setFrom = new Image("img/set-from.png"); setFrom.setTitle("Set From address"); setFrom.setStylePrimaryName("mailxel-toolbar-item"); setFrom.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { grid.insertRow(0); grid.setText(0, 0, "From"); MailSendGrid.this.fromBar = new AddressEditBar(mailxelService, mailxelPanel); grid.setWidget(0, 1, fromBar); } }); Image postpone = new Image("img/save.png"); postpone.setTitle("Postpone Message"); postpone.setStylePrimaryName("mailxel-toolbar-item"); postpone.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final StatusItem si = mailxelPanel.statusStart("postpone"); MailTO mt = createMail(); mailxelService.postpone(mt, new AsyncCallback<String>() { public void onFailure(Throwable caught) { si.error(caught); } public void onSuccess(String result) { if (null != result && result.startsWith("200 OK")) { si.done(); mailxelPanel.closeTab(MailSendGrid.this); } else { si.error("Postpone failed: " + result); } } }); } }); Image send = new Image("img/paper-plane.png"); if (TYPE_SELF == type) { send.setTitle("Store Note"); } else { send.setTitle("Send Mail"); } send.setStylePrimaryName("mailxel-toolbar-item"); send.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { final StatusItem si = mailxelPanel.statusStart("send/store"); if (sending) { si.error("mail send is already in process"); return; } else { sending = true; } MailTO mt = createMail(); if (TYPE_SELF == type) { mailxelService.storeNote(mt, new AsyncCallback<String>() { public void onFailure(Throwable caught) { si.error(caught); sending = false; } public void onSuccess(String result) { if (null != result && result.startsWith("200 OK")) { si.done(); sending = false; mailxelPanel.closeTab(MailSendGrid.this); } else { si.error("Storing note failed: " + result); sending = false; } } }); } else { mailxelService.send(mt, new AsyncCallback<String>() { public void onFailure(Throwable caught) { si.error(caught); sending = false; } public void onSuccess(String status) { if (status.startsWith("200")) { si.done(); sending = false; if (TYPE_NEW != type) { // add a category entry: answered or forwarded String cat = "ANS"; if (TYPE_FORWARD == type) { cat = "FWD"; } List<Integer> origMailId = new ArrayList<Integer>(); origMailId.add(mailTO.id); final StatusItem sic = mailxelPanel.statusStart("update send/answer flags"); mailxelService.updateCategories(origMailId, cat, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { sic.error(caught); } public void onSuccess(Void result) { sic.done("sent and flags updated", 0); } }); } // close tab mailxelPanel.closeTab(MailSendGrid.this); } else { si.error(status); sending = false; } } }); } } }); if (TYPE_SELF != type) { toolbar.add(setFrom); toolbar.add(postpone); } toolbar.add(addAttachement); toolbar.add(send); add(toolbar); add(statusMessage); initWidgets(mailTO, type); }
From source file:ch.heftix.mailxel.client.MailxelMainToolBar.java
License:Open Source License
public MailxelMainToolBar(final MailServiceAsync mailxelService, final MailxelPanel mailxelPanel) { this.mailxelService = mailxelService; this.mailxelPanel = mailxelPanel; logo = new Image("img/mailxel.png"); logo.setTitle("MailXel " + Version.getVersion()); logo.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { PopupPanel pp = new PopupPanel(true); DisclosurePanel dp = new DisclosurePanel("MailXel " + Version.getVersion()); dp.setWidth("400px"); dp.setOpen(true);//w w w . ja v a2 s . c o m HTML html = new HTML(); StringBuffer sb = new StringBuffer(); sb.append("(c) 2008-2010 by Simon Hefti. All rights reserved.<br/>"); sb.append( "<p>mailxel is licensed under the <a href=\"http://www.eclipse.org/legal/epl-v10.html\">EPL 1.0</a>. mailxel is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied."); sb.append("<p>mailxel relies on the following components:"); sb.append("<ul>"); sb.append( "<li>GWT, <a href=\"http://code.google.com/webtoolkit\">http://code.google.com/webtoolkit</a></li>"); sb.append( "<li>sqlite-jdbc, <a href=\"http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC\">http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC</a></li>"); sb.append( "<li>(and thus on sqlite itself, <a href=\"http://www.sqlite.org\">http://www.sqlite.org</a>)</li>"); sb.append( "<li>Java Mail API, <a href=\"http://java.sun.com/products/javamail\">http://java.sun.com/products/javamail</a></li>"); sb.append( "<li>jetty servlet container, <a href=\"http://www.eclipse.org/jetty/\">http://www.eclipse.org/jetty/</a></li>"); sb.append( "<li>fugue-icons, <a href=\"http://code.google.com/p/fugue-icons-src/\">http://code.google.com/p/fugue-icons-src/</a></li>"); sb.append("<li>jsoup, <a href=\"http://jsoup.org\">http://jsoup.org</a></li>"); sb.append("</ul>"); html.setHTML(sb.toString()); dp.add(html); dp.setOpen(true); pp.add(dp); pp.show(); } }); Image home = new Image("img/find.png"); home.setTitle("Search"); home.setStylePrimaryName("mailxel-toolbar-item"); home.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { Panel panel = new MailOverviewGrid(mailxelService, mailxelPanel); mailxelPanel.addTab(panel, "Search"); } }); final Image query = new Image("img/document-task.png"); query.setTitle("Search (predefined query)"); query.setStylePrimaryName("mailxel-toolbar-item"); query.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { final StatusItem si = mailxelPanel.statusStart("retrieve stored message queries"); mailxelService.searchQueries(MessageQueryTO.T_MESSAGE_QUERY, null, new AsyncCallback<List<MessageQueryTO>>() { public void onFailure(Throwable caught) { si.error(caught); } public void onSuccess(List<MessageQueryTO> result) { si.done(); if (null != result && result.size() > 0) { PopupMenu popupMenu = new PopupMenu(query); for (MessageQueryTO mqTO : result) { String name = mqTO.shortname + " (" + UIUtil.shorten(mqTO.name) + ")"; MenuItem menuItem = new MenuItem(name, new MessageQueryCommand( mailxelService, mailxelPanel, popupMenu, mqTO)); String url = DirectMailServiceUtil.getIconURL(mqTO.iconId); if (null != url) { String html = "<img src=\"" + url + "\"/> " + name; menuItem.setHTML(html); } popupMenu.addItem(menuItem); } popupMenu.show(); } } }); } }); Image mailnew = new Image("img/mail-new.png"); mailnew.setTitle("New Mail"); mailnew.setStylePrimaryName("mailxel-toolbar-item"); mailnew.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { final MailSendGrid mailSendGrid = new MailSendGrid(mailxelService, mailxelPanel, null, MailSendGrid.TYPE_NEW); mailxelPanel.addTab(mailSendGrid, "New Mail"); } }); Image noteToSelf = new Image("img/note.png"); noteToSelf.setTitle("Note to myself"); noteToSelf.setStylePrimaryName("mailxel-toolbar-item"); noteToSelf.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { final MailSendGrid mailSendGrid = new MailSendGrid(mailxelService, mailxelPanel, null, MailSendGrid.TYPE_SELF); mailxelPanel.addTab(mailSendGrid, "New Note"); } }); Image contacts = new Image("img/address-book.png"); contacts.setTitle("Address Book"); contacts.setStylePrimaryName("mailxel-toolbar-item"); contacts.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { AddressOverviewGrid ag = new AddressOverviewGrid(mailxelService, mailxelPanel); mailxelPanel.addTab(ag, "Contacts"); } }); /** * mail download menu on click, a menu with the available accounts is * displayed, allowing the user is asked to choose the data source. */ final Image download = new Image("img/download-mail.png"); download.setTitle("Mail download"); download.setStylePrimaryName("mailxel-toolbar-item"); download.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { ConfigTO configTO = mailxelPanel.getConfig(); String[] accounts = configTO.accountNames; if (null != accounts && accounts.length > 0) { PopupMenu popupMenu = new PopupMenu(download); // first item: allow download from all known accounts MenuItem menuItem = new MenuItem("Scan all accounts", new ScanMailFolderCommand(mailxelService, mailxelPanel, popupMenu, accounts)); popupMenu.addItem(menuItem); // add one menu item per account for (int i = 0; i < accounts.length; i++) { String[] selectedAccount = new String[1]; selectedAccount[0] = accounts[i]; menuItem = new MenuItem(accounts[i], new ScanMailFolderCommand(mailxelService, mailxelPanel, popupMenu, selectedAccount)); popupMenu.addItem(menuItem); } popupMenu.show(); } } }); final Image reorgMailFolder = new Image("img/wand.png"); reorgMailFolder.setTitle("reorganize mail folder"); reorgMailFolder.setStylePrimaryName("mailxel-toolbar-item"); reorgMailFolder.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { ConfigTO configTO = mailxelPanel.getConfig(); String[] accounts = configTO.accountNames; if (null != accounts && accounts.length > 0) { PopupMenu popupMenu = new PopupMenu(reorgMailFolder); // first item: allow reorg from all known accounts MenuItem menuItem = new MenuItem("All accounts", new ReorgMailFolderCommand(mailxelService, mailxelPanel, popupMenu, reorgMailFolder, accounts)); popupMenu.addItem(menuItem); // add one menu item per account for (int i = 0; i < accounts.length; i++) { String[] selectedAccount = new String[1]; selectedAccount[0] = accounts[i]; menuItem = new MenuItem(accounts[i], new ReorgMailFolderCommand(mailxelService, mailxelPanel, popupMenu, reorgMailFolder, selectedAccount)); popupMenu.addItem(menuItem); } popupMenu.show(); } } }); final Image categories = new Image("img/tags.png"); categories.setTitle("Manage Categories"); categories.setStylePrimaryName("mailxel-toolbar-item"); categories.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { CategoryOverviewGrid cog = new CategoryOverviewGrid(mailxelService, mailxelPanel); mailxelPanel.addTab(cog, "Categories"); } }); final Image setup = new Image("img/preferences-system.png"); setup.setTitle("System Setup"); setup.setStylePrimaryName("mailxel-toolbar-item"); setup.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { // ConfigTabPanel cg = new ConfigTabPanel(); ConfigGrid cg = new ConfigGrid(mailxelService, mailxelPanel); mailxelPanel.addTab(cg, "Setup"); } }); final Image login = new Image("img/lock.png"); login.setTitle("Login"); login.setStylePrimaryName("mailxel-toolbar-item"); login.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { // create login box LoginPanel loginPanel = new LoginPanel(mailxelService, mailxelPanel); int x = login.getAbsoluteLeft(); int y = login.getAbsoluteTop(); loginPanel.setPopupPosition(x, y); loginPanel.show(); } }); final Image additional = new Image("img/context-menu.png"); additional.setTitle("Additional functions"); additional.setStylePrimaryName("mailxel-toolbar-item"); final PopupCommand importMboxCommand = new PopupCommand() { public void execute() { final PopupPanel pup = new PopupPanel(true); HorizontalPanel hp = new HorizontalPanel(); final TextBox tb = new TextBox(); tb.setWidth("300px"); hp.add(tb); Button b = new Button(); b.setText("import"); b.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { String name = tb.getText(); if (null != name) { name = name.trim(); if (name.length() > 0) { final StatusItem si = mailxelPanel.statusStart("Import from mbox: " + name); mailxelService.importMboxFile(name, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { si.error(caught); } public void onSuccess(Void result) { si.done(); } }); pup.hide(); } } } }); hp.add(b); pup.add(hp); int x = additional.getAbsoluteLeft(); int y = additional.getAbsoluteTop(); pup.setPopupPosition(x, y); /** show input box for path to mbox file */ pup.show(); /** hide the list of available additional commands */ hide(); } }; final PopupCommand addressUploadCommand = new PopupCommand() { public void execute() { AddressUploadGrid ug = new AddressUploadGrid(mailxelService, mailxelPanel); mailxelPanel.addTab(ug, "Address Upload"); /** hide the list of available additional commands */ hide(); } }; final Command showWelcomePanelCommand = new Command() { public void execute() { WelcomeToMailxelPanel wp = new WelcomeToMailxelPanel(mailxelService, mailxelPanel); mailxelPanel.addTab(wp, "Welcome"); } }; final PopupCommand deleteConfigCommand = new PopupCommand() { public void execute() { PopupPanel pop = new PopupPanel(true, true); HorizontalPanel hp = new HorizontalPanel(); Label label = new Label("Really delete all configuration?"); hp.add(label); Button b = new Button(); b.setText("Ok"); b.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final StatusItem si = mailxelPanel.statusStart("deleting configuration"); mailxelService.deleteConfig(new AsyncCallback<Void>() { public void onFailure(Throwable caught) { si.error(caught); } public void onSuccess(Void result) { si.done(); } }); } }); hp.add(b); pop.add(hp); int x = additional.getAbsoluteLeft(); int y = additional.getAbsoluteTop(); pop.setPopupPosition(x, y); pop.show(); /** hide the list of available additional commands */ hide(); } }; final Command updateToMeFlagCommand = new Command() { public void execute() { final StatusItem si = mailxelPanel.statusStart("Update 'to me' flag"); mailxelService.updateToMeFlag(new AsyncCallback<Void>() { public void onFailure(Throwable caught) { si.error(caught); } public void onSuccess(Void result) { si.done(); } }); } }; final Command updateFromMeFlagCommand = new Command() { public void execute() { final StatusItem si = mailxelPanel.statusStart("Update 'from me' flag"); mailxelService.updateFromMeFlag(new AsyncCallback<Void>() { public void onFailure(Throwable caught) { si.error(caught); } public void onSuccess(Void result) { si.done(); } }); } }; final Command showStatisticsCommand = new Command() { public void execute() { StatisticsGrid sg = new StatisticsGrid(mailxelService, mailxelPanel); mailxelPanel.addTab(sg, "Statistics"); } }; final Command showIconsCommand = new Command() { public void execute() { IconOverviewGrid og = new IconOverviewGrid(mailxelService, mailxelPanel); mailxelPanel.addTab(og, "Icons"); } }; final Command showMessageQueriesCommand = new Command() { public void execute() { MessageQueryOverviewGrid mqog = new MessageQueryOverviewGrid(mailxelService, mailxelPanel); mailxelPanel.addTab(mqog, "Message Queries"); } }; final Command showAttachmentGridCommand = new Command() { public void execute() { AttachmentOverviewGrid aog = new AttachmentOverviewGrid(mailxelService, mailxelPanel); mailxelPanel.addTab(aog, "Attachment Overview"); } }; final Command closeAllTabsCommand = new Command() { public void execute() { mailxelPanel.closeAllNonEditTabs(); } }; final Command dbHousekeeping = new Command() { public void execute() { final StatusItem si = mailxelPanel.statusStart("DB housekeeping"); mailxelService.housekeeping(new AsyncCallback<String>() { public void onFailure(Throwable caught) { si.error(caught); } public void onSuccess(String result) { if (result.startsWith("200 OK")) { si.done(); } else { si.error(result); } } }); } }; final Command messageCount = new Command() { public void execute() { updateCounts(); } }; additional.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { MenuBar popupMenuBar = new MenuBar(true); PopupPanel popupPanel = new PopupPanel(true); MenuItem menuItem = new MenuItem("Attachment Overview", showAttachmentGridCommand); popupMenuBar.addItem(menuItem); menuItem = new MenuItem("Close all Tabs", closeAllTabsCommand); popupMenuBar.addItem(menuItem); menuItem = new MenuItem("Message Queries", showMessageQueriesCommand); popupMenuBar.addItem(menuItem); menuItem = new MenuItem("DB Housekeeping", dbHousekeeping); popupMenuBar.addItem(menuItem); menuItem = new MenuItem("update pending messages count", messageCount); popupMenuBar.addItem(menuItem); menuItem = new MenuItem("Statistics", showStatisticsCommand); popupMenuBar.addItem(menuItem); menuItem = new MenuItem("Icons", showIconsCommand); popupMenuBar.addItem(menuItem); menuItem = new MenuItem("Import mbox file", importMboxCommand); importMboxCommand.setPopupPanel(popupPanel); popupMenuBar.addItem(menuItem); menuItem = new MenuItem("Address upload", addressUploadCommand); addressUploadCommand.setPopupPanel(popupPanel); popupMenuBar.addItem(menuItem); menuItem = new MenuItem("Welcome", showWelcomePanelCommand); popupMenuBar.addItem(menuItem); menuItem = new MenuItem("Delete existing configuration", deleteConfigCommand); popupMenuBar.addItem(menuItem); menuItem = new MenuItem("Update 'from me' flag", updateFromMeFlagCommand); popupMenuBar.addItem(menuItem); menuItem = new MenuItem("Update 'to me' flag", updateToMeFlagCommand); popupMenuBar.addItem(menuItem); popupMenuBar.setVisible(true); popupPanel.add(popupMenuBar); int x = additional.getAbsoluteLeft(); int y = additional.getAbsoluteTop(); popupPanel.setPopupPosition(x, y); popupPanel.show(); } }); updateCounts(); add(home); add(query); add(mailnew); add(noteToSelf); add(contacts); add(categories); add(download); add(reorgMailFolder); add(setup); add(login); add(additional); add(logo); add(msgCountAct); }
From source file:ch.heftix.mailxel.client.MessageQueryEditGrid.java
License:Open Source License
public MessageQueryEditGrid(final MailServiceAsync mailxelService, final MailxelPanel mailxelPanel, final MessageQueryTO mqTO) { HorizontalPanel toolbar = new HorizontalPanel(); Image save = new Image("img/save.png"); save.setTitle("Save"); save.setStylePrimaryName("mailxel-toolbar-item"); save.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { final StatusItem si = mailxelPanel.statusStart("message query save"); if (tbName.isDirty()) { mqTO.nameDirty = true;/*from ww w . ja va2 s . c o m*/ mqTO.name = tbName.getTextTrimmed(); } if (tbShortname.isDirty()) { mqTO.shortNameDirty = true; mqTO.shortname = tbShortname.getTextTrimmed(); } if (taSql.isDirty()) { mqTO.sqlDirty = true; mqTO.sql = taSql.getTextTrimmed(); } mailxelService.updateMessageQuery(mqTO, new AsyncCallback<MessageQueryTO>() { public void onFailure(Throwable caught) { si.error(caught); } public void onSuccess(MessageQueryTO result) { si.done(); if (null != mailxelTab) { mailxelTab.setTabText(result.name); } } }); } }); toolbar.add(save); add(toolbar); grid = new FlexTable(); tbName.setText(mqTO.name); tbShortname.setText(mqTO.shortname); taSql.setText(mqTO.sql); grid.setText(0, 0, "Id"); grid.setText(0, 1, Integer.toString(mqTO.id)); grid.setText(1, 0, "Access Count"); grid.setText(1, 1, Integer.toString(mqTO.count)); grid.setText(2, 0, "Shortname"); grid.setWidget(2, 1, tbShortname); grid.setText(3, 0, "Name"); grid.setWidget(3, 1, tbName); add(grid); taSql.setCharacterWidth(80); taSql.setVisibleLines(25); taSql.setText(mqTO.sql); add(taSql); }
From source file:ch.heftix.mailxel.client.MessageQueryOverviewGrid.java
License:Open Source License
public MessageQueryOverviewGrid(final MailServiceAsync mailxelService, final MailxelPanel mailxelPanel) { HorizontalPanel toolbar = new HorizontalPanel(); Image addQuery = new Image("img/plus.png"); addQuery.setTitle("New Query"); addQuery.setStylePrimaryName("mailxel-toolbar-item"); addQuery.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { MessageQueryTO mqTO = new MessageQueryTO(); mqTO.id = Constants.UNDEFINED_ID; mqTO.name = "new query"; queries.add(mqTO);// ww w .j a v a 2s .c o m updateGrid(queries); MessageQueryEditGrid dg = new MessageQueryEditGrid(mailxelService, mailxelPanel, mqTO); mailxelPanel.addTab(dg, "new message query"); } }); toolbar.add(addQuery); add(toolbar); final TextBox query = new TextBox(); query.setWidth("400px"); // header grid.setText(LABEL_ROW, 0, "Count"); grid.setText(LABEL_ROW, 1, "Short"); grid.setText(LABEL_ROW, 2, "Query Name"); final MailxelAsyncCallback<List<MessageQueryTO>> callback = new MailxelAsyncCallback<List<MessageQueryTO>>() { private StatusItem si = null; public void setStatusItem(StatusItem statusItem) { this.si = statusItem; } public void onSuccess(List<MessageQueryTO> result) { queries = result; int row = updateGrid(result); si.done("found " + Integer.toString(row - FIRST_PAYLOAD_ROW) + " queries.", 0); } public void onFailure(Throwable caught) { si.error(caught); } }; final KeyPressHandler kbla = new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (KeyCodes.KEY_ENTER == event.getCharCode()) { String snTxt = UIUtil.trimNull(query.getText()); StatusItem si = mailxelPanel.statusStart("query search"); callback.setStatusItem(si); mailxelService.searchQueries(null, snTxt, callback); } } }; query.addKeyPressHandler(kbla); grid.setWidget(HEADER_ROW_1, 2, query); grid.addClickHandler(new ClickHandler() { public void onClick(ClickEvent clickEvent) { Cell cell = grid.getCellForEvent(clickEvent); final int row = cell.getRowIndex(); // row >= FIRST_PAYLOAD_ROW: skip header if (row >= FIRST_PAYLOAD_ROW) { MessageQueryTO query = queries.get(row - FIRST_PAYLOAD_ROW); final MessageQueryEditGrid detailGrid = new MessageQueryEditGrid(mailxelService, mailxelPanel, query); mailxelPanel.addTab(detailGrid, "mquery: " + query.shortname); } } }); add(grid); }
From source file:ch.heftix.mailxel.client.MultiLinePanel.java
License:Open Source License
/** * @param maxLength a new line is started after maxLength chars * @param separator widget used to separate entries * @param separatorLength length of separator widget, in chars *//*ww w.ja va2 s . c om*/ public MultiLinePanel(final int maxLength, final String separator) { this.maxLength = maxLength; this.separator = separator; curPanel = new HorizontalPanel(); totalChars = 0; add(curPanel); }
From source file:ch.heftix.mailxel.client.MultiLinePanel.java
License:Open Source License
/** * @param maxLength a new line is started after maxLength chars */// w w w . j ava 2s . c o m public MultiLinePanel(final int maxLength) { this.maxLength = maxLength; this.separator = null; curPanel = new HorizontalPanel(); totalChars = 0; add(curPanel); }
From source file:ch.heftix.mailxel.client.MultiLinePanel.java
License:Open Source License
/** * add new widget, create new line if necessary * /*from w w w . j a va2 s . c o m*/ * @param widget widget to be added * @param length length, in chars, of this widget */ public void addWidget(final Widget widget, final int length) { if (totalChars > maxLength) { // start a new line curPanel = new HorizontalPanel(); add(curPanel); totalChars = 0; } if (null != separator && curPanel.getWidgetCount() > 0) { curPanel.add(new Label(separator)); totalChars += separator.length(); } curPanel.add(widget); widgetPanelMap.put(widget, curPanel); totalChars += length; }