List of usage examples for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter
public FlexCellFormatter getFlexCellFormatter()
From source file:net.s17fabu.vip.gwt.showcase.client.content.i18n.CwConstantsExample.java
License:Apache License
/** * Initialize this example./*from w ww. ja v a2 s. c o m*/ */ @Override public Widget onInitialize() { // Create the internationalized constants ExampleConstants exampleConstants = GWT.create(ExampleConstants.class); // Use a FlexTable to layout the content FlexTable layout = new FlexTable(); FlexCellFormatter formatter = layout.getFlexCellFormatter(); layout.setCellSpacing(5); // Add a link to the source code of the Interface HTML link = new HTML(" <a href=\"javascript:void(0);\">ExampleConstants</a>"); link.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { selectTab(2); } }); HorizontalPanel linkPanel = new HorizontalPanel(); linkPanel.setSpacing(3); linkPanel.add(new HTML(constants.cwConstantsExampleLinkText())); linkPanel.add(link); layout.setWidget(0, 0, linkPanel); formatter.setColSpan(0, 0, 2); // Show the first name TextBox firstNameBox = new TextBox(); firstNameBox.setText("Amelie"); firstNameBox.setWidth("17em"); layout.setHTML(1, 0, exampleConstants.firstName()); layout.setWidget(1, 1, firstNameBox); // Show the last name TextBox lastNameBox = new TextBox(); lastNameBox.setText("Crutcher"); lastNameBox.setWidth("17em"); layout.setHTML(2, 0, exampleConstants.lastName()); layout.setWidget(2, 1, lastNameBox); // Create a list box of favorite colors ListBox colorBox = new ListBox(); Map<String, String> colorMap = exampleConstants.colorMap(); for (Map.Entry<String, String> entry : colorMap.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); colorBox.addItem(value, key); } layout.setHTML(3, 0, exampleConstants.favoriteColor()); layout.setWidget(3, 1, colorBox); // Return the layout Widget return layout; }
From source file:net.s17fabu.vip.gwt.showcase.client.content.i18n.CwConstantsWithLookupExample.java
License:Apache License
/** * Initialize this example./*from ww w. j a va 2 s. c o m*/ */ @Override public Widget onInitialize() { // Create the internationalized constants colorConstants = GWT.create(ColorConstants.class); // Use a FlexTable to layout the content FlexTable layout = new FlexTable(); FlexCellFormatter formatter = layout.getFlexCellFormatter(); layout.setCellSpacing(5); // Add a link to the source code of the Interface HTML link = new HTML(" <a href=\"javascript:void(0);\">ColorConstants</a>"); link.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { selectTab(2); } }); HorizontalPanel linkPanel = new HorizontalPanel(); linkPanel.setSpacing(3); linkPanel.add(new HTML(constants.cwConstantsWithLookupExampleLinkText())); linkPanel.add(link); layout.setWidget(0, 0, linkPanel); formatter.setColSpan(0, 0, 2); // Add a field so the user can type a color colorBox = new TextBox(); colorBox.setText("red"); colorBox.setWidth("17em"); layout.setHTML(1, 0, constants.cwConstantsWithLookupExampleMethodName()); layout.setWidget(1, 1, colorBox); // Show the last name colorResultsBox = new TextBox(); colorResultsBox.setEnabled(false); colorResultsBox.setWidth("17em"); layout.setHTML(2, 0, constants.cwConstantsWithLookupExampleResults()); layout.setWidget(2, 1, colorResultsBox); // Add a handler to update the color as the user types a lookup value colorBox.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { updateColor(); } }); // Return the layout Widget updateColor(); return layout; }
From source file:net.s17fabu.vip.gwt.showcase.client.content.i18n.CwMessagesExample.java
License:Apache License
/** * Initialize this example./* w w w .ja v a2 s.com*/ */ @Override public Widget onInitialize() { // Create the internationalized error messages errorMessages = GWT.create(ErrorMessages.class); // Use a FlexTable to layout the content FlexTable layout = new FlexTable(); FlexCellFormatter formatter = layout.getFlexCellFormatter(); layout.setCellSpacing(5); // Add a link to the source code of the Interface HTML link = new HTML(" <a href=\"javascript:void(0);\">ErrorMessages</a>"); link.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { selectTab(2); } }); HorizontalPanel linkPanel = new HorizontalPanel(); linkPanel.setSpacing(3); linkPanel.add(new HTML(constants.cwMessagesExampleLinkText())); linkPanel.add(link); layout.setWidget(0, 0, linkPanel); formatter.setColSpan(0, 0, 2); // Show the template for reference String template = errorMessages.permissionDenied("{0}", "{1}", "{2}"); layout.setHTML(1, 0, constants.cwMessagesExampleTemplateLabel()); layout.setHTML(1, 1, template); // Add argument 0 arg0Box = new TextBox(); arg0Box.setText("amelie"); layout.setHTML(2, 0, constants.cwMessagesExampleArg0Label()); layout.setWidget(2, 1, arg0Box); // Add argument 1 arg1Box = new TextBox(); arg1Box.setText("guest"); layout.setHTML(3, 0, constants.cwMessagesExampleArg1Label()); layout.setWidget(3, 1, arg1Box); // Add argument 2 arg2Box = new TextBox(); arg2Box.setText("/secure/blueprints.xml"); layout.setHTML(4, 0, constants.cwMessagesExampleArg2Label()); layout.setWidget(4, 1, arg2Box); // Add the formatted message formattedMessage = new HTML(); layout.setHTML(5, 0, constants.cwMessagesExampleFormattedLabel()); layout.setWidget(5, 1, formattedMessage); formatter.setVerticalAlignment(5, 0, HasVerticalAlignment.ALIGN_TOP); // Add handlers to all of the argument boxes KeyUpHandler keyUpHandler = new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { updateMessage(); } }; arg0Box.addKeyUpHandler(keyUpHandler); arg1Box.addKeyUpHandler(keyUpHandler); arg2Box.addKeyUpHandler(keyUpHandler); // Return the layout Widget updateMessage(); return layout; }
From source file:net.s17fabu.vip.gwt.showcase.client.content.panels.CwDecoratorPanel.java
License:Apache License
/** * Initialize this example./* ww w . j a va 2 s . co m*/ */ @Override public Widget onInitialize() { // 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, constants.cwDecoratorPanelFormTitle()); cellFormatter.setColSpan(0, 0, 2); cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); // Add some standard form options layout.setHTML(1, 0, constants.cwDecoratorPanelFormName()); layout.setWidget(1, 1, new TextBox()); layout.setHTML(2, 0, constants.cwDecoratorPanelFormDescription()); layout.setWidget(2, 1, new TextBox()); // Wrap the content in a DecoratorPanel DecoratorPanel decPanel = new DecoratorPanel(); decPanel.setWidget(layout); return decPanel; }
From source file:net.s17fabu.vip.gwt.showcase.client.content.panels.CwDisclosurePanel.java
License:Apache License
/** * Create a form that contains undisclosed advanced options. *///from w ww. ja v a2 s.com private Widget createAdvancedForm() { // Create a table to layout the form options FlexTable layout = new FlexTable(); layout.setCellSpacing(6); layout.setWidth("300px"); FlexCellFormatter cellFormatter = layout.getFlexCellFormatter(); // Add a title to the form layout.setHTML(0, 0, constants.cwDisclosurePanelFormTitle()); cellFormatter.setColSpan(0, 0, 2); cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); // Add some standard form options layout.setHTML(1, 0, constants.cwDisclosurePanelFormName()); layout.setWidget(1, 1, new TextBox()); layout.setHTML(2, 0, constants.cwDisclosurePanelFormDescription()); layout.setWidget(2, 1, new TextBox()); // Create some advanced options HorizontalPanel genderPanel = new HorizontalPanel(); String[] genderOptions = constants.cwDisclosurePanelFormGenderOptions(); for (int i = 0; i < genderOptions.length; i++) { genderPanel.add(new RadioButton("gender", genderOptions[i])); } Grid advancedOptions = new Grid(2, 2); advancedOptions.setCellSpacing(6); advancedOptions.setHTML(0, 0, constants.cwDisclosurePanelFormLocation()); advancedOptions.setWidget(0, 1, new TextBox()); advancedOptions.setHTML(1, 0, constants.cwDisclosurePanelFormGender()); advancedOptions.setWidget(1, 1, genderPanel); // Add advanced options to form in a disclosure panel DisclosurePanel advancedDisclosure = new DisclosurePanel(constants.cwDisclosurePanelFormAdvancedCriteria()); advancedDisclosure.setAnimationEnabled(true); advancedDisclosure.ensureDebugId("cwDisclosurePanel"); advancedDisclosure.setContent(advancedOptions); layout.setWidget(3, 0, advancedDisclosure); cellFormatter.setColSpan(3, 0, 2); // Wrap the contents in a DecoratorPanel DecoratorPanel decPanel = new DecoratorPanel(); decPanel.setWidget(layout); return decPanel; }
From source file:net.s17fabu.vip.gwt.showcase.client.content.tables.CwFlexTable.java
License:Apache License
/** * Initialize this example./*from w w w . ja va2s .c om*/ */ @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:net.s17fabu.vip.gwt.showcase.client.content.tables.CwFlexTable.java
License:Apache License
/** * Add a row to the flex table.//from w w w . j a v a 2 s. co m */ private void addRow(FlexTable flexTable) { int numRows = flexTable.getRowCount(); flexTable.setWidget(numRows, 0, Showcase.images.gwtLogo().createImage()); flexTable.setWidget(numRows, 1, Showcase.images.gwtLogo().createImage()); flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows + 1); }
From source file:net.s17fabu.vip.gwt.showcase.client.content.tables.CwFlexTable.java
License:Apache License
/** * Remove a row from the flex table./*w w w .j a v a 2s. c o m*/ */ private void removeRow(FlexTable flexTable) { int numRows = flexTable.getRowCount(); if (numRows > 1) { flexTable.removeRow(numRows - 1); flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows - 1); } }
From source file:next.celebs.page.SearchPage.java
License:Apache License
public SearchPage(Context ctx_) { this.ctx = ctx_; setStyleName("ySearchPage yPopupPage"); setWidth(WIDTH + "px"); setPopupPosition(336, 88);// w ww.j a va2 s . c o m show(); FlowPanel content = new FlowPanel(); setWidget(content); FlexTable ft = new FlexTable(); ft.setWidth(WIDTH + "px"); final TextBox box = new TextBox(); ImageButton btnDone = new ImageButton(RES.btnDone()); final Label celebField = new Label(); celebField.setStyleName("ySearchName"); btnDone.addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { String celebName = MiscUtils.noNull(celebField.getText()); if (!MiscUtils.isEmpty(box.getText()) || celebName.length() > 1) { doHide(); ctx.getEventBus().fireEvent(new SearchEvent(box.getText() + " " + celebName)); } } }); FlowPanel scrNested = new FlowPanel(); ScrollPanel scrollPanel = new ScrollPanel(scrNested); init(scrollPanel, scrNested, celebField); ImageButton btnClear = new ImageButton(RES.btnClear()); btnClear.addMouseDownHandler(new MouseDownHandler() { @Override public void onMouseDown(MouseDownEvent event) { box.setText(""); celebField.setText(""); } }); celebField.setWidth("240px"); ft.setWidget(0, 0, box); ft.setWidget(0, 1, celebField); ft.setWidget(0, 2, btnClear); ft.setWidget(1, 0, btnDone); ft.setWidget(1, 1, scrollPanel); ft.getRowFormatter().setStyleName(0, "ySearchRow"); FlexCellFormatter fcf = ft.getFlexCellFormatter(); fcf.setColSpan(1, 1, 2); fcf.setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_BOTTOM); content.add(ft); }
From source file:next.i.view.XTableCell.java
License:Apache License
private void XTableCell_(CellData cellData) { FlexTable xt = new FlexTable(); _panel = xt;// w w w . j a v a2 s. c o m initWidget(_panel); _panel.setStyleName(XStyle.tableCell.name()); FlexCellFormatter fcf = xt.getFlexCellFormatter(); Widget[] westW = cellData.getWestWidgets(); Widget[] eastW = cellData.getEastWidgets(); Widget[] textW = cellData.getTextWidgets(); int colInx = 0; int westLen = 0; if (westW != null) { westLen = westW.length; for (Widget w : westW) { xt.setWidget(0, colInx, w); if (textW != null) { fcf.setRowSpan(0, colInx, textW.length); fcf.setHorizontalAlignment(0, colInx, HasHorizontalAlignment.ALIGN_LEFT); fcf.setVerticalAlignment(0, colInx, HasVerticalAlignment.ALIGN_MIDDLE); } colInx++; } } if (textW != null) { for (int i = 0; i < textW.length; i++) { if (i == 0) { xt.setWidget(i, colInx, textW[i]); fcf.setWidth(i, colInx, "99%"); } else { xt.setWidget(i, colInx - westLen, textW[i]); } } colInx++; } if (eastW != null) { for (Widget w : eastW) { xt.setWidget(0, colInx, w); if (textW != null) { fcf.setRowSpan(0, colInx, textW.length); fcf.setHorizontalAlignment(0, colInx, HasHorizontalAlignment.ALIGN_RIGHT); } colInx++; } } // TODO toggle state if (!_isFromController) { addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { _panel.addStyleName(XStyle.selected.name()); new Timer() { public void run() { removeStyleName(XStyle.selected.name()); } }.schedule(300); } }); } }