Package com.google.gwt.gen2.logging.handler.shared

Examples of com.google.gwt.gen2.logging.handler.shared.ListLogHandler


  public void testBasicLogger() {
    Log.clearLogHandlers();
    Log.setDefaultLevel(Level.INFO);

    final ListLogHandler handler = new ListLogHandler();
    Log.addLogHandler(handler);

    // Check set up
    assertEquals(Level.INFO, Log.getDefaultLevel());

    // Check level iterator.
    Iterator<Level> iterator = Log.levelIterator();
    assertEquals(Level.ALL, iterator.next());
    assertEquals(Level.FINEST, iterator.next());
    assertEquals(Level.FINER, iterator.next());

    // Basic Test.
    Log.severe("severe");
    assertEquals("severe", getLastMessage(handler));
    Log.finest("finest");
    assertEquals("severe", getLastMessage(handler));

    // Test setting the log level.

    // On
    Log.setDefaultLevel(Level.FINEST);
    Log.finest("finest");
    assertEquals("finest", getLastMessage(handler));

    // Off
    Log.setDefaultLevel(Level.OFF);
    Log.severe("going into the void");
    assertEquals("finest", getLastMessage(handler));

    // Test category filters.
    String cParent = "com.mycompany";
    String cChild1 = "com.mycompany.package1";
    String cChild2 = "com.mycompany.package2";

    Log.setDefaultLevel(Level.CONFIG);
    Log.config("config", cChild1);
    assertEquals("config", getLastMessage(handler));
    assertEquals(cChild1, handler.getLast().getCategory());
    Log.setDefaultLevel(Level.WARNING);
    Log.config("bad", cChild1);
    assertEquals("config", getLastMessage(handler));
    Log.setLevel(cParent, Level.CONFIG);
    Log.setLevel(cChild2, Level.INFO);
View Full Code Here


  public void testBasicLogger() {
    Log.clearLogHandlers();
    Log.setDefaultLevel(Level.INFO);

    final ListLogHandler handler = new ListLogHandler();
    Log.addLogHandler(handler);

    // Check set up
    assertEquals(Level.INFO, Log.getDefaultLevel());

    // Check level iterator.
    Iterator iterator = Log.levelIterator();
    assertEquals(Level.ALL, iterator.next());
    assertEquals(Level.FINEST, iterator.next());
    assertEquals(Level.FINER, iterator.next());

    // Basic Test.
    Log.severe("severe");
    assertEquals("severe", getLastMessage(handler));
    Log.finest("finest");
    assertEquals("severe", getLastMessage(handler));

    // Test setting the log level.

    // On
    Log.setDefaultLevel(Level.FINEST);
    Log.finest("finest");
    assertEquals("finest", getLastMessage(handler));

    // Off
    Log.setDefaultLevel(Level.OFF);
    Log.severe("going into the void");
    assertEquals("finest", getLastMessage(handler));

    // Test category filters.
    String cParent = "com.mycompany";
    String cChild1 = "com.mycompany.package1";
    String cChild2 = "com.mycompany.package2";

    Log.setDefaultLevel(Level.CONFIG);
    Log.config("config", cChild1);
    assertEquals("config", getLastMessage(handler));
    assertEquals(cChild1, handler.getLast().getCategory());
    Log.setDefaultLevel(Level.WARNING);
    Log.config("bad", cChild1);
    assertEquals("config", getLastMessage(handler));
    Log.setLevel(cParent, Level.CONFIG);
    Log.setLevel(cChild2, Level.INFO);
View Full Code Here

    // 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.setColumnResizePolicy(ScrollTable.ColumnResizePolicy.DISABLED);
              break;
            case 1:
              scrollTable.setColumnResizePolicy(ScrollTable.ColumnResizePolicy.SINGLE_CELL);
              break;
            case 2:
              scrollTable.setColumnResizePolicy(ScrollTable.ColumnResizePolicy.MULTI_CELL);
              break;
          }
        }
      });
      form.addButton(button);
    }

    // Add button to reset column widths
    {
      Button button = new Button("Reset Column Widths", new ClickHandler() {
        public void onClick(ClickEvent event) {
          AbstractScrollTable scrollTable = ScrollTableDemo.get().getScrollTable();
          scrollTable.resetColumnWidths();
        }
      });
      form.addButton(button);
    }
View Full Code Here

    // 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);
View Full Code Here

    // 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);
View Full Code Here

    // Initialize the cell editor
    InlineCellEditor<String> editor = createCellEditor();

    // Create the edit info
    Grid grid = new Grid(1, 1);
    CellEditInfo cellEditInfo = new CellEditInfo(grid, 0, 0);

    // Create the callback
    TestCallback<String> callback = new TestCallback<String>(cellEditInfo);

    // Edit the cell
View Full Code Here

    // Initialize the cell editor
    InlineCellEditor<String> editor = createCellEditor();

    // Create the edit info
    Grid grid = new Grid(1, 1);
    CellEditInfo cellEditInfo = new CellEditInfo(grid, 0, 0);

    // Create the callback
    TestCallback<String> callback = new TestCallback<String>(cellEditInfo);

    // Edit the cell
View Full Code Here

  /**
   * Test the {@link CellEditInfo} inner class.
   */
  public void testCellEditInfo() {
    Grid grid = new Grid(1, 1);
    CellEditInfo info = new CellEditInfo(grid, 1, 2);
    assertEquals(grid, info.getTable());
    assertEquals(1, info.getRowIndex());
    assertEquals(2, info.getCellIndex());
  }
View Full Code Here

      return;
    }

    // Forward the request to the cell editor
    final RowType rowValue = getRowValue(row);
    CellEditInfo editInfo = new CellEditInfo(getDataTable(), row, column);
    cellEditor.editCell(editInfo, colDef.getCellValue(rowValue),
        new CellEditor.Callback() {
          public void onCancel(CellEditInfo cellEditInfo) {
          }
View Full Code Here

   * Test the column width info.
   */
  public void testCurrentColumnWidthInfo() {
    // getPercentageDifference
    {
      ColumnWidthInfo info = new ColumnWidthInfo(100, 300, 200, 150);

      // getters
      assertEquals(150, info.getCurrentWidth());
      assertEquals(100, info.getMinimumWidth());
      assertEquals(300, info.getMaximumWidth());
      assertEquals(200, info.getPreferredWidth());

      // percentage difference
      info.setNewWidth(150);
      assertEquals(-0.25, info.getPercentageDifference(), 0.001);

      // required width
      info.setRequiredWidth(40);
      assertEquals(40, info.getRequiredWidth());

      // new width
      info.setNewWidth(190);
      assertEquals(190, info.getNewWidth());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.gen2.logging.handler.shared.ListLogHandler

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.