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.googlecode.hmvc4gwt.example.hmvcblog.frontend.dashboard.client.addblog.AddBlogController.java

License:Open Source License

public void initView() {

    Label labelTitle = new Label(I18N.constants.labelBlogTitle());
    getView().setLabelTitle(labelTitle);

    Label labelDescription = new Label(I18N.constants.labelBlogDescription());
    getView().setLabelDescription(labelDescription);

    TextBox textBoxTitle = new TextBox();
    getView().setTextBoxTitle(textBoxTitle);

    TextArea textAreaDescription = new TextArea();
    getView().setTextAreaDescription(textAreaDescription);

    Button buttonAddBlog = new Button(I18N.constants.buttonAddBlog());
    buttonAddBlog.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            addBlog();//w  ww.j a v a 2s . com
        }
    });
    getView().setButtonAddBlog(buttonAddBlog);

    Button buttonCancel = new Button(I18N.constants.buttonCancel());
    buttonCancel.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            getComponent().terminateComponent();
            History.back();
        }
    });
    getView().setButtonCancel(buttonCancel);

    HorizontalPanel horizontalPanelButtons = new HorizontalPanel();
    horizontalPanelButtons.add(buttonAddBlog);
    horizontalPanelButtons.add(buttonCancel);

    FlexTable felxtableContainer = new FlexTable();
    getView().setFlexTableContainer(felxtableContainer);

    felxtableContainer.setWidget(0, 0, labelTitle);
    felxtableContainer.setWidget(0, 1, textBoxTitle);
    felxtableContainer.setWidget(1, 0, labelDescription);
    felxtableContainer.setWidget(1, 1, textAreaDescription);
    felxtableContainer.setWidget(2, 1, horizontalPanelButtons);

}

From source file:com.googlecode.hmvc4gwt.example.hmvcblog.frontend.dashboard.client.dashboard.DashboardController.java

License:Open Source License

public void initView() {

    AbsolutePanel absolutePanelContainer = new AbsolutePanel();
    getView().setAbsolutePanelContainer(absolutePanelContainer);

    Label labelTitle = new Label(I18N.constants.labelDashboard());
    getView().setLabelTitle(labelTitle);

    Hyperlink hyperlinkEditUserData = new Hyperlink(I18N.constants.linkEditUserData(),
            HistoryToken.editUserdata);// w w w  . ja v a2s .co m
    getView().setEditUserData(hyperlinkEditUserData);

    Hyperlink hyperlinkLogout = new Hyperlink(I18N.constants.linkLogout(), HistoryToken.logout);
    getView().setLogout(hyperlinkLogout);

    FlexTable flexTableBloglist = new FlexTable();
    flexTableBloglist.setStylePrimaryName("tableBlogList");
    getView().setFlexTableBlogList(flexTableBloglist);

    Label labelBloglist = new Label(I18N.constants.labelUserBlogList());
    getView().setLabelBloglist(labelBloglist);

    Hyperlink hyperlinkAddBlog = new Hyperlink(I18N.constants.labelAddBlog(), HistoryToken.addBlog);
    getView().setHyperlinkAddBlog(hyperlinkAddBlog);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setStylePrimaryName("panelMenu");
    horizontalPanel.setSpacing(3);
    horizontalPanel.add(getView().getEditUserData());
    horizontalPanel.add(getView().getLogout());

    absolutePanelContainer.add(horizontalPanel);
    absolutePanelContainer.add(flexTableBloglist);
    absolutePanelContainer.add(hyperlinkAddBlog);

}

From source file:com.googlecode.hmvc4gwt.example.hmvcblog.frontend.dashboard.client.edit.blog.EditBlogController.java

License:Apache License

/**
 * @param blogEntryDTO//from w w  w. j  a  v a2s . c o  m
 */
