Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.Grid


    // Setup the progress bars
    exampleBar2.setTextVisible(false);
    exampleBar2.addStyleName("gwt-ProgressBar-thin");

    // Place everything in a nice looking grid
    Grid grid = new Grid(7, 3);
    grid.setBorderWidth(1);
    grid.setCellPadding(3);

    // Set the current progress
    final TextBox curBox = new TextBox();
    curBox.setText("0.0");
    grid.setWidget(0, 1, curBox);
    grid.setHTML(0, 2, "The current progress.");
    grid.setWidget(0, 0, new Button("Set Progress", new ClickListener() {
      public void onClick(Widget sender) {
        simulationTimer.cancel();
        mainProgressBar.setProgress(new Float(curBox.getText()).floatValue());
      }
    }));

    // Set the minimum progress
    final TextBox minBox = new TextBox();
    minBox.setText(mainProgressBar.getMinProgress() + "");
    grid.setWidget(1, 1, minBox);
    grid.setHTML(1, 2, "The minimum progress progress.");
    grid.setWidget(1, 0, new Button("Set Min Progress", new ClickListener() {
      public void onClick(Widget sender) {
        simulationTimer.cancel();
        mainProgressBar.setMinProgress(new Float(minBox.getText()).floatValue());
      }
    }));

    // Set the maximum progress
    final TextBox maxBox = new TextBox();
    maxBox.setText(mainProgressBar.getMaxProgress() + "");
    grid.setWidget(2, 1, maxBox);
    grid.setHTML(2, 2, "The maximum progress.");
    grid.setWidget(2, 0, new Button("Set Max Progress", new ClickListener() {
      public void onClick(Widget sender) {
        simulationTimer.cancel();
        mainProgressBar.setMaxProgress(new Float(maxBox.getText()).floatValue());
      }
    }));

    // Show or hide the text
    final HTML textVisibleLabel = new HTML("visible");
    grid.setWidget(3, 1, textVisibleLabel);
    grid.setHTML(3, 2, "Show or hide the text in the progress bar.");
    grid.setWidget(3, 0, new Button("Toggle Text", new ClickListener() {
      public void onClick(Widget sender) {
        if (mainProgressBar.isTextVisible()) {
          textVisibleLabel.setHTML("hidden");
          mainProgressBar.setTextVisible(false);
        } else {
          textVisibleLabel.setHTML("visible");
          mainProgressBar.setTextVisible(true);
        }
      }
    }));

    // Add the default text option
    final HTML defaultTextLabel = new HTML("custom");
    grid.setWidget(4, 1, defaultTextLabel);
    grid.setHTML(4, 2, "Override the format of the text with a custom"
        + "format.");
    grid.setWidget(4, 0, new Button("Toggle Custom Text", new ClickListener() {
      public void onClick(Widget sender) {
        if (useCustomText) {
          defaultTextLabel.setHTML("default");
          useCustomText = false;
          mainProgressBar.setProgress(mainProgressBar.getProgress());
        } else {
          defaultTextLabel.setHTML("custom");
          useCustomText = true;
          mainProgressBar.setProgress(mainProgressBar.getProgress());
        }
      }
    }));

    // Add static resize timer methods
    final HTML resizeCheckLabel = new HTML("enabled");
    grid.setWidget(5, 1, resizeCheckLabel);
    grid.setHTML(5, 2, "When resize checking is enabled, a Timer will "
        + "periodically check if the Widget's dimensions have changed.  If "
        + "they change, the widget will be redrawn.");
    grid.setWidget(5, 0, new Button("Toggle Resize Checking",
        new ClickListener() {
          public void onClick(Widget sender) {
            if (ResizableWidgetCollection.get().isResizeCheckingEnabled()) {
              ResizableWidgetCollection.get().setResizeCheckingEnabled(false);
              resizeCheckLabel.setHTML("disabled");

            } else {
              ResizableWidgetCollection.get().setResizeCheckingEnabled(true);
              resizeCheckLabel.setHTML("enabled");
            }
          }
        }));

    // Create a form to set width of element
    final TextBox widthBox = new TextBox();
    widthBox.setText("50%");
    grid.setWidget(6, 1, widthBox);
    grid.setHTML(6, 2, "Set the width of the widget.  Use this to see how "
        + "resize checking detects the new dimensions and redraws the widget.");
    grid.setWidget(6, 0, new Button("Set Width", new ClickListener() {
      public void onClick(Widget sender) {
        mainProgressBar.setWidth(widthBox.getText());
      }
    }));
