Example usage for com.google.gwt.user.client.ui FlexTable FlexTable

List of usage examples for com.google.gwt.user.client.ui FlexTable FlexTable

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui FlexTable FlexTable.

Prototype

public FlexTable() 

Source Link

Usage

From source file:com.qualogy.qafe.gwt.client.ui.renderer.PanelRenderer.java

License:Apache License

public UIObject render(ComponentGVO component, String uuid, String parent, String context) {
    UIObject panel = null;//from  w w  w.  java2 s.c  om
    if (component != null) {
        if (component instanceof PanelGVO) {
            final ComponentGVO finalComponentGVO = component;
            final String finalUuid = uuid;
            final String finalParent = parent;
            final PanelGVO root = (PanelGVO) component;
            LayoutGVO layout = root.getLayout();
            if (layout instanceof AutoLayoutGVO) {
                if (root.getMenu() != null && !(component instanceof RootPanelGVO)) {
                    panel = new FlexTable() {
                        @Override
                        public void onBrowserEvent(Event event) {
                            if (event.getTypeInt() == Event.ONCONTEXTMENU) {
                                DOM.eventPreventDefault(event);
                                applyContextMenu(event, finalComponentGVO, finalUuid, finalParent);
                            }
                            super.onBrowserEvent(event);
                        }

                        @Override
                        protected void setElement(Element elem) {
                            super.setElement(elem);
                            sinkEvents(Event.ONCONTEXTMENU);
                        }
                    };
                } else {
                    panel = new FlexTable();
                }
                panel.setTitle(component.getTooltip());
                AutoLayoutGVO autoLayoutGVO = (AutoLayoutGVO) layout;
                int columns = autoLayoutGVO.getCols() != null ? autoLayoutGVO.getCols().intValue() : 1;
                UIObject[] children = renderChildComponents(layout.getComponents(), uuid, parent, context);

                if (children != null) {
                    int nrOfRows = (children.length / columns) + 1;

                    for (int i = 0; i < nrOfRows; i++) {
                        for (int j = 0; j < columns; j++) {
                            int element = (i * columns) + j;
                            if (element < children.length) {
                                if (children[element] != null) {
                                    if (children[element] instanceof Widget) {
                                        ((FlexTable) panel).setWidget(i, j, (Widget) children[element]);
                                    }
                                }
                            }
                        }
                    }
                }
            } else if (layout instanceof AbsoluteLayoutGVO) {
                AbsoluteLayoutGVO absoluteLayout = (AbsoluteLayoutGVO) layout;
                if (root.getMenu() != null && !(component instanceof RootPanelGVO)) {
                    panel = new AbsolutePanel() {
                        @Override
                        public void onBrowserEvent(Event event) {
                            if (event.getTypeInt() == Event.ONCONTEXTMENU) {
                                DOM.eventPreventDefault(event);
                                applyContextMenu(event, finalComponentGVO, finalUuid, finalParent);
                            }
                            super.onBrowserEvent(event);
                        }

                        @Override
                        protected void setElement(Element elem) {
                            super.setElement(elem);
                            sinkEvents(Event.ONCONTEXTMENU);
                        }
                    };
                } else {
                    panel = new AbsolutePanel();
                }
                AbsolutePanel absolutePanel = (AbsolutePanel) panel;
                ElementGVO[] elementGVOs = absoluteLayout.getElements();
                if (elementGVOs != null) {
                    for (int i = 0; i < elementGVOs.length; i++) {
                        UIObject uiObject = super.renderChildComponent(elementGVOs[i].getComponent(), uuid,
                                parent, context);
                        if (uiObject instanceof Widget) {
                            absolutePanel.add((Widget) uiObject, elementGVOs[i].getX(), elementGVOs[i].getY());
                        }
                    }
                }
            } else if (layout instanceof GridLayoutGVO) {
                GridLayoutGVO gridLayout = (GridLayoutGVO) layout;
                if (root.getMenu() != null && !(component instanceof RootPanelGVO)) {
                    panel = new FlexTable() {
                        @Override
                        public void onBrowserEvent(Event event) {
                            if (event.getTypeInt() == Event.ONCONTEXTMENU) {
                                DOM.eventPreventDefault(event);
                                applyContextMenu(event, finalComponentGVO, finalUuid, finalParent);
                            }
                            super.onBrowserEvent(event);
                        }

                        @Override
                        protected void setElement(Element elem) {
                            super.setElement(elem);
                            sinkEvents(Event.ONCONTEXTMENU);
                        }
                    };
                } else {
                    panel = new FlexTable();
                }
                ElementGVO[] elementGVOs = gridLayout.getElements();
                if (elementGVOs != null) {
                    int maxX = 0;
                    int maxY = 0;
                    for (int i = 0; i < elementGVOs.length; i++) {
                        if (maxX < elementGVOs[i].getX()) {
                            maxX = elementGVOs[i].getX();
                        }
                        if (maxY < elementGVOs[i].getY()) {
                            maxY = elementGVOs[i].getY();
                        }
                    }
                    RendererHelper.addMenu(component, panel, uuid, parent);
                    FlexTable flexTable = (FlexTable) panel;
                    flexTable.setTitle(root.getTooltip());
                    for (int i = 0; i < elementGVOs.length; i++) {
                        UIObject uiObject = super.renderChildComponent(elementGVOs[i].getComponent(), uuid,
                                parent, context);
                        if (uiObject instanceof Widget) {
                            flexTable.setWidget(elementGVOs[i].getY(), elementGVOs[i].getX(),
                                    (Widget) uiObject);
                            if (elementGVOs[i].getStyleClass() != null
                                    && elementGVOs[i].getStyleClass().length() > 0) {
                                flexTable.getFlexCellFormatter().setStyleName(elementGVOs[i].getY(),
                                        elementGVOs[i].getX(), elementGVOs[i].getStyleClass());
                            }
                            Element gvoElement = flexTable.getFlexCellFormatter()
                                    .getElement(elementGVOs[i].getY(), elementGVOs[i].getX());
                            RendererHelper.setStyleForElement(gvoElement, elementGVOs[i].getStyleProperties());
                            if (elementGVOs[i].getGridwidth() > 0) {
                                flexTable.getFlexCellFormatter().setColSpan(elementGVOs[i].getY(),
                                        elementGVOs[i].getX(), elementGVOs[i].getGridwidth());
                            }
                            if (elementGVOs[i].getGridheight() > 0) {
                                flexTable.getFlexCellFormatter().setRowSpan(elementGVOs[i].getY(),
                                        elementGVOs[i].getX(), elementGVOs[i].getGridheight());
                            }
                        }
                    }
                }
            } else if (layout instanceof HorizontalLayoutGVO) {
                if (root.getMenu() != null && !(component instanceof RootPanelGVO)) {
                    panel = new HorizontalPanel() {
                        @Override
                        public void onBrowserEvent(Event event) {
                            if (event.getTypeInt() == Event.ONCONTEXTMENU) {
                                DOM.eventPreventDefault(event);
                                applyContextMenu(event, finalComponentGVO, finalUuid, finalParent);
                            }
                            super.onBrowserEvent(event);
                        }

                        @Override
                        protected void setElement(Element elem) {
                            super.setElement(elem);
                            sinkEvents(Event.ONCONTEXTMENU);
                        }
                    };
                } else {
                    panel = new HorizontalPanel();
                }
                performCommonTasks(root, panel, uuid, parent);
            } else if (layout instanceof VerticalLayoutGVO) {
                if (root.getMenu() != null && !(component instanceof RootPanelGVO)) {
                    panel = new VerticalPanel() {
                        @Override
                        public void onBrowserEvent(Event event) {
                            if (event.getTypeInt() == Event.ONCONTEXTMENU) {
                                DOM.eventPreventDefault(event);
                                applyContextMenu(event, finalComponentGVO, finalUuid, finalParent);
                            }
                            super.onBrowserEvent(event);
                        }

                        @Override
                        protected void setElement(Element elem) {
                            super.setElement(elem);
                            sinkEvents(Event.ONCONTEXTMENU);
                        }
                    };
                } else {
                    panel = new VerticalPanel();
                }
                performCommonTasks(root, panel, uuid, parent);
            } else if (layout instanceof AbsoluteLayoutGVO) {
                if (root.getMenu() != null && !(component instanceof RootPanelGVO)) {
                    panel = new DockPanel() {
                        @Override
                        public void onBrowserEvent(Event event) {
                            if (event.getTypeInt() == Event.ONCONTEXTMENU) {
                                DOM.eventPreventDefault(event);
                                applyContextMenu(event, finalComponentGVO, finalUuid, finalParent);
                            }
                            super.onBrowserEvent(event);
                        }

                        @Override
                        protected void setElement(Element elem) {
                            super.setElement(elem);
                            sinkEvents(Event.ONCONTEXTMENU);
                        }
                    };
                } else {
                    panel = new DockPanel();
                }
                performCommonTasks(root, (Panel) panel, uuid, parent);
            } else if (layout instanceof BorderLayoutGVO) {
                if (root.getMenu() != null && !(component instanceof RootPanelGVO)) {
                    panel = new DockPanel() {
                        @Override
                        public void onBrowserEvent(Event event) {
                            if (event.getTypeInt() == Event.ONCONTEXTMENU) {
                                DOM.eventPreventDefault(event);
                                applyContextMenu(event, finalComponentGVO, finalUuid, finalParent);
                            }
                            super.onBrowserEvent(event);
                        }

                        @Override
                        protected void setElement(Element elem) {
                            super.setElement(elem);
                            sinkEvents(Event.ONCONTEXTMENU);
                        }
                    };
                } else {
                    panel = new DockPanel();
                }
                DockPanel dockPanel = (DockPanel) panel;
                dockPanel.setHorizontalAlignment(DockPanel.ALIGN_CENTER);
                dockPanel.setSpacing(3);
                BorderLayoutGVO borderLayoutGVO = (BorderLayoutGVO) layout;
                if (borderLayoutGVO.getNorth() != null) {
                    dockPanel.add(
                            (Widget) renderChildComponent(borderLayoutGVO.getNorth(), uuid, parent, context),
                            DockPanel.NORTH);
                }
                if (borderLayoutGVO.getSouth() != null) {
                    dockPanel.add(
                            (Widget) renderChildComponent(borderLayoutGVO.getSouth(), uuid, parent, context),
                            DockPanel.SOUTH);
                }
                if (borderLayoutGVO.getEast() != null) {
                    dockPanel.add(
                            (Widget) renderChildComponent(borderLayoutGVO.getEast(), uuid, parent, context),
                            DockPanel.EAST);
                }
                if (borderLayoutGVO.getWest() != null) {
                    dockPanel.add(
                            (Widget) renderChildComponent(borderLayoutGVO.getWest(), uuid, parent, context),
                            DockPanel.WEST);
                }
                if (borderLayoutGVO.getCenter() != null) {
                    dockPanel.add(
                            (Widget) renderChildComponent(borderLayoutGVO.getCenter(), uuid, parent, context),
                            DockPanel.CENTER);
                }

            }
            if (root.getConcurrentModificationEnabled() && (root.getFieldName() != null)
                    && !root.getFieldName().isEmpty()) {
                addChecksum(panel);
            }
            if (root.getFieldName() != null && root.getFieldName().length() > 0
                    && root.getShowdatacontrol() != null && root.getShowdatacontrol().booleanValue()) {
                DockPanel dockPanel = null;
                if (root.getMenu() != null && !(component instanceof RootPanelGVO)) {
                    dockPanel = new DockPanel() {
                        @Override
                        public void onBrowserEvent(Event event) {
                            if (event.getTypeInt() == Event.ONCONTEXTMENU) {
                                DOM.eventPreventDefault(event);
                                applyContextMenu(event, finalComponentGVO, finalUuid, finalParent);
                            }
                            super.onBrowserEvent(event);
                        }

                        @Override
                        protected void setElement(Element elem) {
                            super.setElement(elem);
                            sinkEvents(Event.ONCONTEXTMENU);
                        }
                    };
                } else {
                    dockPanel = new DockPanel();
                }
                dockPanel.add(createDataPanelToolBar(root, uuid, parent), DockPanel.NORTH);
                dockPanel.add((Widget) panel, DockPanel.NORTH);
                panel = dockPanel;
            }
            if (root.getDisclosure()) {
                DisclosurePanel disclosurePanel = new DisclosurePanel(root.getTitle());
                disclosurePanel.setAnimationEnabled(true);
                disclosurePanel.add((Widget) panel);
                panel = disclosurePanel;
            } else if (root.getTitle() != null && root.getTitle().length() > 0) {
                CaptionPanel titledPanel = null;
                if (root.getMenu() != null && !(component instanceof RootPanelGVO)) {
                    titledPanel = new CaptionPanel(root.getTitle()) {
                        @Override
                        public void onBrowserEvent(Event event) {
                            if (event.getTypeInt() == Event.ONCONTEXTMENU) {
                                DOM.eventPreventDefault(event);
                                applyContextMenu(event, finalComponentGVO, finalUuid, finalParent);
                            }
                            super.onBrowserEvent(event);
                        }

                        @Override
                        protected void setElement(Element elem) {
                            super.setElement(elem);
                            sinkEvents(Event.ONCONTEXTMENU);
                        }
                    };
                } else {
                    titledPanel = new CaptionPanel(root.getTitle());
                }
                titledPanel.add((Widget) panel);
                panel = titledPanel;
            }

            RendererHelper.fillIn(component, panel, uuid, parent, context);
        }
    }
    return panel;
}

