Example usage for com.google.gwt.user.client.ui Grid insertRow

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

Introduction

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

Prototype

@Override
public int insertRow(int beforeRow) 

Source Link

Document

Inserts a new row into the table.

Usage

From source file:co.fxl.gui.gwt.GWTGridPanel.java

License:Open Source License

@Override
public IGridRow row(final int row) {
    return new IGridRow() {

        @Override/*from   ww w. j  a v  a 2s  . c  o m*/
        public int height() {
            throw new UnsupportedOperationException();
        }

        @Override
        public IGridPanel remove() {
            Grid grid = (Grid) container.widget;
            grid.removeRow(row);
            cells.removeRow(row);
            return GWTGridPanel.this;
        }

        @Override
        public IGridPanel insert() {
            Grid grid = (Grid) container.widget;
            grid.insertRow(row);
            cells.insertRow(row);
            return GWTGridPanel.this;
        }
    };
}

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

License:Apache License

private void display(NativeMap<VerificationInfo> jobs) {
    int row = 0;//from  w  w  w .j  a  v a2s. c om
    int column = 5;
    Grid grid = new Grid(row, column);
    for (String key : jobs.keySet()) {
        grid.insertRow(row);
        HorizontalPanel p = new HorizontalPanel();
        short vote = jobs.get(key).value();
        if (vote > 0) {
            p.add(new Image(VerifyStatusPlugin.RESOURCES.greenCheck()));
        } else if (vote < 0) {
            p.add(new Image(VerifyStatusPlugin.RESOURCES.redNot()));
        } else if (vote == 0) {
            p.add(new Image(VerifyStatusPlugin.RESOURCES.warning()));
        }
        Anchor anchor = new Anchor(jobs.get(key).name(), jobs.get(key).url());
        anchor.setTitle("view logs");
        p.add(anchor);
        InlineLabel durlabel = new InlineLabel(" (" + jobs.get(key).duration() + ")");
        durlabel.setTitle("duration");
        p.add(durlabel);
        if (jobs.get(key).abstain()) {
            Image img = new Image(VerifyStatusPlugin.RESOURCES.info());
            img.setTitle("non voting");
            p.add(img);
        }
        if (jobs.get(key).rerun()) {
            Image img = new Image(VerifyStatusPlugin.RESOURCES.rerun());
            img.setTitle("re-run");
            p.add(img);
        }
        grid.setWidget(row, 1, p);
        InlineLabel catLabel = new InlineLabel(jobs.get(key).category());
        catLabel.setTitle("category");
        grid.setWidget(row, 2, catLabel);
        InlineLabel repLabel = new InlineLabel(jobs.get(key).reporter());
        repLabel.setTitle("reporter");
        grid.setWidget(row, 3, repLabel);
        InlineLabel grLabel = new InlineLabel(FormatUtil.shortFormat(jobs.get(key).granted()));
        grLabel.setTitle("date saved");
        grid.setWidget(row, 4, grLabel);
        row++;
    }
    add(new PopDownButton("Jobs", grid));
}

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

License:Apache License

private void display(String patchsetId, NativeMap<VerificationInfo> jobs) {
    int row = 0;//from   w w w  .j  av a 2 s  .c om
    int column = 1;
    Grid grid = new Grid(row, column);
    for (String key : jobs.keySet()) {
        HorizontalPanel p = new HorizontalPanel();
        short vote = jobs.get(key).value();
        if (vote > 0) {
            p.add(new Image(VerifyStatusPlugin.RESOURCES.greenCheck()));
        } else if (vote < 0) {
            p.add(new Image(VerifyStatusPlugin.RESOURCES.redNot()));
        } else if (vote == 0) {
            p.add(new Image(VerifyStatusPlugin.RESOURCES.warning()));
        }
        Anchor anchor = new Anchor(jobs.get(key).name(), jobs.get(key).url());
        anchor.setTitle("view logs");
        p.add(anchor);
        InlineLabel label = new InlineLabel(" (" + jobs.get(key).duration() + ")");
        label.setTitle("duration");
        p.add(label);
        if (jobs.get(key).rerun()) {
            Image img = new Image(VerifyStatusPlugin.RESOURCES.rerun());
            img.setTitle("re-run");
            p.add(img);
        }
        if (jobs.get(key).abstain()) {
            Image img = new Image(VerifyStatusPlugin.RESOURCES.info());
            img.setTitle("non voting");
            p.add(img);
        }
        grid.insertRow(row);
        grid.setWidget(row, 0, p);
        row++;
    }
    HorizontalPanel p = new HorizontalPanel();
    InlineHyperlink all = new InlineHyperlink("Show All Reports",
            "/x/" + Plugin.get().getName() + "/jobs/" + patchsetId);
    p.add(all);
    grid.insertRow(row);
    grid.setWidget(row, 0, p);
    add(grid);
}

From source file:com.googlesource.gerrit.plugins.zuul.client.LabelPanel.java

License:Apache License

