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

Examples of com.google.gwt.user.client.ui.HTMLTable.CellFormatter


      this.addHeadings(grid);
    }
    grid.setCellPadding(0);
    grid.setCellSpacing(0);

    final CellFormatter cellFormatter = grid.getCellFormatter();
    final String dayStyle = this.getDayStyle();

    for (int r = 0; r < rows; r++) {
      for (int c = 0; c < WidgetConstants.CALENDAR_COLUMNS; c++) {
        cellFormatter.setAlignment(r, c, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
        cellFormatter.setWidth(r, c, "100%");
        cellFormatter.setHeight(r, c, "100%");
        cellFormatter.setStyleName(r, c, dayStyle);
      }
    }

    return grid;
  }
View Full Code Here


   * @param right
   * @param corner
   * @param bottom
   */
  protected void setHandleEventListeners(final EventListener right, final EventListener corner, final EventListener bottom) {
    final CellFormatter formatter = this.getGrid().getCellFormatter();
    final Element rightElement = formatter.getElement(0, 1);
    DOM.setEventListener(rightElement, right);
    DOM.sinkEvents(rightElement, EventBitMaskConstants.MOUSE_DOWN);

    final Element cornerElement = formatter.getElement(1, 1);
    DOM.setEventListener(cornerElement, corner);
    DOM.sinkEvents(cornerElement, EventBitMaskConstants.MOUSE_DOWN);

    final Element bottomElement = formatter.getElement(1, 0);
    DOM.setEventListener(bottomElement, bottom);
    DOM.sinkEvents(bottomElement, EventBitMaskConstants.MOUSE_DOWN);
  }
View Full Code Here

      mainContainer.setWidget(0, 0, firstWidget);
      mainContainer.setWidget(0, 1, divider);
      mainContainer.setWidget(0, 2, secondWidget);

      CellFormatter cellFormatter = mainContainer.getCellFormatter();

      cellFormatter.setHorizontalAlignment(0, 0, HasAlignment.ALIGN_LEFT);
      cellFormatter.setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP);

      cellFormatter.setStyleName(0, 1, "SplitPaneDividerField");
      cellFormatter.setHorizontalAlignment(0, 1, HasAlignment.ALIGN_CENTER);
      cellFormatter.setVerticalAlignment(0, 1, HasAlignment.ALIGN_MIDDLE);

      cellFormatter.setHorizontalAlignment(0, 2, HasAlignment.ALIGN_LEFT);
      cellFormatter.setVerticalAlignment(0, 2, HasAlignment.ALIGN_TOP);
    } else {
      mainContainer = new Grid(3, 1);

      mainContainer.setWidget(0, 0, firstWidget);
      mainContainer.setWidget(1, 0, divider);
      mainContainer.setWidget(2, 0, secondWidget);

      CellFormatter cellFormatter = mainContainer.getCellFormatter();

      cellFormatter.setHorizontalAlignment(0, 0, HasAlignment.ALIGN_LEFT);
      cellFormatter.setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP);

      cellFormatter.setStyleName(1, 0, "SplitPaneDividerField");
      cellFormatter.setHorizontalAlignment(1, 0, HasAlignment.ALIGN_CENTER);
      cellFormatter.setVerticalAlignment(1, 0, HasAlignment.ALIGN_MIDDLE);

      cellFormatter.setHorizontalAlignment(2, 0, HasAlignment.ALIGN_LEFT);
      cellFormatter.setVerticalAlignment(2, 0, HasAlignment.ALIGN_TOP);
    }

    mainContainer.setStyleName("SplitPane");
    mainContainer.setCellPadding(0);
    mainContainer.setCellSpacing(0);
View Full Code Here

    firstWidget.setWidget(widget);
  }

  public void setPadding(int padding) {
    mainContainer.setCellPadding(padding);
    CellFormatter cellFormatter = mainContainer.getCellFormatter();
    if (splitOrientation == VERTICAL_SPLIT) {
      DOM.setStyleAttribute(cellFormatter.getElement(0, 1), "padding", "0px");
    } else {
      DOM.setStyleAttribute(cellFormatter.getElement(1, 0), "padding", "0px");
    }
  }
