01: /*
02: * This file is not part of the ItsNat framework.
03: *
04: * Original source code use and closed source derivatives are authorized
05: * to third parties with no restriction or fee.
06: * The original source code is owned by the author.
07: *
08: * This program is distributed AS IS in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11: *
12: * Author: Jose Maria Arranz Santamaria
13: * (C) Innowhere Software Services S.L., Spanish company, year 2007
14: */
15:
16: package org.itsnat.feashow.features.components.tables;
17:
18: import org.itsnat.comp.ItsNatTable;
19: import org.itsnat.comp.ItsNatTableCellRenderer;
20: import org.itsnat.feashow.features.components.shared.Circle;
21: import org.w3c.dom.Element;
22:
23: public class CircleTableCellRenderer implements ItsNatTableCellRenderer {
24: public CircleTableCellRenderer() {
25: }
26:
27: public void renderTableCell(ItsNatTable table, int row, int column,
28: Object value, boolean isSelected, boolean hasFocus,
29: Element cellElem, boolean isNew) {
30: Circle circle = (Circle) value;
31:
32: int radio = circle.getRadio();
33: int cx = column * radio + radio;
34: int cy = row * 2 * radio + radio;
35: cellElem.setAttribute("cx", Integer.toString(cx));
36: cellElem.setAttribute("cy", Integer.toString(cy));
37: cellElem.setAttribute("r", Integer.toString(radio));
38: }
39:
40: public void unrenderTableCell(ItsNatTable table, int row,
41: int column, Element cellContentElem) {
42: }
43: }
|