List of usage examples for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter
public FlexCellFormatter getFlexCellFormatter()
From source file:gwtquery.plugins.draggable.client.GWTIntegrationSample.java
License:Apache License
/** * Create a Decorated Form The code comes from the GWT show case : * http://gwt.google.com/samples/Showcase/Showcase.html#!CwDecoratorPanel * * @return//from ww w. j a v a 2 s . c o m */ private DecoratorPanel createDecoratedForm() { // Create a table to layout the form options FlexTable layout = new FlexTable(); layout.setCellSpacing(6); FlexCellFormatter cellFormatter = layout.getFlexCellFormatter(); // Add a title to the form layout.setHTML(0, 0, "Enter Search Criteria"); cellFormatter.setColSpan(0, 0, 2); cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); // Add some standard form options layout.setHTML(1, 0, "Name"); layout.setWidget(1, 1, new TextBox()); layout.setHTML(2, 0, "Description"); layout.setWidget(2, 1, new TextBox()); // Wrap the content in a DecoratorPanel DecoratorPanel decPanel = new DecoratorPanel(); decPanel.setWidget(layout); return decPanel; }
From source file:ilarkesto.gwt.client.TableBuilder.java
License:Open Source License
public FlexTable createTable() { if (!currentRow.cells.isEmpty()) nextRow();/*from w w w . j a v a2s . c o m*/ FlexTable table = new FlexTable(); table.setStyleName(styleName); table.setCellSpacing(cellSpacing); table.setCellPadding(cellPadding); if (centered) table.getElement().setAttribute("align", "center"); String widthAsString = width == null ? "" : width; table.setWidth(widthAsString); table.getElement().setAttribute("width", widthAsString); if (columnWidths != null) { ColumnFormatter columnFormatter = table.getColumnFormatter(); for (int i = 0; i < columnWidths.length; i++) { columnFormatter.setWidth(i, columnWidths[i]); } } int rowIndex = 0; for (Row row : rows) { int colIndex = 0; for (Cell cell : row.cells) { table.setWidget(rowIndex, colIndex, cell.widget); if (cell.colspan > 1) table.getFlexCellFormatter().setColSpan(rowIndex, colIndex, cell.colspan); if (cell.align != null) { table.getCellFormatter().setHorizontalAlignment(rowIndex, colIndex, cell.align); } colIndex += cell.colspan; } rowIndex++; } return table; }
From source file:io.pelle.mango.client.gwt.ColumnLayoutStrategy.java
License:Open Source License
@SuppressWarnings({ "rawtypes", "unchecked" }) public void createLayout(Panel parent, BaseContainerElement<?, ?> baseContainer) { if (!baseContainer.getControls().isEmpty()) { int colummCount = baseContainer.getColummCount(); FlexTable flexTable = new FlexTable(); flexTable.addStyleName(GwtStyles.FORM); parent.add(flexTable);/* w ww . j a v a 2 s . co m*/ int currentRow = 0; int currentColumn = 0; for (BaseDictionaryControl baseControl : baseContainer.getControls()) { Widget control = ControlHandler.getInstance().createControl(baseControl, layoutType); switch (layoutType) { case EDITOR: flexTable.setHTML(currentRow, currentColumn * 2, DictionaryModelUtil.getEditorLabel(baseControl.getModel())); break; case FILTER: flexTable.setHTML(currentRow, currentColumn * 2, DictionaryModelUtil.getFilterLabel(baseControl.getModel())); break; } flexTable.setWidget(currentRow, currentColumn * 2 + 1, control); if (currentColumn >= colummCount - 1) { currentColumn = 0; currentRow++; } else { currentColumn++; if (currentColumn > 0) { flexTable.getFlexCellFormatter().setStyleName(currentRow, currentColumn * 2, GwtStyles.COLUMN_LAYOUT_HORIZONTAL_SPACING); } } } } if (!baseContainer.getChildren().isEmpty()) { for (BaseContainerElement<?, ?> lBaseContainer : baseContainer.getChildren()) { IContainer<Panel> container = ContainerFactory.createContainer(lBaseContainer, this); parent.add(container.getContainer()); if (container.getContainer() instanceof Panel && !(lBaseContainer instanceof BaseTableElement || lBaseContainer instanceof TabFolder)) { createLayout(container.getContainer(), lBaseContainer); } } } }
From source file:me.springframework.gwtsample.client.act.AddressInputView.java
License:Open Source License
public AddressInputView() { final FlexTable flexTable = new FlexTable(); initWidget(flexTable);//from w ww .j av a 2s .c o m flexTable.setWidth("200px"); final Label sourceLabel = new Label("Source"); flexTable.setWidget(1, 0, sourceLabel); final Label destinationLabel = new Label("Destination"); flexTable.setWidget(2, 0, destinationLabel); sourceTextBox = new TextBox(); flexTable.setWidget(1, 1, sourceTextBox); flexTable.getCellFormatter().setWidth(1, 1, "100%"); sourceTextBox.setWidth("100%"); destinationTextBox = new TextBox(); flexTable.setWidget(2, 1, destinationTextBox); flexTable.getCellFormatter().setWidth(2, 1, "100%"); destinationTextBox.setWidth("100%"); final Button searchButton = new Button(); flexTable.setWidget(3, 0, searchButton); searchButton.addClickListener(new ClickListener() { public void onClick(final Widget arg0) { updateState(); addressInputActivity.okButtonClicked(); } }); flexTable.getFlexCellFormatter().setColSpan(3, 0, 2); searchButton.setText("Search"); final Label enterAddressLabel = new Label("Enter address:"); flexTable.setWidget(0, 0, enterAddressLabel); flexTable.getFlexCellFormatter().setColSpan(0, 0, 2); }
From source file:me.springframework.gwtsample.client.act.MapView.java
License:Open Source License
public MapView() { final FlexTable flexTable = new FlexTable(); initWidget(flexTable);/* w w w. j a v a 2 s. c om*/ final Image image = new Image(); flexTable.setWidget(1, 0, image); flexTable.getFlexCellFormatter().setColSpan(1, 0, 2); image.setUrl("map2.JPG"); selectedsourceLabel = new Label("selectedSource"); selectedsourceLabel.setWidth("225px"); flexTable.setWidget(0, 0, selectedsourceLabel); selecteddestinationLabel = new Label("selectedDestination"); selecteddestinationLabel.setWidth("225px"); flexTable.setWidget(0, 1, selecteddestinationLabel); }
From source file:n3phele.client.presenter.helpers.RequestWithProgressDialog.java
License:Open Source License
public void createLoadingMessage() { working = new DialogBox(); FlexTable dialogContents = new FlexTable(); dialogContents.setCellPadding(15);//from w ww. ja v a2 s. c o m working.setWidget(dialogContents); // Add some text to the top of the dialog details = new HTML(this.message); alert = new HTML(); dialogContents.setWidget(0, 0, details); dialogContents.getFlexCellFormatter().setColSpan(0, 0, 2); dialogContents.setWidget(1, 0, alert); dialogContents.getFlexCellFormatter().setColSpan(1, 0, 2); Button closeButton = new Button("cancel", new ClickHandler() { public void onClick(ClickEvent event) { RequestWithProgressDialog.this.cancel(); } }); dialogContents.setWidget(2, 1, closeButton); dialogContents.getFlexCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_LEFT); working.setGlassEnabled(true); working.setAnimationEnabled(true); working.center(); working.show(); }
From source file:n3phele.client.widgets.ActionDialogBox.java
License:Open Source License
public ActionDialogBox(String title, String noText, String yesText, Delegate<C> onYesClick) { FlexTable dialogContents = new FlexTable(); dialogContents.setCellPadding(15);//from w w w. j a va 2 s. c om this.setTitle(title); this.setText(title); this.noText = noText; this.yesText = yesText; this.onYesClick = onYesClick; this.setWidget(dialogContents); // Add some text to the top of the dialog details = new HTML(this.message); dialogContents.setWidget(0, 0, details); dialogContents.getFlexCellFormatter().setColSpan(0, 0, 2); Button closeButton = new Button(this.noText, new ClickHandler() { public void onClick(ClickEvent event) { hide(); } }); dialogContents.setWidget(1, 1, closeButton); Button doitButton = new Button(this.yesText, new ClickHandler() { public void onClick(ClickEvent event) { ActionDialogBox.this.onYesClick.execute(value); hide(); } }); dialogContents.setWidget(1, 0, doitButton); dialogContents.getFlexCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT); dialogContents.getFlexCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_LEFT); }
From source file:net.auroris.ColorPicker.client.ColorPicker.java
License:GNU Affero Public License
/** * Instantiates a new color picker.//from www .j a v a 2 s .c om */ public ColorPicker() { // UI Drawing // ------------------ hue = 0; saturation = 100; brightness = 100; red = 255; green = 0; blue = 0; final VerticalPanel vp = new VerticalPanel(); final HorizontalPanel hp = new HorizontalPanel(); final FlexTable hxTable = new FlexTable(); vp.add(hxTable); vp.add(hp); // Add the large slider map slidermap = new SliderMap(this); hp.add(slidermap); hp.setCellWidth(slidermap, "130px"); hp.setCellHeight(slidermap, "130px"); // Add the small slider bar sliderbar = new SliderBar(this); hp.add(sliderbar); hp.setCellWidth(sliderbar, "30px"); hp.setCellHeight(sliderbar, "130px"); // Define the Flextable's content // Color preview at the top colorpreview = new HTML(""); colorpreview.setWidth("30px"); colorpreview.setHeight("30px"); DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black"); // Radio buttons final String rbgroup = "color" + this.hashCode(); rbHue = new RadioButton(rbgroup, "H:"); rbHue.addClickHandler(this); rbSaturation = new RadioButton(rbgroup, "S:"); rbSaturation.addClickHandler(this); rbBrightness = new RadioButton(rbgroup, "V:"); rbBrightness.addClickHandler(this); rbRed = new RadioButton(rbgroup, "R:"); rbRed.addClickHandler(this); rbGreen = new RadioButton(rbgroup, "G:"); rbGreen.addClickHandler(this); rbBlue = new RadioButton(rbgroup, "B:"); rbBlue.addClickHandler(this); // Textboxes tbHue = new TextBox(); tbHue.setText(new Integer(hue).toString()); tbHue.setMaxLength(3); tbHue.setVisibleLength(4); tbHue.addKeyPressHandler(this); tbHue.addChangeHandler(this); tbSaturation = new TextBox(); tbSaturation.setText(new Integer(saturation).toString()); tbSaturation.setMaxLength(3); tbSaturation.setVisibleLength(4); tbSaturation.addKeyPressHandler(this); tbSaturation.addChangeHandler(this); tbBrightness = new TextBox(); tbBrightness.setText(new Integer(brightness).toString()); tbBrightness.setMaxLength(3); tbBrightness.setVisibleLength(4); tbBrightness.addKeyPressHandler(this); tbBrightness.addChangeHandler(this); tbRed = new TextBox(); tbRed.setText(new Integer(red).toString()); tbRed.setMaxLength(3); tbRed.setVisibleLength(4); tbRed.addKeyPressHandler(this); tbRed.addChangeHandler(this); tbGreen = new TextBox(); tbGreen.setText(new Integer(green).toString()); tbGreen.setMaxLength(3); tbGreen.setVisibleLength(4); tbGreen.addKeyPressHandler(this); tbGreen.addChangeHandler(this); tbBlue = new TextBox(); tbBlue.setText(new Integer(blue).toString()); tbBlue.setMaxLength(3); tbBlue.setVisibleLength(4); tbBlue.addKeyPressHandler(this); tbBlue.addChangeHandler(this); tbHexColor = new TextBox(); tbHexColor.setText("ff0000"); tbHexColor.setMaxLength(6); tbHexColor.setVisibleLength(6); tbHexColor.addKeyPressHandler(this); tbHexColor.addChangeHandler(this); // Put together the FlexTable hxTable.setWidget(0, 0, colorpreview); hxTable.getFlexCellFormatter().setColSpan(0, 0, 3); // Uncomment this part if we want the rest of textboxes // hxTable.setWidget(1, 0, rbHue); // hxTable.setWidget(1, 1, tbHue); // hxTable.setWidget(1, 2, new HTML("°")); // hxTable.setWidget(2, 0, rbSaturation); // hxTable.setWidget(2, 1, tbSaturation); // hxTable.setText(2, 2, "%"); // hxTable.setWidget(3, 0, rbBrightness); // hxTable.setWidget(3, 1, tbBrightness); // hxTable.setText(3, 2, "%"); // hxTable.setWidget(4, 0, rbRed); // hxTable.setWidget(4, 1, tbRed); // hxTable.setWidget(5, 0, rbGreen); // hxTable.setWidget(5, 1, tbGreen); // hxTable.setWidget(6, 0, rbBlue); // hxTable.setWidget(6, 1, tbBlue); hxTable.setText(0, 1, "# "); hxTable.setWidget(0, 2, tbHexColor); // table.getFlexCellFormatter().setColSpan(7, 1, 2); // Final setup // panel.add(table); rbSaturation.setValue(true); setPreview("ff0000"); DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default"); // First event onClick(rbSaturation); initWidget(vp); }
From source file:net.europa13.taikai.web.client.ui.TournamentPanel.java
License:Open Source License
public TournamentPanel() { final FlexTable table = new FlexTable(); int row = 0;// w w w .j a v a 2s .co m //********************************************************************* // Id and taikai info, mostly for debugging purposes. table.setText(row, 0, "Id"); tbId = new Label(); // tbId.setEnabled(false); table.setWidget(row++, 1, tbId); table.setText(row, 0, "Taikai"); tbTaikai = new Label(); // tbTaikai.setEnabled(false); table.setWidget(row++, 1, tbTaikai); //********************************************************************* // General info table.setText(row, 0, "Namn"); tbName = new TextBox(); table.setWidget(row++, 1, tbName); //********************************************************************* // Pool controls poolBox = new TournamentPoolPanel(); table.setWidget(row, 0, poolBox); table.getFlexCellFormatter().setColSpan(row, 0, table.getCellCount(0)); row++; seedTable = new TournamentSeedPanel(); table.setWidget(row, 0, seedTable); table.getFlexCellFormatter().setColSpan(row, 0, table.getCellCount(0)); row++; // advancementTable = new TournamentAdvancementTable(); // table.setWidget(row, 0, advancementTable); // table.getFlexCellFormatter().setColSpan(row, 0, table.getCellCount(0)); // row++; add(table); }
From source file:net.opentsdb.tsd.client.QueryUi.java
License:Open Source License
/** * This is the entry point method./*from w ww . j a v a 2 s . c o m*/ */ public void onModuleLoad() { asyncGetJson(AGGREGATORS_URL, new GotJsonCallback() { public void got(final JSONValue json) { // Do we need more manual type checking? Not sure what will happen // in the browser if something other than an array is returned. final JSONArray aggs = json.isArray(); for (int i = 0; i < aggs.size(); i++) { aggregators.add(aggs.get(i).isString().stringValue()); } ((MetricForm) metrics.getWidget(0)).setAggregators(aggregators); } }); // All UI elements need to regenerate the graph when changed. { final ValueChangeHandler<Date> vch = new ValueChangeHandler<Date>() { public void onValueChange(final ValueChangeEvent<Date> event) { refreshGraph(); } }; TextBox tb = start_datebox.getTextBox(); tb.addBlurHandler(refreshgraph); tb.addKeyPressHandler(refreshgraph); start_datebox.addValueChangeHandler(vch); tb = end_datebox.getTextBox(); tb.addBlurHandler(refreshgraph); tb.addKeyPressHandler(refreshgraph); end_datebox.addValueChangeHandler(vch); } autoreoload_interval.addBlurHandler(refreshgraph); autoreoload_interval.addKeyPressHandler(refreshgraph); yrange.addBlurHandler(refreshgraph); yrange.addKeyPressHandler(refreshgraph); y2range.addBlurHandler(refreshgraph); y2range.addKeyPressHandler(refreshgraph); ylog.addClickHandler(new AdjustYRangeCheckOnClick(ylog, yrange)); y2log.addClickHandler(new AdjustYRangeCheckOnClick(y2log, y2range)); ylog.addClickHandler(refreshgraph); y2log.addClickHandler(refreshgraph); ylabel.addBlurHandler(refreshgraph); ylabel.addKeyPressHandler(refreshgraph); y2label.addBlurHandler(refreshgraph); y2label.addKeyPressHandler(refreshgraph); yformat.addBlurHandler(refreshgraph); yformat.addKeyPressHandler(refreshgraph); y2format.addBlurHandler(refreshgraph); y2format.addKeyPressHandler(refreshgraph); wxh.addBlurHandler(refreshgraph); wxh.addKeyPressHandler(refreshgraph); horizontalkey.addClickHandler(refreshgraph); keybox.addClickHandler(refreshgraph); nokey.addClickHandler(refreshgraph); yrange.setValidationRegexp("^(" // Nothing or + "|\\[([-+.0-9eE]+|\\*)?" // "[start + ":([-+.0-9eE]+|\\*)?\\])$"); // :end]" yrange.setVisibleLength(5); yrange.setMaxLength(44); // MAX=2^26=20 chars: "[-$MAX:$MAX]" yrange.setText("[0:]"); y2range.setValidationRegexp("^(" // Nothing or + "|\\[([-+.0-9eE]+|\\*)?" // "[start + ":([-+.0-9eE]+|\\*)?\\])$"); // :end]" y2range.setVisibleLength(5); y2range.setMaxLength(44); // MAX=2^26=20 chars: "[-$MAX:$MAX]" y2range.setText("[0:]"); y2range.setEnabled(false); y2log.setEnabled(false); ylabel.setVisibleLength(10); ylabel.setMaxLength(50); // Arbitrary limit. y2label.setVisibleLength(10); y2label.setMaxLength(50); // Arbitrary limit. y2label.setEnabled(false); yformat.setValidationRegexp("^(|.*%..*)$"); // Nothing or at least one %? yformat.setVisibleLength(10); yformat.setMaxLength(16); // Arbitrary limit. y2format.setValidationRegexp("^(|.*%..*)$"); // Nothing or at least one %? y2format.setVisibleLength(10); y2format.setMaxLength(16); // Arbitrary limit. y2format.setEnabled(false); wxh.setValidationRegexp("^[1-9][0-9]{2,}x[1-9][0-9]{2,}$"); // 100x100 wxh.setVisibleLength(9); wxh.setMaxLength(11); // 99999x99999 wxh.setText((Window.getClientWidth() - 20) + "x" + (Window.getClientHeight() * 4 / 5)); final FlexTable table = new FlexTable(); table.setText(0, 0, "From"); { final HorizontalPanel hbox = new HorizontalPanel(); hbox.add(new InlineLabel("To")); final Anchor now = new Anchor("(now)"); now.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { end_datebox.setValue(new Date()); refreshGraph(); } }); hbox.add(now); hbox.add(autoreoload); hbox.setWidth("100%"); table.setWidget(0, 1, hbox); } autoreoload.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { if (autoreoload.isChecked()) { final HorizontalPanel hbox = new HorizontalPanel(); hbox.setWidth("100%"); hbox.add(new InlineLabel("Every:")); hbox.add(autoreoload_interval); hbox.add(new InlineLabel("seconds")); table.setWidget(1, 1, hbox); if (autoreoload_interval.getValue().isEmpty()) { autoreoload_interval.setValue("15"); } autoreoload_interval.setFocus(true); lastgraphuri = ""; // Force refreshGraph. refreshGraph(); // Trigger the 1st auto-reload } else { table.setWidget(1, 1, end_datebox); } } }); autoreoload_interval.setValidationRegexp("^([5-9]|[1-9][0-9]+)$"); // >=5s autoreoload_interval.setMaxLength(4); autoreoload_interval.setVisibleLength(8); table.setWidget(1, 0, start_datebox); table.setWidget(1, 1, end_datebox); { final HorizontalPanel hbox = new HorizontalPanel(); hbox.add(new InlineLabel("WxH:")); hbox.add(wxh); table.setWidget(0, 3, hbox); } { final MetricForm.MetricChangeHandler metric_change_handler = new MetricForm.MetricChangeHandler() { public void onMetricChange(final MetricForm metric) { final int index = metrics.getWidgetIndex(metric); metrics.getTabBar().setTabText(index, getTabTitle(metric)); } private String getTabTitle(final MetricForm metric) { final String metrictext = metric.getMetric(); final int last_period = metrictext.lastIndexOf('.'); if (last_period < 0) { return metrictext; } return metrictext.substring(last_period + 1); } }; final EventsHandler updatey2range = new EventsHandler() { protected <H extends EventHandler> void onEvent(final DomEvent<H> event) { for (final Widget metric : metrics) { if (!(metric instanceof MetricForm)) { continue; } if (((MetricForm) metric).x1y2().getValue()) { y2range.setEnabled(true); y2log.setEnabled(true); y2label.setEnabled(true); y2format.setEnabled(true); return; } } y2range.setEnabled(false); y2log.setEnabled(false); y2label.setEnabled(false); y2format.setEnabled(false); } }; final MetricForm metric = new MetricForm(refreshgraph); metric.x1y2().addClickHandler(updatey2range); metric.setMetricChangeHandler(metric_change_handler); metrics.add(metric, "metric 1"); metrics.selectTab(0); metrics.add(new InlineLabel("Loading..."), "+"); metrics.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(final BeforeSelectionEvent<Integer> event) { final int item = event.getItem(); final int nitems = metrics.getWidgetCount(); if (item == nitems - 1) { // Last item: the "+" was clicked. event.cancel(); final MetricForm metric = new MetricForm(refreshgraph); metric.x1y2().addClickHandler(updatey2range); metric.setMetricChangeHandler(metric_change_handler); metric.setAggregators(aggregators); metrics.insert(metric, "metric " + nitems, item); metrics.selectTab(item); metric.setFocus(true); } } }); table.setWidget(2, 0, metrics); } table.getFlexCellFormatter().setColSpan(2, 0, 2); table.getFlexCellFormatter().setRowSpan(1, 3, 2); final DecoratedTabPanel optpanel = new DecoratedTabPanel(); optpanel.add(makeAxesPanel(), "Axes"); optpanel.add(makeKeyPanel(), "Key"); optpanel.selectTab(0); table.setWidget(1, 3, optpanel); final DecoratorPanel decorator = new DecoratorPanel(); decorator.setWidget(table); final VerticalPanel graphpanel = new VerticalPanel(); graphpanel.add(decorator); { final VerticalPanel graphvbox = new VerticalPanel(); graphvbox.add(graphstatus); graph.setVisible(false); graphvbox.add(graph); graph.addErrorHandler(new ErrorHandler() { public void onError(final ErrorEvent event) { graphstatus.setText("Oops, failed to load the graph."); } }); graphpanel.add(graphvbox); } final DecoratedTabPanel mainpanel = new DecoratedTabPanel(); mainpanel.setWidth("100%"); mainpanel.add(graphpanel, "Graph"); mainpanel.add(stats_table, "Stats"); mainpanel.add(logs, "Logs"); mainpanel.add(build_data, "Version"); mainpanel.selectTab(0); mainpanel.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(final BeforeSelectionEvent<Integer> event) { clearError(); final int item = event.getItem(); switch (item) { case 1: refreshStats(); return; case 2: refreshLogs(); return; case 3: refreshVersion(); return; } } }); final VerticalPanel root = new VerticalPanel(); root.setWidth("100%"); root.add(current_error); current_error.setVisible(false); current_error.addStyleName("dateBoxFormatError"); root.add(mainpanel); RootPanel.get("queryuimain").add(root); // Must be done at the end, once all the widgets are attached. ensureSameWidgetSize(optpanel); }