Source Code Cross Referenced for ToolWorld.java in  » 6.0-JDK-Modules » java-3d » com » db » server » 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 » 6.0 JDK Modules » java 3d » com.db.server 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2001 Silvere Martin-Michiellot All Rights Reserved.
003:         *
004:         * Silvere Martin-Michiellot grants you ("Licensee") a non-exclusive,
005:         * royalty free, license to use, modify and redistribute this
006:         * software in source and binary code form,
007:         * provided that i) this copyright notice and license appear on all copies of
008:         * the software; and ii) Licensee does not utilize the software in a manner
009:         * which is disparaging to Silvere Martin-Michiellot.
010:         *
011:         * This software is provided "AS IS," without a warranty of any kind. ALL
012:         * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
013:         * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
014:         * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. Silvere Martin-Michiellot
015:         * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
016:         * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
017:         * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
018:         * Silvere Martin-Michiellot OR ITS LICENSORS BE LIABLE
019:         * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
020:         * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
021:         * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
022:         * OR INABILITY TO USE SOFTWARE, EVEN IF Silvere Martin-Michiellot HAS BEEN
023:         * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
024:         *
025:         * This software is not designed or intended for use in on-line control of
026:         * aircraft, air traffic, aircraft navigation or aircraft communications; or in
027:         * the design, construction, operation or maintenance of any nuclear
028:         * facility. Licensee represents and warrants that it will not use or
029:         * redistribute the Software for such purposes.
030:         *
031:         * @Author: Silvere Martin-Michiellot
032:         *
033:         */
034:
035:        package com.db.server;
036:
037:        //import com.db.swing3d.*;
038:        import java.util.*;
039:        import javax.jdo.*;
040:        import javax.media.j3d.*;
041:
042:        /**
043:         */
044:
045:        public abstract class ToolWorld extends ObjectWorld {
046:
047:            //please use the fields from this class and not the fields from objectWorld when a duplicate exists
048:
049:            //copied from objectWorld: Start
050:
051:            //Lords and self are always allowed full rights
052:
053:            public final static int NO_CAPABILITY = 0;
054:
055:            public final static int SALABLE = 1;
056:            public final static int RESHAPEABLE = 2;
057:            public final static int SOUNDALTERABLE = 4;
058:            public final static int VISIBLE = 8;
059:            public final static int SONORE = 16;
060:            public final static int MOVABLE = 32;
061:            public final static int COLLIDABLE = 64;
062:            public final static int INVENTORIZABLE = 128;
063:            public final static int ACCESSORY = 256;
064:            public final static int CUTABLE = 512;
065:            public final static int GLUABLE = 1024;
066:            public final static int DUPLICABLE = 2048;
067:
068:            //copied from objectWorld: End
069:
070:            public final static int GENERIC = 4096;
071:            public final static int HEADUP = 8192;
072:            public final static int FERTILE = 16384;
073:            public final static int MANIPULATES = 32768;
074:            public final static int SUPPRESSOR = 65536;
075:
076:            private static int LAST_CAPABILITY = (ToolWorld.SUPPRESSOR * 2) - 1;
077:
078:            public static int DEFAULT_DESIGNER_CAPABILITIES = ToolWorld.LAST_CAPABILITY;
079:
080:            /**
081:             * input acces list: objects and tools of the World Spot library (can also be used by owner to restrict even more the rights of the tool to access some objects or tools)
082:             * output acces list: objects and tools of the World Spot library (can also be used by owner to restrict even more the rights of the tool to access some objects or tools)
083:             * Capabilities (4 booleans grant access for invited lords, peers, peers vassals and vassals) existence locked by designer:
084:             * generic: can pick one of this tool on the soil and there is still one remaining
085:             * headup
086:             * fertile (generate children tools or objects that are to be put in the inventory or in the 3D multi user scene) (these tools or objects should be in the output acces list)
087:             * manipulates (Locks and removes temporarily the object from the 3D multi user scene of every client but the owner to eventually store it in the 3D GUI of a tool. While the object is locked, other clients should see a greyed 3D volume that corresponds to the object be cannot be actionned. The lock should either be automatically removed when the user release the object or manually by the owner or a lord of an owner. Lock shouldn't be automatically removed by timeout.) (these tools or objects should be in the input and output acces list)
088:             * suppressor (deletes children tools or objects) (these tools or objects should be in the output acces list)
089:             * has 3d grab hand cursor
090:             * Tools logic: actions corresponding to capabilities or to input in status or from a tool of the input list
091:             * cursor 3d
092:             * icone 3d
093:             * head up geometry (swing3D class, functionnality is equivalent to swing but objects are 3D semi-transparent volumes in the front or head up of the 3D world) (Head up geometry usually replaces geometry and sound from 3D world considering the tool has been picked but this is not always the case. When this happens, the object should be put in the inventory)
094:             * GUI behaviors (provided by the swing3D system)
095:             * output tool (or object) or property of a tool (declared in the output access list).  */
096:
097:            private Cursor3D cursor3D;
098:            private Icon3D icon3D;
099:            private Frame3D frame3D;
100:            private HashSet inputAccessList;
101:            private HashSet outputAccessList;
102:
103:            //put final here as a designer
104:            private HashSet designerInputAccessList;
105:            private HashSet designerOutputAccessList;
106:
107:            //not a real extension of constructor
108:            public ToolWorld(UniverseServer universeServer, Avatar userOwner) {
109:
110:                super (universeServer, userOwner);
111:                inputAccessList = new HashSet();
112:                outputAccessList = new HashSet();
113:                cursor3D = new Cursor3D();
114:                icon3D = new Icon3D();
115:                frame3D = new Frame3D();
116:
117:            }
118:
119:            //every "get" or "set" or "add" or "remove" call assumes valid user's rights (depending on who calls)
120:            //otherwise the server returns a request refused message
121:
122:            public final Cursor3D getCursor3D() {
123:
124:                return this .cursor3D;
125:
126:            }
127:
128:            public final void setCursor3D(Cursor3D cursor3D) {
129:
130:                this .cursor3D = cursor3D;
131:                this .setDirty();
132:                this .doCursor3DChanged();
133:
134:            }
135:
136:            public final Icon3D getIcon3D() {
137:
138:                return this .icon3D;
139:
140:            }
141:
142:            public final void setIcon3D(Icon3D icon3D) {
143:
144:                this .icon3D = icon3D;
145:                this .setDirty();
146:                this .doIcon3DChanged();
147:
148:            }
149:
150:            public final Frame3D getFrame3D() {
151:
152:                return this .frame3D;
153:
154:            }
155:
156:            public final void setFrame3D(Frame3D frame3D) {
157:
158:                this .frame3D = frame3D;
159:                this .setDirty();
160:                this .doFrame3DChanged();
161:
162:            }
163:
164:            public final HashSet getInputAccessList() {
165:
166:                return this .inputAccessList;
167:
168:            }
169:
170:            //will be matched against designer access list
171:            //HashSet should be made of class objects (not class instances) that inherit ObjectWorld
172:            public final void setInputAccessList(HashSet inputAccessList) {
173:
174:                Iterator iterator;
175:                boolean good;
176:
177:                iterator = inputAccessList.iterator();
178:                good = true;
179:
180:                while (iterator.hasNext() && good) {
181:                    good = objectWorldInstance(iterator.next().getClass());
182:                }
183:
184:                if (good) {
185:                    this .inputAccessList = inputAccessList;
186:                    this .setDirty();
187:                    this .doInputAccessListChanged();
188:                }
189:
190:            }
191:
192:            //will be matched against designer access list
193:            public final void addInputAccess(Class objectWorldSubClass) {
194:
195:                if (objectWorldInstance(objectWorldSubClass)) {
196:                    this .inputAccessList.add(objectWorldSubClass);
197:                    this .setDirty();
198:                    this .doInputAccessListChanged();
199:                }
200:
201:            }
202:
203:            public final void removeInputAccess(Class objectWorldSubClass) {
204:
205:                this .inputAccessList.remove(objectWorldSubClass);
206:                this .setDirty();
207:                this .doInputAccessListChanged();
208:
209:            }
210:
211:            public final HashSet getOutputAccessList() {
212:
213:                return this .outputAccessList;
214:
215:            }
216:
217:            //will be matched against designer access list
218:            //HashSet should be made of class objects (not class instances) that inherit ObjectWorld
219:            public final void setOutputAccessList(HashSet outputAccessList) {
220:
221:                Iterator iterator;
222:                boolean good;
223:
224:                iterator = outputAccessList.iterator();
225:                good = true;
226:
227:                while (iterator.hasNext() && good) {
228:                    good = objectWorldInstance(iterator.next().getClass());
229:                }
230:
231:                if (good) {
232:                    this .outputAccessList = outputAccessList;
233:                    this .setDirty();
234:                    this .doOutputAccessListChanged();
235:                }
236:
237:            }
238:
239:            //will be matched against designer access list
240:            public final void addOutputAccess(Class objectWorldSubClass) {
241:
242:                if (objectWorldInstance(objectWorldSubClass)) {
243:                    this .outputAccessList.add(objectWorldSubClass);
244:                    this .setDirty();
245:                    this .doOutputAccessListChanged();
246:                }
247:
248:            }
249:
250:            public final void removeOutputAccess(Class objectWorldSubClass) {
251:
252:                this .outputAccessList.remove(objectWorldSubClass);
253:                this .setDirty();
254:                this .doOutputAccessListChanged();
255:
256:            }
257:
258:            //input send to the 3D GUI system of object and processed in internal methods
259:            //GUI behaviors (provided by the swing3D system)
260:
261:            //output tool (or object) or property of a tool (declared in the output access list).
262:
263:            //SYSTEM CALLS DEPENDING ON CAPABILITIES
264:
265:            public int getDesignerCapabilities() {
266:
267:                //The designer of the object has to encode the desired feature mask of its object
268:                //by setting objectCapabilities
269:                //just to ensure no one will subclass his object to do undesired behaviors
270:                //Designers should use the modifier "final" to ensure there is no one counterfeiting their identity
271:
272:                //GENERIC tools should also be duplicable
273:                return super .getDesignerCapabilities();
274:
275:            }
276:
277:            public HashSet getDesignerInputAccessList() {
278:
279:                //The designer of the object has to encode the desired feature mask of its object
280:                //by setting InputAccessList which will restrict active userInputAccessList
281:                //HashSet should be made of class objects (not class instances) that inherit ObjectWorld
282:                //just to ensure no one will subclass his object to do undesired behaviors
283:                //Designers should use the modifier "final" to ensure there is no one counterfeiting their identity
284:
285:                designerInputAccessList = new HashSet();
286:                return this .designerInputAccessList;
287:
288:            }
289:
290:            public HashSet getDesignerOutputAccessList() {
291:
292:                //The designer of the object has to encode the desired feature mask of its object
293:                //by setting OutputAccessList which will restrict active userOutputAccessList
294:                //HashSet should be made of class objects (not class instances) that inherit ObjectWorld
295:                //just to ensure no one will subclass his object to do undesired behaviors
296:                //Designers should use the modifier "final" to ensure there is no one counterfeiting their identity
297:
298:                designerOutputAccessList = new HashSet();
299:                return this .designerOutputAccessList;
300:
301:            }
302:
303:            //only class of selected objects
304:            //returns intersection
305:            private final HashSet matchLists(HashSet designerList,
306:                    HashSet userList) {
307:
308:                HashSet result;
309:                Iterator iterator1;
310:                Iterator iterator2;
311:                boolean found;
312:                Object object1;
313:                Object object2;
314:
315:                result = new HashSet();
316:
317:                iterator1 = designerList.iterator();
318:                iterator2 = userList.iterator();
319:
320:                while (iterator1.hasNext()) {
321:                    found = false;
322:                    object1 = (Object) iterator1.next();
323:                    while ((iterator1.hasNext()) && (!found)) {
324:                        object2 = (Object) iterator2.next();
325:                        found = (object1.getClass() == object2.getClass());
326:                    }
327:                    if (found) {
328:                        result.add(object1);
329:                    }
330:                }
331:
332:                return result;
333:
334:            }
335:
336:            private boolean objectWorldInstance(Class classValue) {
337:
338:                if (classValue == ObjectWorld.class) {
339:                    return true;
340:                } else {
341:                    if (classValue == Object.class) {
342:                        return false;
343:                    } else {
344:                        return objectWorldInstance(classValue.getSuperclass());
345:                    }
346:                }
347:
348:            }
349:
350:            //Frame3D, Icon3D, Cursor3D not implemented
351:            //XXXXX
352:            protected void processGUI() {
353:
354:                HashSet result;
355:
356:                //uses user's input and ouput list
357:                result = this .matchLists(this .getDesignerInputAccessList(),
358:                        this .getInputAccessList());
359:                result = this .matchLists(this .getDesignerOutputAccessList(),
360:                        this .getOutputAccessList());
361:                //matchs these lists against designer's lists
362:
363:                if (this .checkWritable(ToolWorld.GENERIC + ToolWorld.HEADUP
364:                        + ToolWorld.FERTILE + ToolWorld.MANIPULATES
365:                        + ToolWorld.SUPPRESSOR)) {
366:
367:                    //trigger something
368:                    this .doGeneric();
369:                    this .doHeadUp();
370:                    this .doFertile();
371:                    this .doManipulates();
372:                    this .doSuppressor();
373:
374:                }
375:
376:            }
377:
378:            //time sliced actions
379:
380:            public void doCursor3DChanged() {
381:
382:            }
383:
384:            public void doIcon3DChanged() {
385:
386:            }
387:
388:            public void doFrame3DChanged() {
389:
390:            }
391:
392:            public void doInputAccessListChanged() {
393:
394:            }
395:
396:            public void doOutputAccessListChanged() {
397:
398:            }
399:
400:            //Generic tools should also be duplicable (it is an error from the designer not to do so)
401:            public void doGeneric() {
402:
403:            }
404:
405:            //Headup should replace 3D world geometry
406:            //if it doesn't then the Tool is still on the soil and its 3D state should be shared over the different clients that have grabbed the tool
407:            public void doHeadUp() {
408:
409:            }
410:
411:            public void doFertile() {
412:
413:            }
414:
415:            public void doManipulates() {
416:
417:            }
418:
419:            public void doSuppressor() {
420:
421:            }
422:
423:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.