Source Code Cross Referenced for Classification.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.ClassificationView;
014:        import components.ClassificationWindow;
015:        import components.SchemaTreeView;
016:        import components.SchemaTreeWindow;
017:        import components.TaxonomyTreeView;
018:        import components.TaxonomyTreeWindow;
019:        import graphical.DragListView;
020:        import graphical.DragPolicy;
021:        import graphical.Minimize;
022:        import graphical.WindowTiler;
023:        import soif.CSID;
024:        import soif.Schema;
025:        import soif.SchemaGetter;
026:        import soif.Taxonomy;
027:        import soif.TaxonomyGetter;
028:        import util.ReportError;
029:
030:        import netscape.application.Alert;
031:        import netscape.application.Application;
032:        import netscape.application.Bitmap;
033:        import netscape.application.Button;
034:        import netscape.application.Color;
035:        import netscape.application.ExternalWindow;
036:        import netscape.application.InternalWindow;
037:        import netscape.application.Menu;
038:        import netscape.application.MenuItem;
039:        import netscape.application.MenuView;
040:        import netscape.application.Size;
041:        import netscape.application.Target;
042:        import netscape.application.View;
043:        import netscape.application.Window;
044:        import netscape.application.WindowOwner;
045:
046:        import java.util.Enumeration;
047:        import java.util.Vector;
048:
049:        public class Classification extends Application implements  Target,
050:                WindowOwner {
051:            private WindowTiler windowTiler;
052:
053:            private TaxonomyTreeView taxonomyTreeView;
054:            private TaxonomyTreeWindow taxonomyIW;
055:
056:            private SchemaTreeView schemaTreeView;
057:            private SchemaTreeWindow schemaIW;
058:
059:            private ClassificationWindow classificationIW;
060:
061:            private ExternalWindow externalWindow;
062:
063:            // tracks only the TaxonomyWindows
064:            private Vector IWList;
065:
066:            private boolean editTaxonomy;
067:
068:            private SchemaGetter sg;
069:            private TaxonomyGetter tg;
070:            private String testSchema;
071:            private String testTaxonomy;
072:            private String testClassRules;
073:
074:            private Schema schema;
075:            private Taxonomy taxonomy;
076:
077:            private MenuItem miT1;
078:
079:            private boolean standAlone = false;
080:            private Bitmap bm;
081:
082:            public boolean changed;
083:
084:            public void init() {
085:                super .init();
086:
087:                Header.showVersion(Messages.TITLE_CLASSRULES, true, true);
088:                boolean valid = true;
089:                boolean editTaxonomy = false;
090:
091:                changed = false;
092:
093:                bm = new Bitmap(components.Header.minCompass,
094:                        components.Header.minCompassSize.width,
095:                        components.Header.minCompassSize.height);
096:                externalWindow = new ExternalWindow();
097:                setMainRootView(externalWindow.rootView());
098:                mainRootView().setColor(graphical.Header.DESKTOPCOLOR);
099:                externalWindow.setTitle(Messages.TITLE_CLASSRULES);
100:                externalWindow.setOwner(this ); // To intercept close
101:
102:                // Create window tiler
103:                windowTiler = new WindowTiler();
104:
105:                String CGILocation = Header.parameterMacro(this , "CGILocation");
106:                String CGITarget = Header.parameterMacro(this , "CGITarget");
107:                String CGITaxRead = Header.parameterMacro(this , "CGITaxRead");
108:                String CGITaxWrite = Header.parameterMacro(this , "CGITaxWrite");
109:                String CGISchemaRead = Header.parameterMacro(this ,
110:                        "CGISchemaRead");
111:                String CGIRulesRead = Header.parameterMacro(this ,
112:                        "CGIRulesRead");
113:                String CGIRulesWrite = Header.parameterMacro(this ,
114:                        "CGIRulesWrite");
115:
116:                CSID csid = Header.parameterCSIDMacro(this );
117:
118:                if ((CGILocation == null) || (CGITarget == null)
119:                        || (CGITaxRead == null) || (CGITaxWrite == null)
120:                        || (CGISchemaRead == null) || (CGIRulesRead == null)
121:                        || (CGIRulesWrite == null) || (csid.isValid() == false)) {
122:                    valid = false;
123:                }
124:
125:                testSchema = parameterNamed("testSchema");
126:                testTaxonomy = parameterNamed("testTaxonomy");
127:                testClassRules = parameterNamed("testClassRules");
128:
129:                if ((testTaxonomy != null) && (testSchema != null)
130:                        && (testClassRules != null)) {
131:                    valid = true;
132:                }
133:
134:                String testMenu = parameterNamed("testMenu");
135:
136:                if (standAlone) {
137:                    testSchema = "testSchema";
138:                    testTaxonomy = "testTaxonomy";
139:                    testClassRules = "testClassRules";
140:                    testMenu = "testMenu";
141:                    valid = true;
142:                }
143:
144:                if (valid) {
145:                    Menu menu = new Menu();
146:                    MenuItem fileMenuItem = menu
147:                            .addItemWithSubmenu(Messages.MENU_FILE);
148:                    fileMenuItem.submenu().addItem(Messages.CMD_SAVE,
149:                            components.Messages.SCUT_SAVE, Messages.CMD_SAVE,
150:                            this );
151:                    fileMenuItem.submenu().addItem(Messages.CMD_CLOSE,
152:                            components.Messages.SCUT_CLOSE, Messages.CMD_CLOSE,
153:                            this );
154:                    MenuItem windMenuItem = menu
155:                            .addItemWithSubmenu(Messages.MENU_WINDOW);
156:                    windMenuItem.submenu().addItem(Messages.CMD_NEWTAXWIND,
157:                            Messages.CMD_NEWTAXWIND, this );
158:                    windMenuItem.submenu().addItem(Messages.CMD_NEWSCHWIND,
159:                            Messages.CMD_NEWSCHWIND, this );
160:                    if (testMenu != null) {
161:                        MenuItem testMenuItem = menu
162:                                .addItemWithSubmenu(Messages.MENU_TEST);
163:                        miT1 = testMenuItem.submenu().addItem(
164:                                Messages.LBL_EDITABLETAX,
165:                                Messages.LBL_EDITABLETAX, this , true);
166:                        miT1.setState(editTaxonomy);
167:                    }
168:                    MenuView menuView = new MenuView(menu);
169:                    menuView.sizeToMinSize();
170:                    externalWindow.setMenuView(menuView);
171:
172:                    if (testSchema == null) {
173:                        sg = new SchemaGetter(CGILocation, CGITarget
174:                                + CGISchemaRead, csid);
175:                        sg.start();
176:                    } else {
177:                        ReportError.reportError(ReportError.WARNING,
178:                                ReportError.ADMIN, "Classification", "init",
179:                                Messages.USETESTSCHEMA);
180:                        schema = Instrument.testSchema();
181:                        sg = null;
182:                    }
183:
184:                    if (testTaxonomy == null) {
185:                        tg = new TaxonomyGetter(CGILocation, CGITarget
186:                                + CGITaxRead, csid);
187:                        tg.start();
188:                    } else {
189:                        ReportError.reportError(ReportError.WARNING,
190:                                ReportError.ADMIN, "Classification", "init",
191:                                Messages.USETESTTAXONOMY);
192:                        taxonomy = Instrument.testTaxonomy();
193:                        tg = null;
194:                    }
195:
196:                    if (testSchema == null) {
197:                        sg.waitFor();
198:                        schema = sg.getSchema();
199:                    }
200:                    if (testTaxonomy == null) {
201:                        tg.waitFor();
202:                        taxonomy = tg.getTaxonomy();
203:                    }
204:                    if (testClassRules == null) {
205:                        classificationIW = new ClassificationWindow(
206:                                graphical.Header.WINDOWHGAP, externalWindow
207:                                        .menuView().height()
208:                                        + graphical.Header.WINDOWVGAP,
209:                                graphical.Header.IWINDWIDTH,
210:                                graphical.Header.IWINDHEIGHT, schema, taxonomy,
211:                                CGILocation, CGITarget, CGIRulesRead,
212:                                CGIRulesWrite, false);
213:                    } else {
214:                        ReportError.reportError(ReportError.WARNING,
215:                                ReportError.ADMIN, "Classification", "init",
216:                                Messages.USETESTCLASSRULES);
217:
218:                        classificationIW = new ClassificationWindow(
219:                                graphical.Header.WINDOWHGAP, externalWindow
220:                                        .menuView().height()
221:                                        + graphical.Header.WINDOWVGAP,
222:                                graphical.Header.IWINDWIDTH,
223:                                graphical.Header.IWINDHEIGHT, schema, taxonomy,
224:                                Instrument.testClassRules(), false);
225:                        classificationIW.testClassRules = testClassRules;
226:                    }
227:                    classificationIW.classificationView.notifyOfChange = this ;
228:                    classificationIW.setMinimize(bm,
229:                            components.Messages.LBL_CLASSRULES, externalWindow,
230:                            windowTiler);
231:                    classificationIW.setRootView(externalWindow.rootView());
232:                    windowTiler.addWindow(classificationIW); // Tile window (set position)
233:                    classificationIW.show();
234:
235:                    buildNewIWList();
236:
237:                    Header.EWSizer(externalWindow, classificationIW);
238:
239:                    // Set up so that close button sends a CMD_CLOSE. Then we will
240:                    // automatically check for unsaved changes when the close button is hit.
241:                    classificationIW.setCloseCommand(Messages.CMD_CLOSE);
242:                    classificationIW.setCloseTarget(this );
243:                    externalWindow.show();
244:                }
245:
246:                Header.showVersion(Messages.TITLE_CLASSRULES, false, true);
247:            }
248:
249:            /**
250:             * Note that only the Taxonomy windows are tracked.
251:             */
252:            // SGP: also in RDEdit
253:            public void buildNewIWList() {
254:                if (IWList != null) {
255:                    InternalWindow iw;
256:                    Enumeration e = IWList.elements();
257:                    while (e.hasMoreElements()) {
258:                        iw = (InternalWindow) e.nextElement();
259:                        if (iw != null) {
260:                            iw.hide();
261:                            iw.setRootView(null); // SGP: needed?
262:                        }
263:                    }
264:                    IWList.removeAllElements(); // SGP: necessary?
265:                }
266:
267:                IWList = new Vector();
268:            }
269:
270:            public void performCommand(String command, Object arg) {
271:                if (Messages.CMD_SAVE.equals(command)) {
272:                    classificationIW.classificationView.clickCommand();
273:                    externalWindow.rootView().setOverrideCursor(
274:                            View.WAIT_CURSOR);
275:                    if (testClassRules == null) {
276:                        classificationIW.classificationView.writeClassRules();
277:                    } else {
278:                        System.out.println(classificationIW.classificationView
279:                                .toStringClassRules());
280:                    }
281:                    externalWindow.rootView().removeOverrideCursor();
282:                    changed = false;
283:                    Alert.runAlertExternally(Alert.notificationImage(),
284:                            Messages.SAVED_CLASSRULES, "", Messages.CMD_OK,
285:                            null, null);
286:                    graphical.Header.showStatus(Messages.SAVED);
287:                } else if (Messages.CMD_NEWTAXWIND.equals(command)) {
288:                    if ((tg != null) && (taxonomy == null)) {
289:                        tg.waitFor();
290:                        taxonomy = tg.getTaxonomy();
291:                    }
292:
293:                    TaxonomyTreeWindow taxonomyTreeWindow = new TaxonomyTreeWindow(
294:                            graphical.Header.WINDOWHGAP, externalWindow
295:                                    .menuView().height()
296:                                    + graphical.Header.WINDOWVGAP,
297:                            graphical.Header.IWINDWIDTH,
298:                            graphical.Header.IWINDHEIGHT, taxonomy,
299:                            editTaxonomy, false, null);
300:                    taxonomyTreeWindow.setMinimize(bm,
301:                            components.Messages.LBL_TAXONOMY, externalWindow,
302:                            windowTiler);
303:                    taxonomyTreeWindow
304:                            .setDragSourcePolicy(graphical.DragPolicy.DRAGFROMCOPY);
305:                    taxonomyTreeWindow
306:                            .setDragDestinationPolicy(graphical.DragPolicy.DRAGTOACCEPT);
307:                    IWList.addElement((Object) taxonomyTreeWindow);
308:                    IWList.addElement((Object) taxonomyTreeWindow.minimize());
309:                    windowTiler.addWindow(taxonomyTreeWindow); // Tile window (set position)
310:                    taxonomyTreeWindow.show();
311:                } else if (Messages.CMD_NEWSCHWIND.equals(command)) {
312:                    if ((sg != null) && (schema == null)) {
313:                        sg.waitFor();
314:                        schema = sg.getSchema();
315:                    }
316:
317:                    SchemaTreeWindow schemaTreeWindow = new SchemaTreeWindow(
318:                            graphical.Header.WINDOWHGAP, externalWindow
319:                                    .menuView().height()
320:                                    + graphical.Header.WINDOWVGAP,
321:                            graphical.Header.IWINDWIDTH,
322:                            graphical.Header.IWINDHEIGHT, schema, false, false,
323:                            true);
324:                    schemaTreeWindow.setRootView(externalWindow.rootView()); // SGP ??
325:                    schemaTreeWindow.setMinimize(bm,
326:                            components.Messages.LBL_SCHEMA, externalWindow,
327:                            windowTiler);
328:                    schemaTreeWindow
329:                            .setDragSourcePolicy(graphical.DragPolicy.DRAGFROMCOPY);
330:                    windowTiler.addWindow(schemaTreeWindow); // Tile window (set position)
331:                    schemaTreeWindow.show();
332:                } else if (Messages.LBL_EDITABLETAX.equals(command)) {
333:                    buildNewIWList();
334:                    editTaxonomy = miT1.state();
335:                } else if (Messages.CMD_CLOSE.equals(command)) {
336:                    if (closeRequest() == false) { // Check for ensaved changes (MCW)
337:                        return;
338:                    }
339:
340:                    classificationIW.hide();
341:                    externalWindow.dispose();
342:                } else if (graphical.Messages.MSG_CHANGED_DATA.equals(command)) {
343:                    changed = true;
344:                }
345:            }
346:
347:            public boolean closeRequest() {
348:                // If there are unsaved changes display dialog and allow Save changes,
349:                // Discard changes and Cancel changes. (MCW)
350:
351:                if (changed == true) {
352:                    int answer = Alert.runAlertExternally(Alert
353:                            .notificationImage(),
354:                            components.Messages.TITLE_CR_UNSAVED, "",
355:                            Messages.CMD_SAVE, components.Messages.CMD_DISCARD,
356:                            Messages.CMD_CANCEL);
357:                    if (answer == components.Header.SAVE_SAVE) { // Save
358:                        performCommand(applications.Messages.CMD_SAVE, null);
359:                        return true;
360:                    } else if (answer == components.Header.SAVE_CONTINUE) { // Discard?
361:                        return true;
362:                    }
363:
364:                    return false; // Cancelled - stay open
365:                }
366:
367:                return true; // No changes - close
368:            }
369:
370:            public static void main(String args[]) {
371:                Classification app;
372:                app = new Classification();
373:                app.standAlone = true;
374:                app.run();
375:                System.exit(0);
376:            }
377:
378:            /**
379:             * WindowOwner interface. Used to intercept close on application window
380:             * and check for unsaved changes.
381:             */
382:
383:            public void windowDidHide(Window window) {
384:                /*
385:                 * Removed this, it causes a crash if the applet is closed and
386:                 * then the user clicks on the disable button in the admin window
387:
388:                stopRunning();
389:
390:                 */
391:            }
392:
393:            public boolean windowWillHide(Window window) {
394:                return closeRequest(); // Check for unsaved changes
395:            }
396:
397:            public void windowDidBecomeMain(Window window) {
398:            }
399:
400:            public void windowDidResignMain(Window window) {
401:            }
402:
403:            public void windowDidShow(Window window) {
404:            }
405:
406:            public boolean windowWillShow(Window window) {
407:                return true;
408:            }
409:
410:            public void windowWillSizeBy(Window window, Size size) {
411:            }
412:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.