List of usage examples for com.google.gwt.user.client.ui FlexTable FlexTable
public FlexTable()
From source file:com.mcherm.zithiacharsheet.client.TreeGrid.java
License:Apache License
public TreeGrid(TreeGridItem rootItem, int numColumns, final TreeImages treeImages) { this.numColumns = numColumns; this.treeImages = treeImages; table = new FlexTable(); int row = 0;//from w w w .jav a2 s . c o m List<WidgetOrText> header = getHeader(); if (header != null) { createHeader(header); row += 1; } liveRoot = new TreeGridBranchLiveRoot(rootItem, row); initWidget(table); }
From source file:com.msco.mil.client.com.sencha.gxt.explorer.client.layout.border.BorderLayoutUiBinderDynamicAttributeExample.java
License:sencha.com license
@UiFactory public FlexTable createFlexTable() { FlexTable table = new FlexTable(); table.getElement().getStyle().setProperty("margin", "10px"); table.setCellSpacing(8);// www .ja va2 s .com table.setCellPadding(4); for (int i = 0; i < LayoutRegion.values().length; i++) { final LayoutRegion r = LayoutRegion.values()[i]; if (r == LayoutRegion.CENTER) { continue; } SelectHandler handler = new SelectHandler() { @Override public void onSelect(SelectEvent event) { TextButton btn = (TextButton) event.getSource(); String txt = btn.getText(); if (txt.equals("Expand")) { con.expand(r); } else if (txt.equals("Collapse")) { con.collapse(r); } else if (txt.equals("Show")) { con.show(r); } else { con.hide(r); } } }; table.setHTML(i, 0, "<div style='font-size: 12px; width: 100px'>" + r.name() + ":</span>"); table.setWidget(i, 1, new TextButton("Expand", handler)); table.setWidget(i, 2, new TextButton("Collapse", handler)); table.setWidget(i, 3, new TextButton("Show", handler)); table.setWidget(i, 4, new TextButton("Hide", handler)); } return table; }
From source file:com.msco.mil.client.com.sencha.gxt.explorer.client.layout.BorderLayoutExample.java
License:sencha.com license
public Widget asWidget() { final BorderLayoutContainer con = new BorderLayoutContainer(); con.setBorders(true);//from www.j a v a 2 s .com ContentPanel north = new ContentPanel(); ContentPanel west = new ContentPanel(); ContentPanel center = new ContentPanel(); center.setHeadingText("BorderLayout Example"); FlexTable table = new FlexTable(); table.getElement().getStyle().setProperty("margin", "10px"); table.setCellSpacing(8); table.setCellPadding(4); for (int i = 0; i < LayoutRegion.values().length; i++) { final LayoutRegion r = LayoutRegion.values()[i]; if (r == LayoutRegion.CENTER) { continue; } SelectHandler handler = new SelectHandler() { @Override public void onSelect(SelectEvent event) { TextButton btn = (TextButton) event.getSource(); String txt = btn.getText(); if (txt.equals("Expand")) { con.expand(r); } else if (txt.equals("Collapse")) { con.collapse(r); } else if (txt.equals("Show")) { con.show(r); } else { con.hide(r); } } }; table.setHTML(i, 0, "<div style='font-size: 12px; width: 100px'>" + r.name() + ":</span>"); table.setWidget(i, 1, new TextButton("Expand", handler)); table.setWidget(i, 2, new TextButton("Collapse", handler)); table.setWidget(i, 3, new TextButton("Show", handler)); table.setWidget(i, 4, new TextButton("Hide", handler)); } center.setResize(false); center.add(table); ContentPanel east = new ContentPanel(); ContentPanel south = new ContentPanel(); BorderLayoutData northData = new BorderLayoutData(100); northData.setMargins(new Margins(5)); northData.setCollapsible(true); northData.setSplit(true); BorderLayoutData westData = new BorderLayoutData(150); westData.setCollapsible(true); westData.setSplit(true); westData.setCollapseMini(true); westData.setMargins(new Margins(0, 5, 0, 5)); MarginData centerData = new MarginData(); BorderLayoutData eastData = new BorderLayoutData(150); eastData.setMargins(new Margins(0, 5, 0, 5)); eastData.setCollapsible(true); eastData.setSplit(true); BorderLayoutData southData = new BorderLayoutData(100); southData.setMargins(new Margins(5)); southData.setCollapsible(true); southData.setCollapseMini(true); con.setNorthWidget(north, northData); con.setWestWidget(west, westData); con.setCenterWidget(center, centerData); con.setEastWidget(east, eastData); con.setSouthWidget(south, southData); SimpleContainer simple = new SimpleContainer(); simple.add(con, new MarginData(10)); return simple; }
From source file:com.msco.mil.client.com.sencha.gxt.explorer.client.toolbar.AdvancedToolBarExample.java
License:sencha.com license
private ContentPanel createMulti() { SamplePanel panel = new SamplePanel(); panel.setHeadingText("Multi Columns"); ButtonGroup group = new ButtonGroup(); group.setHeadingText("Clipboard"); panel.getToolBar().add(group);//from ww w .ja v a 2s. c o m FlexTable table = new FlexTable(); group.add(table); TextButton btn = new TextButton("Cool", ExampleImages.INSTANCE.add16()); table.setWidget(0, 0, btn); btn = new TextButton("Cut", ExampleImages.INSTANCE.add16()); Menu menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); table.setWidget(0, 1, btn); btn = new TextButton("Copy", ExampleImages.INSTANCE.add16()); table.setWidget(1, 0, btn); // // btn = new TextButton("Paste", ExampleImages.INSTANCE.add16()); table.setWidget(1, 1, btn); group = new ButtonGroup(); group.setHeadingText("Other Bogus Actions"); panel.getToolBar().add(group); table = new FlexTable(); group.add(table); btn = new TextButton("Cool", ExampleImages.INSTANCE.add16()); table.setWidget(0, 0, btn); btn = new TextButton("Cut", ExampleImages.INSTANCE.add16()); menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); table.setWidget(0, 1, btn); btn = new TextButton("Copy", ExampleImages.INSTANCE.add16()); table.setWidget(1, 0, btn); // // btn = new TextButton("Paste", ExampleImages.INSTANCE.add16()); table.setWidget(1, 1, btn); return panel; }
From source file:com.msco.mil.client.com.sencha.gxt.explorer.client.toolbar.AdvancedToolBarExample.java
License:sencha.com license
private ContentPanel createMulti2() { SamplePanel panel = new SamplePanel(); panel.setHeadingText("Multi Columns No Title"); ButtonGroup group = new ButtonGroup(); group.setHeadingText("Clipboard"); group.setHeaderVisible(false);//from www.j av a2 s . co m FlexTable table = new FlexTable(); group.add(table); TextButton btn = new TextButton("Cool", ExampleImages.INSTANCE.add16()); table.setWidget(0, 0, btn); btn = new TextButton("Cut", ExampleImages.INSTANCE.add16()); Menu menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); table.setWidget(0, 1, btn); btn = new TextButton("Copy", ExampleImages.INSTANCE.add16()); table.setWidget(1, 0, btn); btn = new TextButton("Paste", ExampleImages.INSTANCE.add16()); table.setWidget(1, 1, btn); group = new ButtonGroup(); group.setHeadingText("Other Bogus Actions"); group.setHeaderVisible(false); panel.getToolBar().add(group); table = new FlexTable(); group.add(table); btn = new TextButton("Cool", ExampleImages.INSTANCE.add16()); table.setWidget(0, 0, btn); btn = new TextButton("Cut", ExampleImages.INSTANCE.add16()); menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); table.setWidget(0, 1, btn); btn = new TextButton("Copy", ExampleImages.INSTANCE.add16()); table.setWidget(1, 0, btn); btn = new TextButton("Paste", ExampleImages.INSTANCE.add16()); table.setWidget(1, 1, btn); panel.getToolBar().add(group); return panel; }
From source file:com.msco.mil.client.com.sencha.gxt.explorer.client.toolbar.AdvancedToolBarExample.java
License:sencha.com license
private ContentPanel createMixed() { SamplePanel panel = new SamplePanel(); panel.setHeadingText("Mix and match icon sizes"); for (int i = 0; i < 2; i++) { ButtonGroup group = new ButtonGroup(); group.setHeadingText("Clipboard"); panel.getToolBar().add(group);/*w w w .ja va 2s .c o m*/ FlexTable table = new FlexTable(); group.add(table); TextButton btn = new TextButton("Paste", ExampleImages.INSTANCE.add32()); btn.setScale(ButtonScale.LARGE); btn.setIconAlign(IconAlign.TOP); btn.setArrowAlign(ButtonArrowAlign.BOTTOM); table.setWidget(0, 0, btn); table.getFlexCellFormatter().setRowSpan(0, 0, 3); btn = new TextButton("Format", ExampleImages.INSTANCE.add32()); btn.setScale(ButtonScale.LARGE); btn.setIconAlign(IconAlign.TOP); btn.setArrowAlign(ButtonArrowAlign.BOTTOM); table.setWidget(0, 1, btn); table.getFlexCellFormatter().setRowSpan(0, 1, 3); btn = new TextButton("Copy", ExampleImages.INSTANCE.add16()); Menu menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); table.setWidget(0, 2, btn); btn = new TextButton("Cut", ExampleImages.INSTANCE.add16()); table.setWidget(1, 2, btn); btn = new TextButton("Paste", ExampleImages.INSTANCE.add16()); table.setWidget(2, 2, btn); cleanCells(table.getElement()); } return panel; }
From source file:com.msco.mil.client.com.sencha.gxt.explorer.client.toolbar.OverflowToolBarExample.java
License:sencha.com license
public Widget asWidget() { final Window window = new Window(); window.setHeadingText("Overflow Example"); window.setPixelSize(400, 200);/*from w ww . ja v a 2 s . com*/ window.setMinWidth(50); ToolBar toolBar = new ToolBar(); // toolBar.setSpacing(2); toolBar.setBorders(true); // toolBar.addStyleName(ThemeStyles.getStyle().borderBottom()); ButtonGroup group = new ButtonGroup(); group.setHeadingText("Clipboard"); toolBar.add(group); FlexTable table = new FlexTable(); group.add(table); TextButton button = new TextButton("Cool"); button.setIcon(ExampleImages.INSTANCE.add16()); table.setWidget(0, 0, button); button = new TextButton("Copy"); button.setIcon(ExampleImages.INSTANCE.add16()); table.setWidget(0, 1, button); button = new TextButton("Add"); button.setIcon(ExampleImages.INSTANCE.user_add()); table.setWidget(1, 0, button); button = new TextButton("Delete"); button.setIcon(ExampleImages.INSTANCE.user_delete()); table.setWidget(1, 1, button); toolBar.add(new FillToolItem()); group = new ButtonGroup(); group.setHeadingText("Other Bogus Actions"); toolBar.add(group); table = new FlexTable(); group.add(table); button = new TextButton("Cool"); button.setIcon(ExampleImages.INSTANCE.add16()); table.setWidget(0, 0, button); button = new TextButton("Copy"); button.setIcon(ExampleImages.INSTANCE.add16()); table.setWidget(0, 1, button); button = new TextButton("Add"); button.setIcon(ExampleImages.INSTANCE.user_add()); table.setWidget(1, 0, button); button = new TextButton("Delete"); button.setIcon(ExampleImages.INSTANCE.user_delete()); table.setWidget(1, 1, button); NorthSouthContainer comp = new NorthSouthContainer(); // comp.getElement().getStyle().setBackgroundColor(ThemeStyles.getStyle().backgroundColorLight()); comp.setNorthWidget(toolBar); window.add(comp); window.setMinButtonWidth(100); window.setButtonAlign(BoxLayoutPack.CENTER); window.addButton(new TextButton("Save")); window.addButton(new TextButton("Cancel")); window.addButton(new TextButton("Close")); window.addButton(new TextButton("Highlight")); window.addButton(new TextButton("Shutdown")); TextButton b = new TextButton("ToolBar Overflow Example"); b.addSelectHandler(new SelectHandler() { @Override public void onSelect(SelectEvent event) { window.show(); } }); VerticalPanel vp = new VerticalPanel(); vp.setSpacing(10); vp.add(b); return vp; }
From source file:com.nanosim.client.Application.java
License:Apache License
/** * Create the panel at the top of the page that contains the title and links. *///from w w w. j a v a 2 s . co m private void createTopPanel() { topPanel = new FlexTable(); topPanel.setCellPadding(0); topPanel.setCellSpacing(0); topPanel.setStyleName(DEFAULT_STYLE_NAME + "-top"); FlexCellFormatter formatter = topPanel.getFlexCellFormatter(); // Setup the links cell linksPanel = new HorizontalPanel(); topPanel.setWidget(0, 0, linksPanel); formatter.setStyleName(0, 0, DEFAULT_STYLE_NAME + "-links"); formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); formatter.setColSpan(0, 0, 2); // Setup the title cell setTitleWidget(null); formatter.setStyleName(1, 0, DEFAULT_STYLE_NAME + "-title"); // Setup the options cell setOptionsWidget(null); formatter.setStyleName(1, 1, DEFAULT_STYLE_NAME + "-options"); formatter.setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_RIGHT); // Align the content to the top topPanel.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP); topPanel.getRowFormatter().setVerticalAlign(1, HasVerticalAlignment.ALIGN_TOP); }
From source file:com.nanosim.client.content.tables.CwFlexTable.java
License:Apache License
/** * Initialize this example./* w ww. j a v a2 s .c o m*/ */ @NanosimSource @Override public Widget onInitialize() { // Create a Flex Table final FlexTable flexTable = new FlexTable(); FlexCellFormatter cellFormatter = flexTable.getFlexCellFormatter(); flexTable.addStyleName("cw-FlexTable"); flexTable.setWidth("32em"); flexTable.setCellSpacing(5); flexTable.setCellPadding(3); // Add some text cellFormatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT); flexTable.setHTML(0, 0, constants.cwFlexTableDetails()); cellFormatter.setColSpan(0, 0, 2); // Add a button that will add more rows to the table Button addRowButton = new Button(constants.cwFlexTableAddRow(), new ClickHandler() { public void onClick(ClickEvent event) { addRow(flexTable); } }); addRowButton.addStyleName("sc-FixedWidthButton"); Button removeRowButton = new Button(constants.cwFlexTableRemoveRow(), new ClickHandler() { public void onClick(ClickEvent event) { removeRow(flexTable); } }); removeRowButton.addStyleName("sc-FixedWidthButton"); VerticalPanel buttonPanel = new VerticalPanel(); buttonPanel.setStyleName("cw-FlexTable-buttonPanel"); buttonPanel.add(addRowButton); buttonPanel.add(removeRowButton); flexTable.setWidget(0, 1, buttonPanel); cellFormatter.setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP); // Add two rows to start addRow(flexTable); addRow(flexTable); // Return the panel flexTable.ensureDebugId("cwFlexTable"); return flexTable; }
From source file:com.nitrous.gwt.earth.client.demo.ExecuteBatchDemo.java
License:Apache License
/** * The Google earth API has loaded, start the application *///w w w . j a va 2 s . c o m private void onApiLoaded() { // construct the UI widget earth = new GoogleEarthWidget(); // register a listener to be notified when the earth plug-in has loaded earth.addPluginReadyListener(new GEPluginReadyListener() { public void pluginReady(GEPlugin ge) { // show map content once the plugin has loaded loadMapContent(); } public void pluginInitFailure() { // failure! Window.alert("Failed to initialize Google Earth Plug-in"); } }); Button runBatchedButton = new Button("Batched calls"); runBatchedButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { runBatched(); } }); Button runUnbatchedButton = new Button("Unbatched calls"); runUnbatchedButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { runUnbatched(); } }); Button clearButton = new Button("Clear map"); clearButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { clear(); } }); batchedResult = new HTML(" "); unbatchedResult = new HTML(" "); FlexTable resultTable = new FlexTable(); resultTable.setBorderWidth(1); for (int row = 0; row < 2; row++) { for (int col = 0; col < 2; col++) { resultTable.getCellFormatter().setHeight(row, col, "20px"); resultTable.getCellFormatter().setHorizontalAlignment(row, col, HasHorizontalAlignment.ALIGN_CENTER); } } resultTable.setWidget(0, 0, runUnbatchedButton); resultTable.setWidget(1, 0, unbatchedResult); resultTable.setWidget(0, 1, runBatchedButton); resultTable.setWidget(1, 1, batchedResult); HorizontalPanel topPanel = new HorizontalPanel(); topPanel.setWidth("100%"); topPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); topPanel.add(resultTable); topPanel.add(clearButton); DockLayoutPanel layout = new DockLayoutPanel(Unit.PX); layout.addNorth(topPanel, 80D); layout.add(earth); RootLayoutPanel.get().add(layout); // begin loading the Google Earth Plug-in earth.init(); }