Example usage for com.google.gwt.user.client Window alert

List of usage examples for com.google.gwt.user.client Window alert

Introduction

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

Prototype

public static void alert(String msg) 

Source Link

Usage

From source file:com.google.gwt.gen2.demo.scrolltable.client.option.column.ResizeColumnOption.java

License:Apache License

@Override
protected Widget onInitialize() {
    CustomForm form = new CustomForm();

    // Column selection
    final TextBox columnBox = new TextBox();
    columnBox.setText("3");
    columnBox.setWidth("50px");
    form.addLabeledWidget("Column Index:", columnBox);

    // Width selection
    final TextBox widthBox = new TextBox();
    widthBox.setText("25");
    widthBox.setWidth("50px");
    form.addLabeledWidget("Width (pixels):", widthBox);

    // Add button to set column size
    {/*from w ww . j  a va2  s . c o m*/
        Button button = new Button("Set Actual Column Width", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int column = Integer.parseInt(columnBox.getText());
                    int width = Integer.parseInt(widthBox.getText());
                    if (column >= 0) {
                        ScrollTableDemo.get().getScrollTable().setColumnWidth(column, width);
                    }
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    // Add button to set preferred column size
    if (PagingScrollTableDemo.get() == null) {
        Button button = new Button("Set Preferred Column Width", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int column = Integer.parseInt(columnBox.getText());
                    int width = Integer.parseInt(widthBox.getText());
                    if (column >= 0) {
                        ((ScrollTable) ScrollTableDemo.get().getScrollTable()).setPreferredColumnWidth(column,
                                width);
                    }
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    // Add button to set min column size
    if (PagingScrollTableDemo.get() == null) {
        Button button = new Button("Set Minimum Column Width", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int column = Integer.parseInt(columnBox.getText());
                    int width = Integer.parseInt(widthBox.getText());
                    if (column >= 0) {
                        ((ScrollTable) ScrollTableDemo.get().getScrollTable()).setMinimumColumnWidth(column,
                                width);
                    }
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    // Add button to set max column size
    if (PagingScrollTableDemo.get() == null) {
        Button button = new Button("Set Maximum Column Width", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int column = Integer.parseInt(columnBox.getText());
                    int width = Integer.parseInt(widthBox.getText());
                    if (column >= 0) {
                        ((ScrollTable) ScrollTableDemo.get().getScrollTable()).setMaximumColumnWidth(column,
                                width);
                    }
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    return form;
}

From source file:com.google.gwt.gen2.demo.scrolltable.client.option.data.InsertDataRowOption.java

License:Apache License

@Override
protected Widget onInitialize() {
    CustomForm form = new CustomForm();

    // Row selection
    final TextBox rowBox = new TextBox();
    rowBox.setText("3");
    rowBox.setWidth("50px");
    form.addLabeledWidget("Row Index:", rowBox);

    // Add button to insert one row
    {//from   ww w . ja  v a  2s . c  o  m
        Button button = new Button("Insert 1 Row", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    insertDataRows(row, 1);
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    // Add button to insert 10 rows
    {
        Button button = new Button("Insert 10 Rows", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    insertDataRows(row, 10);
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    // Add button to insert 100 rows
    {
        Button button = new Button("Insert 100 Rows", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    insertDataRows(row, 100);
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    // Add button to remove a row
    {
        Button button = new Button("Remove Row", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    ScrollTableDemo.get().getDataTable().removeRow(row);
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    return form;
}

From source file:com.google.gwt.gen2.demo.scrolltable.client.option.data.SetDataTextOption.java

License:Apache License

@Override
protected Widget onInitialize() {
    CustomForm form = new CustomForm();

    // Row selection
    final TextBox rowBox = new TextBox();
    rowBox.setText("3");
    rowBox.setWidth("50px");
    form.addLabeledWidget("Row Index", rowBox);

    // Column selection
    final TextBox columnBox = new TextBox();
    columnBox.setText("4");
    columnBox.setWidth("50px");
    form.addLabeledWidget("Column Index", columnBox);

    // Text selection
    final TextBox textBox = new TextBox();
    textBox.setText("<b>Hello World</b>");
    form.addLabeledWidget("Text:", textBox);

    // Add button to set text
    {/* w w  w . ja  va 2 s  .  c  om*/
        Button button = new Button("Set Cell Text", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    int column = Integer.parseInt(columnBox.getText());
                    String text = textBox.getText();
                    ScrollTableDemo.get().getDataTable().setText(row, column, text);
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    // Add button to set html
    {
        Button button = new Button("Set Cell HTML", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    int column = Integer.parseInt(columnBox.getText());
                    String text = textBox.getText();
                    ScrollTableDemo.get().getDataTable().setHTML(row, column, text);
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    return form;
}

From source file:com.google.gwt.gen2.demo.scrolltable.client.option.header.ColSpanOption.java

License:Apache License

@Override
protected Widget onInitialize() {
    CustomForm form = new CustomForm();

    // Row selection
    final TextBox rowBox = new TextBox();
    rowBox.setText("1");
    rowBox.setWidth("50px");
    form.addLabeledWidget("Row Index:", rowBox);

    // Cell selection
    final TextBox cellBox = new TextBox();
    cellBox.setText("0");
    cellBox.setWidth("50px");
    form.addLabeledWidget("Cell Index:", cellBox);

    // Colspan selection
    final TextBox colSpanBox = new TextBox();
    colSpanBox.setText("1");
    colSpanBox.setWidth("50px");
    form.addLabeledWidget("ColSpan:", colSpanBox);

    // Rowspan selection
    final TextBox rowSpanBox = new TextBox();
    rowSpanBox.setText("1");
    rowSpanBox.setWidth("50px");
    form.addLabeledWidget("RowSpan:", rowSpanBox);

    // Add button to set the spans
    {/*from   w  w w.  j ava  2  s  .c om*/
        Button button = new Button("Set row/colspan", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    int cell = Integer.parseInt(cellBox.getText());
                    int rowSpan = Integer.parseInt(rowSpanBox.getText());
                    int colSpan = Integer.parseInt(colSpanBox.getText());
                    FlexTable headerTable = ScrollTableDemo.get().getHeaderTable();
                    headerTable.getFlexCellFormatter().setRowSpan(row, cell, rowSpan);
                    headerTable.getFlexCellFormatter().setColSpan(row, cell, colSpan);
                    ScrollTableDemo.get().getScrollTable().redraw();
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    return form;
}

From source file:com.google.gwt.gen2.demo.scrolltable.client.option.header.InsertHeaderRowOption.java

License:Apache License

@Override
protected Widget onInitialize() {
    CustomForm form = new CustomForm();

    // Row selection
    final TextBox rowBox = new TextBox();
    rowBox.setText("1");
    rowBox.setWidth("50px");
    form.addLabeledWidget("Row Index:", rowBox);

    // Add button to insert one row
    {//from w w  w. j a  v a2 s  . c o m
        Button button = new Button("Insert 1 Row", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    FlexTable headerTable = ScrollTableDemo.get().getHeaderTable();
                    headerTable.insertRow(row);
                    headerTable.setHTML(row, 0, "&nbsp;");
                    ScrollTableDemo.get().getScrollTable().redraw();
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    // Add button to remove a row
    {
        Button button = new Button("Remove Row", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    ScrollTableDemo.get().getHeaderTable().removeRow(row);
                    ScrollTableDemo.get().getScrollTable().redraw();
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    // Cell selection
    final TextBox cellBox = new TextBox();
    cellBox.setText("0");
    cellBox.setWidth("50px");
    form.addLabeledWidget("Cell Index", cellBox);

    // Add button to insert one cell
    {
        Button button = new Button("Insert 1 Cell", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    int cell = Integer.parseInt(cellBox.getText());
                    FlexTable headerTable = ScrollTableDemo.get().getHeaderTable();
                    headerTable.insertCell(row, cell);
                    headerTable.setHTML(row, 0, "&nbsp;");
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    // Add button to remove a cell
    {
        Button button = new Button("Remove Cell", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    int cell = Integer.parseInt(cellBox.getText());
                    ScrollTableDemo.get().getHeaderTable().removeCell(row, cell);
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    return form;
}

From source file:com.google.gwt.gen2.demo.scrolltable.client.option.header.SetHeaderTextOption.java

License:Apache License

@Override
protected Widget onInitialize() {
    CustomForm form = new CustomForm();

    // Row selection
    final TextBox rowBox = new TextBox();
    rowBox.setText("1");
    rowBox.setWidth("50px");
    form.addLabeledWidget("Row Index", rowBox);

    // Column selection
    final TextBox columnBox = new TextBox();
    columnBox.setText("2");
    columnBox.setWidth("50px");
    form.addLabeledWidget("Column Index", columnBox);

    // Text selection
    final TextBox textBox = new TextBox();
    textBox.setText("<b>Hello World</b>");
    form.addLabeledWidget("Text", textBox);

    // Add button to set text
    {/*from   w ww .j a v a2  s  .c om*/
        Button button = new Button("Set Cell Text", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    int column = Integer.parseInt(columnBox.getText());
                    String text = textBox.getText();
                    ScrollTableDemo.get().getHeaderTable().setText(row, column, text);
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    // Add button to set html
    {
        Button button = new Button("Set Cell HTML", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    int column = Integer.parseInt(columnBox.getText());
                    String text = textBox.getText();
                    ScrollTableDemo.get().getHeaderTable().setHTML(row, column, text);
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    return form;
}

From source file:com.google.gwt.gen2.demo.scrolltable.client.option.paging.CacheSizeOption.java

License:Apache License

@Override
protected Widget onInitialize() {
    CustomForm form = new CustomForm();

    // Pre cache size
    final TextBox preCacheBox = new TextBox();
    preCacheBox.setText("50");
    preCacheBox.setWidth("50px");
    form.addLabeledWidget("Pre Cache Size:", preCacheBox);

    // Post cache size
    final TextBox postCacheBox = new TextBox();
    postCacheBox.setText("50");
    postCacheBox.setWidth("50px");
    form.addLabeledWidget("Post Cache Size:", postCacheBox);

    // Add button to set the row count
    {/*w  ww . j  a v  a 2 s  .  co m*/
        Button button = new Button("Set Cache Size", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int preCache = Integer.parseInt(preCacheBox.getText());
                    int postCache = Integer.parseInt(postCacheBox.getText());
                    PagingScrollTableDemo.get().getCachedTableModel().setPreCachedRowCount(preCache);
                    PagingScrollTableDemo.get().getCachedTableModel().setPostCachedRowCount(postCache);
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                }
            }
        });
        form.addButton(button);
    }

    return form;
}

From source file:com.google.gwt.gen2.demo.scrolltable.client.option.paging.PageSizeOption.java

License:Apache License

@Override
protected Widget onInitialize() {
    CustomForm form = new CustomForm();

    // Num rows selection
    final TextBox rowCountBox = new TextBox();
    rowCountBox.setText("1000");
    rowCountBox.setWidth("50px");
    form.addLabeledWidget("Total Row Count:", rowCountBox);

    // Add button to set the row count
    {//from   w  w  w .j av  a2  s.  co m
        Button button = new Button("Set Total Row Count", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int rowCount = Integer.parseInt(rowCountBox.getText());
                    PagingScrollTableDemo.get().getCachedTableModel().setRowCount(rowCount);
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                }
            }
        });
        form.addButton(button);
    }

    // Page Size selection
    final TextBox pageSizeBox = new TextBox();
    pageSizeBox.setText("10");
    pageSizeBox.setWidth("50px");
    form.addLabeledWidget("Page Size", pageSizeBox);

    // Add button to insert one cell
    {
        Button button = new Button("Set Page Size", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int pageSize = Integer.parseInt(pageSizeBox.getText());
                    PagingScrollTableDemo.get().getPagingScrollTable().setPageSize(pageSize);
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                }
            }
        });
        form.addButton(button);
    }

    return form;
}

From source file:com.google.gwt.gen2.demo.scrolltable.client.option.setup.TableSizeOption.java

License:Apache License

@Override
protected Widget onInitialize() {
    CustomForm form = new CustomForm();

    // Height selection
    final TextBox heightBox = new TextBox();
    heightBox.setText("400px");
    heightBox.setWidth("50px");
    form.addLabeledWidget("Height:", heightBox);

    // Width selection
    final TextBox widthBox = new TextBox();
    widthBox.setText("95%");
    widthBox.setWidth("50px");
    form.addLabeledWidget("Width:", widthBox);

    // Add button to change status
    {/*ww w. j a v  a2  s .  c om*/
        Button button = new Button("Set Table Size", new ClickHandler() {
            public void onClick(ClickEvent event) {
                String height = heightBox.getText();
                String width = widthBox.getText();
                ScrollTableDemo.get().getScrollTable().setSize(width, height);
            }
        });
        form.addButton(button);
    }

    // Add button to get minimum offset width
    {
        Button button = new Button("Get Minimum Offset Width", new ClickHandler() {
            public void onClick(ClickEvent event) {
                int width = ScrollTableDemo.get().getScrollTable().getMinimumOffsetWidth();
                Window.alert("Minimum Offset Width: " + width);
            }
        });
        form.addButton(button);
    }

    return form;
}

From source file:com.google.gwt.gen2.demo.scrolltable.client.option.sort.ShiftRowsOption.java

License:Apache License

@Override
protected Widget onInitialize() {
    CustomForm form = new CustomForm();

    // Row selection
    final TextBox rowBox = new TextBox();
    rowBox.setText("3");
    rowBox.setWidth("50px");
    form.addLabeledWidget("Row Index:", rowBox);

    // Add button to shift row up
    {/*from  w w w  . j a v  a 2  s  . c  o  m*/
        Button button = new Button("Shift Row Up", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    if (row >= 0) {
                        ScrollTableDemo.get().getDataTable().moveRowUp(row);
                        rowBox.setText((row - 1) + "");
                    }
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    // Add button to shift row down
    {
        Button button = new Button("Shift Row Down", new ClickHandler() {
            public void onClick(ClickEvent event) {
                try {
                    int row = Integer.parseInt(rowBox.getText());
                    if (row >= 0) {
                        ScrollTableDemo.get().getDataTable().moveRowDown(row);
                        rowBox.setText((row + 1) + "");
                    }
                } catch (NumberFormatException e) {
                    Window.alert("Please enter valid integers for the row and column.");
                } catch (IndexOutOfBoundsException e) {
                    Window.alert("The row or column index you entered is out of bounds.");
                }
            }
        });
        form.addButton(button);
    }

    return form;
}