Source Code Cross Referenced for ServerEditor.java in  » Web-Server » Jigsaw » org » w3c » jigadmin » editors » 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 » Web Server » Jigsaw » org.w3c.jigadmin.editors 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // ServerEditor.java
002:        // $Id: ServerEditor.java,v 1.15 2000/08/16 21:37:31 ylafon Exp $
003:        // (c) COPYRIGHT MIT and INRIA, 1998.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        package org.w3c.jigadmin.editors;
007:
008:        import java.awt.GridLayout;
009:        import java.awt.Font;
010:        import java.awt.Component;
011:        import java.awt.BorderLayout;
012:
013:        import javax.swing.JPanel;
014:        import javax.swing.JLabel;
015:        import javax.swing.BorderFactory;
016:        import javax.swing.JTabbedPane;
017:        import javax.swing.border.TitledBorder;
018:        import javax.swing.event.ChangeListener;
019:
020:        import java.util.Properties;
021:
022:        import org.w3c.jigadmin.RemoteResourceWrapper;
023:        import org.w3c.jigadmin.widgets.DnDTabbedPane;
024:        import org.w3c.jigadmin.events.ResourceActionSource;
025:        import org.w3c.jigadmin.events.ResourceActionListener;
026:
027:        import org.w3c.jigsaw.admin.RemoteResource;
028:        import org.w3c.jigsaw.admin.RemoteAccessException;
029:
030:        import org.w3c.tools.widgets.Utilities;
031:        import org.w3c.tools.sorter.Sorter;
032:
033:        /**
034:         * The server editor.
035:         * @version $Revision: 1.15 $
036:         * @author  Benoît Mahé (bmahe@w3.org)
037:         */
038:        public class ServerEditor extends JPanel implements 
039:                ServerEditorInterface {
040:
041:            private class Retryer extends Thread {
042:
043:                RemoteAccessException ex = null;
044:
045:                public void run() {
046:                    while (server.getServerBrowser().shouldRetry(ex)) {
047:                        try {
048:                            initializeServerHelpers();
049:                            break;
050:                        } catch (RemoteAccessException ex2) {
051:                            ex = ex2;
052:                        }
053:                    }
054:                    build();
055:                }
056:
057:                private Retryer(RemoteAccessException ex) {
058:                    this .ex = ex;
059:                }
060:            }
061:
062:            protected RemoteResourceWrapper server = null;
063:            protected String name = null;
064:            protected ServerHelperInterface shelpers[] = null;
065:
066:            /**
067:             * Reload the server configuration.
068:             * @param server the new server wrapper
069:             */
070:            public void setServer(RemoteResourceWrapper server) {
071:                this .server = server;
072:                try {
073:                    initializeServerHelpers();
074:                    build();
075:                } catch (RemoteAccessException ex) {
076:                    (new Retryer(ex)).start();
077:                }
078:            }
079:
080:            /**
081:             * Get the component.
082:             * @return a Component
083:             */
084:            public Component getComponent() {
085:                return this ;
086:            }
087:
088:            /**
089:             * initialize the server helpers.
090:             * @exception RemoteAccessException if a remote error occurs
091:             */
092:            protected void initializeServerHelpers()
093:                    throws RemoteAccessException {
094:                shelpers = null;
095:                //use ServerHelperFactory....
096:                RemoteResource rr = server.getResource();
097:                String names[] = rr.enumerateResourceIdentifiers();
098:                Sorter.sortStringArray(names, true);
099:                shelpers = new ServerHelperInterface[names.length];
100:                for (int i = 0; i < names.length; i++) {
101:                    RemoteResourceWrapper rrw = server
102:                            .getChildResource(names[i]);
103:                    shelpers[i] = ServerHelperFactory.getServerHelper(names[i],
104:                            rrw);
105:                }
106:
107:                for (int i = 0; i < shelpers.length; i++) {
108:                    if (shelpers[i] instanceof  ResourceActionSource) {
109:                        ResourceActionSource source = (ResourceActionSource) shelpers[i];
110:                        for (int j = 0; j < shelpers.length; j++) {
111:                            if (j != i) {
112:                                if (shelpers[j] instanceof  ResourceActionListener) {
113:                                    ResourceActionListener listener = (ResourceActionListener) shelpers[j];
114:                                    source.addResourceActionListener(listener);
115:                                }
116:                            }
117:                        }
118:                    }
119:                }
120:            }
121:
122:            /**
123:             * Build the interface.
124:             */
125:            protected void build() {
126:                removeAll();
127:                invalidate();
128:                setLayout(new BorderLayout());
129:                TitledBorder border = BorderFactory.createTitledBorder(name);
130:                border.setTitleFont(Utilities.reallyBigBoldFont);
131:                setBorder(border);
132:                //tabbedpane
133:                JTabbedPane tabbedPane = new DnDTabbedPane();
134:                if (shelpers == null)
135:                    return;
136:
137:                for (int i = 0; i < shelpers.length; i++) {
138:                    if (shelpers[i] instanceof  ChangeListener)
139:                        tabbedPane
140:                                .addChangeListener((ChangeListener) shelpers[i]);
141:
142:                    if (shelpers[i] instanceof  ControlServerHelper) {
143:                        //add it on top of the panel
144:                        add(shelpers[i].getComponent(), BorderLayout.NORTH);
145:                    } else {
146:                        String name = shelpers[i].getName().replace('_', ' ');
147:                        char chars[] = name.toCharArray();
148:                        chars[0] = Character.toUpperCase(chars[0]);
149:                        String helperName = new String(chars);
150:                        tabbedPane.addTab(helperName, null, shelpers[i]
151:                                .getComponent(), shelpers[i].getToolTip());
152:                    }
153:                }
154:                tabbedPane.setSelectedIndex(0);
155:                add(tabbedPane, BorderLayout.CENTER);
156:                validate();
157:            }
158:
159:            /**
160:             * Initialize this editor.
161:             * @param name the editor name
162:             * @param rrw the RemoteResourceWrapper wrapping the editor node.
163:             * @param p the editor properties
164:             */
165:            public void initialize(String name, RemoteResourceWrapper rrw,
166:                    Properties p) {
167:                this .server = rrw;
168:                this .name = name;
169:            }
170:
171:            public ServerEditor() {
172:                //for new Isntance
173:            }
174:
175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.