View Full Code Here


    exampleBar2.setCurrentValue(13.0);
    exampleBar2.setNumTicks(25);
    exampleBar2.setNumLabels(25);

    // Place everything in a nice looking grid
    Grid grid = new Grid(9, 3);
    grid.setBorderWidth(1);
    grid.setCellPadding(3);

    // The type of text to display
    final HTML defaultTextLabel = new HTML("custom");

    // Set the current slider position
    curBox.setText("50.0");
    grid.setWidget(0, 1, curBox);
    grid.setHTML(0, 2, "The current value of the knob.");
    grid.setWidget(0, 0, new Button("Set Current Value", new ClickListener() {
      public void onClick(Widget sender) {
        mainSliderBar.setCurrentValue(new Float(curBox.getText()).floatValue());
      }
    }));

    // Set the minimum value
    final TextBox minBox = new TextBox();
    minBox.setText("0.0");
    grid.setWidget(1, 1, minBox);
    grid.setHTML(1, 2, "The lower bounds (minimum) of the range.");
    grid.setWidget(1, 0, new Button("Set Min Value", new ClickListener() {
      public void onClick(Widget sender) {
        mainSliderBar.setMinValue(new Float(minBox.getText()).floatValue());
      }
    }));

    // Set the maximum value
    final TextBox maxBox = new TextBox();
    maxBox.setText("100.0");
    grid.setWidget(2, 1, maxBox);
    grid.setHTML(2, 2, "The upper bounds (maximum) of the range.");
    grid.setWidget(2, 0, new Button("Set Max Value", new ClickListener() {
      public void onClick(Widget sender) {
        mainSliderBar.setMaxValue(new Float(maxBox.getText()).floatValue());
      }
    }));

    // Set the step size
    final TextBox stepSizeBox = new TextBox();
    stepSizeBox.setText("1.0");
    grid.setWidget(3, 1, stepSizeBox);
    grid.setHTML(3, 2, "The increments between each knob position.");
    grid.setWidget(3, 0, new Button("Set Step Size", new ClickListener() {
      public void onClick(Widget sender) {
        mainSliderBar.setStepSize(new Float(stepSizeBox.getText()).floatValue());
      }
    }));

    // Set the number of tick marks
    final TextBox numTicksBox = new TextBox();
    numTicksBox.setText("10");
    grid.setWidget(4, 1, numTicksBox);
    grid.setHTML(4, 2,
        "The vertical black lines along the range of value.  Note that the "
            + "number of ticks is actually one more than the number you "
            + "specify, so setting the number of ticks to one will display a "
            + "tick at each end of the slider.");
    grid.setWidget(4, 0, new Button("Set Num Ticks", new ClickListener() {
      public void onClick(Widget sender) {
        mainSliderBar.setNumTicks(new Integer(numTicksBox.getText()).intValue());
      }
    }));

    // Set the number of labels
    final TextBox numLabelsBox = new TextBox();
    numLabelsBox.setText("5");
    grid.setWidget(5, 1, numLabelsBox);
    grid.setHTML(5, 2, "The labels above the ticks.");
    grid.setWidget(5, 0, new Button("Set Num Labels", new ClickListener() {
      public void onClick(Widget sender) {
        mainSliderBar.setNumLabels(new Integer(numLabelsBox.getText()).intValue());
      }
    }));

    // Create a form to set width of element
    final TextBox widthBox = new TextBox();
    widthBox.setText("50%");
    grid.setWidget(6, 1, widthBox);
    grid.setHTML(6, 2, "Set the width of the slider.  Use this to see how "
        + "resize checking detects the new dimensions and redraws the widget.");
    grid.setWidget(6, 0, new Button("Set Width", new ClickListener() {
      public void onClick(Widget sender) {
        mainSliderBar.setWidth(widthBox.getText());
      }
    }));

    // Add the default text option
    grid.setWidget(7, 1, defaultTextLabel);
    grid.setHTML(7, 2, "Override the format of the labels with a custom"
        + "format.");
    grid.setWidget(7, 0, new Button("Toggle Custom Text", new ClickListener() {
      public void onClick(Widget sender) {
        if (useCustomText) {
          defaultTextLabel.setHTML("default");
          useCustomText = false;
          mainSliderBar.redraw();
        } else {
          defaultTextLabel.setHTML("custom");
          useCustomText = true;
          mainSliderBar.redraw();
        }
      }
    }));

    // Add static resize timer methods
    final HTML resizeCheckLabel = new HTML("enabled");
    grid.setWidget(8, 1, resizeCheckLabel);
    grid.setHTML(8, 2, "When resize checking is enabled, a Timer will "
        + "periodically check if the Widget's dimensions have changed.  If "
        + "they change, the widget will be redrawn.");
    grid.setWidget(8, 0, new Button("Toggle Resize Checking",
        new ClickListener() {
          public void onClick(Widget sender) {
            if (ResizableWidgetCollection.get().isResizeCheckingEnabled()) {
              ResizableWidgetCollection.get().setResizeCheckingEnabled(false);
              resizeCheckLabel.setHTML("disabled");
View Full Code Here

    }
  }

  @Override
  protected Widget onInitialize() {
    Grid grid = new Grid(3, 3);

    // Row Index
    HorizontalPanel panel1 = new HorizontalPanel();
    panel1.add(add1RowButton);
    panel1.add(new HTML(" "));
    panel1.add(add10RowButton);
    panel1.add(new HTML(" "));
    panel1.add(add100RowButton);
    panel1.add(new HTML(" "));
    panel1.add(removeRowButton);
    rowIndexBox.setWidth("50px");
    rowIndexBox.setText("4");
    grid.setHTML(0, 0, "<B>Row:</B>");
    grid.setWidget(0, 1, rowIndexBox);
    grid.setWidget(0, 2, panel1);

    // Column Index
    HorizontalPanel panel2 = new HorizontalPanel();
    panel2.add(resizeColumnCountButton);
    columnIndexBox.setWidth("50px");
    columnIndexBox.setText("4");
    grid.setHTML(1, 0, "<B>Column:</B>");
    grid.setWidget(1, 1, columnIndexBox);
    grid.setWidget(1, 2, panel2);

    // HTML string
    HorizontalPanel panel3 = new HorizontalPanel();
    panel3.add(setTextButton);
    panel3.add(new HTML("&nbsp;"));
    panel3.add(setHtmlButton);
    textBox.setWidth("200px");
    textBox.setText("<B>Hello World</B>");
    grid.setHTML(2, 0, "<B>Text:</B>");
    grid.setWidget(2, 1, textBox);
    grid.setWidget(2, 2, panel3);
   
    return grid;
  }
View Full Code Here

    }
  }

  @Override
  protected Widget onInitialize() {
    Grid grid = new Grid(5, 3);

    // Row Index
    HorizontalPanel panel1 = new HorizontalPanel();
    panel1.add(insertRowButton);
    panel1.add(new HTML("&nbsp;"));
    panel1.add(removeRowButton);
    rowIndexBox.setWidth("50px");
    rowIndexBox.setText("0");
    grid.setHTML(0, 0, "<B>Row:</B>");
    grid.setWidget(0, 1, rowIndexBox);
    grid.setWidget(0, 2, panel1);

    // Column Index
    HorizontalPanel panel2 = new HorizontalPanel();
    panel2.add(insertCellButton);
    panel2.add(new HTML("&nbsp;"));
    panel2.add(removeCellButton);
    cellIndexBox.setWidth("50px");
    cellIndexBox.setText("0");
    grid.setHTML(1, 0, "<B>Cell:</B>");
    grid.setWidget(1, 1, cellIndexBox);
    grid.setWidget(1, 2, panel2);

    // HTML string
    HorizontalPanel panel3 = new HorizontalPanel();
    panel3.add(setTextButton);
    panel3.add(new HTML("&nbsp;"));
    panel3.add(setHtmlButton);
    textBox.setWidth("200px");
    textBox.setText("<B>Hello World</B>");
    grid.setHTML(2, 0, "<B>Text:</B>");
    grid.setWidget(2, 1, textBox);
    grid.setWidget(2, 2, panel3);

    // ColSpan
    HorizontalPanel panel4 = new HorizontalPanel();
    panel4.add(setColSpanButton);
    colSpanBox.setWidth("50px");
    colSpanBox.setText("1");
    grid.setHTML(3, 0, "<B>ColSpan:</B>");
    grid.setWidget(3, 1, colSpanBox);
    grid.setWidget(3, 2, panel4);

    // RowSpan
    HorizontalPanel panel5 = new HorizontalPanel();
    panel5.add(setRowSpanButton);
    rowSpanBox.setWidth("50px");
    rowSpanBox.setText("1");
    grid.setHTML(4, 0, "<B>RowSpan:</B>");
    grid.setWidget(4, 1, rowSpanBox);
    grid.setWidget(4, 2, panel5);

    return grid;
  }
View Full Code Here

    }
  }

  @Override
  protected Widget onInitialize() {
    grid = new Grid(5, 3);

    // Num Rows
    HorizontalPanel panel1 = new HorizontalPanel();
    panel1.add(numRowsButton);
    numRowsBox.setWidth("50px");
View Full Code Here

    public Calculator() {

        DockPanel dockPanel = new DockPanel();

        Grid controls = new Grid(5, 2);
        Grid numbersP = new Grid(4, 3);

        // initialize the 1-9 buttons
        for (int row = 0; row < 3; row++) {
            for (int col = 0; col < 3; col++) {
                numbersP.setWidget(row, col, new NumberButton(this, row
                        * 3 + col + 1));
            }
        }
        numbersP.setWidget(3, 0, new NumberButton(this, 0));
        numbersP.setWidget(3, 1, new NumberButton(this, "."));
        numbersP.setWidget(3, 2, new ControlButton(this,
                new ControlAction(this, "+/-") {
                    @Override
                    public boolean isMultiArg() {
                        return false;
                    }
View Full Code Here

     * Creates a grid according to the current row and column count information.
     *
     * @return grid
     */
    private Grid createGrid() {
        grid = new Grid(rows, columns);
        grid.setWidth("100%");
        grid.setHeight("100%");
        grid.addClickHandler(this);
        return grid;
    }
View Full Code Here

                Window.alert("Cancelar");
                  dialogBox.hide();
              }
          });  
         
        Grid gridBotones = new Grid(1, 3);
        gridBotones.setSize("", "");
        gridBotones.setWidget(0, 1, closeButton);
        gridBotones.setWidget(0, 2, deleteButton);
        gridBotones.getCellFormatter().setWidth(0, 0, "200px");
        gridBotones.getCellFormatter().setHeight(0, 0, "15px");
        gridBotones.getCellFormatter().setWidth(0, 1, "80px");
        gridBotones.getCellFormatter().setWidth(0, 2, "80px");

      dialogContents.add(gridBotones);
      return dialogBox;
     
  }
View Full Code Here

  }
 
  MyDialog(Widget contents, boolean modal) {
    super(false, modal);
    setAnimationEnabled(true);
    Grid grid = new Grid(1,1);
    grid.setWidget(0, 0, dockPanel);
    setWidget(grid);
   
    hp.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_RIGHT);
    hp.add(buttons);
