List of usage examples for com.google.gwt.user.client.ui HorizontalPanel add
@Override public void add(Widget w)
From source file:carteirainveste.client.DateUtil.java
License:Creative Commons License
void buildPortfolioPanel() { portfolioEndDatePanel.add(new Label("Data:")); portfolioEndDatePanel.add(portfolioEndDate); HorizontalPanel controlPanel = new HorizontalPanel(); FetchQuotesButtonHandler fetchQuotesButtonHandler = new FetchQuotesButtonHandler(); Button fetchQuotesButton = new Button("Buscar Cotacoes", fetchQuotesButtonHandler); controlPanel.add(portfolioHideSoldPositionsCheckBox); controlPanel.add(fetchQuotesButton); portfolioPanel.clear();// w w w . j a v a 2 s.c o m portfolioPanel.add(portfolioEndDatePanel); portfolioPanel.add(controlPanel); portfolioPanel.add(portfolioTab); portfolioPanel.add(accountBalanceTab); portfolioPanel.add(portfolioDebugPanel); portfolioDebugPanel.clear(); }
From source file:carteirainveste.client.DateUtil.java
License:Creative Commons License
void buildQuotePanel() { HorizontalPanel quoteClearPanel = new HorizontalPanel(); quoteClearPanel.add(clearTodayQuoteButton); quoteClearPanel.add(clearPastQuoteButton); quotePanel.clear();// w w w . j a v a 2 s. com quotePanel.add(addQuotePanel); quotePanel.add(quoteClearPanel); quotePanel.add(quoteGrid); }
From source file:carteirainveste.client.DateUtil.java
License:Creative Commons License
void buildPrefPanel() { updatePrefPanel();/* ww w.j a va 2s. co m*/ HorizontalPanel prefSellSpreadPanel = new HorizontalPanel(); HorizontalPanel prefBrokerFeePanel = new HorizontalPanel(); HorizontalPanel prefTaxExemptionPanel = new HorizontalPanel(); HorizontalPanel prefTaxFeePanel = new HorizontalPanel(); HorizontalPanel prefDayTradeTaxFeePanel = new HorizontalPanel(); prefSellSpreadPanel.add(new Label("Spread de venda")); prefBrokerFeePanel.add(new Label("Corretagem fixa")); prefTaxExemptionPanel.add(new Label("Limite de isencao")); prefTaxFeePanel.add(new Label("Taxa de IR sobre lucro")); prefDayTradeTaxFeePanel.add(new Label("Taxa de IR sobre lucro day-trade")); prefSellSpreadPanel.add(prefSellSpreadText); prefBrokerFeePanel.add(prefBrokerFeeText); prefTaxExemptionPanel.add(prefTaxExemptionText); prefTaxFeePanel.add(prefTaxFeeText); prefDayTradeTaxFeePanel.add(prefDayTradeTaxFeeText); prefSellSpreadPanel.add(new Label("%")); prefTaxFeePanel.add(new Label("%")); prefDayTradeTaxFeePanel.add(new Label("%")); //prefPanel.add(new Label("Estimativa de Valor Realizavel para Venda de Acoes no Mercado a Vista")); prefPanel.add(prefSellSpreadPanel); prefPanel.add(prefBrokerFeePanel); prefPanel.add(prefTaxExemptionPanel); prefPanel.add(prefTaxFeePanel); prefPanel.add(prefDayTradeTaxFeePanel); }
From source file:cc.alcina.framework.gwt.client.ClientNotificationsImpl.java
License:Apache License
@Override public void showDialog(String captionHTML, Widget captionWidget, String msg, MessageType messageType, List<Button> extraButtons, String containerStyle) { ensureImages();/* www.j a v a2s .c o m*/ HorizontalAlignmentConstant align = messageType == MessageType.ERROR ? HasHorizontalAlignment.ALIGN_LEFT : HasHorizontalAlignment.ALIGN_CENTER; if (dialogBox != null) { dialogBox.hide(); } String title = CommonUtils.friendlyConstant(messageType); dialogBox = new GlassDialogBox(); dialogBox.setAnimationEnabled(dialogAnimationEnabled); AbstractImagePrototype aip = null; String text = ""; switch (messageType) { case INFO: aip = AbstractImagePrototype.create(images.info()); text = "Information"; break; case WARN: aip = AbstractImagePrototype.create(images.warning()); text = "Warning"; break; case ERROR: aip = AbstractImagePrototype.create(images.error()); text = "Problem notification"; break; } dialogBox.setText(text); FlexTable ft = new FlexTable(); containerStyle = containerStyle != null ? containerStyle : (messageType == MessageType.ERROR || !CommonUtils.isNullOrEmpty(msg)) ? "medium" : "narrow"; ft.setCellSpacing(4); ft.setStyleName("alcina-Notification"); ft.addStyleName(containerStyle); FlexCellFormatter cf = (FlexCellFormatter) ft.getCellFormatter(); ft.setWidget(0, 0, aip.createImage()); cf.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); cf.setWidth(0, 0, "40px"); FlowPanel fp = new FlowPanel(); fp.setStyleName("text"); Widget capWidget = captionHTML != null ? new HTML(captionHTML) : captionWidget; if (captionHTML != null) { capWidget.setStyleName("caption"); } fp.add(capWidget); if (!CommonUtils.isNullOrEmpty(msg)) { Link nh = new Link("View detail"); nh.addStyleName("pad-5"); dialogHtml = new HTML("<span class='logboxpre'>" + msg.replace("\n", "<br>") + "</span>", true); final ScrollPanel sp = new ScrollPanel(dialogHtml); sp.setStyleName("logbox"); sp.setVisible(containerStyle.equals("wide")); nh.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { sp.setVisible(!sp.isVisible()); } }); if (LooseContext.getBoolean(ClientNotifications.CONTEXT_AUTOSHOW_DIALOG_DETAIL)) { sp.setVisible(true); } fp.add(nh); fp.add(sp); } ft.setWidget(0, 1, fp); cf.setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(8); Button closeButton = new Button("Close"); hp.add(closeButton); if (extraButtons != null) { for (Button b : extraButtons) { hp.add(b); } } ft.setWidget(1, 0, hp); cf.setColSpan(1, 0, 2); cf.setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); } }); dialogBox.setWidget(ft); dialogBox.center(); dialogBox.show(); Scheduler.get().scheduleDeferred(() -> closeButton.setFocus(true)); }
From source file:cc.alcina.framework.gwt.client.stdlayout.MainTabPanel.java
License:Apache License
private HorizontalPanel createButtonsPanel() { HorizontalPanel hp = new HorizontalPanel(); hp.setStyleName("alcina-MainMenuRight"); hp.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT); for (IsWidget button : buttons) { if (button instanceof LoginStateVisibleWithWidget) { button.asWidget().ensureDebugId(((LoginStateVisibleWithWidget) button).getDebugId()); }// w ww.ja va2 s .c o m hp.add(button); hp.add(new BarSep()); } return hp; }
From source file:cc.alcina.framework.gwt.client.widget.dialog.CancellableRemoteDialog.java
License:Apache License
public CancellableRemoteDialog(String msg, PermissibleActionListener l, boolean autoShow) { if (l == null) { l = new PermissibleActionListener() { public void vetoableAction(PermissibleActionEvent evt) { CancellableRemoteDialog.this.hide(); }//www.j a v a 2 s . com }; } final PermissibleActionListener lCopy = l; setText("Please wait..."); setAnimationEnabled(initialAnimationEnabled()); Grid grr = new Grid(2, 1); status = msg; statusLabel = new Label(msg); grr.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); grr.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); grr.setCellPadding(4); cancelButton = new Button("Cancel"); setRetryButton(new Button("Retry")); cancelButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { PermissibleAction action = new PermissibleAction(); action.setActionName(CANCEL_ACTION); lCopy.vetoableAction(new PermissibleActionEvent(this, action)); } }); grr.setWidget(0, 0, statusLabel); HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(0); hp.add(cancelButton); hp.add(getRetryButton()); getRetryButton().setVisible(false); grr.setWidget(1, 0, hp); setWidget(grr); if (autoShow) { centerAndShow(); } }
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);//from ww w .j a va 2 s. c om 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.kune.core.client.auth.SignInPanel.java
License:GNU Affero Public License
/** * Creates the register and forgot passwd. * * @return the vertical panel/*from w w w . j ava 2 s . c o 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"); }/*from w w w. j a v a 2 s .com*/ } } // 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; }// w ww.ja v a2 s . co 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); }