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.google.code.p.gwtchismes.client.GWTCAlert.java

License:Apache License

protected void initialize(int options) {
    super.initialize(options);

    contentTable = new FlexTable();
    txt = new HTML();
    okButton = new GWTCButton("OK");

    okButton.setImage(okButton.getImagesBundle().dialogOk());

    if ((options & OPTION_DISABLE_OK_BUTTON) == OPTION_DISABLE_OK_BUTTON)
        okButtonDisabled = true;//ww  w. j  a  v  a  2s  . c  o  m

    contentTable.setStyleName(GWTCAlert.STYLE_PANEL);
    contentTable.getCellFormatter().addStyleName(0, 0, GWTCAlert.STYLE_MSG);
    contentTable.setWidget(0, 0, txt);

    contentTable.getCellFormatter().addStyleName(1, 0, GWTCAlert.STYLE_BTN);

    contentTable.setWidget(1, 0, okButton);

    okButton.addStyleName(GWTCAlert.STYLE_BUTTON);
    okButton.addStyleName("gwtc-alert-rndbutton");
    this.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    okButton.setVisible(!okButtonDisabled);

    setStyleName(MAIN_STYLE);
    if ((options & OPTION_ROUNDED_GREY) == OPTION_ROUNDED_GREY
            || (options & OPTION_ROUNDED_BLUE) == OPTION_ROUNDED_BLUE
            || (options & OPTION_ROUNDED_FLAT) == OPTION_ROUNDED_FLAT) {
        addStyleDependentName(STYLE_BOX);
    }
    super.add(contentTable);
}

From source file:com.google.code.p.gwtchismes.client.GWTCButton.java

License:Apache License

private void setUpGWTCButton() {
    container = new FlexTable();
    container.setStyleName(S_BTN);//from w w w  .  j  av  a 2s  .co m
    container.setCellSpacing(0);
    container.setCellPadding(0);
    container.setHTML(0, 0, " ");
    container.getCellFormatter().setStyleName(0, 0, S_BTN + "-" + S_L);
    container.getCellFormatter().setStyleName(0, 1, S_BTN + "-" + S_C);

    textPanel = new FocusPanel();
    textPanel.addFocusHandler(focusHandler);
    textPanel.addBlurHandler(blurHandler);
    textPanel.addKeyPressHandler(keyPressHandler);
    textPanel.addMouseDownHandler(mouseDownHandler);
    textPanel.addMouseOverHandler(mouseOverHandler);
    textPanel.addMouseOutHandler(mouseOutHandler);
    textPanel.setStyleName(S_BTN + "-focus");
    container.setWidget(0, 1, textPanel);

    container.setHTML(0, 2, " ");
    container.getCellFormatter().setStyleName(0, 2, S_BTN + "-" + S_R);

    replaceElement(container.getElement());
    //DOM.sinkEvents(textPanel.getElement(), Event.ONCLICK | Event.FOCUSEVENTS | Event.ONMOUSEDOWN | Event.ONMOUSEOVER | Event.ONMOUSEOUT);
}

From source file:com.google.code.p.gwtchismes.client.GWTCIntervalSelector.java

License:Apache License

private void drawLayout1() {
    mainGrid.getRowFormatter().addStyleName(1, "InfoContainer");

    FlexTable tSelector = new FlexTable();
    tSelector.setWidget(0, 0, changeCheckinLink);
    tSelector.setWidget(0, 1, nightsLabel);
    tSelector.setWidget(0, 2, nightsListBox);
    mainGrid.setWidget(0, 0, tSelector);

    FlexTable tInfo = new FlexTable();
    tInfo.getRowFormatter().addStyleName(0, CHECKIN_ROW);
    tInfo.getRowFormatter().addStyleName(1, CHECKOUT_ROW);
    tInfo.setWidget(0, 0, checkinLabel);
    tInfo.setWidget(0, 1, checkinDateValue);
    tInfo.setWidget(0, 2, checkinWeekValue);
    tInfo.setWidget(1, 0, checkoutLabel);
    tInfo.setWidget(1, 1, checkoutDateValue);
    tInfo.setWidget(1, 2, checkoutWeekValue);
    mainGrid.setWidget(1, 0, tInfo);/*from ww  w.j  a  va 2  s . c  om*/
}

From source file:com.google.code.p.gwtchismes.client.GWTCIntervalSelector.java

License:Apache License

