Examples of CustomForm


Examples of com.google.gwt.gen2.demo.scrolltable.client.option.CustomForm

    return DESC_CACHE;
  }

  @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
    {
      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;
  }
View Full Code Here

Examples of com.google.gwt.gen2.demo.scrolltable.client.option.CustomForm

    return DESC_RESIZING;
  }

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

    // Add the current policy
    policyBox = new ListBox();
    policyBox.addItem("Unconstrained");
    policyBox.addItem("Flow");
    policyBox.addItem("Fixed");
    policyBox.addItem("Fill");
    form.addLabeledWidget("Resize Policy:", policyBox);
    refreshPolicy();

    // Add button to change status
    {
      Button button = new Button("Set Resize Policy", new ClickHandler() {
        public void onClick(ClickEvent event) {
          AbstractScrollTable scrollTable = ScrollTableDemo.get().getScrollTable();
          switch (policyBox.getSelectedIndex()) {
            case 0:
              scrollTable.setResizePolicy(ScrollTable.ResizePolicy.UNCONSTRAINED);
              break;
            case 1:
              scrollTable.setResizePolicy(ScrollTable.ResizePolicy.FLOW);
              break;
            case 2:
              scrollTable.setResizePolicy(ScrollTable.ResizePolicy.FIXED_WIDTH);
              break;
            case 3:
              scrollTable.setResizePolicy(ScrollTable.ResizePolicy.FILL_WIDTH);
              break;
          }
        }
      });
      form.addButton(button);
    }

    return form;
  }
View Full Code Here

Examples of com.google.gwt.gen2.demo.scrolltable.client.option.CustomForm

    return "Set the page size and total row count";
  }

  @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
    {
      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;
  }
View Full Code Here

Examples of com.google.gwt.gen2.demo.scrolltable.client.option.CustomForm

    return "Set the padding within cells and spacing between cells";
  }

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

    // Padding selection
    final TextBox paddingBox = new TextBox();
    paddingBox.setText("3");
    paddingBox.setWidth("50px");
    form.addLabeledWidget("Cell Padding:", paddingBox);

    // Spacing selection
    final TextBox spacingBox = new TextBox();
    spacingBox.setText("3");
    spacingBox.setWidth("50px");
    form.addLabeledWidget("Cell Spacing:", spacingBox);

    // Add button to set padding and spacing
    {
      Button button = new Button("Set Padding and Spacing",
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              try {
                int padding = Integer.parseInt(paddingBox.getText());
                int spacing = Integer.parseInt(spacingBox.getText());
                ScrollTableDemo.get().getScrollTable().setCellPadding(padding);
                ScrollTableDemo.get().getScrollTable().setCellSpacing(spacing);
              } 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;
  }
View Full Code Here

Examples of com.google.gwt.gen2.demo.scrolltable.client.option.CustomForm

    return DESC_SORTING;
  }

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

    // Add the current policy
    policyBox = new ListBox();
    policyBox.addItem("Disabled");
    policyBox.addItem("Single Cell");
    policyBox.addItem("Multi Cell");
    form.addLabeledWidget("Sort Policy:", policyBox);
    refreshPolicy();

    // Add button to change policy
    {
      Button button = new Button("Set Sort Policy", new ClickHandler() {
        public void onClick(ClickEvent event) {
          AbstractScrollTable scrollTable = ScrollTableDemo.get().getScrollTable();
          switch (policyBox.getSelectedIndex()) {
            case 0:
              scrollTable.setSortPolicy(SortPolicy.DISABLED);
              break;
            case 1:
              scrollTable.setSortPolicy(SortPolicy.SINGLE_CELL);
              break;
            case 2:
              scrollTable.setSortPolicy(SortPolicy.MULTI_CELL);
              break;
          }
        }
      });
      form.addButton(button);
    }

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

    // Add a button to sort the column
    {
      Button button = new Button("Sort Column", new ClickHandler() {
        public void onClick(ClickEvent event) {
          try {
            int column = Integer.parseInt(columnBox.getText());
            ScrollTableDemo.get().getDataTable().sortColumn(column);
            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 a button to make column sortable
    if (PagingScrollTableDemo.get() == null) {
      Button button = new Button("Make Sortable", new ClickHandler() {
        public void onClick(ClickEvent event) {
          try {
            int column = Integer.parseInt(columnBox.getText());
            ScrollTable scrollTable = (ScrollTable) ScrollTableDemo.get().getScrollTable();
            scrollTable.setColumnSortable(column, true);
          } catch (NumberFormatException e) {
            Window.alert("Please enter valid integers for the row and column.");
          }
        }
      });
      form.addButton(button);
    }

    // Add a button to make column unsortable
    if (PagingScrollTableDemo.get() == null) {
      Button button = new Button("Make Unsortable", new ClickHandler() {
        public void onClick(ClickEvent event) {
          try {
            int column = Integer.parseInt(columnBox.getText());
            ScrollTable scrollTable = (ScrollTable) ScrollTableDemo.get().getScrollTable();
            scrollTable.setColumnSortable(column, false);
          } catch (NumberFormatException e) {
            Window.alert("Please enter valid integers for the row and column.");
          }
        }
      });
      form.addButton(button);
    }

    return form;
  }
View Full Code Here

Examples of com.google.gwt.gen2.demo.scrolltable.client.option.CustomForm

    return "Shift rows up or down";
  }

  @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
    {
      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;
  }
View Full Code Here

Examples of com.google.gwt.gen2.demo.scrolltable.client.option.CustomForm

    return "Set the contents of a cell";
  }

  @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
    {
      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;
  }
View Full Code Here

Examples of com.google.gwt.gen2.demo.scrolltable.client.option.CustomForm

    return "Swap rows";
  }

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

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

    // Row2 selection
    final TextBox rowBox2 = new TextBox();
    rowBox2.setText("6");
    rowBox2.setWidth("50px");
    form.addLabeledWidget("Row 2 Index:", rowBox2);

    // Add button to swap rows
    {
      Button button = new Button("Swap Rows", new ClickHandler() {
        public void onClick(ClickEvent event) {
          try {
            int row1 = Integer.parseInt(rowBox1.getText());
            int row2 = Integer.parseInt(rowBox2.getText());
            if (row1 >= 0 && row2 >= 0) {
              ScrollTableDemo.get().getDataTable().swapRows(row1, row2);
            }
          } 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 reverse all rows
    {
      Button button = new Button("Reverse All Rows", new ClickHandler() {
        public void onClick(ClickEvent event) {
          ScrollTableDemo.get().getDataTable().reverseRows();
        }
      });
      form.addButton(button);
    }

    return form;
  }
View Full Code Here

Examples of com.google.gwt.gen2.demo.scrolltable.client.option.CustomForm

    return "Insert a row at a specified index";
  }

  @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
    {
      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;
  }
View Full Code Here

Examples of com.google.gwt.gen2.demo.scrolltable.client.option.CustomForm

    return "Set the colspan of a cell";
  }

  @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
    {
      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;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.