Examples of CellFormatter


Examples of com.google.gwt.gen2.table.override.client.HTMLTable.CellFormatter

  public void testCheckboxSelection() {
    // Initialize the grid
    SelectionGrid testGrid = getSelectionGrid();
    testGrid.resize(3, 4);
    RowFormatter rowFormatter = testGrid.getRowFormatter();
    CellFormatter cellFormatter = testGrid.getCellFormatter();

    // Verify the column count before setting the checkbox policy
    assertEquals(4, testGrid.getColumnCount());
    for (int i = 0; i < 3; i++) {
      Element tr = rowFormatter.getElement(i);
      assertEquals(4, tr.getChildNodes().getLength());
    }

    // Verify the column count after setting the checkbox policy
    testGrid.setSelectionPolicy(SelectionPolicy.CHECKBOX);
    assertEquals(4, testGrid.getColumnCount());
    for (int i = 0; i < 3; i++) {
      Element tr = rowFormatter.getElement(i);
      assertEquals(5, tr.getChildNodes().getLength());
    }

    // Set html and verify
    testGrid.setText(0, 0, "test");
    assertEquals("test", testGrid.getText(0, 0));
    assertEquals("test", cellFormatter.getElement(0, 0).getInnerText());
    assertEquals("test",
        DOM.getChild(rowFormatter.getElement(0), 1).getInnerText());
  }
View Full Code Here

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

  private void _updateStyles(int fromRow) {
    HTMLTable.RowFormatter rf = flexTable.getRowFormatter();
    rf.addStyleName(CONTROL_ROW, "TermTable-controlRow");
    rf.addStyleName(HEADER_ROW, "TermTable-header");
    CellFormatter cf = flexTable.getCellFormatter();
   
    for (int row = fromRow, rows = flexTable.getRowCount(); row < rows; ++row) {
     
      if ( SET_EVEN_N_ODD_ROW_STYLE && row >= FIRST_REGULAR_ROW ) {
        rf.setStyleName(row, (row % 2) != 0 ? "TermTable-OddRow" : "TermTable-EvenRow");
      }
      cf.setAlignment(row, 0, ALIGN_CENTER, ALIGN_MIDDLE);
    }
   
    _updateControlColumns(flexTable.getCellCount(0) - 1);
  }
View Full Code Here

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

  private void _updateStyles(int fromRow) {
    HTMLTable.RowFormatter rf = flexTable.getRowFormatter();
    rf.addStyleName(CONTROL_ROW, "TermTable-controlRow");
    rf.addStyleName(HEADER_ROW, "TermTable-header");
    CellFormatter cf = flexTable.getCellFormatter();
   
    for (int row = fromRow, rows = flexTable.getRowCount(); row < rows; ++row) {
     
      if ( SET_EVEN_N_ODD_ROW_STYLE && row >= FIRST_REGULAR_ROW ) {
        rf.setStyleName(row, (row % 2) != 0 ? "TermTable-OddRow" : "TermTable-EvenRow");
      }
      cf.setAlignment(row, 0, ALIGN_CENTER, ALIGN_MIDDLE);
    }
   
    _updateControlColumns(flexTable.getCellCount(0) - 1);
  }
View Full Code Here

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

    grid = new Grid(1, 5);
    grid.setWidget(0, previousYearColumn, backwardsYear);
    grid.setWidget(0, previousMonthColumn, backwards);
    grid.setWidget(0, nextMonthColumn, forwards);
    grid.setWidget(0, nextYearColumn, forwardsYear);
    CellFormatter formatter = grid.getCellFormatter();
    formatter.setStyleName(0, monthColumn, BASE_NAME + "Month");
    formatter.setWidth(0, previousYearColumn, "1");
    formatter.setWidth(0, previousMonthColumn, "1");
    formatter.setWidth(0, monthColumn, "100%");
    formatter.setWidth(0, nextMonthColumn, "1");
    formatter.setWidth(0, nextYearColumn, "1");
    grid.setStyleName(BASE_NAME + "MonthSelector");
    initWidget(grid);
  }