private void drawLayout4() {
    int idx = 0;/*from  w ww  .  ja  va2s. co m*/

    mainGrid.getRowFormatter().addStyleName(idx, CHECKIN_ROW);
    HorizontalPanel checkinInfo = new HorizontalPanel();
    mainGrid.setWidget(idx, 0, checkinLabel);
    checkinInfo.add(checkinDateValue);
    checkinInfo.add(checkinWeekValue);
    checkinInfo.add(checkinButton);
    mainGrid.setWidget(idx, 1, checkinInfo);
    idx++;

    mainGrid.getCellFormatter().addStyleName(idx, 0, NIGHTS_ROW);
    mainGrid.setWidget(idx, 0, nightsLabel);
    nightsLabel.addStyleName(LABELS);

    FlexTable nightsInfo = new FlexTable();
    mainGrid.setWidget(idx, 1, nightsInfo);
    nightsInfo.setWidget(0, 0, nightsListBox);
    nightsInfo.getCellFormatter().addStyleName(0, 0, NIGHTS_ROW);

    nightsInfo.setWidget(0, 1, checkoutLabel);
    nightsInfo.getCellFormatter().addStyleName(0, 1, CHECKOUT_ROW);
    nightsInfo.setWidget(0, 2, checkoutDateValue);
    nightsInfo.getCellFormatter().addStyleName(0, 2, CHECKOUT_ROW);
}

From source file:com.google.code.p.gwtcsample.client.GWTCSample.java

License:Apache License

private Panel createPanelWithDescription(Widget widget, String description) {
    FlexTable panel = new FlexTable();
    panel.addStyleName("descrPanel");

    Label label = new Label(description);
    label.setStyleName("descrLabel");

    panel.setWidget(0, 0, label);//from ww w  .jav  a 2  s . c o m
    panel.setWidget(0, 1, widget);
    panel.getCellFormatter().setWidth(0, 1, "100%");
    panel.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP);
    widget.addStyleName("descrWidget");
    return panel;
}

From source file:com.google.gerrit.client.change.DownloadBox.java

License:Apache License

DownloadBox(ChangeInfo change, String revision, PatchSet.Id psId) {
    this.change = change;
    this.revision = revision;
    this.psId = psId;
    this.commandTable = new FlexTable();
    this.scheme = new ListBox();
    this.scheme.addChangeHandler(new ChangeHandler() {
        @Override/*from w w w .  j  a  v a2s  .  co m*/
        public void onChange(ChangeEvent event) {
            renderCommands();
            if (Gerrit.isSignedIn()) {
                saveScheme();
            }
        }
    });

    setStyleName(Gerrit.RESOURCES.css().downloadBox());
    commandTable.setStyleName(Gerrit.RESOURCES.css().downloadBoxTable());
    scheme.setStyleName(Gerrit.RESOURCES.css().downloadBoxScheme());
    add(commandTable);
}

From source file:com.google.gerrit.client.ui.CommentPanel.java

License:Apache License

protected CommentPanel(CommentLinkProcessor commentLinkProcessor) {
    this.commentLinkProcessor = commentLinkProcessor;
    final FlowPanel body = new FlowPanel();
    initWidget(body);/*from  w ww.  j a  va2 s  .c  o  m*/
    setStyleName(Gerrit.RESOURCES.css().commentPanel());

    messageSummary = new InlineLabel();
    messageSummary.setStyleName(Gerrit.RESOURCES.css().commentPanelSummary());

    header = new FlexTable();
    header.setStyleName(Gerrit.RESOURCES.css().commentPanelHeader());
    header.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            setOpen(!isOpen());
        }
    });
    header.setText(0, 1, "");
    header.setWidget(0, 2, messageSummary);
    header.setText(0, 3, "");
    final CellFormatter fmt = header.getCellFormatter();
    fmt.setStyleName(0, 1, Gerrit.RESOURCES.css().commentPanelAuthorCell());
    fmt.setStyleName(0, 2, Gerrit.RESOURCES.css().commentPanelSummaryCell());
    fmt.setStyleName(0, 3, Gerrit.RESOURCES.css().commentPanelDateCell());
    fmt.setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);
    body.add(header);

    content = new FlowPanel();
    content.setStyleName(Gerrit.RESOURCES.css().commentPanelContent());
    content.setVisible(false);
    body.add(content);

    messageText = new DoubleClickHTML();
    messageText.setStyleName(Gerrit.RESOURCES.css().commentPanelMessage());
    content.add(messageText);
}

From source file:com.google.gwt.demos.fasttree.client.FastTreeDemo.java

License:Apache License