private void createTreeItemBlogEntry(BlogEntryDTO blogEntryDTO,
        List<BlogEntryCommentDTO> listBlogEntryCommentDTO, Tree treeBlogEntries) {

    Label labelTitle = new Label(blogEntryDTO.getTitle());

    Hyperlink hyperlinkEdit = new Hyperlink(I18N.constants.linkEdit(),
            HistoryToken.editBlogEntry + "=" + blogEntryDTO.getId());
    Hyperlink hyperlinkRemove = new Hyperlink(I18N.constants.linkRemove(), "");
    hyperlinkRemove.addClickListener(getClickListenerRemoveBlogEntry());

    FlexTable tableBlogEntryTreeItem = new FlexTable();

    tableBlogEntryTreeItem.setWidget(0, 0, labelTitle);
    tableBlogEntryTreeItem.setWidget(0, 1, hyperlinkRemove);
    tableBlogEntryTreeItem.setWidget(0, 2, hyperlinkEdit);

    FlexCellFormatter cellFormatter = tableBlogEntryTreeItem.getFlexCellFormatter();
    cellFormatter.setColSpan(1, 0, 3);

    tableBlogEntryTreeItem.setWidget(1, 0, new Label(blogEntryDTO.getText()));

    TreeItem treeItemBlogEntry = treeBlogEntries.addItem(tableBlogEntryTreeItem);

    getModel().getMapTreeItemBlogEntryDTO().put(treeItemBlogEntry, blogEntryDTO);

    for (BlogEntryCommentDTO blogEntryCommentDTO : listBlogEntryCommentDTO) {

        createTreeItemBlogEntryComment(blogEntryCommentDTO, treeItemBlogEntry);

    }
}

From source file:com.googlecode.hmvc4gwt.example.hmvcblog.frontend.dashboard.client.edit.blog.EditBlogController.java

License:Apache License

/**
 * @param blogEntryCommentDTO/*from w  w w. jav a 2s .  co  m*/
 * @param treeItemBlogEntry
 */
private void createTreeItemBlogEntryComment(BlogEntryCommentDTO blogEntryCommentDTO,
        TreeItem treeItemBlogEntry) {

    Label labelText = new Label(blogEntryCommentDTO.getText());

    Hyperlink hyperlinkRemove = new Hyperlink(I18N.constants.linkRemove(), "");
    hyperlinkRemove.addClickListener(getClickListenerRemoveBlogEntryComment());

    FlexTable flexTableBlogEntryComment = new FlexTable();

    flexTableBlogEntryComment.setWidget(0, 0, labelText);
    flexTableBlogEntryComment.setWidget(0, 1, hyperlinkRemove);

    TreeItem treeItemBlogComment = treeItemBlogEntry.addItem(flexTableBlogEntryComment);

    getModel().getMapTreeItemBlogEntryCommentDTO().put(treeItemBlogComment, blogEntryCommentDTO);
}

From source file:com.googlesource.gerrit.plugins.verifystatus.client.JobsScreen.java

License:Apache License

private void display(NativeMap<VerificationInfo> jobs) {
    int columns = 7;
    FlexTable t = new FlexTable();
    t.setStyleName("verifystatus-jobsTable");
    FlexCellFormatter fmt = t.getFlexCellFormatter();
    for (int c = 0; c < columns; c++) {
        fmt.addStyleName(0, c, "dataHeader");
        fmt.addStyleName(0, c, "topMostCell");
    }/*from   w  ww.  ja  v a2  s.c om*/
    fmt.addStyleName(0, 0, "leftMostCell");

    t.setText(0, 0, "Result");
    t.setText(0, 1, "Name");
    t.setText(0, 2, "Duration");
    t.setText(0, 3, "Voting");
    t.setText(0, 4, "Rerun");
    t.setText(0, 5, "Category");
    t.setText(0, 6, "Reporter");
    t.setText(0, 7, "Date");

    int row = 1;
    for (String key : jobs.keySet()) {
        VerificationInfo vi = jobs.get(key);

        for (int c = 0; c < columns; c++) {
            fmt.addStyleName(row, c, "dataCell");
            fmt.addStyleName(row, 0, "leftMostCell");
        }
        short vote = vi.value();
        if (vote > 0) {
            t.setWidget(row, 0, new Image(VerifyStatusPlugin.RESOURCES.greenCheck()));
        } else if (vote < 0) {
            t.setWidget(row, 0, new Image(VerifyStatusPlugin.RESOURCES.redNot()));
        } else if (vote == 0) {
            t.setWidget(row, 0, new Image(VerifyStatusPlugin.RESOURCES.warning()));
        }
        Anchor anchor = new Anchor(vi.name(), vi.url());
        t.setWidget(row, 1, anchor);
        t.setText(row, 2, vi.duration());
        if (vi.abstain()) {
            t.setText(row, 3, "non-voting");
        } else {
            t.setText(row, 3, "voting");
        }
        if (vi.rerun()) {
            t.setText(row, 4, "Y");
        } else {
            t.setText(row, 4, "N");
        }

        t.setText(row, 5, vi.category());
        t.setText(row, 6, vi.reporter());
        t.setText(row, 7, FormatUtil.shortFormat(vi.granted()));
        row++;
    }
    add(t);
}

