01: package org.jasig.portal.channels.jsp.tree;
02:
03: /**
04: * Implementations of this class represent an object that knows how to acquire
05: * specific pieces of information needed to present a node in a hierarchical
06: * tree view.
07: *
08: * @author Mark Boyd
09: */
10: public interface ISurrogate {
11: /**
12: * Determines if the passed in Object is an instance of an object for which
13: * this class can act as a surrogate.
14: * @param o
15: * @return true if this class can act as a surrogate for the passed in object.
16: */
17: public boolean canResolve(Object o);
18:
19: /**
20: * Gets the unique id for the passed in object. This id will be used in as
21: * the value of query parameter, jsp_tree_item, in the event that this
22: * item supports any actions and the link for that action for thit item in
23: * the view was selected by a user. It also is the value passed to the label
24: * resolver to acquire the UI presentable label to represent the passed in
25: * object in the view.
26: *
27: * @param o
28: * @return the id for o.
29: */
30: public String getId(Object o);
31:
32: /**
33: * Returns information needed for rendering the UI representation of this
34: * node. Since label rendering is pluggable the object returned should be
35: * known and understood by the plugged-in rendering JSP.
36: * @param o
37: * @return the UI presentable label for o.
38: */
39: public Object getLabelData(Object o);
40:
41: /**
42: * Indicates if this object has aspects. Aspects act like children
43: * but do not include a line from them to the parent-to-child branch and
44: * can be exposed without expanding the parent to show the children. Unlike
45: * children, aspects can not have any contained nodes. They are only meant
46: * to portray some information of the parent node.
47: *
48: * @param o
49: * @return
50: */
51: public boolean hasAspects(Object o);
52:
53: /**
54: * Returns the aspects of the passed in object. This method is only called
55: * hasAspects() returns true. Aspects act like children but do not include a
56: * line from them to the parent-to-child branch and can be exposed without
57: * expanding the parent to show the children. Unlike children, aspects can
58: * not have any containing nodes. They are only meant to portray some
59: * information of the parent node.
60: *
61: * @param o
62: * @return
63: */
64: public Object[] getAspects(Object o);
65:
66: public boolean canContainChildren(Object o);
67:
68: public boolean hasChildren(Object o);
69:
70: public Object[] getChildren(Object o);
71: }
|