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

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


        transactionsGrid.setText(row, 5, transaction.comment);
        rowFormatter.addStyleName(row, isOutgoing ? "transactionsTableOutgoingTransactionRow" : "transactionsTableIncomingTransactionRow");
        row++;
      }
    }
    CellFormatter cellFormatter = transactionsGrid.getCellFormatter();
    for (int row = 0; row < transactionsGrid.getRowCount(); row++) {
      for (int cell = 0; cell < transactionsGrid.getCellCount(row); cell++) {
        cellFormatter.addStyleName(row, cell, "transactionsTableCell");
      }
    }
  }
View Full Code Here


    } else {
      bottomPanel.setCellHorizontalAlignment(contentDecorator,
          HasHorizontalAlignment.ALIGN_RIGHT);
      contentDecorator.getElement().setAttribute("align", "RIGHT");
    }
    CellFormatter formatter = contentLayout.getCellFormatter();

    // Add the content title
    setContentTitle(new HTML("Content"));
    formatter.setStyleName(0, 0, DEFAULT_STYLE_NAME + "-content-title");

    // Add the content wrapper
    contentWrapper = new SimplePanel();
    contentLayout.setWidget(1, 0, contentWrapper);
    formatter.setStyleName(1, 0, DEFAULT_STYLE_NAME + "-content-wrapper");
    setContent(null);

    // Add a window resize handler
    Window.addResizeHandler(this);
  }
View Full Code Here

  @ShowcaseSource
  @Override
  public Widget onInitialize() {
    // Use a Grid to layout the content
    Grid layout = new Grid(4, 2);
    CellFormatter formatter = layout.getCellFormatter();
    layout.setCellSpacing(5);

    // Add a field to select the pattern
    patternList = new ListBox();
    patternList.setWidth("17em");
    String[] patterns = constants.cwDateTimeFormatPatterns();
    for (String pattern : patterns) {
      patternList.addItem(pattern);
    }
    patternList.addChangeHandler(new ChangeHandler() {
      public void onChange(ChangeEvent event) {
        updatePattern();
      }
    });
    layout.setHTML(0, 0, constants.cwDateTimeFormatPatternLabel());
    layout.setWidget(0, 1, patternList);

    // Add a field to display the pattern
    patternBox = new TextBox();
    patternBox.setWidth("17em");
    patternBox.addKeyUpHandler(new KeyUpHandler() {
      public void onKeyUp(KeyUpEvent event) {
        updatePattern();
      }
    });

    layout.setWidget(1, 1, patternBox);

    // Add a field to set the value
    valueBox = new TextBox();
    valueBox.setWidth("17em");
    valueBox.setText("13 September 1999 12:34:56");
    valueBox.addKeyUpHandler(new KeyUpHandler() {

      public void onKeyUp(KeyUpEvent event) {
        updateFormattedValue();
      }

    });

    layout.setHTML(2, 0, constants.cwDateTimeFormatValueLabel());
    layout.setWidget(2, 1, valueBox);

    // Add a field to display the formatted value
    formattedBox = new Label();
    formattedBox.setWidth("17em");
    layout.setHTML(3, 0, constants.cwDateTimeFormatFormattedLabel());
    layout.setWidget(3, 1, formattedBox);
    formatter.setVerticalAlignment(3, 0, HasVerticalAlignment.ALIGN_TOP);

    // Return the layout Widget
    updatePattern();
    return layout;
  }
View Full Code Here

    grid.setWidget(0, 0, backYear);
    grid.setWidget(0, 1, backMonth);
    grid.setWidget(0, 3, forwardMonth);
    grid.setWidget(0, 4, forwardYear);

    CellFormatter formatter = grid.getCellFormatter();
    formatter.setStyleName(0, 2, "datePickerMonth");
    formatter.setWidth(0, 0, "1");
    formatter.setWidth(0, 1, "1");
    formatter.setWidth(0, 2, "100%");
    formatter.setWidth(0, 3, "1");
    formatter.setWidth(0, 4, "1");
    grid.setStyleName("datePickerMonthSelector");

    initWidget(grid);
  }
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();
      int dayIdx = i + shift < CalendarModel.DAYS_IN_WEEK ? i + shift : 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

    // Set up grid.
    grid = new Grid(1, 3);
    grid.setWidget(0, 0, backwards);
    grid.setWidget(0, 2, forwards);

    CellFormatter formatter = grid.getCellFormatter();
    formatter.setStyleName(0, 1, css().month());
    formatter.setWidth(0, 0, "1");
    formatter.setWidth(0, 1, "100%");
    formatter.setWidth(0, 2, "1");
    grid.setStyleName(css().monthSelector());
    initWidget(grid);
  }
View Full Code Here

  protected void addColumnStyle(final int column, final String style) {
    this.checkColumn("parameter:column", column);

    final Grid table = this.getGrid();
    final CellFormatter cellFormatter = table.getCellFormatter();
    final int rows = table.getRowCount();
    for (int row = 0; row < rows; row++) {
      cellFormatter.addStyleName(row, column, style);
    }
  }
View Full Code Here

  protected void removeColumnStyle(final int column, final String style) {
    this.checkColumn("parameter:column", column);

    final Grid table = this.getGrid();
    final CellFormatter cellFormatter = table.getCellFormatter();
    final int rows = table.getRowCount();
    for (int row = 0; row < rows; row++) {
      cellFormatter.removeStyleName(row, column, style);
    }
  }
View Full Code Here

    for (int row = gridRowCount; row < requiredGridCount; row++) {
      final String style = ((row & 1) == 1) ? evenRowStyle : oddRowStyle;
      rowFormatter.addStyleName(row, style);

      final CellFormatter cellFormatter = table.getCellFormatter();
      final int sortedColumn = this.getSortedColumn();

      for (int column = 0; column < columnCount; column++) {
        if (this.isColumnSortable(column)) {
          cellFormatter.setStyleName(row, column, sortableColumnStyle);

          if (sortedColumn == column) {
            cellFormatter.addStyleName(row, column, sortedColumnStyle);
          }
        }
      }
    }
View Full Code Here

    String monthStyle = date.getDate() != 1 ? this.getPreviousMonthStyle() : currentMonthStyle;

    final int rowOffset = this.hasHeadings() ? 1 : 0;
    final int lastRow = grid.getRowCount();

    final CellFormatter cellFormatter = grid.getCellFormatter();

    for (int row = rowOffset; row < lastRow; row++) {
      for (int column = 0; column < WidgetConstants.CALENDAR_COLUMNS; column++) {

        final int year = date.getYear() + WidgetConstants.CALENDAR_YEAR_BIAS;
        final int month = date.getMonth();
        final int dayOfMonth = date.getDate();

        cellFormatter.setStyleName(row, column, dayStyle);
        cellFormatter.addStyleName(row, column, monthStyle);

        final Widget widget = this.createDayTile(year, month, dayOfMonth);
        grid.setWidget(row, column, widget, year, month, dayOfMonth);

        date.setDate(dayOfMonth + 1);
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.