Source Code Cross Referenced for SchemaEdit.java in  » Portal » Open-Portal » applications » 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 » Portal » Open Portal » applications 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
003:         *  NETSCAPE COMMUNICATIONS CORPORATION
004:         *
005:         *  Copyright (c) 1996 Netscape Communications Corporation.
006:         *  All Rights Reserved.
007:         *  Use of this Source Code is subject to the terms of the applicable
008:         *  license agreement from Netscape Communications Corporation.
009:         */
010:
011:        package applications;
012:
013:        import components.SchemaTreeWindow;
014:        import graphical.DragListView;
015:        import graphical.WindowTiler;
016:        import soif.CSID;
017:        import util.ReportError;
018:
019:        import netscape.application.Alert;
020:        import netscape.application.Application;
021:        import netscape.application.Bitmap;
022:        import netscape.application.ExternalWindow;
023:        import netscape.application.ListItem;
024:        import netscape.application.Menu;
025:        import netscape.application.MenuItem;
026:        import netscape.application.MenuView;
027:        import netscape.application.Size;
028:        import netscape.application.Target;
029:        import netscape.application.View;
030:        import netscape.application.Window;
031:        import netscape.application.WindowOwner;
032:
033:        public class SchemaEdit extends Application implements  Target,
034:                WindowOwner {
035:            private WindowTiler windowTiler;
036:
037:            private SchemaTreeWindow schemaTreeWindow;
038:            private String testSchema;
039:            private ExternalWindow externalWindow;
040:            public boolean changed;
041:
042:            private boolean standAlone = false;
043:
044:            public void init() {
045:                super .init();
046:
047:                Header.showVersion(Messages.TITLE_SCHEMAEDIT, true, true);
048:
049:                boolean valid = true;
050:
051:                changed = false;
052:
053:                externalWindow = new ExternalWindow();
054:                setMainRootView(externalWindow.rootView());
055:                mainRootView().setColor(graphical.Header.DESKTOPCOLOR);
056:                externalWindow.setTitle(Messages.TITLE_SCHEMAEDIT);
057:                externalWindow.setOwner(this ); // To intercept close
058:
059:                // Create window tiler
060:                windowTiler = new WindowTiler();
061:
062:                String CGILocation = Header.parameterMacro(this , "CGILocation");
063:                String CGITarget = Header.parameterMacro(this , "CGITarget");
064:                String CGISchemaRead = Header.parameterMacro(this ,
065:                        "CGISchemaRead");
066:                String CGISchemaWrite = Header.parameterMacro(this ,
067:                        "CGISchemaWrite");
068:                String CGISchemaWriteReindex = Header.parameterMacro(this ,
069:                        "CGISchemaWriteReindex");
070:
071:                CSID csid = Header.parameterCSIDMacro(this );
072:
073:                if ((CGILocation == null) || (CGITarget == null)
074:                        || (CGISchemaRead == null) || (CGISchemaWrite == null)
075:                        || (CGISchemaWriteReindex == null)
076:                        || (csid.isValid() == false)) {
077:                    valid = false;
078:                }
079:
080:                testSchema = (standAlone) ? "testSchema"
081:                        : parameterNamed("testSchema");
082:                if (testSchema != null) {
083:                    valid = true;
084:                }
085:
086:                if (valid) {
087:                    Menu menu = new Menu();
088:                    MenuItem fileMenuItem = menu
089:                            .addItemWithSubmenu(Messages.MENU_FILE);
090:                    fileMenuItem.submenu().addItem(Messages.CMD_SAVE,
091:                            components.Messages.SCUT_SAVE, Messages.CMD_SAVE,
092:                            this );
093:                    fileMenuItem.submenu().addItem(Messages.CMD_CLOSE,
094:                            components.Messages.SCUT_CLOSE, Messages.CMD_CLOSE,
095:                            this );
096:                    MenuView menuView = new MenuView(menu);
097:                    menuView.sizeToMinSize();
098:                    externalWindow.setMenuView(menuView);
099:
100:                    if (testSchema == null) {
101:                        schemaTreeWindow = new SchemaTreeWindow(0, 0,
102:                                graphical.Header.IWINDWIDTH,
103:                                graphical.Header.IWINDHEIGHT, CGILocation,
104:                                CGITarget, CGISchemaRead, CGISchemaWrite, csid,
105:                                true, false, true);
106:                    } else {
107:                        ReportError.reportError(ReportError.WARNING,
108:                                ReportError.ADMIN, "SchemaEdit", "init",
109:                                Messages.USETESTSCHEMA);
110:
111:                        schemaTreeWindow = new SchemaTreeWindow(0, 0,
112:                                graphical.Header.IWINDWIDTH,
113:                                graphical.Header.IWINDHEIGHT, Instrument
114:                                        .testSchema(), true, false, true);
115:                    }
116:                    if (CGISchemaWriteReindex != null) {
117:                        schemaTreeWindow.schemaTreeView
118:                                .setWriteReindex(CGISchemaWriteReindex);
119:                    }
120:
121:                    schemaTreeWindow.schemaTreeView.notifyOfChange = this ;
122:                    schemaTreeWindow.moveTo(graphical.Header.WINDOWHGAP,
123:                            externalWindow.menuView().height()
124:                                    + graphical.Header.WINDOWVGAP);
125:                    schemaTreeWindow.setCloseable(false);
126:                    schemaTreeWindow.setMinimize(new Bitmap(
127:                            components.Header.minCompass,
128:                            components.Header.minCompassSize.width,
129:                            components.Header.minCompassSize.height),
130:                            components.Messages.LBL_SCHEMA, externalWindow,
131:                            windowTiler);
132:
133:                    Header.EWSizer(externalWindow, schemaTreeWindow);
134:
135:                    windowTiler.addWindow(schemaTreeWindow); // Tile window (set position)
136:                    schemaTreeWindow.setCloseable(true);
137:                    schemaTreeWindow.setCloseCommand(Messages.CMD_CLOSE);
138:                    schemaTreeWindow.setCloseTarget(this );
139:                    schemaTreeWindow.show();
140:                    externalWindow.show();
141:                }
142:
143:                Header.showVersion(Messages.TITLE_SCHEMAEDIT, false, true);
144:            }
145:
146:            public void performCommand(String command, Object arg) {
147:                if (Messages.CMD_SAVE.equals(command)) {
148:                    if (!schemaTreeWindow.schemaTreeView.valid()) {
149:                        return;
150:                    }
151:
152:                    String status = null;
153:
154:                    schemaTreeWindow.schemaTreeView.completeEditing();
155:                    schemaTreeWindow.schemaTreeView.getDetail();
156:                    externalWindow.rootView().setOverrideCursor(
157:                            View.WAIT_CURSOR);
158:                    if (testSchema == null) {
159:                        status = schemaTreeWindow.schemaTreeView.writeSchema();
160:                    } else {
161:                        System.out
162:                                .println(schemaTreeWindow.schemaTreeView.schema
163:                                        .toSOIF());
164:                        status = "";
165:                    }
166:                    externalWindow.rootView().removeOverrideCursor();
167:                    changed = false; // SGP: not always correct,
168:                    // because some of the save choices get made in
169:                    // schemaTreeView.  ought to tighten up the save
170:                    // in general, it's spread across two classes.
171:                    if (status != null) {
172:                        if (!status.equals("NODIALOG")) {
173:                            Alert.runAlertExternally(Alert.notificationImage(),
174:                                    Messages.SAVED_SCHEMA,
175:                                    Messages.SERVER_RESTART, Messages.CMD_OK,
176:                                    null, null);
177:                            graphical.Header.showStatus(Messages.SAVED);
178:                        }
179:                    }
180:                } else if (Messages.CMD_CLOSE.equals(command)) {
181:                    if (changed) {
182:                        int answer = Alert.runAlertExternally(Alert
183:                                .notificationImage(), Messages.CHANGED_DATA,
184:                                "", components.Messages.CMD_SAVE,
185:                                components.Messages.CMD_DISCARD,
186:                                components.Messages.CMD_CANCEL);
187:
188:                        if (answer == components.Header.SAVE_CANCEL) { // Cancel close?
189:                            return;
190:                        }
191:
192:                        if (answer == components.Header.SAVE_SAVE) { // Save
193:                            performCommand(Messages.CMD_SAVE, null);
194:                        }
195:
196:                        externalWindow.dispose();
197:                    } else {
198:                        externalWindow.dispose();
199:                    }
200:                } else if (graphical.Messages.MSG_CHANGED_DATA.equals(command)) {
201:                    changed = true;
202:                }
203:            }
204:
205:            public static void main(String args[]) {
206:                SchemaEdit app;
207:                app = new SchemaEdit();
208:                app.standAlone = true;
209:                app.run();
210:                System.exit(0);
211:            }
212:
213:            /**
214:             * WindowOwner interface. Used to intercept close on application window
215:             * and check for unsaved changes.
216:             */
217:
218:            public void windowDidHide(Window window) {
219:                /*
220:                 * Removed this, it causes a crash if the applet is closed and
221:                 * then the user clicks on the disable button in the admin window
222:
223:                stopRunning();
224:
225:                 */
226:            }
227:
228:            public boolean windowWillHide(Window window) {
229:                if (changed) {
230:                    int answer = Alert.runAlertExternally(Alert
231:                            .notificationImage(), Messages.CHANGED_DATA, "",
232:                            components.Messages.CMD_SAVE,
233:                            components.Messages.CMD_DISCARD,
234:                            components.Messages.CMD_CANCEL);
235:
236:                    if (answer == components.Header.SAVE_CANCEL) { // Cancel close?
237:                        return false;
238:                    }
239:
240:                    if (answer == components.Header.SAVE_SAVE) { // Save
241:                        performCommand(Messages.CMD_SAVE, null);
242:                    }
243:                }
244:
245:                return true;
246:            }
247:
248:            public void windowDidBecomeMain(Window window) {
249:            }
250:
251:            public void windowDidResignMain(Window window) {
252:            }
253:
254:            public void windowDidShow(Window window) {
255:            }
256:
257:            public boolean windowWillShow(Window window) {
258:                return true;
259:            }
260:
261:            public void windowWillSizeBy(Window window, Size size) {
262:            }
263:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.