<DataType> void paint() { Canvas c = Canvas.get(); CellStamp<DataType> stamp; int y = 0; for (int i = 0; i < model.getRowCount(Section.SCROLLABLE); i++) { RowAddress address = viewport.createAddress(i, Section.SCROLLABLE); @SuppressWarnings("unchecked") DataType datum = (DataType) model.get(address); stamp = stampFactory.getStamp(address, datum); Axis.Span stampSpan = new Axis.Span(Axis.V, y, stamp.getSpan(Axis.V, datum)); if (viewport .getCellPainter() .isRowVisible(stampSpan, RowVisibilityType.ACKNOWLEDGE_PARTIAL)) { // WIP: BG such as highlight needs to paint outside this inset I just pushed c.pushBounds( ListModelPainter.CELL_TEXT_INSET, y, viewport.getBounds().width, stampSpan.span); stamp.paint(c, address, datum); c.popBounds(); } y += stampSpan.span; } }
// RevalidateWidthNotification to self <DataType> int getContentHeight() { int height = viewport.getCellPainter().staticContent.northSpan; for (int i = 0; i < model.getRowCount(Section.SCROLLABLE); i++) { RowAddress address = viewport.createAddress(i, Section.SCROLLABLE); @SuppressWarnings("unchecked") DataType datum = (DataType) model.get(address); CellStamp<DataType> stamp = stampFactory.getStamp(address, datum); height += stamp.getSpan(Axis.V, datum); } return height; }
@SuppressWarnings("unchecked") @Override public void compositionCompleted() { viewport = (CellViewportComposite<ListModelPainter>) CompositionRegistry.getComposite(CellViewportComposite.class); viewport.getComponent().installHandler(this); model = CompositionRegistry.getService(ListDataModel.class); stampFactory = CompositionRegistry.getService(CellStamp.Factory.class); }
private <DataType> int calculateRowTop(int row) { int position = 0; for (int i = 0; i < row; i++) { RowAddress address = viewport.createAddress(i, Section.SCROLLABLE); @SuppressWarnings("unchecked") DataType datum = (DataType) model.get(address); CellStamp<DataType> stamp = stampFactory.getStamp(address, datum); position += stamp.getSpan(Axis.V, datum); } return position; }
@Override public UserInterfaceActor getActor() { return viewport.getComponent().getActor(); }