Package com.google.gwt.gen2.complexpanel.client

Examples of com.google.gwt.gen2.complexpanel.client.FastTreeItem


    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("3");
    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());
            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;
  }
View Full Code Here


    return DESC_SCROLLING;
  }

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

    // Add the policy
    scrollPolicyBox = new ListBox();
    scrollPolicyBox.addItem("both");
    scrollPolicyBox.addItem("horizontal");
    scrollPolicyBox.addItem("disabled");
    form.addLabeledWidget("Scroll Policy:", scrollPolicyBox);
    refreshPolicy();

    // Add button to change status
    {
      Button button = new Button("Set Scroll Policy", new ClickHandler() {
        public void onClick(ClickEvent event) {
          AbstractScrollTable scrollTable = ScrollTableDemo.get().getScrollTable();
          switch (scrollPolicyBox.getSelectedIndex()) {
            case 0:
              scrollTable.setScrollPolicy(ScrollTable.ScrollPolicy.BOTH);
              break;
            case 1:
              scrollTable.setScrollPolicy(ScrollTable.ScrollPolicy.HORIZONTAL);
              break;
            case 2:
              scrollTable.setScrollPolicy(ScrollTable.ScrollPolicy.DISABLED);
              break;
          }
        }
      });
      form.addButton(button);
    }

    return form;
  }
View Full Code Here

    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

    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

    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

    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

    assertFired(mouse1, mouse2, mouse3);
    assertNotFired(adaptor1, click1, click2);

    // Checks to see if click events are still working.
    reset();
    manager.fireEvent(new ClickEvent(null));
    assertNotFired(mouse1, mouse2, mouse3);
    assertFired(click1, click2, adaptor1);
  }
View Full Code Here

  private void addHandlers(HandlerManager manager) {
    manager.addHandler(MouseDownEvent.TYPE, mouse1);
    manager.addHandler(MouseDownEvent.TYPE, mouse2);
    manager.addHandler(MouseDownEvent.TYPE, adaptor1);
    manager.fireEvent(new MouseDownEvent(null));
    assertEquals(3, manager.getHandlerCount(MouseDownEvent.TYPE));
    assertFired(mouse1, mouse2, adaptor1);
    manager.addHandler(MouseDownEvent.TYPE, mouse3);
    assertEquals(4, manager.getHandlerCount(MouseDownEvent.TYPE));

    manager.addHandler(MouseDownEvent.TYPE, mouse1);
    manager.addHandler(MouseDownEvent.TYPE, mouse2);
    manager.addHandler(MouseDownEvent.TYPE, adaptor1);

    // You can indeed add handlers twice, they will only be removed one at a
    // time though.
    assertEquals(7, manager.getHandlerCount(MouseDownEvent.TYPE));
    manager.addHandler(ClickEvent.TYPE, adaptor1);
    manager.addHandler(ClickEvent.TYPE, click1);
    manager.addHandler(ClickEvent.TYPE, click2);

    assertEquals(7, manager.getHandlerCount(MouseDownEvent.TYPE));
    assertEquals(3, manager.getHandlerCount(ClickEvent.TYPE));

    reset();
    manager.fireEvent(new MouseDownEvent(null));
    assertFired(mouse1, mouse2, mouse3, adaptor1);
    assertNotFired(click1, click2);
  }
View Full Code Here

  public void testRemoveHandlers() {
    HandlerManager manager = new HandlerManager("bogus source");
    addHandlers(manager);
    // Gets rid of first instance.
    manager.removeHandler(MouseDownEvent.TYPE, adaptor1);
    manager.fireEvent(new MouseDownEvent(null));
    assertFired(mouse1, mouse2, mouse3, adaptor1);
    assertNotFired(click1, click2);

    // Gets rid of second instance.
    manager.removeHandler(MouseDownEvent.TYPE, adaptor1);
    reset();
    manager.fireEvent(new MouseDownEvent(null));
    assertFired(mouse1, mouse2, mouse3);
    assertNotFired(adaptor1, click1, click2);

    // Checks to see if click events are still working.
    reset();
View Full Code Here

      }

    });

    reset();
    manager.fireEvent(new MouseDownEvent(null));
    assertFired(mouse1, adaptor1, mouse3);
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.gen2.complexpanel.client.FastTreeItem

Copyright © 2018 www.massapicom. 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.