From source file:com.qualogy.qafe.mgwt.client.ui.component.QShowPanel.java

License:Apache License

private FlexTable createInnerPanel() {
    FlexTable panel = new FlexTable();
    QLabel labelClose = new QLabel("X");
    labelClose.setStyleName(ComponentHelper.STYLE_SHOWPANEL_CLOSE);
    labelClose.addTapHandler(new TapHandler() {
        @Override//from   ww  w  . j  av  a  2  s .  com
        public void onTap(TapEvent event) {
            hide();
        }
    });
    panel.setWidget(0, 1, labelClose);
    return panel;
}

From source file:com.risevision.ui.client.common.widgets.colorPicker.ColorPickerDialog.java

License:Open Source License

public ColorPickerDialog() {
    super(false, true); //set auto-hide and modal

    contentPanel.add(colorPalette);/*from  w  w  w .  j av  a 2s .  c  o m*/
    contentPanel.add(colorRGB);
    contentPanel.add(colorHSV);
    contentPanel.add(colorMap);

    contentBar.addTab("Palette");
    contentBar.addTab("RGB");
    contentBar.addTab("HSV");
    contentBar.addTab("Map");

    contentPanel.showWidget(PALETTE_PANEL);
    contentBar.selectTab(PALETTE_PANEL);

    // Define the panels
    HorizontalPanel colorPanel = new HorizontalPanel();
    colorPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    colorPanel.add(new Label("Color:"));
    colorPanel.add(new SpacerWidget());
    colorPanel.add(colorTextBox);

    HorizontalPanel transparencyPanel = new HorizontalPanel();
    transparencyPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    transparencyPanel.add(new Label("None:"));
    transparencyPanel.add(new SpacerWidget());
    transparencySwab.setWidth("20px");
    transparencySwab.setHeight("20px");
    transparencySwab.getElement().getStyle().setProperty("border", "1px solid #666");
    //        DOM.setStyleAttribute(getElement(), "cursor", "default");
    transparencySwab.getElement().getStyle().setProperty("backgroundImage", "url(/images/preview-opacity.png)");
    transparencyPanel.add(transparencySwab);

    VerticalPanel previewPanel = new VerticalPanel();
    previewPanel.setHeight("100%");
    previewPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    previewPanel.add(previewWidget);
    previewPanel.add(historyWidget);

    HorizontalPanel alphaPanel = new HorizontalPanel();
    alphaPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    alphaPanel.setWidth("100%");
    alphaPanel.add(new Label("Alpha:"));
    HTML spacer3 = new HTML("&nbsp;");
    alphaPanel.add(spacer3);
    alphaPanel.setCellWidth(spacer3, "100%");
    alphaPanel.add(alphaSlider);

    buttonPanel.add(okButton);
    buttonPanel.add(new SpacerWidget());
    buttonPanel.add(cancelButton);

    // Put it together      
    FlexTable middleTable = new FlexTable();
    middleTable.setCellSpacing(0);
    middleTable.setCellPadding(0);

    middleTable.setWidget(0, 0, colorPanel);
    middleTable.getCellFormatter().setWidth(0, 1, "5px");
    middleTable.setWidget(0, 2, transparencyPanel);

    middleTable.getCellFormatter().setHeight(1, 0, "5px");

    middleTable.setWidget(2, 0, contentBar);

    middleTable.setWidget(3, 0, contentPanel);
    middleTable.getCellFormatter().setVerticalAlignment(3, 2, HasVerticalAlignment.ALIGN_MIDDLE);
    middleTable.getCellFormatter().setHorizontalAlignment(3, 2, HasHorizontalAlignment.ALIGN_CENTER);
    middleTable.setWidget(3, 2, previewPanel);

    middleTable.getCellFormatter().setHeight(4, 0, "5px");

    middleTable.setWidget(5, 0, alphaPanel);
    middleTable.setWidget(5, 2, alphaTextBox);

    middleTable.setWidget(6, 0, buttonPanel);

    setWidget(middleTable);

    styleControls();
    initButtons();
    initHandlers();
    initCommands();
}

