KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > table > DefaultCell


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.wcf.table;
14
15 /**
16  * default cells that are rendered by the DefaultCellRenderer.
17  */

18
19 public class DefaultCell implements Comparable JavaDoc {
20   private String JavaDoc URL;
21   private Object JavaDoc value;
22   private String JavaDoc target;
23   private String JavaDoc image;
24   private String JavaDoc onClick;
25
26   public DefaultCell(String JavaDoc URL, Object JavaDoc value) {
27     this.URL = URL;
28     this.value = value;
29     this.image = null;
30   }
31
32   /**
33    * creates a clickable
34    */

35   public DefaultCell(String JavaDoc URL, Object JavaDoc value, String JavaDoc imageUrl) {
36     this.URL = URL;
37     this.value = value;
38     this.image = imageUrl;
39   }
40
41   /** the HREF=".." attribute of the <a ...> element */
42   public String JavaDoc getURL() {
43     return URL;
44   }
45   /** the HREF=".." attribute of the <a ...> element */
46   public void setURL(String JavaDoc newURL) {
47     URL = newURL;
48   }
49   public void setValue(Object JavaDoc newValue) {
50     value = newValue;
51   }
52   public Object JavaDoc getValue() {
53     return value;
54   }
55   /** the target=".." attribute of the <a ...> element */
56   public void setTarget(String JavaDoc newTarget) {
57     target = newTarget;
58   }
59   /** the target=".." attribute of the <a ...> element */
60   public String JavaDoc getTarget() {
61     return target;
62   }
63   /** the onClick=".." attribute of the <a ...> element */
64   public void setOnClick(String JavaDoc newOnClick) {
65     onClick = newOnClick;
66   }
67   /** the onClick=".." attribute of the <a ...> element */
68   public String JavaDoc getOnClick() {
69     return onClick;
70   }
71   public int compareTo(Object JavaDoc o) {
72     DefaultCell x = (DefaultCell)o;
73     if (value != null)
74       return ((Comparable JavaDoc)value).compareTo(x.value);
75     if (image != null)
76       return image.compareTo(x.image);
77     return URL.compareTo(x.URL);
78   }
79   public void setImage(String JavaDoc newImage) {
80     image = newImage;
81   }
82   public String JavaDoc getImage() {
83     return image;
84   }
85 }
Popular Tags