View Full Code Here

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

  
   public void setSelectedIndex(int index)
   {
      if (selectedIndex_ != index)
      {
         CellFormatter cf = grid_.getCellFormatter() ;
         if (selectedIndex_ >= 0)
            cf.removeStyleName(selectedIndex_, 0, styles_.selected()) ;
        
         selectedIndex_ = index ;
        
         if (index >= 0)
         {
            cf.addStyleName(selectedIndex_, 0, styles_.selected()) ;
            com.google.gwt.dom.client.Element el =
                  DomUtils.getTableCell(grid_.getElement(), index, 0) ;
            DomUtils.ensureVisibleVert(scrollPanel_.getElement(), el, 2) ;
            SelectionEvent.fire(this, getSelectedItem()) ;
         }
View Full Code Here

Examples of com.google.gwt.widgetideas.table.client.overrides.HTMLTable.CellFormatter

    getCell(date).setEnabled(enabled);
  }

  @Override
  public void setup() {
    CellFormatter formatter = grid.getCellFormatter();
    // Set up title.
    for (int i = 0; i < CalendarModel.DAYS_IN_WEEK; i++) {
      int shift = CalendarModel.getLocaleStartingDayOfWeek ();
      int dayIdx = i + shift < CalendarModel.DAYS_IN_WEEK ? i + shift : i + shift - CalendarModel.DAYS_IN_WEEK;
      grid.setText(0, i, getModel().formatDayOfWeek(dayIdx));
      formatter.setStyleName(0, i, Styles.DAY_TITLE);
    }

    for (int row = 1; row <= CalendarModel.WEEKS_IN_MONTH; row++) {
      for (int column = 0; column < CalendarModel.DAYS_IN_WEEK; column++) {
        grid.new Cell(formatter.getElement(row, column), column);
      }
    }
    initWidget(grid);
    setStyleName(Styles.CALENDAR_VIEW);
    ColumnFormatter columnFormatter = grid.getColumnFormatter();
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.CellFormatter

        });

        ListGridField ancestryField = new ListGridField(AncestryUtil.RESOURCE_ANCESTRY, MSG.common_title_ancestry(),
            300);
        // needs to use a different cell formatter than what AncestryUtil.setupAncestryListGridField creates
        ancestryField.setCellFormatter(new CellFormatter() {
            public String format(Object o, ListGridRecord listGridRecord, int rowNum, int colNum) {
                return AncestryUtil.getAncestryValue(listGridRecord, false);
            }
        });
        AncestryUtil.setupAncestryListGridFieldHover(ancestryField);
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.CellFormatter

        return DriftDataSource.ATTR_CTIME;
    }

    @Override
    protected CellFormatter getDetailsLinkColumnCellFormatter() {
        return new CellFormatter() {
            public String format(Object value, ListGridRecord record, int i, int i1) {
                Integer resourceId = record.getAttributeAsInt(AncestryUtil.RESOURCE_ID);
                Integer driftDefId = record.getAttributeAsInt(DriftDataSource.ATTR_CHANGESET_DEF_ID);
                String driftId = getId(record);
                String url = LinkManager.getDriftCarouselDriftLink(resourceId, driftDefId, driftId);
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.CellFormatter

                }
                // should never get here
                return MSG.common_status_unknown();
            }
        });
        statusField.setCellFormatter(new CellFormatter() {
            public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
                OperationRequestStatus status = OperationRequestStatus.valueOf((String) o);
                String icon = ImageManager.getOperationResultsIcon(status);
                return Canvas.imgHTML(icon, 16, 16);
            }
View Full Code Here

Examples of com.smartgwt.client.widgets.grid.CellFormatter

    protected ListGridField createResourceField() {
        ListGridField resourceField = new ListGridField(AncestryUtil.RESOURCE_NAME, MSG.common_title_resource());
        resourceField.setAlign(Alignment.LEFT);
        resourceField.setCellAlign(Alignment.LEFT);
        resourceField.setCellFormatter(new CellFormatter() {
            public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
                String url = LinkManager.getResourceLink(listGridRecord.getAttributeAsInt(AncestryUtil.RESOURCE_ID));
                return LinkManager.getHref(url, o.toString());
            }
        });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.