From source file:com.googlesource.gerrit.plugins.xdocs.client.XDocSideBySideDiffScreen.java

License:Apache License

@Override
protected void display(ChangeInfo change) {
    String frameIdA = "xdoc_sidebyside_diff_a_iframe";
    Frame frameA = getRevisionA() != null
            ? new Frame(XDocApi.getUrl(change.project(), getRevisionSideA(), getPath()))
            : new Frame();
    frameA.getElement().setId(frameIdA);
    XDocScreen.resize(frameA, frameIdA);

    String frameIdB = "xdoc_sidebyside_diff_b_iframe";
    Frame frameB = new Frame(XDocApi.getUrl(change.project(), getRevisionSideB(), getPath()));
    frameB.getElement().setId(frameIdB);
    XDocScreen.resize(frameB, frameIdB);

    FlexTable t = new FlexTable();
    t.setStyleName("xdocs-diff-table");
    int row = addRow(t);
    t.setWidget(row, 0,/*from w w  w.j a  v  a2s . co m*/
            new PatchSetSelectBox(DiffView.SIDE_BY_SIDE, DisplaySide.A, change, base, patchSet, path));
    t.setWidget(row, 1,
            new PatchSetSelectBox(DiffView.SIDE_BY_SIDE, DisplaySide.B, change, base, patchSet, path));
    row = addRow(t);
    t.setWidget(row, 0, frameA);
    t.setWidget(row, 1, frameB);
    add(t);
}

From source file:com.googlesource.gerrit.plugins.xdocs.client.XDocUnifiedDiffScreen.java

License:Apache License

@Override
protected void display(ChangeInfo change) {
    String frameId = "xdoc_unified_diff_iframe";
    Frame frame = new Frame(XDocApi.getUrl(change.project(), getRevision(), getPath()));
    frame.getElement().setId(frameId);//from   www  .  ja va  2 s  . c  om
    XDocScreen.resize(frame, frameId);

    FlexTable t = new FlexTable();
    t.setStyleName("xdocs-diff-table");
    t.addStyleName("xdocs-unified-diff-table");
    t.setWidget(addRow(t), 0,
            new PatchSetSelectBox(DiffView.UNIFIED_DIFF, DisplaySide.A, change, base, patchSet, path));
    t.setWidget(addRow(t), 0,
            new PatchSetSelectBox(DiffView.UNIFIED_DIFF, DisplaySide.B, change, base, patchSet, path));
    t.setWidget(addRow(t), 0, frame);
    add(t);
}

From source file:com.hazelcast.monitor.client.HazelcastMonitor.java

License:Open Source License

