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

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


    private void appendTableRows(final Table type, final Integer r) {
        final int rows = r.intValue();

        if (Table.GRID.equals(type)) {
            final Grid grid = (Grid)table;

            for (int i=0; i < rows; i++) {
                final Number num = new Integer(i);
                grid.resizeRows(i+1);
                grid.setWidget(i, 0, makeLabel(num));
            }

        } else if (Table.FLEX_TABLE.equals(type)) {
            final FlexTable flexTable = (FlexTable)table;
View Full Code Here


    private void insertTableRows(final Table type, final Integer r) {
        final int rows = r.intValue();

        if (Table.GRID.equals(type)) {
            final Grid grid = (Grid)table;

            for (int i=0; i < rows; i++) {
                final Number num = new Integer(i);
                grid.resizeRows(i+1);
                for (int j=i; j > 0; j--) {
                    grid.setWidget(j, 0, grid.getWidget(j-1, 0));
                }
                grid.setWidget(0, 0, makeLabel(num));
            }

        } else if (Table.FLEX_TABLE.equals(type)) {
            final FlexTable flexTable = (FlexTable)table;
View Full Code Here

        _renderers = new ArrayList<GridCellRenderer<T>>();
       
        VerticalPanel vert = new VerticalPanel();
        vert.setSpacing(0);
       
        _caption  = new Grid(1,2);
        _caption.setWidth("100%");
        setCaption(caption);
        vert.add(_caption);
       
       
View Full Code Here

            return null;
        }
    }

    private Widget createNavWidget() {
        Grid p = new Grid(1, 5);
        p.setStyleName(BoundTable.NAV_STYLE);

        Button b = new Button("<<",
                new ClickListener() {

                    public void onClick(Widget sender) {
                        first();
                    }
                });
        b.setStyleName(BoundTable.NAV_STYLE);

        if (this.getCurrentChunk() == 0) {
            b.setEnabled(false);
        }

        p.setWidget(0, 0, b);
        b = new Button("<",
                new ClickListener() {

                    public void onClick(Widget sender) {
                        previous();
                    }
                });
        b.setStyleName(BoundTable.NAV_STYLE);

        if (this.getCurrentChunk() == 0) {
            b.setEnabled(false);
        }

        p.setWidget(0, 1, b);

        b = new Button(">",
                new ClickListener() {

                    public void onClick(Widget sender) {
                        next();
                    }
                });
        b.setStyleName(BoundTable.NAV_STYLE);

        if (this.getCurrentChunk() == (this.getNumberOfChunks() - 1)) {
            b.setEnabled(false);
        }

        Label l = new Label((this.getCurrentChunk() + 1) + " / "
                + this.getNumberOfChunks());
        p.setWidget(0, 2, l);
        p.getCellFormatter().setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_CENTER);

        p.setWidget(0, 3, b);
        b = new Button(">>",
                new ClickListener() {

                    public void onClick(Widget sender) {
                        last();
                    }
                });
        b.setStyleName(BoundTable.NAV_STYLE);

        if (this.getCurrentChunk() == (this.getNumberOfChunks() - 1)) {
            b.setEnabled(false);
        }

        p.setWidget(0, 4, b);

        return p;
    }
View Full Code Here

    protected void init() {
        this.baseStyleName = "gwittir-SoftButton";
        this.clickers = new ClickListenerCollection();
        this.softBase = new FocusPanel();
        this.grid = new Grid(1, 1);
        DOM.setStyleAttribute(this.softBase.getElement(), "display", "inline");
        this.setContent(new Label());
        this.softBase.setWidget(grid);

        final SoftButton instance = this;
View Full Code Here

  @Override
  public void setCanvas(Panel canvas) {
    if(this.canvas != null && this.canvas == canvas) return;
    super.setCanvas(canvas);
    grid = new Grid(0, 2);
    grid.addStyleName(Styles.FIELD_GRID);
    rowIndex = -1;
    canvas.add(grid);
  }
View Full Code Here

    final Label gileadSampleApplicationLabel = new Label("Gilead sample application");
    gileadSampleApplicationLabel.setStyleName("title");
    verticalPanel.add(gileadSampleApplicationLabel);

    final Grid grid = new Grid();
    verticalPanel.add(grid);
    grid.resize(6, 3);

    final Label loginLabel = new Label("Login");
    grid.setWidget(0, 0, loginLabel);

    final Label firstNameLabel = new Label("First Name");
    grid.setWidget(1, 0, firstNameLabel);

    final Label lastNameLabel = new Label("Last Name");
    grid.setWidget(2, 0, lastNameLabel);

    final Label passwordLabel = new Label("Password");
    grid.setWidget(3, 0, passwordLabel);

    final Label messagesLabel = new Label("Messages");
    grid.setWidget(4, 0, messagesLabel);

    final Label newMessageLabel = new Label("New message");
    grid.setWidget(5, 0, newMessageLabel);

    loginTextBox = new TextBox();
    grid.setWidget(0, 1, loginTextBox);
    loginTextBox.setWidth("150px");
    loginTextBox.setTitle("This field will never get updated when back on server.");

    firstNameTextBox = new TextBox();
    grid.setWidget(1, 1, firstNameTextBox);
    firstNameTextBox.setWidth("100%");

    lastNameTextBox = new TextBox();
    grid.setWidget(2, 1, lastNameTextBox);
    lastNameTextBox.setWidth("100%");

    passwordTextBox = new TextBox();
    grid.setWidget(3, 1, passwordTextBox);
    passwordTextBox.setWidth("100%");
    passwordTextBox.setTitle("This field will never get filled.");

    newMessageTextBox = new TextBox();
    grid.setWidget(5, 1, newMessageTextBox);
    newMessageTextBox.setWidth("100%");

    addMessageButton = new Button();
    grid.setWidget(5, 2, addMessageButton);
    addMessageButton.setText("Add");
    addMessageButton.addClickHandler(new ClickHandler(){
      public void onClick(ClickEvent event)
      {
        addMessage();
      }
    });

    final Label serverOnlyLabel = new Label("@ServerOnly");
    serverOnlyLabel.setStyleName("comment");
    grid.setWidget(3, 2, serverOnlyLabel);

    final Label readOnlyLabel = new Label("@ReadOnly");
    readOnlyLabel.setStyleName("comment");
    grid.setWidget(0, 2, readOnlyLabel);

    messagesListBox = new ListBox();
    grid.setWidget(4, 1, messagesListBox);
    messagesListBox.setVisibleItemCount(5);
    messagesListBox.setWidth("100%");

    final HorizontalPanel horizontalPanel = new HorizontalPanel();
    verticalPanel.add(horizontalPanel);
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 ClickHandler() {
      public void onClick(ClickEvent event) {
        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 ClickHandler() {
      public void onClick(ClickEvent event) {
        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 ClickHandler() {
      public void onClick(ClickEvent event) {
        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 ClickHandler() {
      public void onClick(ClickEvent event) {
        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 ClickHandler() {
      public void onClick(ClickEvent event) {
        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 ClickHandler() {
      public void onClick(ClickEvent event) {
        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 ClickHandler() {
      public void onClick(ClickEvent event) {
        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 ClickHandler() {
      public void onClick(ClickEvent event) {

        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 ClickHandler() {
          public void onClick(ClickEvent event) {
            if (ResizableWidgetCollection.get().isResizeCheckingEnabled()) {
              ResizableWidgetCollection.get().setResizeCheckingEnabled(false);
              resizeCheckLabel.setHTML("disabled");
View Full Code Here

public class FreqPopup extends PopupPanel {
  ScrollPanel sp = new ScrollPanel();
  Grid g;

  public FreqPopup(int[] freq) {
    g = new Grid(freq.length + 1, 2);
    g.setText(0, 0, "Hits");
    g.setText(0, 1, "Frequency");
    for (int i = 1; i < g.getRowCount(); i++) {
      g.setText(i - 1, 0, (i-1) + "");
      g.setText(i - 1, 1, freq[i - 1] + "");
View Full Code Here

    Button topTen = new Button("Show top 10");
    vp.add(topTen);
    topTen.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        Grid g = null;
        PopupPanel pop = null;
        if (g == null) {
          pop = new PopupPanel();
          pop.setAutoHideEnabled(true);
          g = new Grid(11, 3);
          g.setText(0, 0, "Top");
          g.setText(0, 1, "Initial Angle");
          g.setText(0, 2, "Circles hit");
          pop.add(g);
        }
        for (int i = 0; i < results.size(); i++) {
          g.setText(i + 1, 0, i + 1 + "");
          g.setText(i + 1, 1, results.get(i).getInitialAngle() + "");
          g.setText(i + 1, 2, results.get(i).printHitSequence());
        }
        pop.show();
        pop.center();

      }
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.