From source file:com.risevision.ui.client.common.widgets.colorPicker.ColorPickerHSV.java

License:Artistic License

public ColorPickerHSV() {
    hue = 0;/*www .j  av  a 2 s .  c om*/
    saturation = 100;
    brightness = 100;

    FlexTable table = new FlexTable();

    // Add the small slider bar
    sliderHue = new SliderBar(this, false, SliderBar.Hue);
    sliderSaturation = new SliderBar(this, false, SliderBar.Saturation);
    sliderBrightness = new SliderBar(this, false, SliderBar.Brightness);

    // 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);

    // Define the Flextable's content
    table.setText(0, 0, "Hue:");
    table.setWidget(1, 0, sliderHue);
    table.setWidget(1, 1, tbHue);
    table.setText(2, 0, "Saturation:");
    table.setWidget(3, 0, sliderSaturation);
    table.setWidget(3, 1, tbSaturation);
    table.setText(4, 0, "Brightness:");
    table.setWidget(5, 0, sliderBrightness);
    table.setWidget(5, 1, tbBrightness);

    styleControls();

    // Final setup
    initWidget(table);
}

From source file:com.risevision.ui.client.common.widgets.colorPicker.ColorPickerRGB.java

License:Artistic License

public ColorPickerRGB() {
    red = 255;// ww  w.  j  av a2s .  c  o  m
    green = 0;
    blue = 0;

    FlexTable table = new FlexTable();

    // Add the small slider bar
    sliderRed = new SliderBar(this, false, SliderMap.Red);
    sliderGreen = new SliderBar(this, false, SliderMap.Green);
    sliderBlue = new SliderBar(this, false, SliderMap.Blue);

    // Define the Flextable's content
    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);

    // Put together the FlexTable
    table.setText(0, 0, "Red:");
    table.setWidget(1, 0, sliderRed);
    table.setWidget(1, 1, tbRed);
    table.setText(2, 0, "Green:");
    table.setWidget(3, 0, sliderGreen);
    table.setWidget(3, 1, tbGreen);
    table.setText(4, 0, "Blue:");
    table.setWidget(5, 0, sliderBlue);
    table.setWidget(5, 1, tbBlue);

    styleControls();

    // Final setup
    initWidget(table);
}

