Source Code Cross Referenced for NamespaceUserObject.java in  » UML » MetaBoss » com » metaboss » applications » designstudio » userobjects » 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 » UML » MetaBoss » com.metaboss.applications.designstudio.userobjects 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002:        // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003:        // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004:        // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005:        // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006:        // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007:        // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008:        // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009:        // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010:        // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011:        // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012:        // POSSIBILITY OF SUCH DAMAGE.
013:        //
014:        // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
015:        package com.metaboss.applications.designstudio.userobjects;
016:
017:        import java.awt.event.ActionEvent;
018:        import java.util.ArrayList;
019:
020:        import com.metaboss.applications.designstudio.Application;
021:        import com.metaboss.applications.designstudio.BaseAction;
022:        import com.metaboss.applications.designstudio.BasePropertiesDialog;
023:        import com.metaboss.applications.designstudio.BaseUserObject;
024:        import com.metaboss.applications.designstudio.components.SeparatorAction;
025:        import com.metaboss.applications.designstudio.propertiesdialogs.SimpleObjectPropertiesdialog;
026:        import com.metaboss.applications.designstudio.propertiesview.PropertiesTableModel;
027:        import com.metaboss.sdlctools.models.metabossmodel.MetaBossModelPackage;
028:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.DataDictionary;
029:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.DataType;
030:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.Namespace;
031:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.NamespaceClass;
032:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.Structure;
033:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Message;
034:
035:        /*		Namespace user object		*/
036:
037:        public class NamespaceUserObject extends BaseUserObject {
038:            public static final int DATATYPE_ACTION = 1;
039:            public static final int TYPETEMPLATE_ACTION = 2;
040:            public static final int NAMESPACE_ACTION = 3;
041:            public static final int STRUCTURES_ACTION = 4;
042:            public static final int MESSAGES_ACTION = 5;
043:
044:            private Namespace mNamespace = null;
045:            private AddDataTypeAction mAddDataTypeAction = new AddDataTypeAction();
046:            private AddNamespaceAction mAddNamespaceAction = new AddNamespaceAction();
047:            private AddTypeTemplateAction mAddTypeTemplateAction = new AddTypeTemplateAction();
048:            private AddStructureAction mAddStrucureAction = new AddStructureAction();
049:            private AddMessageAction mAddMessageAction = new AddMessageAction();
050:
051:            public NamespaceUserObject(Namespace pNamespace) {
052:                super (pNamespace, Application.NAMESPACE_ICON);
053:                mNamespace = pNamespace;
054:            }
055:
056:            public NamespaceUserObject(Namespace pNamespace, String pCaption,
057:                    int pMode) {
058:                super (pNamespace, pCaption, pMode);
059:                mNamespace = pNamespace;
060:            }
061:
062:            // create new namespace
063:            public static void addNewNamespace(DataDictionary pDataDictionary)
064:                    throws Exception {
065:                new NamespaceUserObject(null).addNewObject(
066:                        getObjectPackage(pDataDictionary), pDataDictionary
067:                                .getSubNamespaces());
068:            }
069:
070:            public static void addNewNamespace(Namespace pNamespace)
071:                    throws Exception {
072:                new NamespaceUserObject(null).addNewObject(
073:                        getObjectPackage(pNamespace), pNamespace
074:                                .getSubNamespaces());
075:            }
076:
077:            public BaseUserObject createNewObject(MetaBossModelPackage pPackage) {
078:                NamespaceClass lClass = pPackage.getDataDictionaryModel()
079:                        .getNamespace();
080:                return new NamespaceUserObject(lClass.createNamespace());
081:            }
082:
083:            public Namespace getNamespace() {
084:                return mNamespace;
085:            }
086:
087:            // return object root node captions
088:            public String getRootNodeName() {
089:                return Application.getString("namespaces_node");
090:            }
091:
092:            // load object properties into grid control
093:            public void loadObjectProperties(PropertiesTableModel pModel)
094:                    throws Exception {
095:                super .loadObjectProperties(pModel);
096:                if (pModel == null || mNamespace == null)
097:                    return;
098:
099:                addModelElement(pModel, "Namespace", mNamespace.getNamespace());
100:            }
101:
102:            // fill actions list
103:            public void fillActionsList(ArrayList pList) {
104:                switch (mMode) {
105:                case ALL_ACTIONS:
106:                    super .fillActionsList(pList);
107:                    pList.add(new SeparatorAction());
108:                    pList.add(mAddNamespaceAction);
109:                    pList.add(mAddTypeTemplateAction);
110:                    pList.add(mAddDataTypeAction);
111:                    pList.add(mAddStrucureAction);
112:                    pList.add(mAddMessageAction);
113:                    break;
114:                case NAMESPACE_ACTION:
115:                    pList.add(mAddNamespaceAction);
116:                    break;
117:                case TYPETEMPLATE_ACTION:
118:                    pList.add(mAddTypeTemplateAction);
119:                    break;
120:                case DATATYPE_ACTION:
121:                    pList.add(mAddDataTypeAction);
122:                    break;
123:                case STRUCTURES_ACTION:
124:                    pList.add(mAddStrucureAction);
125:                    break;
126:                case MESSAGES_ACTION:
127:                    pList.add(mAddMessageAction);
128:                    break;
129:                }
130:            }
131:
132:            // get object editor
133:            public BasePropertiesDialog getObjectEditor() {
134:                return new SimpleObjectPropertiesdialog("Namespace");
135:            }
136:
137:            // add data type
138:            private void addDataType() throws Exception {
139:                DataTypeUserObject.addNewDataType(mNamespace);
140:            }
141:
142:            // add namespace
143:            private void addNamespace() throws Exception {
144:                NamespaceUserObject.addNewNamespace(mNamespace);
145:            }
146:
147:            // add typetemplate
148:            private void addTypeTemplate() throws Exception {
149:                TypeTemplateUserObject.addNewTypeTemplate(mNamespace);
150:            }
151:
152:            // add structure
153:            private void addStructure() throws Exception {
154:                StructureUserObject.addNewStructure(mNamespace);
155:            }
156:
157:            // add new service module service
158:            public void addNewMessage() throws Exception {
159:                MessageUserObject.addNewMessage(mNamespace);
160:            }
161:
162:            // returns true if drop object could be accepted
163:            public boolean canAcceptDropObject(BaseUserObject pUserObject,
164:                    boolean pCopy) {
165:                if (pUserObject != null
166:                        && super .canAcceptDropObject(pUserObject, pCopy)) {
167:                    if ((pUserObject instanceof  NamespaceUserObject && (mMode == BaseUserObject.ALL_ACTIONS || mMode == NamespaceUserObject.NAMESPACE_ACTION))
168:                            || (pUserObject instanceof  DataTypeUserObject && (mMode == BaseUserObject.ALL_ACTIONS || mMode == NamespaceUserObject.DATATYPE_ACTION))
169:                            || (pUserObject instanceof  MessageUserObject && (mMode == BaseUserObject.ALL_ACTIONS || mMode == NamespaceUserObject.MESSAGES_ACTION))
170:                            || (pUserObject instanceof  StructureUserObject && (mMode == BaseUserObject.ALL_ACTIONS || mMode == NamespaceUserObject.STRUCTURES_ACTION))) {
171:                        return (pCopy) ? pUserObject.canDuplicate() : true;
172:                    }
173:                }
174:                return false;
175:            }
176:
177:            // acccept drop target in transaction
178:            protected void transactionalAccept(BaseUserObject pUserObject,
179:                    boolean pCopy) throws Exception {
180:                if (pUserObject != null) {
181:                    if (pUserObject instanceof  NamespaceUserObject) {
182:                        NamespaceUserObject lUserObject = (NamespaceUserObject) pUserObject;
183:                        if (pCopy) {
184:                            Namespace lNamespace = (Namespace) Application.sModelRepository
185:                                    .duplicateModelElement(lUserObject
186:                                            .getNamespace());
187:                            lNamespace.setNamespace(mNamespace);
188:                        } else
189:                            lUserObject.getNamespace().setNamespace(mNamespace);
190:                    } else if (pUserObject instanceof  DataTypeUserObject) {
191:                        DataTypeUserObject lUserObject = (DataTypeUserObject) pUserObject;
192:                        if (pCopy) {
193:                            DataType lDataType = (DataType) Application.sModelRepository
194:                                    .duplicateModelElement(lUserObject
195:                                            .getDataType());
196:                            lDataType.setNamespace(mNamespace);
197:                        } else
198:                            lUserObject.getDataType().setNamespace(mNamespace);
199:                    } else if (pUserObject instanceof  StructureUserObject) {
200:                        StructureUserObject lUserObject = (StructureUserObject) pUserObject;
201:                        if (pCopy) {
202:                            Structure lStructure = (Structure) Application.sModelRepository
203:                                    .duplicateModelElement(lUserObject
204:                                            .getStructure());
205:                            lStructure.setNamespace(mNamespace);
206:                        } else {
207:                            // Ensure that all other possible owners are set to null
208:                            lUserObject.getStructure().setServicemodule(null);
209:                            lUserObject.getStructure().setNamespace(mNamespace);
210:                        }
211:                    } else if (pUserObject instanceof  MessageUserObject) {
212:                        MessageUserObject lUserObject = (MessageUserObject) pUserObject;
213:                        if (pCopy) {
214:                            Message lMessage = (Message) Application.sModelRepository
215:                                    .duplicateModelElement(lUserObject
216:                                            .getMessage());
217:                            lMessage.setNamespace(mNamespace);
218:                        } else {
219:                            // Ensure that all other possible owners are set to null
220:                            lUserObject.getMessage().setServicemodule(null);
221:                            lUserObject.getMessage().setNamespace(mNamespace);
222:                        }
223:                    }
224:                }
225:            }
226:
227:            /*				Actions				*/
228:
229:            public class AddDataTypeAction extends BaseAction {
230:                public AddDataTypeAction() {
231:                    super ("Add New DataType", Application
232:                            .getAddIcon(Application.DATATYPE_ICON));
233:                }
234:
235:                public void actionPerformed(ActionEvent e) {
236:                    try {
237:                        addDataType();
238:                    } catch (Throwable t) {
239:                        Application.processError(t);
240:                    }
241:                }
242:            }
243:
244:            public class AddNamespaceAction extends BaseAction {
245:                public AddNamespaceAction() {
246:                    super ("Add New Namespace", Application
247:                            .getAddIcon(Application.NAMESPACE_ICON));
248:                }
249:
250:                public void actionPerformed(ActionEvent e) {
251:                    try {
252:                        addNamespace();
253:                    } catch (Throwable t) {
254:                        Application.processError(t);
255:                    }
256:                }
257:            }
258:
259:            public class AddTypeTemplateAction extends BaseAction {
260:                public AddTypeTemplateAction() {
261:                    super ("Add New TypeTemplate", Application
262:                            .getAddIcon(Application.TYPETEMPLATE_ICON));
263:                }
264:
265:                public void actionPerformed(ActionEvent e) {
266:                    try {
267:                        addTypeTemplate();
268:                    } catch (Throwable t) {
269:                        Application.processError(t);
270:                    }
271:                }
272:            }
273:
274:            public class AddStructureAction extends BaseAction {
275:                public AddStructureAction() {
276:                    super ("Add New Structure", Application
277:                            .getAddIcon(Application.STRUCTURE_ICON));
278:                }
279:
280:                public void actionPerformed(ActionEvent e) {
281:                    try {
282:                        addStructure();
283:                    } catch (Throwable t) {
284:                        Application.processError(t);
285:                    }
286:                }
287:            }
288:
289:            public class AddMessageAction extends BaseAction {
290:                public AddMessageAction() {
291:                    super ("Add New Message", Application
292:                            .getAddIcon(Application.MESSAGE_ICON));
293:                }
294:
295:                public void actionPerformed(ActionEvent e) {
296:                    try {
297:                        addNewMessage();
298:                    } catch (Throwable t) {
299:                        t.printStackTrace();
300:                    }
301:                }
302:            }
303:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.