private void setParents(JsArray<CommitInfo> commits) { setVisible(firstParent, true); TableRowElement next = firstParent; TableRowElement previous = null; for (CommitInfo c : Natives.asList(commits)) { if (next == firstParent) { CopyableLabel copyLabel = getCommitLabel(c); parentCommits.add(copyLabel); setWebLinks(parentWebLinks, c); } else { next.appendChild(DOM.createTD()); Element td1 = DOM.createTD(); td1.appendChild(getCommitLabel(c).getElement()); next.appendChild(td1); FlowPanel linksPanel = new FlowPanel(); linksPanel.addStyleName(style.parentWebLink()); setWebLinks(linksPanel, c); Element td2 = DOM.createTD(); td2.appendChild(linksPanel.getElement()); next.appendChild(td2); previous.getParentElement().insertAfter(next, previous); } previous = next; next = DOM.createTR().cast(); } }
@Override protected boolean resetFocusOnCell() { boolean focused = false; if (hasFilterHeaders() && filterFocusedCellColumn > -1 && filterFocusedCellRow > -1) { TableSectionElement thead = getTableHeadElement(); NodeList<TableRowElement> rows = thead.getRows(); if (filterFocusedCellRow < rows.getLength()) { TableRowElement row = rows.getItem(filterFocusedCellRow); NodeList<TableCellElement> cells = row.getCells(); if (filterFocusedCellColumn < cells.getLength()) { TableCellElement cell = cells.getItem(filterFocusedCellColumn); if (getHeaderBuilder().isHeader(cell)) { Header<?> header = getHeaderBuilder().getHeader(cell); Context context = new Context(0, 0, header.getKey()); focused = resetFocusOnFilterCellImpl(context, header, cell); } } } } if (!focused) { focused = super.resetFocusOnCell(); } return focused; }
@Override protected void redraw() { TableSectionElement nbody = Document.get().createTBodyElement(); for ( int iRow = 0; iRow < data.size(); iRow++ ) { DynamicDataRow rowData = data.get( iRow ); TableRowElement tre = Document.get().createTRElement(); tre.setClassName( getRowStyle( iRow ) ); populateTableRowElement( tre, rowData ); nbody.appendChild( tre ); } // Update table to DOM table.replaceChild( nbody, tbody ); tbody = nbody; }
private TableRowElement populateTableRowElement( TableRowElement tre, DynamicDataRow rowData ) { tre.getStyle().setHeight( resources.rowHeight(), Unit.PX ); for ( int iCol = 0; iCol < columns.size(); iCol++ ) { DynamicColumn<T> column = columns.get( iCol ); if ( column.isVisible() ) { TableCellElement tce = makeTableCellElement( iCol, rowData ); if ( tce != null ) { tre.appendChild( tce ); } } } return tre; }
@Override void hideColumn( int index ) { if ( index < 0 ) { throw new IllegalArgumentException( "index cannot be less than zero" ); } if ( index > columns.size() ) { throw new IllegalArgumentException( "index cannot be greater than the number of rows" ); } for ( int iRow = 0; iRow < data.size(); iRow++ ) { DynamicDataRow rowData = data.get( iRow ); CellValue<? extends Comparable<?>> cell = rowData.get( index ); if ( cell.getRowSpan() > 0 ) { Coordinate hc = cell.getHtmlCoordinate(); TableRowElement tre = tbody.getRows().getItem( hc.getRow() ); TableCellElement tce = tre.getCells().getItem( hc.getCol() ); tre.removeChild( tce ); } } }
@Override void selectCell( CellValue<? extends Comparable<?>> cell ) { if ( cell == null ) { throw new IllegalArgumentException( "cell cannot be null" ); } Coordinate hc = cell.getHtmlCoordinate(); TableRowElement tre = tbody.getRows().getItem( hc.getRow() ) .<TableRowElement>cast(); TableCellElement tce = tre.getCells().getItem( hc.getCol() ) .<TableCellElement>cast(); //Cell selected style takes precedence String cellSelectedStyle = resources.cellTableCellSelected(); String cellOtherwiseStyle = resources.cellTableCellOtherwise(); String cellMultipleValuesStyle = resources.cellTableCellMultipleValues(); tce.removeClassName( cellMultipleValuesStyle ); tce.removeClassName( cellOtherwiseStyle ); tce.addClassName( cellSelectedStyle ); tce.focus(); }
@Override void showColumn( int index ) { if ( index < 0 ) { throw new IllegalArgumentException( "index cannot be less than zero" ); } if ( index > columns.size() ) { throw new IllegalArgumentException( "index cannot be greater than the number of rows" ); } for ( int iRow = 0; iRow < data.size(); iRow++ ) { DynamicDataRow rowData = data.get( iRow ); TableCellElement tce = makeTableCellElement( index, rowData ); if ( tce != null ) { CellValue<? extends Comparable<?>> cell = rowData.get( index ); Coordinate hc = cell.getHtmlCoordinate(); TableRowElement tre = tbody.getRows().getItem( hc.getRow() ); TableCellElement ntce = tre.insertCell( hc.getCol() ); tre.replaceChild( tce, ntce ); } } }
/** * Retrieve the extents of a cell * @param cv The cell for which to retrieve the extents * @return */ CellSelectionDetail getSelectedCellExtents( CellValue<? extends Comparable<?>> cv ) { if ( cv == null ) { throw new IllegalArgumentException( "cv cannot be null" ); } // Cells in hidden columns do not have extents if ( !columns.get( cv.getCoordinate().getCol() ).isVisible() ) { return null; } Coordinate hc = cv.getHtmlCoordinate(); TableRowElement tre = tbody.getRows().getItem( hc.getRow() ).<TableRowElement>cast(); TableCellElement tce = tre.getCells().getItem( hc.getCol() ).<TableCellElement>cast(); int offsetX = tce.getOffsetLeft(); int offsetY = tce.getOffsetTop(); int w = tce.getOffsetWidth(); int h = tce.getOffsetHeight(); CellSelectionDetail e = new CellSelectionDetail( cv.getCoordinate(), offsetX, offsetY, h, w ); return e; }
private void displayQuireItem(com.google.gwt.dom.client.Document htmldoc, TableElement table, Element item) { TableRowElement tr = table.insertRow(-1); TableCellElement td1 = tr.insertCell(-1); TableCellElement td2 = tr.insertCell(-1); TableCellElement td3 = tr.insertCell(-1); td1.setInnerText(item.getAttribute("n")); NodeList l = item.getElementsByTagName("locus"); if (l.getLength() > 0) { Element locus = (Element) l.item(0); td2.appendChild(displayLocus(htmldoc, locus)); for (Node n = locus.getNextSibling(); n != null; n = n .getNextSibling()) { td3.appendChild(displayDescription(htmldoc, n)); } } }
@Override protected void onViewLoaded(TableRowView view) { TableRowElement rowElement = view.getRootElement(); for (int i = 0; i < columns; i++) { rowElement.appendChild(rowElement.getOwnerDocument().createTDElement()); } }
private static NodeList<TableCellElement> getMaxColsAmongRows(NodeList<TableRowElement> rows) { NodeList<TableCellElement> cols = null; int maxCols = 0; for (int i = 0; i < rows.getLength(); i++) { NodeList<TableCellElement> currCols = rows.getItem(i).getCells(); if (currCols.getLength() > maxCols) { maxCols = currCols.getLength(); cols = currCols; } } return cols; }
private void appendRow(String title, JsArrayString l) { TableRowElement row = table.insertRow(-1); TableCellElement th = Document.get().createTHElement(); th.setInnerText(title); row.appendChild(th); row.insertCell(-1).setInnerSafeHtml(formatList(l)); }
public TableCellElement getCell(int aRow, int aCol) { NodeList<TableRowElement> rows = getTableBodyElement().getRows(); if (aRow >= 0 && aRow < rows.getLength()) { TableRowElement row = rows.getItem(aRow); NodeList<TableCellElement> cells = row.getCells(); if (aCol >= 0 && aCol < cells.getLength()) { return cells.getItem(aCol); } } return null; }
public <C> void redrawAllRowsInColumn(int aIndex, ListDataProvider<T> aDataProvider) { if (aIndex >= 0 && aIndex < getColumnCount()) { int start = getVisibleRange().getStart(); Column<T, C> column = (Column<T, C>) getColumn(aIndex); Cell<C> cell = column.getCell(); List<T> data = aDataProvider.getList(); ProvidesKey<T> keys = getKeyProvider(); NodeList<TableRowElement> rows = getTableBodyElement().getRows(); for (int i = 0; i < rows.getLength(); i++) { TableRowElement row = rows.getItem(i); NodeList<TableCellElement> cells = row.getCells(); if (aIndex >= 0 && aIndex < cells.getLength()) { TableCellElement toRerender = cells.getItem(aIndex); if (toRerender != null) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); int dataIdx = start + i; if (dataIdx >= 0 && dataIdx < data.size()) { T object = data.get(dataIdx); Cell.Context cx = new Cell.Context(start + i, aIndex, keys.getKey(object)); cell.render(cx, column.getValue(object), sb); // Take into account, that cell builder supports // some // maps // to cells' divs // and generates them. So we have to work with first // <div> // in <td>. toRerender.getFirstChildElement().setInnerSafeHtml(sb.toSafeHtml()); } } } } } }
/** * Given a click event, return the Cell that was clicked, or null if the event * did not hit this table. The cell can also be null if the click event does * not occur on a specific cell. * * @param event A click event of indeterminate origin * @return The appropriate cell, or null */ public Cell getCellForEvent(MouseEvent<? extends EventHandler> event) { Element td = getEventTargetCell(Event.as(event.getNativeEvent())); if (td == null) { return null; } int row = TableRowElement.as(td.getParentElement()).getSectionRowIndex(); int column = TableCellElement.as(td).getCellIndex(); return new Cell(row, column); }
/** * Get the TD element * * @param root * @param column * @param row * @return */ public static TableCellElement getCell( Element root, int column, int row ) { TableSectionElement tbody = getTBodyElement( root ); TableRowElement tr = tbody.getChild( row ).cast(); TableCellElement td = tr.getChild( column ).cast(); return td; }
@Override public TableCellElement getTd() { TableRowElement tr = getTr(); if( tr == null ) return null; return tr.getChild( getCellIndex() ).cast(); }
@Override public void addClassName( String className ) { TableRowElement tr = getTr(); if( tr != null ) tr.addClassName( className ); }
@Override public void removeClassName( String className ) { TableRowElement tr = getTr(); if( tr != null ) tr.removeClassName( className ); }
private Container ensureAspectRow(String aspectClass) { Container row = this.aspectRows.get(aspectClass); if (row == null) { row = new Container(TableRowElement.TAG); this.aspectRows.put(aspectClass, row); row.setVisible(false); for (int i = 0; i < this.headerRow.getWidgetCount() - 1; i++) { row.append(new TableTH<>()); } this.append(row); } return row; }
private void setCursorType( Cursor cursor ) { for ( int iRow = 0; iRow < widget.headerRows.length; iRow++ ) { TableRowElement tre = widget.headerRows[ iRow ].<TableRowElement>cast(); for ( int iCol = 0; iCol < tre.getCells().getLength(); iCol++ ) { TableCellElement tce = tre.getCells().getItem( iCol ); tce.getStyle().setCursor( cursor ); } } }
private void fixStyles( int iRow ) { while ( iRow < getBody().getChildCount() ) { TableRowElement tre = getBody().getChild( iRow ).<TableRowElement>cast(); tre.setClassName( getRowStyle( iRow ) ); iRow++; } }
@Override void redrawColumns( int startRedrawIndex, int endRedrawIndex ) { if ( startRedrawIndex < 0 ) { throw new IllegalArgumentException( "startRedrawIndex cannot be less than zero." ); } if ( startRedrawIndex > columns.size() ) { throw new IllegalArgumentException( "startRedrawIndex cannot be greater than the number of defined columns." ); } if ( endRedrawIndex < 0 ) { throw new IllegalArgumentException( "endRedrawIndex cannot be less than zero." ); } if ( endRedrawIndex > columns.size() ) { throw new IllegalArgumentException( "endRedrawIndex cannot be greater than the number of defined columns." ); } if ( startRedrawIndex > endRedrawIndex ) { throw new IllegalArgumentException( "startRedrawIndex cannot be greater than endRedrawIndex." ); } for ( int iRow = 0; iRow < data.size(); iRow++ ) { TableRowElement tre = tbody.getRows().getItem( iRow ); DynamicDataRow rowData = data.get( iRow ); redrawTableRowElement( rowData, tre, startRedrawIndex, endRedrawIndex ); } }
@Override public void resizeColumn( DynamicColumn<?> col, int width ) { if ( col == null ) { throw new IllegalArgumentException( "col cannot be null" ); } if ( width < 0 ) { throw new IllegalArgumentException( "width cannot be less than zero" ); } col.setWidth( width ); int iCol = col.getColumnIndex(); for ( DynamicDataRow row : data ) { CellValue<? extends Comparable<?>> cell = row .get( iCol ); Coordinate c = cell.getHtmlCoordinate(); TableRowElement tre = tbody.getRows().getItem( c.getRow() ); TableCellElement tce = tre.getCells().getItem( c.getCol() ); DivElement div = tce.getFirstChild().<DivElement>cast(); DivElement divText = tce.getFirstChild().getFirstChild().<DivElement>cast(); // Set widths tce.getStyle().setWidth( width, Unit.PX ); div.getStyle().setWidth( width, Unit.PX ); divText.getStyle().setWidth( width, Unit.PX ); } }
private void fixRowStyles( int iRow ) { while ( iRow < tbody.getChildCount() ) { Element e = Element.as( tbody.getChild( iRow ) ); TableRowElement tre = TableRowElement.as( e ); tre.setClassName( getRowStyle( iRow ) ); iRow++; } }
@Override protected void createRowElement( int index, DynamicDataRow rowData ) { TableRowElement tre = tbody.insertRow( index ); populateTableRowElement( tre, rowData ); fixRowStyles( index ); }
@Override protected void redrawRows( int startRedrawIndex, int endRedrawIndex ) { if ( startRedrawIndex < 0 ) { throw new IllegalArgumentException( "startRedrawIndex cannot be less than zero." ); } if ( startRedrawIndex > data.size() ) { throw new IllegalArgumentException( "startRedrawIndex cannot be greater than the number of rows in the table." ); } if ( endRedrawIndex < 0 ) { throw new IllegalArgumentException( "endRedrawIndex cannot be less than zero." ); } if ( endRedrawIndex > data.size() ) { throw new IllegalArgumentException( "endRedrawIndex cannot be greater than the number of rows in the table." ); } if ( startRedrawIndex > endRedrawIndex ) { throw new IllegalArgumentException( "startRedrawIndex cannot be greater than endRedrawIndex." ); } //Redraw replacement rows for ( int iRow = startRedrawIndex; iRow <= endRedrawIndex; iRow++ ) { DynamicDataRow rowData = data.get( iRow ); TableRowElement tre = Document.get().createTRElement(); populateTableRowElement( tre, rowData ); tbody.replaceChild( tre, tbody.getChild( iRow ) ); } fixRowStyles( startRedrawIndex ); }
@Override @SuppressWarnings({ "rawtypes" }) void deselectCell( CellValue<? extends Comparable<?>> cell ) { if ( cell == null ) { throw new IllegalArgumentException( "cell cannot be null" ); } Coordinate hc = cell.getHtmlCoordinate(); TableRowElement tre = tbody.getRows().getItem( hc.getRow() ) .<TableRowElement>cast(); TableCellElement tce = tre.getCells().getItem( hc.getCol() ) .<TableCellElement>cast(); //Merging, grouping etc could have led to the selected HTML cell disappearing if ( tce != null ) { String cellSelectedStyle = resources.cellTableCellSelected(); String cellMultipleValuesStyle = resources.cellTableCellMultipleValues(); String cellOtherwiseStyle = resources.cellTableCellOtherwise(); tce.removeClassName( cellSelectedStyle ); //Re-apply applicable styling if ( cell.isOtherwise() ) { tce.addClassName( cellOtherwiseStyle ); } if ( cell instanceof CellValue.GroupedCellValue ) { CellValue.GroupedCellValue gcv = (CellValue.GroupedCellValue) cell; if ( gcv.hasMultipleValues() ) { tce.addClassName( cellMultipleValuesStyle ); } } } }
@Override protected void onBrowserEvent2(Event event) { if (hasFilterHeaders()) { EventTarget eventTarget = event.getEventTarget(); if (!Element.is(eventTarget)) { return; } final Element target = event.getEventTarget().cast(); TableSectionElement thead = getTableHeadElement(); TableSectionElement targetTableSection = null; TableCellElement targetTableCell = null; Element headerParent = null; Element maybeTableCell = null; Element cur = target; while (cur != null && targetTableSection == null) { if (cur == thead) { targetTableSection = cur.cast(); if (maybeTableCell != null) { targetTableCell = maybeTableCell.cast(); break; } } String tagName = cur.getTagName(); if (TableCellElement.TAG_TD.equalsIgnoreCase(tagName) || TableCellElement.TAG_TH.equalsIgnoreCase(tagName)) { maybeTableCell = cur; } if (headerParent == null && getHeaderBuilder().isHeader(cur)) { headerParent = cur; } cur = cur.getParentElement(); } if (targetTableCell != null) { String eventType = event.getType(); TableRowElement targetTableRow = targetTableCell.getParentElement().cast(); int col = targetTableCell.getCellIndex(); if (targetTableSection == thead) { if (headerParent != null) { Header<?> header = getHeaderBuilder().getHeader(headerParent); if (header != null) { int headerIndex = getHeaderBuilder().getRowIndex(targetTableRow); if (header instanceof StringFilterHeader) { if (StringFilterHeader.isFilterFocusEvent(eventType)) { filterFocusedCellColumn = col; filterFocusedCellRow = headerIndex; } else { filterFocusedCellColumn = -1; filterFocusedCellRow = -1; } } } } } } } super.onBrowserEvent2(event); }
public DataTable() { // wrapper Div wrapper = Document.get().createDivElement(); wrapper.getStyle().setPosition( Position.RELATIVE ); wrapper.setTabIndex( 0 ); // for focusability // headings table theadTable = Document.get().createTableElement(); theadTable.setClassName( "table" ); theadTable.getStyle().setWidth( 100, Unit.PCT ); theadTable.getStyle().setTableLayout( TableLayout.FIXED ); headTableColgroup = Document.get().createElement( "colgroup" ); // headings elements thead = Document.get().createTHeadElement(); theadtr = Document.get().createTRElement(); // main table table = Document.get().createTableElement(); table.setClassName( "table" ); table.getStyle().setWidth( 100, Unit.PCT ); table.getStyle().setTableLayout( TableLayout.FIXED ); tableColgroup = Document.get().createElement( "colgroup" ); // table body tbody = Document.get().createTBodyElement(); // wrapper table wrapperTable = Document.get().createTableElement(); wrapperTable.getStyle().setTableLayout( TableLayout.FIXED ); wrapperTable.getStyle().setWidth( 100, Unit.PCT ); wrapperTable.getStyle().setHeight( 100, Unit.PCT ); TableRowElement tr0 = Document.get().createTRElement(); TableCellElement td0 = Document.get().createTDElement(); DivElement div0 = Document.get().createDivElement(); div0.getStyle().setWidth( 100, Unit.PCT ); TableRowElement tr1 = Document.get().createTRElement(); tr1.getStyle().setHeight( 100, Unit.PCT ); TableCellElement td1 = Document.get().createTDElement(); DivElement div1 = Document.get().createDivElement(); div1.getStyle().setHeight( 100, Unit.PCT ); div1.getStyle().setWidth( 100, Unit.PCT ); div1.getStyle().setPosition( Position.RELATIVE ); DivElement div2 = Document.get().createDivElement(); div2.getStyle().setPosition( Position.ABSOLUTE ); div2.getStyle().setTop( 0, Unit.PX ); div2.getStyle().setLeft( 0, Unit.PX ); div2.getStyle().setRight( 0, Unit.PX ); div2.getStyle().setBottom( 0, Unit.PX ); div2.getStyle().setOverflow( Overflow.AUTO ); // bind together theadTable.appendChild( headTableColgroup ); theadTable.appendChild( thead.<Node> cast() ); thead.appendChild( theadtr.<Node> cast() ); table.appendChild( tableColgroup ); table.appendChild( tbody.<Node> cast() ); td0.appendChild( div0 ); div0.appendChild( theadTable.<Node> cast() ); div1.appendChild( div2 ); div2.appendChild( table ); td1.appendChild( div1.<Node> cast() ); tr0.appendChild( td0 ); tr1.appendChild( td1 ); wrapperTable.appendChild( tr0 ); wrapperTable.appendChild( tr1 ); wrapper.appendChild( wrapperTable ); customPanel = new CustomPanel( wrapper ); initWidget( customPanel ); setStylePrimaryName( CSS.main() ); }
@Override public TableRowElement getTr() { return tr; }
public InputDatePicker() { super(Document.get().createDivElement()); StyleUtils.addStyle(this, InputDatePicker.STYLE_DATEPICKER); this.getElement().appendChild(this.datepickerHeader); StyleUtils.addStyle(this.datepickerHeader, InputDatePicker.STYLE_HEADER); /* month selecter */ this.datepickerHeader.appendChild(this.monthPickerButton); StyleUtils.addStyle(this.monthPickerButton, InputDatePicker.STYLE_MONTH_PICKER_BUTTON); /* pagination */ this.datepickerHeader.appendChild(this.monthPagerUl); StyleUtils.addStyle(this.monthPagerUl, InputDatePicker.STYLE_MONTH_PAGER); this.createLi(this.pagePreviusMonthLi, InputDatePicker.STYLE_MONTH_PREVIOUS, "◄"); this.createLi(this.pageTodayLi, InputDatePicker.STYLE_TODAY, "◉"); this.createLi(this.pageNextMonthLi, InputDatePicker.STYLE_MONTH_NEXT, "►"); this.monthPagerUl.appendChild(this.pagePreviusMonthLi); this.monthPagerUl.appendChild(this.pageTodayLi); this.monthPagerUl.appendChild(this.pageNextMonthLi); /* Calendar Picker */ this.getElement().appendChild(this.monthPicker); this.monthPicker.appendChild(this.monthPickerInner); StyleUtils.addStyle(this.monthPicker, InputDatePicker.STYLE_MONTH_PICKER); /* Calendar Picker */ this.getElement().appendChild(this.calendarTable); StyleUtils.addStyle(this.calendarTable, InputDatePicker.STYLE_CALENDAR_PICKER); /* DayPicker Header */ TableSectionElement head = Document.get().createTHeadElement(); TableRowElement headRow = Document.get().createTRElement(); this.calendarTable.appendChild(head); head.appendChild(headRow); for (int i = 0; i < 7; i++) { TableCellElement th = Document.get().createTHElement(); headRow.appendChild(th); int dayToDisplay = (i + InputDatePicker.DATE_TIME_FORMAT_INFO.firstDayOfTheWeek()) % InputDatePicker.DAYS.length; th.setInnerText(InputDatePicker.DAYS[dayToDisplay]); } /* DayPicker Body */ this.calendarTable.appendChild(this.calendatBody); this.today = InputDatePicker.ATTRIBUTE_DATE_FORMAT.parse(InputDatePicker.ATTRIBUTE_DATE_FORMAT.format(new Date())); this.setValue(this.today); Event.sinkEvents(this.getElement(), Event.ONKEYDOWN); Event.sinkEvents(this.monthPickerButton, Event.ONCLICK); Event.sinkEvents(this.pagePreviusMonthLi, Event.ONCLICK); Event.sinkEvents(this.pageTodayLi, Event.ONCLICK); Event.sinkEvents(this.pageNextMonthLi, Event.ONCLICK); this.redraw(); }
private void redrawCalendarPicker() { this.monthPicker.getStyle().setDisplay(Display.NONE); this.calendarTable.getStyle().clearDisplay(); this.calendatBody.removeAllChildren(); int firstDayOfWeek = InputDatePicker.DATE_TIME_FORMAT_INFO.firstDayOfTheWeek(); int lastDayOfWeek = (firstDayOfWeek + InputDatePicker.DAYS_IN_WEEK) % InputDatePicker.DAYS_IN_WEEK; /* Display month */ this.monthPickerButton.setInnerHTML(InputDatePicker.MONTH_YEAR_FORMAT.format(this.cursor) + "<span class=\"caret\"></span>"); Date lastMonth = new Date(this.cursor.getTime()); CalendarUtil.addMonthsToDate(lastMonth, -1); this.pagePreviusMonthLi.setAttribute(InputDatePicker.ATTRIBUTE_DATA_CURSOR, InputDatePicker.ATTRIBUTE_DATE_FORMAT .format(lastMonth)); this.pageTodayLi.setAttribute(InputDatePicker.ATTRIBUTE_DATA_CURSOR, InputDatePicker.ATTRIBUTE_DATE_FORMAT .format(this.today)); Date nextMonth = new Date(this.cursor.getTime()); CalendarUtil.addMonthsToDate(nextMonth, 1); this.pageNextMonthLi.setAttribute(InputDatePicker.ATTRIBUTE_DATA_CURSOR, InputDatePicker.ATTRIBUTE_DATE_FORMAT .format(nextMonth)); /* Draw daypicker */ Date dateToDrow = new Date(this.cursor.getTime()); int selectedMonth = dateToDrow.getMonth(); int firstMonthToDisplay = (selectedMonth + 11) % 12; int lastMonthToDisplay = (selectedMonth + 13) % 12; do { CalendarUtil.addDaysToDate(dateToDrow, -1); } while (firstMonthToDisplay != dateToDrow.getMonth() || dateToDrow.getDay() != firstDayOfWeek); // drow calendarTable TableRowElement headRow = null; while (dateToDrow.getMonth() != lastMonthToDisplay || dateToDrow.getDay() != lastDayOfWeek || dateToDrow.getDate() == 1 && dateToDrow.getDay() == firstDayOfWeek) { if (headRow == null || dateToDrow.getDay() == firstDayOfWeek) { headRow = Document.get().createTRElement(); this.calendatBody.appendChild(headRow); } TableCellElement td = Document.get().createTDElement(); headRow.appendChild(td); DivElement div = Document.get().createDivElement(); td.appendChild(div); div.setInnerText(String.valueOf(dateToDrow.getDate())); div.setAttribute(InputDatePicker.ATTRIBUTE_DATA_DATE, InputDatePicker.ATTRIBUTE_DATE_FORMAT.format(dateToDrow)); if (dateToDrow.getMonth() != selectedMonth) { StyleUtils.addStyle(td, InputDatePicker.STYLE_MUTED); } if (dateToDrow.equals(this.cursor)) { StyleUtils.addStyle(td, InputDatePicker.STYLE_SELECTED); } if (this.today.equals(dateToDrow)) { StyleUtils.addStyle(td, InputDatePicker.STYLE_TODAY); } Event.sinkEvents(div, Event.ONCLICK); CalendarUtil.addDaysToDate(dateToDrow, 1); } }
public TableRow() { super(TableRowElement.TAG); }
/** * Get the index of the row value from the associated {@link TableRowElement}. * * @param row the row element * @return the row value index */ public final int getRowValueIndex(TableRowElement row) { return row.getSectionRowIndex() + getView().getVisibleRange().getStart(); }
/** * Returns the tr element underlying to the row * * @return */ TableRowElement getTr();
public void onRowOver(TableRowElement row);