From source file:com.seanchenxi.gwt.serenity.client.widget.PopupLabelBox.java

License:Apache License

public PopupLabelBox(int columns) {
    super(true, true);
    this.columns = columns;
    this.table = new FlexTable();
    this.table.setSize("100%", "auto");
    setWidget(new ScrollPanel(table));
    setGlassEnabled(false);//from www  .jav a 2 s .c  o  m
    setAutoHideOnHistoryEventsEnabled(true);
    setStyleName(getResources().style().popLabelBox());
}

From source file:com.seanchenxi.gwt.ui.widget.MessageBox.java

License:Apache License

private MessageBox() {
    buttons = new FlowPanel();

    container = new FlexTable();
    container.setSize(getResourceStyle().containerWidth(), getResourceStyle().containerHeight());
    container.setCellPadding(getResourceStyle().containerCellPadding());
    container.setCellSpacing(getResourceStyle().containerCellSpacing());

    CellFormatter cellFormatter = container.getCellFormatter();

    container.setHTML(0, 0, "");
    cellFormatter.getElement(0, 0).setClassName(getResourceStyle().messageBoxIconCell());
    container.setHTML(0, 1, "");

    container.setWidget(1, 0, buttons);//from w  w  w  . j  a  va  2s  . co m
    container.getFlexCellFormatter().setColSpan(1, 0, 2);
    cellFormatter.getElement(1, 0).setClassName(getResourceStyle().messageBoxButtonCell());

    dialog = new DialogBox(false, true);
    dialog.setStyleName(getResourceStyle().messageBox());
    dialog.getCaption().asWidget().setStyleName(getResourceStyle().messageBoxCaption());
    dialog.setWidget(container);
}