View Full Code Here

  public WikiPageBox() {
   
    VerticalPanel panel = new VerticalPanel();
   
    // new wiki page
    newPanel = new Grid(2,2);
    newPanel.setWidget(0, 0, new HTML("Name:"));
    final TextBox name = new TextBox();
    newPanel.setWidget(0, 1, name);
    Button newButton = new Button("Erzeugen");
    newButton.addClickHandler(new ClickHandler() {
     
      @Override
      public void onClick(ClickEvent event) {
        String wikiPageName = name.getText();
        for (WikiPageBoxHandler handler: newHandler)
          handler.onWikiPage(wikiPageName);
        name.setText("");
      }
    });
    newPanel.setWidget(1, 1, newButton);
    panel.add(newPanel);
   
   
    // Auswaehlen
    selectPanel = new Grid(2,2);
    selectPanel.setWidget(0, 0, new HTML("Name"));
    selectBox = new ListBox();
    selectPanel.setWidget(0, 1, selectBox);
    Button selectButton = new Button("Auswählen");
    selectButton.addClickHandler(new ClickHandler() {
     
      @Override
      public void onClick(ClickEvent event) {
        String wikiPageName = selectBox.getItemText(selectBox.getSelectedIndex());
        for (WikiPageBoxHandler listener: selectHandler)
          listener.onWikiPage(wikiPageName);
      }
    });
    selectPanel.setWidget(1, 1, selectButton);
    selectPanel.setVisible(false);
    panel.add(selectPanel);
   
   
    // delete panel
    deletePanel = new Grid(2,2);
    deletePanel.setWidget(0, 0, new HTML("Name"));
    deleteBox = new ListBox();
    deletePanel.setWidget(0, 1, deleteBox);
    Button deleteButton = new Button("Löschen");
    deleteButton.addClickHandler(new ClickHandler() {
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.Grid

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.