01: package org.contineo.web.document;
02:
03: import org.apache.commons.logging.Log;
04: import org.apache.commons.logging.LogFactory;
05:
06: import org.contineo.core.security.Menu;
07:
08: import org.contineo.web.navigation.PageContentBean;
09:
10: import javax.faces.application.Application;
11: import javax.faces.context.FacesContext;
12: import javax.faces.event.ActionEvent;
13:
14: /**
15: * Instances of this bean represents document directories to be displayed in the
16: * navigation tree
17: *
18: * @author Marco Meschieri
19: * @version $Id: Directory.java,v 1.5 2006/08/27 10:25:36 marco Exp $
20: * @since 3.0
21: */
22: public class Directory extends PageContentBean {
23: protected static Log log = LogFactory.getLog(Directory.class);
24: private boolean selected = false;
25: private int count = 0;
26:
27: //True if all childs were loaded from db
28: private boolean loaded = false;
29:
30: public Directory(Menu menu) {
31: super (menu);
32: }
33:
34: /**
35: * The number of contained documents
36: */
37: public int getCount() {
38: return count;
39: }
40:
41: public void setCount(int count) {
42: this .count = count;
43: }
44:
45: @Override
46: public void onSelect(ActionEvent event) {
47: // Documents record manager binding
48: Application application = FacesContext.getCurrentInstance()
49: .getApplication();
50: DocumentNavigation navigation = ((DocumentNavigation) application
51: .createValueBinding("#{documentNavigation}").getValue(
52: FacesContext.getCurrentInstance()));
53: navigation.selectDirectory(this );
54: }
55:
56: public boolean isSelected() {
57: return selected;
58: }
59:
60: public void setSelected(boolean selected) {
61: this .selected = selected;
62: }
63:
64: public boolean isLoaded() {
65: return loaded;
66: }
67:
68: public void setLoaded(boolean loaded) {
69: this.loaded = loaded;
70: }
71: }
|