Source Code Cross Referenced for XPageList.java in  » XML-UI » XUI » net » xoetrope » builder » editor » 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 » XML UI » XUI » net.xoetrope.builder.editor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.xoetrope.builder.editor;
002:
003:        import java.awt.BorderLayout;
004:        import java.util.Enumeration;
005:        import java.util.Hashtable;
006:        import java.util.Vector;
007:
008:        import java.awt.Dimension;
009:        import javax.swing.DefaultListModel;
010:        import javax.swing.JList;
011:        import javax.swing.JPanel;
012:        import javax.swing.event.ListSelectionEvent;
013:        import javax.swing.event.ListSelectionListener;
014:
015:        import net.xoetrope.builder.editor.events.ProjectListener;
016:        import net.xoetrope.builder.editor.events.XPageListListener;
017:        import java.awt.Font;
018:        import javax.swing.JScrollPane;
019:        import javax.swing.border.EmptyBorder;
020:
021:        /**
022:         * <p>An editor for the XUI project</p>
023:         * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
024:         * $Revision: 1.12 $
025:         */
026:        public class XPageList extends JPanel implements  ListSelectionListener,
027:                ProjectListener {
028:            private JList list;
029:            private XPageListListener pageListListener;
030:            private XEditorProject currentProject;
031:            private XPageResource selectedPage;
032:
033:            /**
034:             * Create a new list of pages.
035:             */
036:            public XPageList() {
037:                setLayout(new BorderLayout());
038:
039:                list = new JList();
040:                list
041:                        .setSelectionMode(list.getSelectionModel().SINGLE_SELECTION);
042:                list.addListSelectionListener(this );
043:                list.setFont(XuiDefaults.defaultFont);
044:
045:                JScrollPane sp = new JScrollPane(list);
046:                sp.setBorder(new EmptyBorder(0, 0, 0, 0));
047:                add(sp, BorderLayout.CENTER);
048:            }
049:
050:            /**
051:             * Remove all of the screens and re-populate from the current project.
052:             */
053:            public void projectUpdated() {
054:                list.removeAll();
055:                Hashtable table = currentProject.getPageResources();
056:                Vector v = new Vector(table.size());
057:                Enumeration e = table.keys();
058:
059:                DefaultListModel mdl = new DefaultListModel();
060:                while (e.hasMoreElements()) {
061:                    mdl.addElement(e.nextElement());
062:                }
063:                list.setModel(mdl);
064:                list.updateUI();
065:
066:                if (table.size() > 0) {
067:                    if (selectedPage != null) {
068:                        list.setSelectedValue(selectedPage, true);
069:                        if (pageListListener != null)
070:                            pageListListener.loadPage(selectedPage.getName(),
071:                                    null, 0, 0);
072:                    } else {
073:                        selectedPage = currentProject.getPageResource(list
074:                                .getModel().getElementAt(0).toString());
075:                        list.setSelectedValue(selectedPage, true);
076:                        if (pageListListener != null)
077:                            pageListListener.loadPage(selectedPage.getName(),
078:                                    null, 0, 0);
079:                    }
080:                }
081:            }
082:
083:            /**
084:             * Get the preferred size of this component
085:             * @return the minimum size
086:             */
087:            public Dimension getPreferredSize() {
088:                return new Dimension(230, 100);
089:            }
090:
091:            /**
092:             * If the projectListener is not null call the loadScreen function, passing
093:             * the selected screen.
094:             * @param e
095:             */
096:            public void valueChanged(ListSelectionEvent e) {
097:                if (!e.getValueIsAdjusting()) {
098:                    if (pageListListener != null) {
099:                        if (list.getSelectedValue() != null)
100:                            pageListListener.loadPage(list.getSelectedValue()
101:                                    .toString(), null, 0, 0);
102:                    }
103:                }
104:            }
105:
106:            /**
107:             * Set the ProjectListener
108:             * @param p the new ProjectListener
109:             */
110:            public void addPageListListener(XPageListListener p) {
111:                pageListListener = p;
112:            }
113:
114:            /**
115:             * Get the selected screen name from the XList
116:             * @return the name of the selected screen
117:             */
118:            public String getSelectedPage() {
119:                return (String) list.getSelectedValue();
120:            }
121:
122:            /**
123:             * Select a page
124:             * @param pageName the page to select
125:             */
126:            public void setSelectedPage(XPageResource page) {
127:                selectedPage = page;
128:                list.setSelectedValue(page, true);
129:            }
130:
131:            /**
132:             * The project has been loaded
133:             * @param project the new project reference
134:             */
135:            public void projectLoaded(XEditorProject project) {
136:                currentProject = project;
137:                projectUpdated();
138:            }
139:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.