List of usage examples for com.google.gwt.user.client.ui Button Button
public Button(String html, ClickHandler handler)
From source file:ca.nanometrics.gflot.client.example.DecimationExample.java
License:Open Source License
public Widget createExample() { PlotWithOverviewModel model = new PlotWithOverviewModel(PlotModelStrategy.downSamplingStrategy(20)); PlotOptions plotOptions = new PlotOptions(); plotOptions.setDefaultLineSeriesOptions(new LineSeriesOptions().setLineWidth(1).setShow(true)); plotOptions.setDefaultPointsOptions(new PointsSeriesOptions().setRadius(2).setShow(true)); plotOptions.setDefaultShadowSize(0); final SeriesHandler series = model.addSeries("Random Series", "#003366"); // create the plot final PlotWithOverview plot = new PlotWithOverview(model, plotOptions); // pull the "fake" RPC service for new data final Timer updater = new Timer() { @Override/*from w ww . j a va2 s. co m*/ public void run() { update(series, plot); } }; // put it on a panel FlowPanel panel = new FlowPanel(); panel.add(plot); HorizontalPanel buttonsPanel = new HorizontalPanel(); buttonsPanel.setSpacing(5); buttonsPanel.add(new Button("Start", new ClickListener() { public void onClick(Widget sender) { updater.scheduleRepeating(1000); } })); buttonsPanel.add(new Button("Stop", new ClickListener() { public void onClick(Widget sender) { updater.cancel(); } })); panel.add(buttonsPanel); return panel; }
From source file:ca.nanometrics.gflot.client.example.SlidingWindowExample.java
License:Open Source License
public Widget createExample() { PlotWithOverviewModel model = new PlotWithOverviewModel(PlotModelStrategy.slidingWindowStrategy(20)); PlotOptions plotOptions = new PlotOptions(); plotOptions.setDefaultLineSeriesOptions(new LineSeriesOptions().setLineWidth(1).setShow(true)); plotOptions.setDefaultPointsOptions(new PointsSeriesOptions().setRadius(2).setShow(true)); plotOptions.setDefaultShadowSize(0); plotOptions.setXAxisOptions(new TimeSeriesAxisOptions()); PlotOptions overviewPlotOptions = new PlotOptions().setDefaultShadowSize(0) .setLegendOptions(new LegendOptions().setShow(false)) .setDefaultLineSeriesOptions(new LineSeriesOptions().setLineWidth(1).setFill(true)) .setSelectionOptions(// w w w .j av a 2s . c om new SelectionOptions().setMode(SelectionOptions.X_SELECTION_MODE).setDragging(true)) .setXAxisOptions(new TimeSeriesAxisOptions()); final SeriesHandler series = model.addSeries("Random Series", "#FF9900"); // create the plot final PlotWithOverview plot = new PlotWithOverview(model, plotOptions, overviewPlotOptions); // pull the "fake" RPC service for new data final Timer updater = new Timer() { @Override public void run() { update(series, plot); } }; // put it on a panel FlowPanel panel = new FlowPanel(); panel.add(plot); HorizontalPanel buttonsPanel = new HorizontalPanel(); buttonsPanel.setSpacing(5); buttonsPanel.add(new Button("Start", new ClickListener() { public void onClick(Widget sender) { updater.scheduleRepeating(1000); } })); buttonsPanel.add(new Button("Stop", new ClickListener() { public void onClick(Widget sender) { updater.cancel(); } })); panel.add(buttonsPanel); return panel; }
From source file:carteirainveste.client.DateUtil.java
License:Creative Commons License
void buildTaxPanel() { HorizontalPanel headPanel = new HorizontalPanel(); VerticalPanel prefPanel = new VerticalPanel(); VerticalPanel startLossPanel = new VerticalPanel(); HorizontalPanel lossPanel = new HorizontalPanel(); HorizontalPanel dayTradeLossPanel = new HorizontalPanel(); taxPanel.clear();//from w w w . j a v a 2 s . co m taxEndDatePanel.add(new Label("Data:")); taxEndDatePanel.add(taxEndDate); taxPanel.add(taxEndDatePanel); StockTaxPrefResetButtonHandler stockTaxPrefButtonHandler = new StockTaxPrefResetButtonHandler(); Button stockTaxPrefButton = new Button("Restaurar Recomendacoes", stockTaxPrefButtonHandler); prefPanel.add(stockTaxPrefButton); prefPanel.add(Preference.stockDayTradeAffectExemptionLimit); prefPanel.add(Preference.stockExemptGainsReduceCarriedLoss); prefPanel.add(Preference.stockTaxRatioOverPretaxEarnings); prefPanel.addStyleName("boxedTable"); lossPanel.add(new Label("Perda acumulada inicial:")); lossPanel.add(Preference.startTaxCarryLoss); dayTradeLossPanel.add(new Label("Perda acumulada inicial em Day-trade:")); dayTradeLossPanel.add(Preference.startTaxDayTradeCarryLoss); startLossPanel.add(lossPanel); startLossPanel.add(dayTradeLossPanel); headPanel.add(prefPanel); headPanel.add(startLossPanel); taxPanel.add(headPanel); taxPanel.add(new Label("Apuracao Mensal:")); taxPanel.add(taxGrid); taxPanel.add(new Label("Legenda:")); taxPanel.add(new Label("IR.Devido: Codigo Receita DARF: Pessoa Fisica = 6015, Pessoa Juridica = 3317")); taxPanel.add(new Label("DT.IR.Devido: Codigo Receita DARF: Pessoa Fisica = 6015, Pessoa Juridica = 3317")); taxPanel.add(new Label("Resumo Anual:")); taxPanel.add(taxYearlySummaryGrid); taxPanel.add(new Label("Legenda:")); taxPanel.add(new Label("Repasse BTC: Rendimentos Tributaveis")); taxPanel.add(new Label("Lucro Liquido na Venda de Titulos: Rendimentos Sujeitos a Tributacao Exclusiva")); taxPanel.add(new Label("Cupons de Titulos: Rendimentos Sujeitos a Tributacao Exclusiva")); taxPanel.add(new Label("Aluguel de Acoes: Rendimentos Sujeitos a Tributacao Exclusiva")); taxPanel.add(new Label("Juros Sobre Capital Proprio: Rendimentos Sujeitos a Tributacao Exclusiva")); taxPanel.add(new Label("Dividendos: Rendimentos Isentos e nao Tributaveis")); taxPanel.add(new Label("Ganho Liquido Isento: Rendimentos Isentos e nao Tributaveis")); taxPanel.add(debugPanel); }
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();/* ww 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:ch.unifr.pai.twice.comm.serverPush.standalone.client.ServerPushStandalone.java
License:Apache License
/** * This is the entry point method./*from w w w . ja v a2 s.c om*/ */ /* * (non-Javadoc) * @see com.google.gwt.core.client.EntryPoint#onModuleLoad() */ @Override public void onModuleLoad() { // // // // FlexTable table = new FlexTable(); final TextBox message = new TextBox(); table.setWidget(0, 0, new Label("Message")); table.setWidget(0, 1, message); table.setWidget(1, 0, new Label("Event date")); final DatePicker datePicker = new DatePicker(); table.setWidget(1, 1, datePicker); Button undoable = new Button("Send as undoable event", new ClickHandler() { /** * Creates an {@link UndoableTestEvent} and fires it on the event bus. * * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent) */ @Override public void onClick(ClickEvent event) { UndoableTestEvent e = GWT.create(UndoableTestEvent.class); e.setFoo(message.getText()); if (datePicker.getValue() != null) e.setTimestamp(datePicker.getValue().getTime()); eventBus.fireEvent(e); } }); Button blocking = new Button("Send as blocking event", new ClickHandler() { /** * Creates an {@link BlockingTestEvent} and fires it on the event bus. * * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent) */ @Override public void onClick(ClickEvent event) { BlockingTestEvent e = GWT.create(BlockingTestEvent.class); e.foo = message.getText(); if (datePicker.getValue() != null) e.setTimestamp(datePicker.getValue().getTime()); eventBus.fireEvent(e); } }); Button discarding = new Button("Send as discarding event", new ClickHandler() { /** * Creates an {@link DiscardingTestEvent} and fires it on the event bus. * * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent) */ @Override public void onClick(ClickEvent event) { DiscardingTestEvent e = GWT.create(DiscardingTestEvent.class); e.setInstanceId("eventTests"); e.setFoo(message.getText()); if (datePicker.getValue() != null) e.setTimestamp(datePicker.getValue().getTime()); eventBus.fireEvent(e); } }); final HTML html = new HTML(""); final HTML value = new HTML(""); eventBus.addHandler(BlockingTestEvent.TYPE, new BlockingTestHandler() { /** * listens for blocking test events and adds their message to the display * * @param event */ @Override public void onEvent(BlockingTestEvent event) { html.setHTML(html.getHTML() + " [BLOCKING " + event.getTimestamp() + "] " + event.foo); value.setHTML(event.foo); } }); eventBus.addHandler(UndoableTestEvent.TYPE, new UndoableTestHandler() { /** * undo the event in case of a conflict by resetting the display to the values valid before the event has been applied * * @param event */ @Override public void undo(UndoableTestEvent event) { html.setHTML(event.getOldHistory()); value.setHTML(event.getOldValue()); } /** * listens for undoable events and adds their message to the display * * @param event */ @Override public void onEvent(UndoableTestEvent event) { html.setHTML(html.getHTML() + " [UNDOABLE " + event.getTimestamp() + "] " + event.getFoo()); value.setHTML(event.getFoo()); } /** * stores the state of the display before the newly arrived event has arrived * * @param event */ @Override public void saveState(UndoableTestEvent event) { event.setOldHistory(html.getHTML()); event.setOldValue(value.getHTML()); } }); eventBus.addHandler(DiscardingTestEvent.TYPE, new DiscardingTestHandler() { /** * listens for discarding test events and adds their message to the display * * @param event */ @Override public void onEvent(DiscardingTestEvent event) { html.setHTML(html.getHTML() + " [DISCARDING " + event.getTimestamp() + "] " + event.getFoo()); value.setHTML(event.getFoo()); } }); table.setWidget(2, 0, undoable); table.setWidget(2, 1, blocking); table.setWidget(2, 2, discarding); table.setWidget(3, 0, new Label("Current value: ")); table.setWidget(3, 1, value); table.setWidget(4, 0, new Label("Event history: ")); table.setWidget(4, 1, html); Button ping = new Button("Send ping", new ClickHandler() { @Override public void onClick(ClickEvent event) { PingEvent e = GWT.create(PingEvent.class); e.setInstanceId("eventTests"); if (datePicker.getValue() != null) e.setTimestamp(datePicker.getValue().getTime()); eventBus.fireEvent(e); } }); RootPanel.get().add(table); RootPanel.get().add(ping); RootPanel.get().add(new Label("GWTEvent wrapper")); FlexTable table2 = new FlexTable(); final TextBox box = new TextBox(); table2.setWidget(0, 0, new Label("Textbox")); table2.setWidget(0, 1, box); eventBus.addHandlerToSource(RemoteKeyPressEvent.TYPE, "test", new RemoteKeyPressEvent.RemoteKeyPressHandler() { @Override public void onEvent(RemoteKeyPressEvent event) { box.setValue(box.getValue() + event.getCharCode()); } }); box.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { RemoteKeyPressEvent e = GWT.create(RemoteKeyPressEvent.class); e.wrap(event); eventBus.fireEventFromSource(e, "test"); event.preventDefault(); } }); final MyNewTextBox box4 = new MyNewTextBox(eventBus, "myNewTextBox"); table2.setWidget(1, 0, new Label("My new textbox")); table2.setWidget(1, 1, box4); final RemoteKeyRecorder recorder = new RemoteKeyRecorder("multiFocus", eventBus); RootPanel.get().add(recorder); // final RemoteTextBox box3 = new RemoteTextBox("multiFocus", eventBus); // box3.setValue(""); // RootPanel.get().add(box3); // table2.setWidget(2, 0, new Label("Textbox (undoable - other resource)")); // table2.setWidget(2,1,box3); // RootPanel.get().add(table2); // MultiFocusTextBox multiFocus = new RemoteMultiFocusTextBox("multiFocus", eventBus); RootPanel.get().add(multiFocus); }
From source file:ch.unifr.pai.twice.widgets.mpproxyframe.client.Controller.java
License:Apache License
public Controller(MPFrame frame) { super();/*from w ww . java 2s . c o m*/ this.f = frame; for (int i = 0; i < keys.length; i++) { for (int i2 = 0; i2 < keys[i].length; i2++) { this.setWidget(i, i2, createButton(keys[i][i2])); } } this.setWidget(0, keys[0].length, new Button("BSPC", new ClickHandler() { @Override public void onClick(ClickEvent arg0) { // f.sendDataToFrame(MultiPointerUtils.getDeviceId(arg0), // InputPrefix.KEYCODE + KeyCodes.KEY_BACKSPACE); } })); this.setWidget(0, keys[0].length + 1, new Button("DEL", new ClickHandler() { @Override public void onClick(ClickEvent arg0) { // f.sendDataToFrame(MultiPointerUtils.getDeviceId(arg0), // InputPrefix.KEYCODE + KeyCodes.KEY_DELETE); } })); Button spaceButton = new Button("Space", new ClickHandler() { @Override public void onClick(ClickEvent arg0) { f.sendDataToFrame(MultiCursorController.getUUID(arg0.getNativeEvent()), " "); } }); this.setWidget(keys.length + 1, 0, spaceButton); }
From source file:ch.unifr.pai.twice.widgets.mpproxyframe.client.Controller.java
License:Apache License
private Button createButton(final String value) { return new Button(value, new ClickHandler() { @Override//ww w . j a v a 2 s . c om public void onClick(ClickEvent event) { f.sendDataToFrame(MultiCursorController.getUUID(event.getNativeEvent()), value); } }); }
From source file:client.reservation.dialog.ReservationDetailDialog.java
License:Open Source License
/** * Set popup Content./*ww w . jav a2 s . c om*/ * * @param message * HTML Content */ public void setContent(final HTML message) { this.vPanel.clear(); this.vPanel.add(message); this.vPanel.setStyleName("gwt-DialogBoxContent"); this.vPanel.add(new Button("Close", new ClickListener() { public void onClick(final Widget sender) { ReservationDetailDialog.this.hide(); } })); this.setWidget(this.vPanel); }
From source file:client.richedit.RichTextToolbar.java
License:Apache License
/** * Creates a new toolbar that drives the given rich text area. * * @param richText the rich text area to be controlled *//* www.j a v a 2 s.co m*/ public RichTextToolbar(RichTextArea richText, boolean allowPanelEdit) { this.richText = richText; this.formatter = richText.getFormatter(); outer.add(topPanel); outer.add(bottomPanel); topPanel.setWidth("100%"); bottomPanel.setWidth("100%"); initWidget(outer); setStyleName("gwt-RichTextToolbar"); if (formatter == null) { return; } topPanel.add(bold = createToggleButton(images.bold(), strings.bold())); topPanel.add(italic = createToggleButton(images.italic(), strings.italic())); topPanel.add(underline = createToggleButton(images.underline(), strings.underline())); topPanel.add(subscript = createToggleButton(images.subscript(), strings.subscript())); topPanel.add(superscript = createToggleButton(images.superscript(), strings.superscript())); topPanel.add(justifyLeft = createPushButton(images.justifyLeft(), strings.justifyLeft())); topPanel.add(justifyCenter = createPushButton(images.justifyCenter(), strings.justifyCenter())); topPanel.add(justifyRight = createPushButton(images.justifyRight(), strings.justifyRight())); topPanel.add(strikethrough = createToggleButton(images.strikeThrough(), strings.strikeThrough())); topPanel.add(indent = createPushButton(images.indent(), strings.indent())); topPanel.add(outdent = createPushButton(images.outdent(), strings.outdent())); topPanel.add(hr = createPushButton(images.hr(), strings.hr())); topPanel.add(ol = createPushButton(images.ol(), strings.ol())); topPanel.add(ul = createPushButton(images.ul(), strings.ul())); topPanel.add(removeFormat = createPushButton(images.removeFormat(), strings.removeFormat())); topPanel.add(createLink = createPushButton(images.createLink(), strings.createLink())); topPanel.add(removeLink = createPushButton(images.removeLink(), strings.removeLink())); topPanel.add(insertImage = createPushButton(images.insertImage(), strings.insertImage())); bottomPanel.add(new Label("Text:")); bottomPanel.add(foreColors = createColorList("Foreground")); bottomPanel.add(fonts = createFontList()); bottomPanel.add(fontSizes = createFontSizes()); bottomPanel.add(blockFormats = createBlockFormats()); if (allowPanelEdit) { bottomPanel.add(new Button("Panel Colors", new ClickHandler() { public void onClick(ClickEvent event) { showPanelColorsPopup(); } }), HasAlignment.ALIGN_MIDDLE); } // we only use these listeners for updating status, so don't hook them up unless at // least basic editing is supported. richText.addKeyUpHandler(handler); richText.addClickHandler(handler); }
From source file:client.richedit.RichTextToolbar.java
License:Apache License
protected void showPanelColorsPopup() { final BorderedPopup popup = new BorderedPopup(); FlexTable contents = new FlexTable(); contents.setCellSpacing(5);// w ww .j a v a 2 s. com contents.setCellPadding(0); contents.setText(0, 0, "Enter panel colors (in hex ASCII format, e.g. #FFCC99):"); contents.getFlexCellFormatter().setColSpan(0, 0, 2); contents.setText(1, 0, "Text color:"); final TextBox tcolor = MsoyUI.createTextBox(_tcolor, 7, 7); contents.setWidget(1, 1, tcolor); contents.setText(2, 0, "Background color:"); final TextBox bgcolor = MsoyUI.createTextBox(_bgcolor, 7, 7); contents.setWidget(2, 1, bgcolor); HorizontalPanel buttons = new HorizontalPanel(); buttons.add(new Button(_cmsgs.cancel(), new ClickHandler() { public void onClick(ClickEvent event) { popup.hide(); } })); buttons.add(WidgetUtil.makeShim(5, 5)); buttons.add(new Button(_cmsgs.update(), new ClickHandler() { public void onClick(ClickEvent event) { setPanelColors(tcolor.getText().trim().toLowerCase(), bgcolor.getText().trim().toLowerCase()); popup.hide(); } })); contents.setWidget(3, 0, buttons); contents.getFlexCellFormatter().setColSpan(3, 0, 2); contents.getFlexCellFormatter().setHorizontalAlignment(3, 0, HasAlignment.ALIGN_RIGHT); popup.setWidget(contents); popup.show(); }