protected Widget profileTree() {
    final FlexTable table = new FlexTable();
    final TextBox branches = new TextBox();
    int row = 0;/* w  ww .j a v a 2 s .c om*/
    table.setText(row, 0, "children per node");
    table.setText(row, 1, "total number of rows");
    table.setText(row, 2, "what type of node");
    ++row;
    table.setWidget(row, 0, branches);
    branches.setText("5");
    final TextBox nodes = new TextBox();

    table.setWidget(row, 1, nodes);
    nodes.setText("2000");
    table.setTitle("Number of nodes");

    final ListBox type = new ListBox();
    type.addItem("Text");
    type.addItem("HTML");
    type.addItem("CheckBox");
    type.setSelectedIndex(1);
    table.setWidget(row, 2, type);
    ++row;
    final int widgetRow = row + 1;
    table.setWidget(row, 0, new Button("Normal tree", new ClickListener() {
        public void onClick(Widget sender) {
            long time = System.currentTimeMillis();
            Tree t = new Tree();
            profileCreateTree(t, Integer.parseInt(branches.getText()), Integer.parseInt(nodes.getText()),
                    TreeType.getType(type.getSelectedIndex()));
            table.setWidget(widgetRow, 0, t);
            Window.alert("Elapsed time: " + (System.currentTimeMillis() - time));
        }
    }));

    table.setWidget(row, 1, new Button("Fast tree", new ClickListener() {
        public void onClick(Widget sender) {
            long time = System.currentTimeMillis();
            FastTree t = new FastTree();
            profileCreateTree(t, Integer.parseInt(branches.getText()), Integer.parseInt(nodes.getText()),
                    TreeType.getType(type.getSelectedIndex()));
            table.setWidget(widgetRow, 1, t);
            Window.alert("Elapsed time: " + (System.currentTimeMillis() - time));
        }
    }));
    ++row;
    table.setText(row, 0, "tree results");
    table.getCellFormatter().setVerticalAlignment(row, 0, HasAlignment.ALIGN_TOP);

    table.setText(row, 1, "fasttree results");
    table.getCellFormatter().setVerticalAlignment(row, 1, HasAlignment.ALIGN_TOP);
    return table;
}

From source file:com.google.gwt.demos.glasspanel.client.GlassPanelDemo.java

License:Apache License

public void onModuleLoad2() {
    RootPanel.get().add(new HTML("<code>$doc.compatMode = <b>" + getCompatMode() + "</b></code>"));

    redAbsolutePanel = new AbsolutePanel();
    redAbsolutePanel.setPixelSize(130, 130);
    RootPanel.get().add(redAbsolutePanel, 500, 150);
    redAbsolutePanel.add(new HTML(
            "This red GlassPanel was created<br>" + "with <code>autoHide</code> set to <code>false</code>."));

    greenAbsolutePanel = RootPanel.get("xyz");
    workaroundIssue1813(greenAbsolutePanel.getElement());
    greenAbsolutePanel.add(new HTML("Click or press <code>ESC</code> once<br>"
            + "to remove the gray GlassPanel.<br><br>" + "Click or press <code>ESC</code> a second<br>"
            + "time to remove this green GlassPanel."));

    Button buttonBodyDefault = new Button("BODY setSize(\"\", \"\")");
    buttonBodyDefault.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            removeGlassPanel();//from w  w w. j  a  va2s  .c om
            RootPanel.get().setSize("", "");
            resetGlassPanels();
        }
    });

    Button buttonBodyLarge = new Button("BODY setSize(\"1000px\", \"1000px\")");
    buttonBodyLarge.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            removeGlassPanel();
            RootPanel.get().setSize("1000px", "1000px");
            resetGlassPanels();
        }
    });

    Button buttonHTMLDefault = new Button("HTML setSize(\"\", \"\")");
    buttonHTMLDefault.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            removeGlassPanel();
            Element htmlElement = DOM.getParent(RootPanel.getBodyElement());
            DOM.setStyleAttribute(htmlElement, "width", "");
            DOM.setStyleAttribute(htmlElement, "height", "");
            resetGlassPanels();
        }
    });

    Button buttonHTMLLarge = new Button("HTML setSize(\"2000px\", \"2000px\")");
    buttonHTMLLarge.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            removeGlassPanel();
            Element htmlElement = DOM.getParent(RootPanel.getBodyElement());
            DOM.setStyleAttribute(htmlElement, "width", "2000px");
            DOM.setStyleAttribute(htmlElement, "height", "2000px");
            resetGlassPanels();
        }
    });

    Button buttonScrollingEnable = new Button("Window.enableScrolling(true)");
    buttonScrollingEnable.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            removeGlassPanel();
            Window.enableScrolling(true);
            resetGlassPanels();
        }
    });

    Button buttonScrollingDisable = new Button("Window.enableScrolling(false)");
    buttonScrollingDisable.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            removeGlassPanel();
            Window.enableScrolling(false);
            resetGlassPanels();
        }
    });

    FlexTable buttonTable = new FlexTable();
    buttonTable.addStyleName("buttons");
    RootPanel.get().add(buttonTable, 100, 50);
    buttonTable.setWidget(0, 0, buttonBodyDefault);
    buttonTable.setWidget(0, 1, buttonBodyLarge);

    buttonTable.setWidget(1, 0, buttonHTMLDefault);
    buttonTable.setWidget(1, 1, buttonHTMLLarge);

    buttonTable.setWidget(2, 0, buttonScrollingEnable);
    buttonTable.setWidget(2, 1, buttonScrollingDisable);

    resetGlassPanels();
}

