2009/05/20 - Apache Shale has been retired.
For more information, please explore the Attic.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.shale.clay.config.beans;
22
23 import java.io.Serializable;
24
25 /***
26 * <p>This bean represents the composition of a complex component. The renderId
27 * uniquely sequences it within a top-level {@link ComponentBean}.</p>
28 */
29
30 public class ElementBean extends InnerComponentBean implements Comparable, Serializable {
31
32 /***
33 * <p>Unique id used by the Serializable interface.</p>
34 */
35 private static final long serialVersionUID = 3690760596346123828L;
36
37 /***
38 * <p>An integer id that is used to order a nested component within it's
39 * child collection. This id is also used a the "signature" when resolving
40 * inheritance.
41 * </p>
42 */
43 private int renderId = 0;
44
45 /***
46 * @return a named value list of the object's state
47 */
48 public String toString() {
49 StringBuffer buff = new StringBuffer();
50 buff.append("renderId=\"").append(renderId).append("\" ").append(super.toString());
51 return buff.toString();
52 }
53
54 /***
55 * <p>Returns an integer id that is used to order within the {@link ComponentBean} children
56 * set.</p>
57 *
58 * @return the render id
59 */
60 public int getRenderId() {
61 return renderId;
62 }
63
64 /***
65 * <p>Sets an integer id that is used to order within the {@link ComponentBean} children
66 * set.</p>
67 *
68 * @param i render id
69 */
70 public void setRenderId(int i) {
71 renderId = i;
72 }
73
74 /***
75 * <p>This is an override of the {@link ComponentBean} making the
76 * <code>renderId</code> the ordering identifier instead of the
77 * <code>jsfid</code>.</p>
78 *
79 * @param obj object to compare
80 * @return weight of the comparison
81 */
82 public int compareTo(Object obj) {
83 ElementBean item = (ElementBean) obj;
84 if (item.renderId < renderId) {
85 return 1;
86 } else if (item.renderId > renderId) {
87 return -1;
88 } else {
89 return 0;
90 }
91 }
92
93 }
94