Source Code Cross Referenced for DocumentNavigation.java in  » Content-Management-System » contineo » org » contineo » web » document » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » contineo » org.contineo.web.document 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.contineo.web.document;
002:
003:        import com.icesoft.faces.component.tree.IceUserObject;
004:        import com.icesoft.faces.component.tree.Tree;
005:
006:        import org.apache.commons.logging.Log;
007:        import org.apache.commons.logging.LogFactory;
008:
009:        import org.contineo.core.searchengine.comparision.SearchResult;
010:        import org.contineo.core.searchengine.search.Result;
011:        import org.contineo.core.security.Menu;
012:        import org.contineo.core.security.dao.MenuDAO;
013:
014:        import org.contineo.util.Context;
015:
016:        import org.contineo.web.i18n.Messages;
017:        import org.contineo.web.navigation.NavigationBean;
018:        import org.contineo.web.navigation.PageContentBean;
019:
020:        import java.util.Map;
021:
022:        import javax.faces.application.Application;
023:        import javax.faces.context.FacesContext;
024:        import javax.faces.event.ActionEvent;
025:
026:        import javax.swing.tree.DefaultMutableTreeNode;
027:        import javax.swing.tree.DefaultTreeModel;
028:
029:        /**
030:         * <p>
031:         * The TreeNavigation class is the backing bean for the documents navigation
032:         * tree on the left hand side of the application. Each node in the tree is made
033:         * up of a PageContent which is responsible for the navigation action when a
034:         * tree node is selected.
035:         * </p>
036:         * <p>
037:         * When the Tree component binding takes place the tree nodes are initialised
038:         * and the tree is built. Any addition to the tree navigation must be made to
039:         * this class.
040:         * </p>
041:         * <p>
042:         * This bean also controls which panel is shown on the right side of the
043:         * documents view
044:         * </p>
045:         *
046:         * @author Marco Meschieri
047:         * @version $Id: DocumentNavigation.java,v 1.14 2006/08/29 16:33:46 marco Exp $
048:         * @since 3.0
049:         */
050:        public class DocumentNavigation extends NavigationBean {
051:            protected static Log log = LogFactory
052:                    .getLog(DocumentNavigation.class);
053:
054:            // binding to component
055:            private Tree treeComponent;
056:
057:            // bound to components value attribute
058:            private DirectoryTreeModel model;
059:
060:            /**
061:             * Default constructor of the tree. The root node of the tree is created at
062:             * this point.
063:             */
064:            public DocumentNavigation() {
065:                model = new DirectoryTreeModel();
066:            }
067:
068:            /**
069:             * Gets the default tree model. This model is needed for the value attribute
070:             * of the tree component.
071:             *
072:             * @return default tree model used by the navigation tree
073:             */
074:            public DefaultTreeModel getModel() {
075:                return model;
076:            }
077:
078:            /**
079:             * Gets the tree component binding.
080:             *
081:             * @return tree component binding
082:             */
083:            public Tree getTreeComponent() {
084:                return treeComponent;
085:            }
086:
087:            /**
088:             * Sets the tree component binding.
089:             *
090:             * @param treeComponent tree component to bind to
091:             */
092:            public void setTreeComponent(Tree treeComponent) {
093:                this .treeComponent = treeComponent;
094:            }
095:
096:            public Directory getSelectedDir() {
097:                return model.getSelectedDir();
098:            }
099:
100:            public void refresh() {
101:                selectDirectory(getSelectedDir());
102:                model.reload(model.getSelectedNode());
103:            }
104:
105:            /**
106:             * Changes the currently selected directory and updates the documents list.
107:             *
108:             * @param directoryId
109:             */
110:            public void selectDirectory(Directory directory) {
111:                model.selectDirectory(directory);
112:                model.reload(model.getSelectedNode());
113:
114:                // Notify the records manager
115:                Application application = FacesContext.getCurrentInstance()
116:                        .getApplication();
117:                DocumentsRecordsManager recordsManager = ((DocumentsRecordsManager) application
118:                        .createValueBinding("#{documentsRecordsManager}")
119:                        .getValue(FacesContext.getCurrentInstance()));
120:                recordsManager.selectDirectory(directory.getMenu().getMenuId());
121:                setSelectedPanel(new PageContentBean("documents"));
122:            }
123:
124:            /**
125:             * Opens the directory containing the selected search entry
126:             */
127:            public String openInFolder() {
128:                model.reloadAll();
129:
130:                Map map = FacesContext.getCurrentInstance()
131:                        .getExternalContext().getRequestMap();
132:
133:                Object entry = (Object) map.get("entry");
134:
135:                int menuId = Menu.MENUID_DOCUMENTS;
136:
137:                if (entry instanceof  Result) {
138:                    menuId = ((Result) entry).getMenuId();
139:                } else if (entry instanceof  SearchResult) {
140:                    menuId = ((SearchResult) entry).getMenuId();
141:                } else if (entry instanceof  DocumentRecord) {
142:                    menuId = ((DocumentRecord) entry).getMenuId();
143:                }
144:
145:                // Get the parent directory
146:                MenuDAO menuDao = (MenuDAO) Context.getInstance().getBean(
147:                        MenuDAO.class);
148:                Menu menu = menuDao.findByPrimaryKey(menuId);
149:                Directory dir = model.getDirectory(menu.getMenuParent());
150:                selectDirectory(dir);
151:                setSelectedPanel(new PageContentBean("documents"));
152:
153:                // Show the documents browsing panel
154:                Application application = FacesContext.getCurrentInstance()
155:                        .getApplication();
156:                NavigationBean navigation = ((NavigationBean) application
157:                        .createValueBinding("#{navigation}").getValue(
158:                                FacesContext.getCurrentInstance()));
159:                Menu docMenu = menuDao.findByPrimaryKey(Menu.MENUID_DOCUMENTS);
160:                PageContentBean panel = new PageContentBean("m-"
161:                        + docMenu.getMenuId(), "document/browse");
162:                panel.setContentTitle(Messages
163:                        .getMessage(docMenu.getMenuText()));
164:                navigation.setSelectedPanel(panel);
165:
166:                return null;
167:            }
168:
169:            /**
170:             * Retrieves the directory with the specified identifier
171:             *
172:             * @param direcoryId The directory identifier
173:             * @return The found directory, null if not found
174:             */
175:            public Directory getDirectory(int direcoryId) {
176:                return model.getDirectory(direcoryId);
177:            }
178:
179:            public String delete() {
180:                model.deleteDirectory(model.getSelectedDir());
181:
182:                // Notify the records manager
183:                Application application = FacesContext.getCurrentInstance()
184:                        .getApplication();
185:                DocumentsRecordsManager recordsManager = ((DocumentsRecordsManager) application
186:                        .createValueBinding("#{documentsRecordsManager}")
187:                        .getValue(FacesContext.getCurrentInstance()));
188:                recordsManager.selectDirectory(model.getSelectedDir()
189:                        .getMenuId());
190:                setSelectedPanel(new PageContentBean("documents"));
191:
192:                return null;
193:            }
194:
195:            public String edit() {
196:                setSelectedPanel(new PageContentBean("updateDir"));
197:
198:                Application application = FacesContext.getCurrentInstance()
199:                        .getApplication();
200:                DirectoryEditForm form = ((DirectoryEditForm) application
201:                        .createValueBinding("#{directoryForm}").getValue(
202:                                FacesContext.getCurrentInstance()));
203:                form.setDirectory(model.getSelectedDir());
204:
205:                return null;
206:            }
207:
208:            public String rights() {
209:                setSelectedPanel(new PageContentBean("rights"));
210:
211:                Application application = FacesContext.getCurrentInstance()
212:                        .getApplication();
213:                RightsRecordsManager form = (RightsRecordsManager) application
214:                        .createValueBinding("#{rightsRecordsManager}")
215:                        .getValue(FacesContext.getCurrentInstance());
216:                form.selectDirectory(model.getSelectedDir());
217:
218:                return null;
219:            }
220:
221:            public String newDirectory() {
222:                setSelectedPanel(new PageContentBean("newDir"));
223:
224:                return null;
225:            }
226:
227:            public void addNewDir(Menu dir, Directory parent) {
228:                model.addNewDir(dir, parent);
229:            }
230:
231:            public void nodeClicked(ActionEvent event) {
232:                Tree tree = (Tree) event.getSource();
233:                DefaultMutableTreeNode node = tree.getNavigatedNode();
234:                IceUserObject userObject = (IceUserObject) node.getUserObject();
235:
236:                if (userObject.isExpanded()) {
237:                    model.reload(node);
238:                }
239:            }
240:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.