private DisclosurePanel createClusterAddPanel() {
    final DisclosurePanel disclosurePanel = new DisclosurePanel("Add Cluster to Monitor");

    final TextBox tbGroupName = new TextBox();
    tbGroupName.setText(getTextValue(GROUP_NAME_COOKIE_NAME, "dev"));
    tbGroupName.setWidth("120px");
    final TextBox tbGroupPass = new TextBox();
    tbGroupPass.setText(getTextValue(GROUP_PASSWORD_COOKIE_NAME, "dev-pass"));
    tbGroupPass.setWidth("120px");
    final TextBox tbAddresses = new TextBox();
    tbAddresses.setWidth("120px");
    tbAddresses.setText(getTextValue(GROUP_MEMBERS_COOKIE_NAME, "127.0.0.1:5701"));
    final Label lbError = new Label("");
    lbError.setVisible(false);/*from  w  w w .j av  a2  s.  c  o m*/
    final Button btAddCluster = new Button("Add Cluster");
    btAddCluster
            .addClickHandler(new AddClusterClickHandler(this, tbGroupName, tbGroupPass, tbAddresses, lbError));
    FlexTable table = new FlexTable();
    table.setWidget(0, 0, new Label("Group Name:"));
    table.setWidget(1, 0, new Label("Password:"));
    table.setWidget(2, 0, new Label("Address:"));
    table.setWidget(0, 1, tbGroupName);
    table.setWidget(1, 1, tbGroupPass);
    table.setWidget(2, 1, tbAddresses);
    table.setWidget(3, 1, btAddCluster);
    table.setWidget(4, 0, lbError);
    table.getFlexCellFormatter().setColSpan(4, 0, 2);
    table.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    table.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    table.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    //        disclosurePanel.add(vPanel);
    disclosurePanel.add(table);
    disclosurePanel.setOpen(true);
    return disclosurePanel;
}

From source file:com.hazelcast.monitor.client.MapBrowserPanel.java

License:Open Source License

@Override
protected FlexTable createTable() {
    FlexTable table = new FlexTable();
    table.addStyleName("table");
    table.addStyleName("mapstats");
    FlexTable getTable = new FlexTable();
    table.setWidget(0, 0, new Label(""));
    table.getFlexCellFormatter().setColSpan(0, 0, 2);
    table.setWidget(1, 1, getTable);// w  w w.j  a  v  a  2s . co  m
    final TextBox key = new TextBox();
    getTable.setWidget(0, 0, new Label("Key: "));
    getTable.setWidget(0, 1, key);
    Button button = new Button("Get");
    button.addStyleName("map_get_button");
    getTable.setWidget(0, 2, button);
    FlexTable resultTable = new FlexTable();
    resultTable.setWidth("500px");
    table.setWidget(1, 2, resultTable);
    resultTable.setWidget(0, 0, new Label("Value: "));
    resultTable.setWidget(1, 0, new Label("Hits: "));
    resultTable.setWidget(2, 0, new Label("Cost: "));
    resultTable.setWidget(3, 0, new Label("Valid: "));
    resultTable.setWidget(4, 0, new Label("Expiration Time: "));
    resultTable.setWidget(5, 0, new Label("Last Acess Time: "));
    resultTable.setWidget(6, 0, new Label("Last Update Time: "));
    resultTable.setWidget(7, 0, new Label("Creation Time: "));
    for (int i = 0; i < resultTable.getRowCount(); i++) {
        Label label = (Label) resultTable.getWidget(i, 0);
        label.addStyleName("bold");
        if (i % 2 == 1) {
            resultTable.getRowFormatter().addStyleName(i, "mapstatsEvenRow");
        }
    }
    final TextArea value = new TextArea();
    final Label hits = new Label();
    final Label cost = new Label();
    final Label expirationTime = new Label();
    final Label lastAcessTime = new Label();
    final Label lastUpdateTime = new Label();
    final Label creationTime = new Label();
    final Label valid = new Label();
    resultTable.setWidget(0, 1, value);
    resultTable.setWidget(1, 1, hits);
    resultTable.setWidget(2, 1, cost);
    resultTable.setWidget(3, 1, valid);
    resultTable.setWidget(4, 1, expirationTime);
    resultTable.setWidget(5, 1, lastAcessTime);
    resultTable.setWidget(6, 1, lastUpdateTime);
    resultTable.setWidget(7, 1, creationTime);
    final DateTimeFormat dateFormatter = DateTimeFormat.getFormat("yyyy.MM.dd HH:mm:ss");
    button.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent clickEvent) {
            mapService.get(clusterWidgets.clusterId, name, key.getText(), new AsyncCallback<MapEntry>() {
                public void onFailure(Throwable throwable) {
                    if (throwable instanceof ClientDisconnectedException) {
                        clusterWidgets.disconnected();
                    }
                    value.setText(throwable.toString());
                }

                public void onSuccess(MapEntry mapEntry) {
                    value.setText((mapEntry == null) ? "null" : mapEntry.getValue());
                    hits.setText((mapEntry == null) ? "" : String.valueOf(mapEntry.getHits()));
                    cost.setText((mapEntry == null) ? "" : formatMemorySize(mapEntry.getCost()));
                    valid.setText((mapEntry == null) ? "" : String.valueOf(mapEntry.isValid()));
                    expirationTime.setText(
                            (mapEntry == null) ? "" : format(dateFormatter, mapEntry.getExpirationTime()));
                    lastAcessTime.setText(
                            (mapEntry == null) ? "" : format(dateFormatter, mapEntry.getLastAccessTime()));
                    lastUpdateTime.setText(
                            (mapEntry == null) ? "" : format(dateFormatter, mapEntry.getLastUpdateTime()));
                    creationTime.setText(
                            (mapEntry == null) ? "" : format(dateFormatter, mapEntry.getCreationTime()));
                }
            });
        }
    });
    return table;
}