From source file:com.google.gwt.demos.spinner.client.SpinnerDemoPanel.java

License:Apache License

public SpinnerDemoPanel() {
    FlexTable table = new FlexTable();
    table.setHTML(1, 0, "Value spinner:");
    // Create a value spinner with initial value=0 that allows values between
    // -1000 and 1000
    final ValueSpinner simpleSpinner = new ValueSpinner(0, -1000, 1000);
    table.setWidget(1, 1, simpleSpinner);
    final CheckBox enableSpinner = new CheckBox("Enable/disable");
    enableSpinner.setChecked(simpleSpinner.isEnabled());
    enableSpinner.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            simpleSpinner.setEnabled(enableSpinner.isChecked());
        }/*from  www.j  a  v a  2  s .  c  om*/
    });
    table.setWidget(1, 2, enableSpinner);

    // Create a value spinner that displays the value as a formatted date
    final ValueSpinner dateSpinner = new ValueSpinner(new Date().getTime()) {
        protected String formatValue(long value) {
            return DateTimeFormat.getLongDateFormat().format(new Date(value));
        }

        protected long parseValue(String value) {
            return DateTimeFormat.getLongDateFormat().parse(value).getTime();
        }
    };
    // Min step = milliseconds per day
    dateSpinner.getSpinner().setMinStep(86400000);
    dateSpinner.setStylePrimaryName("dateSpinner");
    table.setHTML(2, 0, "Date spinner:");
    table.setWidget(2, 1, dateSpinner);
    final CheckBox enableDateSpinner = new CheckBox("Enable/disable");
    enableDateSpinner.setChecked(dateSpinner.isEnabled());
    enableDateSpinner.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            dateSpinner.setEnabled(enableDateSpinner.isChecked());
        }
    });
    table.setWidget(2, 2, enableDateSpinner);

    // A TimePicker using AM/PM 12h format
    final TimePicker timePicker = new TimePicker(false);
    table.setHTML(3, 0, "Time picker:");
    table.setWidget(3, 1, timePicker);
    final CheckBox enableTimePicker = new CheckBox("Enable/disable");
    enableTimePicker.setChecked(timePicker.isEnabled());
    enableTimePicker.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            timePicker.setEnabled(enableTimePicker.isChecked());
        }
    });
    table.setWidget(3, 2, enableTimePicker);

    // Creating a date time picker with AM/PM 12h TimePicker
    final DateTimePicker dateTimePicker = new DateTimePicker(false);
    dateTimePicker.setWidth("200px");
    // Create a label to display the selected date
    final Label dateLabel = new Label();
    Button getDate = new Button("Show date");
    getDate.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            // Display the selected date/time using DateTimeFormat
            dateLabel.setText(DateTimeFormat.getMediumDateTimeFormat().format(dateTimePicker.getDate()));
        }
    });
    dateLabel.setStyleName("sandbox-Date");
    table.setHTML(4, 0, "Date time picker:");
    table.setWidget(4, 1, dateTimePicker);
    table.setWidget(5, 0, getDate);
    table.setWidget(5, 1, dateLabel);
    final CheckBox enableDateTimePicker = new CheckBox("Enable/disable");
    enableDateTimePicker.setChecked(dateTimePicker.isEnabled());
    enableDateTimePicker.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            dateTimePicker.setEnabled(enableDateTimePicker.isChecked());
        }
    });
    table.setWidget(4, 2, enableDateTimePicker);

    final VolumeSlider volumeSlider = new VolumeSlider(0, -100, 100);
    volumeSlider.setWidth("250px");
    table.setHTML(7, 0, "Volume slider:");
    table.setWidget(7, 1, volumeSlider);
    final CheckBox enableVolumeSlider = new CheckBox("Enable/disable");
    enableVolumeSlider.setChecked(volumeSlider.isEnabled());
    enableVolumeSlider.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            volumeSlider.setEnabled(enableVolumeSlider.isChecked());
        }
    });
    table.setWidget(7, 2, enableVolumeSlider);

    final TimePicker customTimePicker = new TimePicker(new Date(), null, DateTimeFormat.getFormat("HH"),
            DateTimeFormat.getFormat("mm"), null);
    table.setHTML(8, 0, "Another time picker (24h):");
    table.setWidget(8, 1, customTimePicker);
    final CheckBox enable = new CheckBox("Enable/disable");
    enable.setChecked(customTimePicker.isEnabled());
    enable.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            customTimePicker.setEnabled(enable.isChecked());
        }
    });
    table.setWidget(8, 2, enable);
    initWidget(table);
}