List of usage examples for com.google.gwt.user.client.ui HorizontalPanel HorizontalPanel
public HorizontalPanel()
From source file:cc.alcina.framework.gwt.client.widget.dialog.LoginDisplayer.java
License:Apache License
public LoginDisplayer() { dialogBox = new GlassDialogBox(); dialogBox.setText("Login"); dialogBox.setAnimationEnabled(true); mainPanel = new FlowPanel(); mainPanel.setStyleName("alcina-Login"); mainPanel.ensureDebugId(AlcinaDebugIds.LOGIN_FORM); this.introWidget = new FlowPanel(); introWidget.setVisible(false);//w ww.ja va 2 s .co m mainPanel.add(introWidget); introWidget.setStyleName("intro"); cancelButton = new Button("Cancel"); okButton = new Button("Login"); okButton.ensureDebugId(AlcinaDebugIds.LOGIN_SUBMIT); table = new FlexTable(); table.setWidth("100%"); table.setCellSpacing(2); this.usernameLabel = new Label("Username: "); table.setWidget(0, 0, usernameLabel); nameBox = new TextBox(); WidgetUtils.disableTextBoxHelpers(nameBox); nameBox.ensureDebugId(AlcinaDebugIds.LOGIN_USERNAME); table.setWidget(0, 1, nameBox); table.setWidget(1, 0, new Label("Password: ")); pwdBox = new PasswordTextBox(); WidgetUtils.disableTextBoxHelpers(pwdBox); pwdBox.ensureDebugId(AlcinaDebugIds.LOGIN_PASSWORD); table.setWidget(1, 1, pwdBox); pwdBox.addKeyPressHandler(new EnterAsClickKeyboardListener(pwdBox, okButton)); nameBox.addKeyPressHandler(new EnterAsClickKeyboardListener(nameBox, okButton)); rememberMeBox = new CheckBox(); rememberMeBox.setValue(true); table.setWidget(2, 0, rememberMeBox); table.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); table.setWidget(2, 1, new Label("Remember me on this computer")); statusLabel = new Label("Logging in"); statusLabel.setVisible(false); table.setWidget(4, 1, statusLabel); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); hPanel.setSpacing(5); hPanel.add(okButton); okButton.addStyleName("marginRight10"); hPanel.add(cancelButton); table.setWidget(3, 1, hPanel); mainPanel.add(table); dialogBox.setWidget(mainPanel); }
From source file:cc.alcina.framework.gwt.client.widget.dialog.OkCancelDialogBox.java
License:Apache License
public OkCancelDialogBox(String title, Widget widget, PermissibleActionListener listener, HorizontalAlignmentConstant widgetAlign) { this.widget = widget; this.vetoableActionListener = listener; setText(title);/*ww w . j ava 2 s . co m*/ setAnimationEnabled(showAnimated()); VerticalPanel vp = new VerticalPanel(); vp.add(widget); vp.setCellHorizontalAlignment(widget, widgetAlign); buttonsPanel = new HorizontalPanel(); cancelButton = new Button("Cancel"); cancelButton.addClickHandler(e -> cancel()); okButton = new Button(SafeHtmlUtils.fromString(getOKButtonName())); okButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onOkButtonClicked(); } }); buttonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); buttonsPanel.setSpacing(8); buttonsPanel.add(okButton); buttonsPanel.add(cancelButton); vp.add(buttonsPanel); vp.setCellHorizontalAlignment(buttonsPanel, HasHorizontalAlignment.ALIGN_CENTER); setWidget(vp); adjustDisplay(); center(); }
From source file:cc.kune.common.client.actions.gwtui.GwtSimpleGuiItem.java
License:GNU Affero Public License
/** * Instantiates a new gwt simple gui item. * * @param provider the provider/*from www . j a v a 2s . c o m*/ * @param i18n the i18n */ public GwtSimpleGuiItem(final GuiProvider provider, final HasRTL i18n) { super(provider, i18n); bar = new HorizontalPanel(); initWidget(bar); }
From source file:cc.kune.common.client.actions.ui.ActionSimplePanel.java
License:GNU Affero Public License
/** * Instantiates a new action simple panel. * * @param guiProvider the gui provider/*from w ww .ja v a 2s .co m*/ * @param i18n the i18n */ @Inject public ActionSimplePanel(final GuiProvider guiProvider, final HasRTL i18n) { super(guiProvider, i18n); bar = new HorizontalPanel(); initWidget(bar); }
From source file:cc.kune.core.client.auth.SignInPanel.java
License:GNU Affero Public License
/** * Creates the register and forgot passwd. * * @return the vertical panel/*from www.j ava 2s. co m*/ */ private VerticalPanel createRegisterAndForgotPasswd() { final VerticalPanel noAccRegisterPanel = new VerticalPanel(); final HorizontalPanel hpanel = new HorizontalPanel(); final Label dontHaveAccount = new Label(i18n.t("Don't have an account?")); registerLabel = new Label(i18n.t("Create one.")); createLink(registerLabel, CREATE_ONE); registerLabel.addStyleName("kune-Margin-Medium-l"); forgotPasswordLabel = new Label(i18n.t("Lost your password?")); createLink(forgotPasswordLabel, FORGOT_PASSWD); hpanel.add(dontHaveAccount); hpanel.add(registerLabel); noAccRegisterPanel.add(hpanel); noAccRegisterPanel.add(forgotPasswordLabel); return noAccRegisterPanel; }
From source file:ccm.CCM1.gwt.client.ui.GwtColorPicker.java
License:Apache License
public GwtColorPicker() { // Create a 4x4 grid of buttons with names for 16 colors final Grid grid = new Grid(4, 4); final String[] colors = new String[] { "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "purple", "red", "silver", "teal", "white", "yellow" }; int colornum = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++, colornum++) { // Create a button for each color final Button button = new Button(colors[colornum]); button.addClickListener(this); // Put the button in the Grid layout grid.setWidget(i, j, button); // Set the button background colors. DOM.setStyleAttribute(button.getElement(), "background", colors[colornum]); // For dark colors, the button label must be in white. if ("black navy maroon blue purple".indexOf(colors[colornum]) != -1) { DOM.setStyleAttribute(button.getElement(), "color", "white"); }/*ww w. j ava 2s .c o m*/ } } // Create a panel with the color grid and currently selected color // indicator final HorizontalPanel panel = new HorizontalPanel(); panel.add(grid); panel.add(currentcolor); // Set the class of the color selection feedback box to allow CSS // styling. // We need to obtain the DOM element for the current color label. // This assumes that the <td> element of the HorizontalPanel is // the parent of the label element. Notice that the element has no // parent // before the widget has been added to the horizontal panel. final Element panelcell = DOM.getParent(currentcolor.getElement()); DOM.setElementProperty(panelcell, "className", "colorpicker-currentcolorbox"); // Set initial color. This will be overridden with the value read from // server. setColor("white"); // Composite GWT widgets must call initWidget(). initWidget(panel); }
From source file:ch.heftix.mailxel.client.AddressOverviewGrid.java
License:Open Source License
public AddressOverviewGrid(final MailServiceAsync mailxelService, final MailxelPanel mailxelPanel) { 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("address update"); List<AddressTO> addressesToSave = new ArrayList<AddressTO>(); int len = grid.getRowCount(); for (int i = FIRST_PAYLOAD_ROW; i < len; i++) { TextBoxWChangeDetection tbS = (TextBoxWChangeDetection) grid.getWidget(i, 0); TextBoxWChangeDetection tbN = (TextBoxWChangeDetection) grid.getWidget(i, 1); TextBoxWChangeDetection tbA = (TextBoxWChangeDetection) grid.getWidget(i, 2); CheckBoxWChangeDetection cbV = (CheckBoxWChangeDetection) grid.getWidget(i, 3); CheckBoxWChangeDetection cbP = (CheckBoxWChangeDetection) grid.getWidget(i, 4); if (null != tbS && null != tbA && null != cbV && null != cbP && (tbS.isDirty() || tbN.isDirty() || tbA.isDirty() || cbV.isDirty() || cbP.isDirty())) { // add to save list AddressTO to = new AddressTO(); to.shortname = tbS.getText(); if (tbS.isDirty()) { to.shortNameDirty = true; }/*from www . ja v a 2 s . c o m*/ to.name = tbN.getText(); if (tbN.isDirty()) { to.nameDirty = true; } to.address = tbA.getText(); to.isValid = cbV.getValue(); if (cbV.isDirty()) { to.validDirty = true; } to.isPreferred = cbP.getValue(); if (cbP.isDirty()) { to.preferredDirty = true; } addressesToSave.add(to); } } mailxelService.saveAddresses(addressesToSave, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { si.error(caught); } public void onSuccess(Void result) { si.done(); } }); } }); toolbar.add(save); // toolbar.add(statusMessage); add(toolbar); final TextBox shortname = new TextBox(); shortname.setWidth("50px"); final TextBox address = new TextBox(); address.setWidth("300px"); // header grid.setText(LABEL_ROW, 0, "Shortname"); grid.setText(LABEL_ROW, 1, "Name"); grid.setText(LABEL_ROW, 2, "Address"); grid.setText(LABEL_ROW, 3, "Valid"); grid.setText(LABEL_ROW, 4, "Pref."); grid.setText(LABEL_ROW, 5, "Last Seen"); grid.setText(LABEL_ROW, 6, "# Seen"); ColumnFormatter fmt = grid.getColumnFormatter(); fmt.setWidth(0, "50px"); fmt.setWidth(1, "100px"); fmt.setWidth(2, "300px"); fmt.setWidth(3, "50px"); fmt.setWidth(4, "50px"); fmt.setWidth(5, "100px"); fmt.setWidth(6, "100px"); final AsyncCallback<List<AddressTO>> callback = new AsyncCallback<List<AddressTO>>() { public void onSuccess(List<AddressTO> result) { addresses = result; // clean all except header int rows = grid.getRowCount(); for (int i = rows - 1; i >= FIRST_PAYLOAD_ROW; i--) { grid.removeRow(i); } int row = FIRST_PAYLOAD_ROW; for (AddressTO address : result) { TextBoxWChangeDetection snTB = new TextBoxWChangeDetection(); snTB.setText(address.shortname); snTB.setWidth("50px"); grid.setWidget(row, 0, snTB); // grid.setText(row, 1, address.address); TextBoxWChangeDetection nTB = new TextBoxWChangeDetection(); if (null != address.name) { nTB.setText(address.name); } nTB.setWidth("100px"); grid.setWidget(row, 1, nTB); TextBoxWChangeDetection aTB = new TextBoxWChangeDetection(); aTB.setText(address.address); aTB.setWidth("300px"); grid.setWidget(row, 2, aTB); CheckBoxWChangeDetection cbValid = new CheckBoxWChangeDetection(); cbValid.setValue(address.isValid); grid.setWidget(row, 3, cbValid); CheckBoxWChangeDetection cbPref = new CheckBoxWChangeDetection(); cbPref.setValue(address.isPreferred); grid.setWidget(row, 4, cbPref); grid.setText(row, 5, address.lastSeen); grid.setText(row, 6, Integer.toString(address.count)); row++; } if (null != statusItem) { statusItem.done("found " + Integer.toString(row - FIRST_PAYLOAD_ROW) + " addresses.", 0); statusItem = null; } } public void onFailure(Throwable caught) { statusItem.error(caught); } }; final KeyPressHandler kbla = new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (KeyCodes.KEY_ENTER == event.getCharCode()) { String snTxt = UIUtil.trimNull(shortname.getText()); String aTxt = UIUtil.trimNull(address.getText()); statusItem = mailxelPanel.statusStart("address search"); mailxelService.searchAddresses(snTxt, aTxt, callback); } } }; // final KeyboardListenerAdapter kbla = new KeyboardListenerAdapter() { // // public void onKeyPress(Widget sender, char keyCode, int modifiers) { // if (KEY_ENTER == keyCode) { // String snTxt = UIUtil.trimNull(shortname.getText()); // String aTxt = UIUtil.trimNull(address.getText()); // // statusItem = mailxelPanel.statusStart("address search started"); // // mailxelService.searchAddresses(snTxt, aTxt, callback); // } // } // }; shortname.addKeyPressHandler(kbla); address.addKeyPressHandler(kbla); grid.setWidget(HEADER_ROW_1, 0, shortname); grid.setWidget(HEADER_ROW_1, 2, address); add(grid); }
From source file:ch.heftix.mailxel.client.AddressUploadGrid.java
License:Open Source License
public AddressUploadGrid(final MailServiceAsync mailxelService, final MailxelPanel mailxelPanel) { 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) { String text = textArea.getText(); mailxelService.saveAddresses(text, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { statusMessage.setText("Cannot save addresses: " + caught); }//from w w w . j a v a 2 s . c o m public void onSuccess(Void result) { statusMessage.setText("Addresses saved"); } }); } }); toolbar.add(save); toolbar.add(statusMessage); add(toolbar); textArea.setCharacterWidth(80); textArea.setVisibleLines(25); add(textArea); }
From source file:ch.heftix.mailxel.client.CategorizationToolbar.java
License:Open Source License
public CategorizationToolbar(final HasPrevNext prevNextProvider, final MailDetailDisplay mailDetailDisplay, final MailServiceAsync mailxelService, final MailxelPanel mailxelPanel) { this.prevNextProvider = prevNextProvider; this.mailDetailDisplay = mailDetailDisplay; final AsyncCallback<Void> markCatCallback = new AsyncCallback<Void>() { public void onSuccess(Void result) { // mailxelPanel.setWorking(false); showNext();//from w w w .j a va2s. c o m mailxelPanel.updateMailCounts(); } public void onFailure(Throwable caught) { // mailxelPanel.setWorking(false); mailxelPanel.statusError("set categories failed", caught); } }; Image fwd = new Image("img/resultset_next.png"); fwd.setTitle("Next"); fwd.setStylePrimaryName("mailxel-toolbar-item"); fwd.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { showNext(); } }); Image prev = new Image("img/resultset_previous.png"); prev.setTitle("Next"); prev.setStylePrimaryName("mailxel-toolbar-item"); prev.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { showPrev(); } }); Image scheduleForLater = new Image("img/clock_go.png"); scheduleForLater.setTitle("Schedule for Later"); scheduleForLater.setStylePrimaryName("mailxel-toolbar-item"); scheduleForLater.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { if (currentMessageId > 0) { mailxelService.markStatus(currentMessageId, 999, markCatCallback); } } }); // Image scheduleForToday = new Image("img/target.png"); // scheduleForToday.setTitle("Schedule for Today"); // scheduleForToday.setStylePrimaryName("mailxel-toolbar-item"); // scheduleForToday.addClickHandler(new ClickHandler() { // // public void onClick(ClickEvent sender) { // if (currentMessageId > 0) { // mailxelService.markStatus(currentMessageId, 992, markCatCallback); // } // } // }); Image imgLike = new Image("img/star-small.png"); imgLike.setTitle("Like"); imgLike.setStylePrimaryName("mailxel-toolbar-item"); imgLike.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { if (currentMessageId > 0) { mailxelService.markStatus(currentMessageId, 989, markCatCallback); } } }); Image ignore = new Image("img/ignore.png"); ignore.setTitle("Ignore"); ignore.setStylePrimaryName("mailxel-toolbar-item"); ignore.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { if (currentMessageId > 0) { mailxelService.markStatus(currentMessageId, 994, markCatCallback); } } }); Image tookNote = new Image("img/eye.png"); tookNote.setTitle("Took Note"); tookNote.setStylePrimaryName("mailxel-toolbar-item"); tookNote.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { if (currentMessageId > 0) { mailxelService.markStatus(currentMessageId, 993, markCatCallback); } } }); Image waitForAnswer = new Image("img/hourglass.png"); waitForAnswer.setTitle("waiting for answer"); waitForAnswer.setStylePrimaryName("mailxel-toolbar-item"); waitForAnswer.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { if (currentMessageId > 0) { mailxelService.markStatus(currentMessageId, 998, markCatCallback); } } }); Image done = new Image("img/tick.png"); done.setTitle("task completed"); done.setStylePrimaryName("mailxel-toolbar-item"); done.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { if (currentMessageId > 0) { mailxelService.markStatus(currentMessageId, 997, markCatCallback); } } }); Image trash = new Image("img/bin.png"); trash.setTitle("trash"); trash.setStylePrimaryName("mailxel-toolbar-item"); trash.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { if (currentMessageId > 0) { List<Integer> ids = new ArrayList<Integer>(); ids.add(currentMessageId); mailxelService.markAsDeleted(ids, markCatCallback); } } }); CategorySuggestOracle oracle = new CategorySuggestOracle(mailxelService); final SuggestBox gtdSb = new SuggestBox(oracle); gtdSb.setWidth("50px"); gtdSb.setTitle("add category"); Image categorize = new Image("img/categorize.png"); categorize.setTitle("categorize"); categorize.setStylePrimaryName("mailxel-toolbar-item"); categorize.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { String gtd = gtdSb.getText(); if (currentMessageId > 0 && null != gtd) { List<Integer> ids = new ArrayList<Integer>(); ids.add(currentMessageId); mailxelService.updateCategories(ids, gtd, markCatCallback); } } }); HorizontalPanel gtdBar = new HorizontalPanel(); gtdBar.add(gtdSb); gtdBar.add(categorize); add(prev); add(scheduleForLater); // add(scheduleForToday); add(imgLike); add(waitForAnswer); add(done); add(tookNote); add(ignore); add(trash); add(gtdBar); add(fwd); }
From source file:ch.heftix.mailxel.client.CategoryOverviewGrid.java
License:Open Source License
public CategoryOverviewGrid(final MailServiceAsync mailxelService, final MailxelPanel mailxelPanel) { 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("category update"); List<Category> categoriesToSave = new ArrayList<Category>(); int len = grid.getRowCount(); for (int i = FIRST_PAYLOAD_ROW; i < len; i++) { TextBoxWChangeDetection tbS = (TextBoxWChangeDetection) grid.getWidget(i, 0); if (null != tbS && tbS.isDirty()) { // add to save list Category existing = categories.get(i - FIRST_PAYLOAD_ROW); existing.name = tbS.getText(); categoriesToSave.add(existing); }//from www. j av a 2 s . c om } mailxelService.saveCategories(categoriesToSave, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { si.error(caught); } public void onSuccess(Void result) { si.done(); } }); } }); toolbar.add(save); Image addCategory = new Image("img/plus.png"); addCategory.setTitle("New Category"); addCategory.setStylePrimaryName("mailxel-toolbar-item"); addCategory.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { Category cat = new Category(); cat.id = Constants.UNDEFINED_ID; cat.name = "new category"; categories.add(cat); updateGrid(categories); } }); toolbar.add(addCategory); add(toolbar); final TextBox category = new TextBox(); category.setWidth("400px"); // header grid.setText(LABEL_ROW, 0, "Category"); final MailxelAsyncCallback<List<Category>> callback = new MailxelAsyncCallback<List<Category>>() { private StatusItem si = null; public void setStatusItem(StatusItem statusItem) { this.si = statusItem; } public void onSuccess(List<Category> result) { categories = result; int row = updateGrid(result); si.done("found " + Integer.toString(row - FIRST_PAYLOAD_ROW) + " categories.", 0); } public void onFailure(Throwable caught) { si.error(caught); } }; // final KeyboardListenerAdapter kbla = new KeyboardListenerAdapter() { // // public void onKeyPress(Widget sender, char keyCode, int modifiers) { // if (KEY_ENTER == keyCode) { // String snTxt = UIUtil.trimNull(category.getText()); // // mailxelPanel.setStatus("category search started"); // // mailxelService.searchCategories(snTxt, callback); // } // } // }; final KeyPressHandler kbla = new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (KeyCodes.KEY_ENTER == event.getCharCode()) { String snTxt = UIUtil.trimNull(category.getText()); StatusItem si = mailxelPanel.statusStart("category search"); callback.setStatusItem(si); mailxelService.searchCategories(snTxt, callback); } } }; category.addKeyPressHandler(kbla); grid.setWidget(HEADER_ROW_1, 0, category); add(grid); }