From source file:com.sencha.gxt.explorer.client.layout.BorderLayoutUiBinderExample.java

License:sencha.com license

@UiFactory
public FlexTable createFlexTable() {
    FlexTable table = new FlexTable();
    table.getElement().getStyle().setProperty("margin", "10px");
    table.setCellSpacing(8);/*  w w  w.  j  a  v  a  2s.c o  m*/
    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.shinetech.client.screen.MemberScreen.java

License:Apache License

private void init() {
    add(new HTML("<h1>Shine Reference GWT</h1>"));
    add(new HTML("<p>This sample shows simple member search and edit functionality</p><br>"));

    // Search Panel
    HorizontalPanel pnlSearch = new HorizontalPanel();
    pnlSearch.add(new Label("Search for Member ID : "));
    pnlSearch.add(tbSearch);//from   w  w w  .  j a  v  a2 s .c o m
    pnlSearch.add(btnSearch);
    btnSearch.addClickListener(this);
    add(pnlSearch);

    // Single Member Details Panel
    add(new HTML("<br>"));
    add(new Label("Member Details : "));
    FlexTable tblMember = new FlexTable();
    tblMember.setText(0, 0, "First Name");
    tblMember.setWidget(0, 1, tbFirstName);
    tblMember.setText(1, 0, "Last Name");
    tblMember.setWidget(1, 1, tbLastName);
    add(tblMember);

    // Button Panel
    HorizontalPanel btnPanel = new HorizontalPanel();
    btnDelete.addClickListener(this);
    btnSave.addClickListener(this);
    btnRefresh.addClickListener(this);
    btnPanel.add(btnDelete);
    btnPanel.add(btnSave);
    btnPanel.add(btnRefresh);
    add(btnPanel);

    // Status Box
    add(new HTML("<br>"));
    add(new Label("Status : "));
    tbStatusBox.setCharacterWidth(80);
    tbStatusBox.setVisibleLines(4);
    add(tbStatusBox);

    // Set Focus for Screen
    focusWidget = tbSearch;
}

From source file:com.siderakis.demo.client.MultiSelectDemo.java

License:Apache License

private void addMultiUploadInput() {
    final FileInput fileInput = new FileInput();
    fileInput.setAllowMultipleFiles(true);
    panel.add(new Label(fileInput.supportsFileAPI() ? "Select multiple files:"
            : "Your browser doesn't support multiple files!:"));

    fileInput.setName("uploadFormElement");

    panel.add(fileInput);// w w  w. jav a 2 s.  c  o m

    final FlexTable table = new FlexTable();
    panel.add(table);
    fileInput.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(final ChangeEvent event) {
            table.removeAllRows();
            table.setHTML(0, 0, "<b>File name</b>");
            table.setHTML(0, 1, "<b>File size</b>");
            int row = 1;
            for (final File file : fileInput.getFiles()) {
                table.setText(row, 0, file.getFileName());
                table.setText(row, 1, file.getFileSize() + "");
                ++row;
            }
        }
    });
}