private void display(DependencyInfo result) {
    int row = 0;/*from  ww  w. j ava2 s  .  com*/
    int column = 1;
    Grid grid = new Grid(row, column);
    // show depends-on ids
    for (int i = 0; i < result.dependsOn().length(); i++) {
        HorizontalPanel p = new HorizontalPanel();
        p.addStyleName("infoBlock");
        Label label = new Label("Depends-on");
        label.setWidth("72px");
        p.add(label);
        CopyableLabel cl = new CopyableLabel(result.dependsOn().get(i));
        if (result.cycle()) {
            cl.getElement().getStyle().setColor(COLOR_RED);
        }
        p.add(cl);
        grid.insertRow(row);
        grid.setWidget(row, 0, p);
        row++;
    }
    // show needed-by ids
    for (int i = 0; i < result.neededBy().length(); i++) {
        HorizontalPanel p = new HorizontalPanel();
        p.addStyleName("infoBlock");
        Label label = new Label("Needed-by");
        label.setWidth("72px");
        p.add(label);
        CopyableLabel cl = new CopyableLabel(result.neededBy().get(i));
        if (result.cycle()) {
            cl.getElement().getStyle().setColor(COLOR_RED);
        }
        p.add(cl);
        grid.insertRow(row);
        grid.setWidget(row, 0, p);
        row++;
    }
    add(grid);
}

From source file:org.catchwa.skeetstalker.client.SkeetStalker.java

License:Open Source License

private void refreshAnswerThese() {
    if (answerTheseService == null) {
        answerTheseService = GWT.create(AnswerTheseService.class);
    }//from   w ww  .ja  va  2s. c om
    AsyncCallback<String[]> callback = new AsyncCallback<String[]>() {
        public void onFailure(Throwable caught) {
            // TODO: Do something with errors.
        }

        public void onSuccess(String[] result) {
            Grid table = (Grid) RootPanel.get("questionsContainer").getWidget(0);
            for (int i = 0; i < result.length; i++) {
                int splitHere = result[i].lastIndexOf(' ');
                String title = result[i].substring(0, splitHere);
                String id = result[i].substring(splitHere + 1, result[i].length());
                String base = sites.get(siteChoices.getItemText(siteChoices.getSelectedIndex()));
                base = base.replace("api.", "");
                String html = "<a href=\"" + base + "/questions/" + id + "\" target=\"_blank\">" + title
                        + "</a>";
                if (!containsRow(table, html)) {
                    if (table.getRowCount() > 2) {
                        table.insertRow(1);
                        table.setHTML(1, 0, html);
                        while (table
                                .getRowCount() > org.catchwa.skeetstalker.shared.Constants.CLIENT_TABLE_ROW_LIMIT) {
                            table.removeRow(table.getRowCount() - 1);
                        }
                    } else {
                        table.resizeRows(3);
                        table.setHTML(2, 0, table.getHTML(1, 0));
                        table.setHTML(1, 0, html);
                    }
                }
            }
        }
    };
    answerTheseService.getQuestions(id, site, callback);
}

From source file:org.openelis.ui.widget.Balloon.java

License:Open Source License

public static void drawExceptions(ArrayList<Exception> endUser, ArrayList<Exception> valid, Element element,
        final int ex, final int ey) {
    ArrayList<Exception> exceptions = null;
    Grid grid;

    // Clear panel
    exceptionPanel.clear();//from  w  w  w  .  j  a  va  2s  .co m
    grid = new Grid(0, 2);
    exceptionPanel.add(grid);

    x = ex;
    y = ey;

    // Get out if widget has no exceptions to display;
    if (endUser == null && valid == null)
        return;

    for (int i = 0; i < 2; i++) {
        switch (i) {
        /*
         * First iteration check EndUserException if no EndUserExceptions do
         * i++ and fall through to check validatExceptions
         */
        case 0:
            exceptions = endUser;
            if (exceptions == null)
                continue;
            break;
        /*
         * If no validation exceptions continue out of loop
         */
        case 1:
            exceptions = valid;
            if (exceptions == null)
                continue;
        }

        for (Exception exception : exceptions) {
            grid.insertRow(0);
            if (exception instanceof Warning) {
                grid.getCellFormatter().setStyleName(0, 0, dialogCss.WarnIcon());
                grid.getCellFormatter().setStyleName(0, 1, dialogCss.warnPopupLabel());
            } else {
                grid.getCellFormatter().setStyleName(0, 0, dialogCss.ErrorIcon());
                grid.getCellFormatter().setStyleName(0, 1, dialogCss.errorPopupLabel());
            }
            grid.setText(0, 1, exception.getMessage());
        }
    }

    balloon.setContent(exceptionPanel);
    if (element == null)
        balloon.setPlacement(Balloon.Placement.MOUSE);
    else {
        targetElement = element;
        balloon.setPlacement(Balloon.Placement.TOP);
    }

    Options options = new Options();
    options.setDelayHide(5000);
    showBalloon(options);

}