View Full Code Here

    }

    protected void onLoad() {
      super.onLoad();

      CellFormatter cellFormatter = mainContainer.getCellFormatter();
      if (splitOrientation == VERTICAL_SPLIT) {
        if (leftWidth != -1) {
          DOM.setStyleAttribute(cellFormatter.getElement(0, 0), "width", (int) leftWidth + "px");
          DOM.setStyleAttribute(cellFormatter.getElement(0, 1), "width", "5px");
          DOM.setStyleAttribute(cellFormatter.getElement(0, 2), "width", (int) (originalWidth
              - divider.getOffsetWidth() - leftWidth)
              + "px");
        } else {
          DOM.setStyleAttribute(cellFormatter.getElement(0, 0), "width", (int) ((originalWidth - divider
              .getOffsetWidth()) * leftRatio)
              + "px");
          DOM.setStyleAttribute(cellFormatter.getElement(0, 1), "width", "5px");
          DOM.setStyleAttribute(cellFormatter.getElement(0, 2), "width", (int) ((originalWidth - divider
              .getOffsetWidth()) * (1 - leftRatio))
              + "px");
        }
      } else {
        if (leftWidth != -1) {
          Window.alert((int) (originalHeight - divider.getOffsetHeight() - leftWidth) + "px");

          DOM.setStyleAttribute(cellFormatter.getElement(0, 0), "height", (int) leftWidth + "px");
          DOM.setStyleAttribute(cellFormatter.getElement(1, 0), "height", "5px");
          DOM.setStyleAttribute(cellFormatter.getElement(2, 0), "height", (int) (originalHeight
              - divider.getOffsetHeight() - leftWidth)
              + "px");
        } else {
          DOM.setStyleAttribute(cellFormatter.getElement(0, 0), "height", (int) ((originalHeight - divider
              .getOffsetHeight()) * leftRatio)
              + "px");
          DOM.setStyleAttribute(cellFormatter.getElement(1, 0), "height", "5px");
          DOM.setStyleAttribute(cellFormatter.getElement(2, 0), "height", (int) ((originalHeight - divider
              .getOffsetHeight()) * (1 - leftRatio))
              + "px");
        }
      }
    }
View Full Code Here

      DOM.releaseCapture(this.getElement());
    }

    public void onMouseMove(MouseMoveEvent event) {
      if (dragging) {
        CellFormatter cellFormatter = mainContainer.getCellFormatter();

        int newFirstWidth;
        if (splitOrientation == VERTICAL_SPLIT) {
          newFirstWidth = EditorUtils.parseInt(DOM.getStyleAttribute(cellFormatter.getElement(0, 0), "width")) + event.getX();

          if (newFirstWidth >= originalWidth) {
            newFirstWidth = originalWidth;
          }

          DOM.setStyleAttribute(cellFormatter.getElement(0, 0), "width", normalizeMin(newFirstWidth) + "px");
          DOM.setStyleAttribute(cellFormatter.getElement(0, 2), "width", normalizeMin(originalWidth - newFirstWidth
              - divider.getOffsetWidth())
              + "px");
        } else {
          newFirstWidth = EditorUtils.parseInt(DOM.getStyleAttribute(cellFormatter.getElement(0, 0), "height")) + event.getY();

          if (newFirstWidth >= originalHeight) {
            newFirstWidth = originalHeight;
          }

          DOM.setStyleAttribute(cellFormatter.getElement(0, 0), "height", normalizeMin(newFirstWidth) + "px");
          DOM.setStyleAttribute(cellFormatter.getElement(2, 0), "height", normalizeMin(originalHeight - newFirstWidth
              - divider.getOffsetHeight())
              + "px");
        }
      }
    }
View Full Code Here

  }

  @Override
  public void setup() {
    // Preparation
    CellFormatter formatter = grid.getCellFormatter();
    int weekendStartColumn = -1;
    int weekendEndColumn = -1;

    // Set up the day labels.
    for (int i = 0; i < CalendarModel.DAYS_IN_WEEK; i++) {
      int shift = CalendarUtil.getStartingDayOfWeek();
      // //* Here is my change *////
      shift += firstDayofWeek;
      int dayIdx = i + shift;
      if (i + shift >= CalendarModel.DAYS_IN_WEEK) {
        dayIdx = i + shift - CalendarModel.DAYS_IN_WEEK;
      }
      grid.setText(0, i, getModel().formatDayOfWeek(dayIdx));

      if (CalendarUtil.isWeekend(dayIdx)) {
        formatter.setStyleName(0, i, css().weekendLabel());
        if (weekendStartColumn == -1) {
          weekendStartColumn = i;
        } else {
          weekendEndColumn = i;
        }
      } else {
        formatter.setStyleName(0, i, css().weekdayLabel());
      }
    }

    // Set up the calendar grid.
    for (int row = 1; row <= CalendarModel.WEEKS_IN_MONTH; row++) {
      for (int column = 0; column < CalendarModel.DAYS_IN_WEEK; column++) {
        // set up formatter.
        Element e = formatter.getElement(row, column);
        grid.new DateCell(e, column == weekendStartColumn
            || column == weekendEndColumn);
      }
    }
    initWidget(grid);
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.HTMLTable.CellFormatter

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.