From source file:com.hazelcast.monitor.client.MapEntrySetBrowserPanel.java

License:Open Source License

@Override
protected FlexTable createTable() {
    FlexTable table = new FlexTable();
    table.addStyleName("table");
    table.addStyleName("mapstats");
    table.setWidget(0, 0, new Label(""));
    table.getFlexCellFormatter().setColSpan(0, 0, 2);
    Button button = new Button("Refresh");
    table.setWidget(1, 0, button);// w  ww.  j a v  a 2s.co  m
    final TextArea value = new TextArea();
    value.setVisible(false);
    table.setWidget(1, 1, value);
    button.addStyleName("map_refresh_button");
    final Grid resultTable = new Grid(2, 4);
    resultTable.setWidth("800px");
    table.setWidget(2, 0, resultTable);
    table.getFlexCellFormatter().setColSpan(2, 0, 2);
    resultTable.setText(0, 0, "Key:");
    resultTable.setText(0, 1, "Key class:");
    resultTable.setText(0, 2, "Value:");
    resultTable.setText(0, 3, "Value class:");
    resultTable.getRowFormatter().addStyleName(0, "mapstatsEvenRow");
    button.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent clickEvent) {
            mapService.getEntries(clusterWidgets.clusterId, name, new AsyncCallback<MapEntry[]>() {
                public void onFailure(Throwable throwable) {
                    if (throwable instanceof ClientDisconnectedException) {
                        clusterWidgets.disconnected();
                    }
                    value.setVisible(true);
                    value.setText(throwable.toString());
                }

                public void onSuccess(MapEntry[] mapEntries) {
                    resultTable.resizeRows(mapEntries.length + 1);
                    value.setVisible(false);
                    int row = 1;
                    for (final MapEntry mapEntry : mapEntries) {
                        resultTable.setText(row, 0, mapEntry.getKey());
                        resultTable.setText(row, 1, mapEntry.getKeyClass());
                        resultTable.setText(row, 2, mapEntry.getValue());
                        resultTable.setText(row, 3, mapEntry.getValueClass());
                        if (row % 2 == 0) {
                            resultTable.getRowFormatter().addStyleName(row, "mapstatsEvenRow");
                        }
                        row++;
                    }
                }
            });
        }
    });
    return table;
}