KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > prefuse > visual > VisualTable


1 package prefuse.visual;
2
3 import java.awt.BasicStroke JavaDoc;
4 import java.awt.Font JavaDoc;
5 import java.awt.geom.Rectangle2D JavaDoc;
6
7 import prefuse.Visualization;
8 import prefuse.data.CascadedTable;
9 import prefuse.data.Schema;
10 import prefuse.data.Table;
11 import prefuse.data.event.EventConstants;
12 import prefuse.data.expression.Predicate;
13 import prefuse.visual.tuple.TableVisualItem;
14
15 /**
16  * A visual abstraction of a Table data structure. Serves as a backing table
17  * for VisualItem tuples. VisualTable dervies from CascadedTable,
18  * so can inherit another table's values. Commonly, a VisualTable is used to
19  * take a raw data table and "strap" visual properties on top of it.
20  * VisualTables should not be created directly, they are created automatically
21  * by adding data to a Visualization, for example by using the
22  * {@link Visualization#addTable(String, Table)} method.
23  *
24  * @author <a HREF="http://jheer.org">jeffrey heer</a>
25  */

26 public class VisualTable extends CascadedTable implements VisualTupleSet {
27
28     private Visualization m_vis;
29     private String JavaDoc m_group;
30     
31     // ------------------------------------------------------------------------
32
// Constructors
33

34     /**
35      * Create a new VisualTable.
36      * @param parent the parent table whose values this table should inherit
37      * @param vis the Visualization associated with this table
38      * @param group the data group of this table
39      */

40     public VisualTable(Table parent, Visualization vis, String JavaDoc group) {
41         this(parent, vis, group, null, VisualItem.SCHEMA);
42     }
43
44     /**
45      * Create a new VisualTable.
46      * @param parent the parent table whose values this table should inherit
47      * @param vis the Visualization associated with this table
48      * @param group the data group of this table
49      * @param rowFilter a predicate determing which rows of the parent table
50      * should be inherited by this table and which should be filtered out
51      */

52     public VisualTable(Table parent, Visualization vis, String JavaDoc group,
53             Predicate rowFilter)
54     {
55         this(parent, vis, group, rowFilter, VisualItem.SCHEMA);
56     }
57
58     /**
59      * Create a new VisualTable.
60      * @param parent the parent table whose values this table should inherit
61      * @param vis the Visualization associated with this table
62      * @param group the data group of this table
63      * @param rowFilter a predicate determing which rows of the parent table
64      * should be inherited by this table and which should be filtered out
65      * @param schema the data schema to use for the table's local columns
66      */

67     public VisualTable(Table parent, Visualization vis, String JavaDoc group,
68             Predicate rowFilter, Schema schema)
69     {
70         super(parent, rowFilter, null, TableVisualItem.class);
71         init(vis, group, schema);
72     }
73
74     // -- non-cascaded visual table -------------------------------------------
75

76     /**
77      * Create a new VisualTable without a parent table.
78      * @param vis the Visualization associated with this table
79      * @param group the data group of this table
80      */

81     public VisualTable(Visualization vis, String JavaDoc group) {
82         super(TableVisualItem.class);
83         init(vis, group, VisualItem.SCHEMA);
84     }
85     
86     /**
87      * Create a new VisualTable without a parent table.
88      * @param vis the Visualization associated with this table
89      * @param group the data group of this table
90      * @param schema the data schema to use for the table's local columns
91      */

92     public VisualTable(Visualization vis, String JavaDoc group, Schema schema) {
93         super(TableVisualItem.class);
94         init(vis, group, schema);
95     }
96
97     /**
98      * Create a new VisualTable without a parent table.
99      * @param vis the Visualization associated with this table
100      * @param group the data group of this table
101      * @param schema the data schema to use for the table's local columns
102      * @param tupleType the type of Tuple instances to use
103      */

104     public VisualTable(Visualization vis, String JavaDoc group, Schema schema,
105             Class JavaDoc tupleType)
106     {
107         super(tupleType);
108         init(vis, group, schema);
109     }
110     
111     /**
112      * Initialize this VisualTable
113      * @param vis the Visualization associated with this table
114      * @param group the data group of this table
115      * @param schema the data schema to use for the table's local columns
116      */

117     protected void init(Visualization vis, String JavaDoc group, Schema schema) {
118         setVisualization(vis);
119         setGroup(group);
120         addColumns(schema);
121         if ( canGetBoolean(VisualItem.VISIBLE) )
122             index(VisualItem.VISIBLE);
123         if ( canGetBoolean(VisualItem.STARTVISIBLE) )
124             index(VisualItem.STARTVISIBLE);
125         if ( canGetBoolean(VisualItem.VALIDATED) )
126             index(VisualItem.VALIDATED);
127     }
128     
129     // ------------------------------------------------------------------------
130

131     /**
132      * Relay table events. Ensures that updated visual items are invalidated
133      * and that damage reports are issued for deleted items.
134      */

135     protected void fireTableEvent(int row0, int row1, int col, int type) {
136         // table attributes changed, so we invalidate the bounds
137
if ( type==EventConstants.UPDATE )
138         {
139             if ( col != VisualItem.IDX_VALIDATED ) {
140                 for ( int r=row0; r<=row1; ++r )
141                     setValidated(r,false);
142             } else {
143                 // change in validated status
144
for ( int r=row0; r<=row1; ++r ) {
145                     if ( !isValidated(r) ) {
146                         // retrieve the old bounds to report damage
147
m_vis.damageReport(getItem(r), getBounds(r));
148                     }
149                 }
150             }
151         }
152         else if ( type==EventConstants.DELETE && col==EventConstants.ALL_COLUMNS)
153         {
154             for ( int r=row0; r<=row1; ++r ) {
155                 if ( isVisible(r) && isValidated(r) ) {
156                     VisualItem item = (VisualItem)getTuple(r);
157                     m_vis.damageReport(item, getBounds(r));
158                 }
159             }
160         }
161         // now propagate the change event
162
super.fireTableEvent(row0, row1, col, type);
163     }
164     
165     // ------------------------------------------------------------------------
166
// VisualItemTable Methods
167

168     /**
169      * @see prefuse.visual.VisualTupleSet#getVisualization()
170      */

171     public Visualization getVisualization() {
172         return m_vis;
173     }
174     
175     /**
176      * Set the visualization associated with this VisualTable
177      * @param vis the visualization to set
178      */

179     public void setVisualization(Visualization vis) {
180         m_vis = vis;
181     }
182     
183     /**
184      * Get the visualization data group name for this table
185      * @return the data group name
186      */

187     public String JavaDoc getGroup() {
188         return m_group;
189     }
190     
191     /**
192      * Set the visualization data group name for this table
193      * @return the data group name to use
194      */

195     public void setGroup(String JavaDoc group) {
196         m_group = group;
197     }
198     
199     /**
200      * Get the VisualItem for the given table row.
201      * @param row a table row index
202      * @return the VisualItem for the given table row
203      */

204     public VisualItem getItem(int row) {
205         return (VisualItem)getTuple(row);
206     }
207     
208     /**
209      * Add a new row to the table and return the VisualItem for that row. Only
210      * allowed if there is no parent table, otherwise an exception will result.
211      * @return the VisualItem for the newly added table row.
212      */

213     public VisualItem addItem() {
214         return getItem(addRow());
215     }
216     
217     // ------------------------------------------------------------------------
218
// VisualItem Data Access
219

220     /**
221      * Indicates if the given row is currently validated. If not,
222      * validateBounds() must be run to update the bounds to a current value.
223      * @param row the table row
224      * @return true if validated, false otherwise
225      */

226     public boolean isValidated(int row) {
227         return getBoolean(row, VisualItem.VALIDATED);
228     }
229     
230     /**
231      * Set the given row's validated flag. This is for internal use by prefuse
232      * and, in general, should not be called by application code.
233      * @param row the table row to set
234      * @param value the value of the validated flag to set.
235      */

236     public void setValidated(int row, boolean value) {
237         setBoolean(row, VisualItem.VALIDATED, value);
238     }
239     
240     /**
241      * Indicates if the given row is currently set to be visible. Items with
242      * the visible flag set false will not be drawn by a display. Invisible
243      * items are also by necessity not interactive, regardless of the value of
244      * the interactive flag.
245      * @param row the table row
246      * @return true if visible, false if invisible
247      */

248     public boolean isVisible(int row) {
249         return getBoolean(row, VisualItem.VISIBLE);
250     }
251     
252     /**
253      * Set the given row's visibility.
254      * @param row the table row to set
255      * @param value true to make the item visible, false otherwise.
256      */

257     public void setVisible(int row, boolean value) {
258         setBoolean(row, VisualItem.VISIBLE, value);
259     }
260     
261     /**
262      * Indicates if the start visible flag is set to true. This is the
263      * visibility value consulted for the staring value of the visibility
264      * field at the beginning of an animated transition.
265      * @param row the table row
266      * @return true if this item starts out visible, false otherwise.
267      */

268     public boolean isStartVisible(int row) {
269         return getBoolean(row, VisualItem.STARTVISIBLE);
270     }
271     
272     /**
273      * Set the start visible flag.
274      * @param row the table row to set
275      * @param value true to set the start visible flag, false otherwise
276      */

277     public void setStartVisible(int row, boolean value) {
278         setBoolean(row, VisualItem.STARTVISIBLE, value);
279     }
280
281     /**
282      * Indictes if the end visible flag is set to true. This is the
283      * visibility value consulted for the ending value of the visibility
284      * field at the end of an animated transition.
285      * @param row the table row
286      * @return true if this items ends visible, false otherwise.
287      */

288     public boolean isEndVisible(int row) {
289         return getBoolean(row, VisualItem.ENDVISIBLE);
290     }
291     
292     /**
293      * Set the end visible flag.
294      * @param row the table row to set
295      * @param value true to set the end visible flag, false otherwise
296      */

297     public void setEndVisible(int row, boolean value) {
298         setBoolean(row, VisualItem.ENDVISIBLE, value);
299     }
300     
301     /**
302      * Indicates if this item is interactive, meaning it can potentially
303      * respond to mouse and keyboard input events.
304      * @param row the table row
305      * @return true if the item is interactive, false otherwise
306      */

307     public boolean isInteractive(int row) {
308         return getBoolean(row, VisualItem.INTERACTIVE);
309     }
310
311     /**
312      * Set the interactive status of the given row.
313      * @param row the table row to set
314      * @param value true for interactive, false for non-interactive
315      */

316     public void setInteractive(int row, boolean value) {
317         setBoolean(row, VisualItem.INTERACTIVE, value);
318     }
319     
320     /**
321      * Indicates the given row is expanded. Only used for items that are
322      * part of a graph structure.
323      * @param row the table row
324      * @return true if expanded, false otherwise
325      */

326     public boolean isExpanded(int row) {
327         return getBoolean(row, VisualItem.EXPANDED);
328     }
329
330     /**
331      * Set the expanded flag.
332      * @param row the table row to set
333      * @param value true to set as expanded, false as collapsed.
334      */

335     public void setExpanded(int row, boolean value) {
336         setBoolean(row, VisualItem.EXPANDED, value);
337     }
338     
339     /**
340      * Indicates if the given row is fixed, and so will not have its position
341      * changed by any layout or distortion actions.
342      * @param row the table row
343      * @return true if the item has a fixed position, false otherwise
344      */

345     public boolean isFixed(int row) {
346         return getBoolean(row, VisualItem.FIXED);
347     }
348
349     /**
350      * Sets if the given row is fixed in its position.
351      * @param row the table row to set
352      * @param value true to fix the item, false otherwise
353      */

354     public void setFixed(int row, boolean value) {
355         setBoolean(row, VisualItem.FIXED, value);
356     }
357     
358     /**
359      * Indicates if the given row is highlighted.
360      * @param row the table row
361      * @return true for highlighted, false for not highlighted
362      */

363     public boolean isHighlighted(int row) {
364         return getBoolean(row, VisualItem.HIGHLIGHT);
365     }
366     
367     /**
368      * Set the highlighted status of the given row. How higlighting values are
369      * interpreted by the system depends on the various processing actions
370      * set up for an application (e.g., how a
371      * {@link prefuse.action.assignment.ColorAction} might assign colors
372      * based on the flag).
373      * @param row the table row to set
374      * @param value true to highlight the item, false for no highlighting.
375      */

376     public void setHighlighted(int row, boolean value) {
377         setBoolean(row, VisualItem.HIGHLIGHT, value);
378     }
379
380     /**
381      * Indicates if the given row currently has the mouse pointer over it.
382      * @param row the table row
383      * @return true if the mouse pointer is over this item, false otherwise
384      */

385     public boolean isHover(int row) {
386         return getBoolean(row, VisualItem.HOVER);
387     }
388     
389     /**
390      * Set the hover flag. This is set automatically by the prefuse framework,
391      * so should not need to be set explicitly by application code.
392      * @param row the table row to set
393      * @param value true to set the hover flag, false otherwise
394      */

395     public void setHover(int row, boolean value) {
396         setBoolean(row, VisualItem.HOVER, value);
397     }
398     
399     // ------------------------------------------------------------------------
400

401     /**
402      * Get the current x-coordinate of the given row.
403      * @param row the table row
404      * @return the current x-coordinate
405      */

406     public double getX(int row) {
407         return getDouble(row, VisualItem.X);
408     }
409     
410     /**
411      * Set the current x-coordinate of the given row.
412      * @param row the table row to set
413      * @param x the new current x-coordinate
414      */

415     public void setX(int row, double x) {
416         setDouble(row, VisualItem.X, x);
417     }
418     
419     /**
420      * Get the current y-coordinate of the given row.
421      * @param row the table row
422      * @return the current y-coordinate
423      */

424     public double getY(int row) {
425         return getDouble(row, VisualItem.Y);
426     }
427     
428     /**
429      * Set the current y-coordinate of the given row.
430      * @param row the table row to set
431      * @param y the new current y-coordinate
432      */

433     public void setY(int row, double y) {
434         setDouble(row, VisualItem.Y, y);
435     }
436     
437     /**
438      * Get the starting x-coordinate of the given row.
439      * @param row the table row
440      * @return the starting x-coordinate
441      */

442     public double getStartX(int row) {
443         return getDouble(row, VisualItem.STARTX);
444     }
445     
446     /**
447      * Set the starting x-coordinate of the given row.
448      * @param row the table row to set
449      * @param x the new starting x-coordinate
450      */

451     public void setStartX(int row, double x) {
452         setDouble(row, VisualItem.STARTX, x);
453     }
454     
455     /**
456      * Get the starting y-coordinate of the given row.
457      * @param row the table row
458      * @return the starting y-coordinate
459      */

460     public double getStartY(int row) {
461         return getDouble(row, VisualItem.STARTY);
462     }
463     
464     /**
465      * Set the starting y-coordinate of the given row.
466      * @param row the table row to set
467      * @param y the new starting y-coordinate
468      */

469     public void setStartY(int row, double y) {
470         setDouble(row, VisualItem.STARTY, y);
471     }
472     
473     /**
474      * Get the ending x-coordinate of the given row.
475      * @param row the table row
476      * @return the ending x-coordinate
477      */

478     public double getEndX(int row) {
479         return getDouble(row, VisualItem.ENDX);
480     }
481     
482     /**
483      * Set the ending x-coordinate of the given row.
484      * @param row the table row to set
485      * @param x the new ending x-coordinate
486      */

487     public void setEndX(int row, double x) {
488         setDouble(row, VisualItem.ENDX, x);
489     }
490     
491     /**
492      * Get the ending y-coordinate of the given row.
493      * @param row the table row
494      * @return the ending y-coordinate
495      */

496     public double getEndY(int row) {
497         return getDouble(row, VisualItem.ENDY);
498     }
499
500     /**
501      * Set the ending y-coordinate of the given row.
502      * @param row the table row to set
503      * @param y the new ending y-coordinate
504      */

505     public void setEndY(int row, double y) {
506         setDouble(row, VisualItem.ENDY, y);
507     }
508     
509     /**
510      * Returns the bounds for the VisualItem at the given row index. The
511      * returned reference is for the actual bounds object used by the
512      * system -- do <b>NOT</b> directly edit the values in this returned
513      * object!! This will corrupt the state of the system.
514      *
515      * @param row the table row
516      * @return the bounding box for the item at the given row
517      */

518     public Rectangle2D JavaDoc getBounds(int row) {
519         return (Rectangle2D JavaDoc)get(row, VisualItem.BOUNDS);
520     }
521     
522     /**
523      * Set the bounding box for an item. This method is used by Renderer
524      * modules when the bounds are validated, or set by processing Actions
525      * used in conjunction with Renderers that do not perform bounds
526      * management.
527      * @param row the table row to set
528      * @param x the minimum x-coordinate
529      * @param y the minimum y-coorindate
530      * @param w the width of this item
531      * @param h the height of this item
532      * @see VisualItem#BOUNDS
533      */

534     public void setBounds(int row, double x, double y, double w, double h) {
535         getBounds(row).setRect(x, y, w, h);
536         fireTableEvent(row, row,
537                 getColumnNumber(VisualItem.BOUNDS), EventConstants.UPDATE);
538     }
539     
540     // ------------------------------------------------------------------------
541

542     /**
543      * Get the current stroke color of the row. The stroke color is used
544      * to draw lines and the outlines of shapes. Color values as represented as
545      * an integer containing the red, green, blue, and alpha (transparency)
546      * color channels. A color with a zero alpha component is fully
547      * transparent and will not be drawn.
548      * @param row the table row
549      * @return the current stroke color, represented as an integer
550      * @see prefuse.util.ColorLib
551      */

552     public int getStrokeColor(int row) {
553         return getInt(row, VisualItem.STROKECOLOR);
554     }
555     
556     /**
557      * Set the current stroke color of the row. The stroke color is used to
558      * draw lines and the outlines of shapes. Color values as represented as an
559      * integer containing the red, green, blue, and alpha (transparency)
560      * color channels. A color with a zero alpha component is fully
561      * transparent and will not be drawn.
562      * @param row the table row to set
563      * @param color the current stroke color, represented as an integer
564      * @see prefuse.util.ColorLib
565      */

566     public void setStrokeColor(int row, int color) {
567         setInt(row, VisualItem.STROKECOLOR, color);
568     }
569     
570     /**
571      * Get the starting stroke color of the row. The stroke color is used to
572      * draw lines and the outlines of shapes. Color values as represented as an
573      * integer containing the red, green, blue, and alpha (transparency)
574      * color channels. A color with a zero alpha component is fully
575      * transparent and will not be drawn.
576      * @param row the table row
577      * @return the starting stroke color, represented as an integer
578      * @see prefuse.util.ColorLib
579      */

580     public int getStartStrokeColor(int row) {
581         return getInt(row, VisualItem.STARTSTROKECOLOR);
582     }
583     
584     /**
585      * Set the starting stroke color of the row. The stroke color is used to
586      * draw lines and the outlines of shapes. Color values as represented as an
587      * integer containing the red, green, blue, and alpha (transparency)
588      * color channels. A color with a zero alpha component is fully
589      * transparent and will not be drawn.
590      * @param row the table row to set
591      * @param color the starting stroke color, represented as an integer
592      * @see prefuse.util.ColorLib
593      */

594     public void setStartStrokeColor(int row, int color) {
595         setInt(row, VisualItem.STARTSTROKECOLOR, color);
596     }
597     
598     /**
599      * Get the ending stroke color of the row. The stroke color is used to
600      * draw lines and the outlines of shapes. Color values as represented as an
601      * integer containing the red, green, blue, and alpha (transparency)
602      * color channels. A color with a zero alpha component is fully
603      * transparent and will not be drawn.
604      * @param row the table row
605      * @return the ending stroke color, represented as an integer
606      * @see prefuse.util.ColorLib
607      */

608     public int getEndStrokeColor(int row) {
609         return getInt(row, VisualItem.ENDSTROKECOLOR);
610     }
611     
612     /**
613      * Set the ending stroke color of the row. The stroke color is used to
614      * draw lines and the outlines of shapes. Color values as represented as an
615      * integer containing the red, green, blue, and alpha (transparency)
616      * color channels. A color with a zero alpha component is fully
617      * transparent and will not be drawn.
618      * @param row the table row to set
619      * @param color the ending stroke color, represented as an integer
620      * @see prefuse.util.ColorLib
621      */

622     public void setEndStrokeColor(int row, int color) {
623         setInt(row, VisualItem.ENDSTROKECOLOR, color);
624     }
625     
626     /**
627      * Get the current fill color of the row. The fill color is used to
628      * fill the interior of shapes. Color values as represented as an
629      * integer containing the red, green, blue, and alpha (transparency)
630      * color channels. A color with a zero alpha component is fully
631      * transparent and will not be drawn.
632      * @param row the table row
633      * @return the current fill color, represented as an integer
634      * @see prefuse.util.ColorLib
635      */

636     public int getFillColor(int row) {
637         return getInt(row, VisualItem.FILLCOLOR);
638     }
639     
640     /**
641      * Set the current fill color of the row. The stroke color is used to
642      * fill the interior of shapes. Color values as represented as an
643      * integer containing the red, green, blue, and alpha (transparency)
644      * color channels. A color with a zero alpha component is fully
645      * transparent and will not be drawn.
646      * @param row the table row to set
647      * @param color the current fill color, represented as an integer
648      * @see prefuse.util.ColorLib
649      */

650     public void setFillColor(int row, int color) {
651         setInt(row, VisualItem.FILLCOLOR, color);
652     }
653     
654     /**
655      * Get the starting fill color of the row. The fill color is used to
656      * fill the interior of shapes. Color values as represented as an
657      * integer containing the red, green, blue, and alpha (transparency)
658      * color channels. A color with zero alpha component is fully
659      * transparent and will not be drawn.
660      * @param row the table row
661      * @return the starting fill color, represented as an integer
662      * @see prefuse.util.ColorLib
663      */

664     public int getStartFillColor(int row) {
665         return getInt(row, VisualItem.STARTFILLCOLOR);
666     }
667     
668     /**
669      * Set the starting fill color of the row. The stroke color is used to
670      * fill the interior of shapes. Color values as represented as an
671      * integer containing the red, green, blue, and alpha (transparency)
672      * color channels. A color with a zero alpha component is fully
673      * transparent and will not be drawn.
674      * @param row the table row to set
675      * @param color the starting fill color, represented as an integer
676      * @see prefuse.util.ColorLib
677      */

678     public void setStartFillColor(int row, int color) {
679         setInt(row, VisualItem.STARTFILLCOLOR, color);
680     }
681     
682     /**
683      * Get the ending fill color of the row. The fill color is used to
684      * fill the interior of shapes. Color values as represented as an
685      * integer containing the red, green, blue, and alpha (transparency)
686      * color channels. A color with zero alpha component is fully
687      * transparent and will not be drawn.
688      * @param row the table row
689      * @return the ending fill color, represented as an integer
690      * @see prefuse.util.ColorLib
691      */

692     public int getEndFillColor(int row) {
693         return getInt(row, VisualItem.ENDFILLCOLOR);
694     }
695     
696     /**
697      * Set the ending fill color of the row. The stroke color is used to
698      * fill the interior of shapes. Color values as represented as an
699      * integer containing the red, green, blue, and alpha (transparency)
700      * color channels. A color with a zero alpha component is fully
701      * transparent and will not be drawn.
702      * @param row the table row to set
703      * @param color the ending fill color, represented as an integer
704      * @see prefuse.util.ColorLib
705      */

706     public void setEndFillColor(int row, int color) {
707         setInt(row, VisualItem.ENDFILLCOLOR, color);
708     }
709     
710     /**
711      * Get the current text color of the row. The text color is used to
712      * draw text strings for the item. Color values as represented as an
713      * integer containing the red, green, blue, and alpha (transparency)
714      * color channels. A color with zero alpha component is fully
715      * transparent and will not be drawn.
716      * @param row the table row
717      * @return the current text color, represented as an integer
718      * @see prefuse.util.ColorLib
719      */

720     public int getTextColor(int row) {
721         return getInt(row, VisualItem.TEXTCOLOR);
722     }
723     
724     /**
725      * Set the current text color of the row. The text color is used to
726      * draw text strings for the item. Color values as represented as an
727      * integer containing the red, green, blue, and alpha (transparency)
728      * color channels. A color with a zero alpha component is fully
729      * transparent and will not be drawn.
730      * @param row the table row to set
731      * @param color the current text color, represented as an integer
732      * @see prefuse.util.ColorLib
733      */

734     public void setTextColor(int row, int color) {
735         setInt(row, VisualItem.TEXTCOLOR, color);
736     }
737     
738     /**
739      * Get the starting text color of the row. The text color is used to
740      * draw text strings for the item. Color values as represented as an
741      * integer containing the red, green, blue, and alpha (transparency)
742      * color channels. A color with zero alpha component is fully
743      * transparent and will not be drawn.
744      * @param row the table row
745      * @return the starting text color, represented as an integer
746      * @see prefuse.util.ColorLib
747      */

748     public int getStartTextColor(int row) {
749         return getInt(row, VisualItem.STARTTEXTCOLOR);
750     }
751     
752     /**
753      * Set the starting text color of the row. The text color is used to
754      * draw text strings for the item. Color values as represented as an
755      * integer containing the red, green, blue, and alpha (transparency)
756      * color channels. A color with a zero alpha component is fully
757      * transparent and will not be drawn.
758      * @param row the table row to set
759      * @param color the starting text color, represented as an integer
760      * @see prefuse.util.ColorLib
761      */

762     public void setStartTextColor(int row, int color) {
763         setInt(row, VisualItem.STARTTEXTCOLOR, color);
764     }
765     
766     /**
767      * Get the ending text color of the row. The text color is used to
768      * draw text strings for the item. Color values as represented as an
769      * integer containing the red, green, blue, and alpha (transparency)
770      * color channels. A color with zero alpha component is fully
771      * transparent and will not be drawn.
772      * @param row the table row
773      * @return the ending text color, represented as an integer
774      * @see prefuse.util.ColorLib
775      */

776     public int getEndTextColor(int row) {
777         return getInt(row, VisualItem.ENDTEXTCOLOR);
778     }
779     
780     /**
781      * Set the ending text color of the row. The text color is used to
782      * draw text strings for the item. Color values as represented as an
783      * integer containing the red, green, blue, and alpha (transparency)
784      * color channels. A color with a zero alpha component is fully
785      * transparent and will not be drawn.
786      * @param row the table row to set
787      * @param color the ending text color, represented as an integer
788      * @see prefuse.util.ColorLib
789      */

790     public void setEndTextColor(int row, int color) {
791         setInt(row, VisualItem.ENDTEXTCOLOR, color);
792     }
793     
794     // ------------------------------------------------------------------------
795

796     /**
797      * Get the current size value of the row. Size values are typically used
798      * to scale an item, either in one-dimension (e.g., a bar chart length) or
799      * two-dimensions (e.g., using pixel area to encode a quantitative value).
800      * @param row the table row
801      * @return the current size value
802      */

803     public double getSize(int row) {
804         return getDouble(row, VisualItem.SIZE);
805     }
806     
807     /**
808      * Set the current size value of the row. Size values are typically used
809      * to scale an item, either in one-dimension (e.g., a bar chart length) or
810      * two-dimensions (e.g., using pixel area to encode a quantitative value).
811      * @param row the table row to set
812      * @param size the current size value
813      */

814     public void setSize(int row, double size) {
815         setDouble(row, VisualItem.SIZE, size);
816     }
817     
818     /**
819      * Get the starting size value of the row. Size values are typically used
820      * to scale an item, either in one-dimension (e.g., a bar chart length) or
821      * two-dimensions (e.g., using pixel area to encode a quantitative value).
822      * @param row the table row
823      * @return the starting size value
824      */

825     public double getStartSize(int row) {
826         return getDouble(row, VisualItem.STARTSIZE);
827     }
828     
829     /**
830      * Set the starting size value of the row. Size values are typically used
831      * to scale an item, either in one-dimension (e.g., a bar chart length) or
832      * two-dimensions (e.g., using pixel area to encode a quantitative value).
833      * @param row the table row to set
834      * @param size the starting size value
835      */

836     public void setStartSize(int row, double size) {
837         setDouble(row, VisualItem.STARTSIZE, size);
838     }
839     
840     /**
841      * Get the ending size value of the row. Size values are typically used
842      * to scale an item, either in one-dimension (e.g., a bar chart length) or
843      * two-dimensions (e.g., using pixel area to encode a quantitative value).
844      * @param row the table row
845      * @return the ending size value
846      */

847     public double getEndSize(int row) {
848         return getDouble(row, VisualItem.ENDSIZE);
849     }
850     
851     /**
852      * Set the ending size value of the row. Size values are typically used
853      * to scale an item, either in one-dimension (e.g., a bar chart length) or
854      * two-dimensions (e.g., using pixel area to encode a quantitative value).
855      * @param row the table row to set
856      * @param size the ending size value
857      */

858     public void setEndSize(int row, double size) {
859         setDouble(row, VisualItem.ENDSIZE, size);
860     }
861     
862     // ------------------------------------------------------------------------
863

864     /**
865      * Get the current shape value of the row. One of the SHAPE constants
866      * included in the {@link prefuse.Constants} class. This value only has an
867      * effect if a Renderer that supports different shapes is used
868      * (e.g., {@link prefuse.render.ShapeRenderer}.
869      * @param row the table row
870      * @return the current shape value
871      */

872     public int getShape(int row) {
873         return getInt(row, VisualItem.SHAPE);
874     }
875     
876     /**
877      * Set the current shape value of the row. One of the SHAPE constants
878      * included in the {@link prefuse.Constants} class. This value only has an
879      * effect if a Renderer that supports different shapes is used
880      * (e.g., {@link prefuse.render.ShapeRenderer}.
881      * @param row the table row to set
882      * @param shape the shape value to use
883      */

884     public void setShape(int row, int shape) {
885         setInt(row, VisualItem.SHAPE, shape);
886     }
887     
888     // ------------------------------------------------------------------------
889

890     /**
891      * Get the current stroke used to draw lines and shape outlines for the
892      * item at the given row.
893      * @return the stroke used to draw lines and shape outlines
894      */

895     public BasicStroke JavaDoc getStroke(int row) {
896         return (BasicStroke JavaDoc)get(row, VisualItem.STROKE);
897     }
898     
899     /**
900      * Set the current stroke used to draw lines and shape outlines.
901      * @param stroke the stroke to use to draw lines and shape outlines
902      */

903     public void setStroke(int row, BasicStroke JavaDoc stroke) {
904         set(row, VisualItem.STROKE, stroke);
905     }
906     
907     // ------------------------------------------------------------------------
908

909     /**
910      * Get the current font for the row. The font is used as the default
911      * typeface for drawing text for this item.
912      * @param row the table row
913      * @return the current font value
914      */

915     public Font JavaDoc getFont(int row) {
916         return (Font JavaDoc)get(row, VisualItem.FONT);
917     }
918     
919     /**
920      * Set the current font for the the row. The font is used as the default
921      * typeface for drawing text for this item.
922      * @param row the table row to set
923      * @param font the current font value
924      */

925     public void setFont(int row, Font JavaDoc font) {
926         set(row, VisualItem.FONT, font);
927     }
928     
929     /**
930      * Get the starting font for the row. The font is used as the default
931      * typeface for drawing text for this item.
932      * @param row the table row
933      * @return the starting font value
934      */

935     public Font JavaDoc getStartFont(int row) {
936         return (Font JavaDoc)get(row, VisualItem.STARTFONT);
937     }
938
939     /**
940      * Set the starting font for the row. The font is used as the default
941      * typeface for drawing text for this item.
942      * @param row the table row to set
943      * @param font the starting font value
944      */

945     public void setStartFont(int row, Font JavaDoc font) {
946         set(row, VisualItem.STARTFONT, font);
947     }
948     
949     /**
950      * Get the ending font for the row. The font is used as the default
951      * typeface for drawing text for this item.
952      * @param row the table row
953      * @return the ending font value
954      */

955     public Font JavaDoc getEndFont(int row) {
956         return (Font JavaDoc)get(row, VisualItem.ENDFONT);
957     }
958     
959     /**
960      * Set the ending font for the row. The font is used as the default
961      * typeface for drawing text for this item.
962      * @param row the table row to set
963      * @param font the ending font value
964      */

965     public void setEndFont(int row, Font JavaDoc font) {
966         set(row, VisualItem.ENDFONT, font);
967     }
968
969     // ------------------------------------------------------------------------
970

971     /**
972      * Get the degree-of-interest (DOI) value. The degree-of-interet is an
973      * optional value that can be used to sort items by importance, control
974      * item visibility, or influence particular visual encodings. A common
975      * example is to use the DOI to store the graph distance of a node from
976      * the nearest selected focus node.
977      * @param row the table row
978      * @return the DOI value of this item
979      */

980     public double getDOI(int row) {
981         return getDouble(row, VisualItem.DOI);
982     }
983     
984     /**
985      * Set the degree-of-interest (DOI) value. The degree-of-interet is an
986      * optional value that can be used to sort items by importance, control
987      * item visibility, or influence particular visual encodings. A common
988      * example is to use the DOI to store the graph distance of a node from
989      * the nearest selected focus node.
990      * @param row the table row to set
991      * @param doi the DOI value of this item
992      */

993     public void setDOI(int row, double doi) {
994         setDouble(row, VisualItem.DOI, doi);
995     }
996     
997 } // end of class VisualTable
998
Popular Tags