1 package net.sf.flock.webapp;
2
3 import java.util.Collection;
4
5 import net.sf.flock.FlockResourceException;
6 import net.sf.flock.tree.ITreeNode;
7 import net.sf.flock.tree.PathTreeUtil;
8 import net.sf.tapestry.ApplicationRuntimeException;
9 import net.sf.tapestry.IExternalPage;
10 import net.sf.tapestry.IRequestCycle;
11 import net.sf.tapestry.RequestCycleException;
12 import net.sf.tapestry.html.BasePage;
13
14 public class HomePage extends BasePage implements IExternalPage {
15
16 private String selectedPath="";
17
18 private ITreeNode currentNode;
19
20 public String getSelectedPath() {
21 return selectedPath;
22 }
23
24 public void setSelectedPath(String selectedPath) {
25 this.selectedPath = selectedPath;
26 this.fireObservedChange("selectedPath", selectedPath);
27 }
28
29 public void detach() {
30 this.selectedPath="";
31 this.currentNode = null;
32 super.detach();
33 }
34
35 public ITreeNode getHierarchy() {
36 try {
37 Collection infos = FlockContext.getSubscriptionManager().getSubscriptionInfos();
38 return PathTreeUtil.getHierarchy( infos.iterator() );
39 } catch (FlockResourceException e) {
40 throw new ApplicationRuntimeException(e);
41 }
42
43 }
44
45 /***
46 * @see net.sf.tapestry.IExternalPage#activateExternalPage(Object[], IRequestCycle)
47 */
48 public void activateExternalPage(Object[] parameters, IRequestCycle cycle) throws RequestCycleException {
49 this.setSelectedPath( (String)parameters[0] );
50 }
51
52 public ITreeNode getCurrentNode() {
53 return currentNode;
54 }
55
56 public void setCurrentNode(ITreeNode currentNode) {
57 this.currentNode = currentNode;
58 }
59
60 }
This page was automatically generated by Maven