Source Code Cross Referenced for ReportEntityUserObject.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 javax.swing.JTabbedPane;
021:
022:        import com.metaboss.applications.designstudio.Application;
023:        import com.metaboss.applications.designstudio.BaseAction;
024:        import com.metaboss.applications.designstudio.BasePropertiesDialog;
025:        import com.metaboss.applications.designstudio.BaseUserObject;
026:        import com.metaboss.applications.designstudio.attributestable.AttributesViewPanel;
027:        import com.metaboss.applications.designstudio.components.SeparatorAction;
028:        import com.metaboss.applications.designstudio.propertiesdialogs.ReportEntityPropertiesDialog;
029:        import com.metaboss.applications.designstudio.propertiesview.PropertiesTableModel;
030:        import com.metaboss.sdlctools.models.metabossmodel.MetaBossModelPackage;
031:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Attribute;
032:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.ReportOutputElement;
033:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.ReportOutputEntity;
034:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.ReportOutputEntityClass;
035:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.SystemImplementationModelPackage;
036:
037:        /*		BOReportEntity user object class		*/
038:
039:        public class ReportEntityUserObject extends BaseUserObject {
040:            public static final int ADD_ATTRIBUTE = 1;
041:
042:            private ReportOutputEntity mEntity = null;
043:            private AddNewAttributeAction mAddNewAttributeAction = new AddNewAttributeAction();
044:            private AddAllAttributesAction mAddAllAttributesAction = new AddAllAttributesAction();
045:
046:            public ReportEntityUserObject(ReportOutputEntity pEntity) {
047:                super (pEntity, Application.ENTITY_ICON);
048:                mEntity = pEntity;
049:            }
050:
051:            public ReportEntityUserObject(ReportOutputEntity pEntity,
052:                    String pCaption, int pMode) {
053:                super (pEntity, pCaption, pMode);
054:                mEntity = pEntity;
055:            }
056:
057:            // create new Entity
058:            public static ReportEntityUserObject addNewEntity(
059:                    ReportOutputElement pElement) throws Exception {
060:                return (ReportEntityUserObject) new ReportEntityUserObject(null)
061:                        .addNewObject(getObjectPackage(pElement), pElement
062:                                .getOutputEntities());
063:            }
064:
065:            public BaseUserObject createNewObject(MetaBossModelPackage pPackage) {
066:                SystemImplementationModelPackage lSystemImplementationModelPackage = pPackage
067:                        .getEnterpriseModel().getSystemImplementationModel();
068:                ReportOutputEntityClass lClass = lSystemImplementationModelPackage
069:                        .getReportOutputEntity();
070:                return new ReportEntityUserObject(lClass
071:                        .createReportOutputEntity());
072:            }
073:
074:            public ReportOutputEntity getEntity() {
075:                return mEntity;
076:            }
077:
078:            // return object root node captions
079:            public String getRootNodeName() {
080:                return Application.getString("entities_node");
081:            }
082:
083:            // convert tree element to an action code
084:            public int convertCaptionToAction(String pCaption) {
085:                if (pCaption.equals(Application.getString("attributes_node")))
086:                    return ADD_ATTRIBUTE;
087:                else
088:                    return super .convertCaptionToAction(pCaption);
089:            }
090:
091:            // fill actions list
092:            public void fillActionsList(ArrayList pList) {
093:                switch (mMode) {
094:                case ALL_ACTIONS:
095:                    super .fillActionsList(pList);
096:                    pList.add(new SeparatorAction());
097:                    pList.add(mAddNewAttributeAction);
098:                    if (needToAddAttributes())
099:                        pList.add(mAddAllAttributesAction);
100:                    break;
101:                case ADD_ATTRIBUTE:
102:                    pList.add(mAddNewAttributeAction);
103:                    if (needToAddAttributes())
104:                        pList.add(mAddAllAttributesAction);
105:                    break;
106:                }
107:            }
108:
109:            // load object properties into grid control
110:            public void loadObjectProperties(PropertiesTableModel pModel)
111:                    throws Exception {
112:                super .loadObjectProperties(pModel);
113:                if (pModel == null || mEntity == null)
114:                    return;
115:
116:                addModelElement(pModel, "Entity", mEntity.getEntity());
117:                pModel.AddProperty("Array", boolToString(mEntity.isArray()));
118:            }
119:
120:            public BasePropertiesDialog getObjectEditor() {
121:                return new ReportEntityPropertiesDialog();
122:            }
123:
124:            // add extra properties tabs
125:            public void addExtraPropertiesTabs(JTabbedPane pTabbedPane) {
126:                pTabbedPane.insertTab("Attributes", null,
127:                        new AttributesViewPanel(mEntity), null, 1);
128:            }
129:
130:            // add new child attribute
131:            public void addNewAttribute() throws Exception {
132:                ReportEntityAttributeUserObject
133:                        .addNewReportEntityAttribute(mEntity);
134:            }
135:
136:            // add all attributes
137:            public void addAllAttributes() throws Exception {
138:                if (mEntity == null || mEntity.getEntity() == null)
139:                    return;
140:
141:                Object[] lAttributes = mEntity.getEntity().getAttributes()
142:                        .toArray();
143:                if (lAttributes != null && lAttributes.length > 0) {
144:                    for (int i = 0; i < lAttributes.length; i++) {
145:                        Attribute lAttribute = (Attribute) lAttributes[i];
146:                        if (!attributeAlreadyIn(lAttribute)) {
147:                            Application.beginTransaction();
148:                            try {
149:                                mEntity.getAttributes().add(lAttribute);
150:                                Application.commit();
151:                            } finally {
152:                                Application.checkAndRollback();
153:                            }
154:                            Application
155:                                    .fireObjectInserted(new ReportEntityAttributeUserObject(
156:                                            lAttribute, mEntity));
157:                        }
158:                    }
159:                }
160:            }
161:
162:            // check attribute already added into attributes collection
163:            private boolean attributeAlreadyIn(Attribute pAttribute) {
164:                return mEntity.getAttributes().contains(pAttribute);
165:            }
166:
167:            // check as if there is a need to add attributes
168:            private boolean needToAddAttributes() {
169:                if (mEntity != null && mEntity.getEntity() != null) {
170:                    int lSize = mEntity.getEntity().getAttributes().size();
171:                    if (lSize > 0 && mEntity.getAttributes().size() < lSize)
172:                        return true;
173:                }
174:                return false;
175:            }
176:
177:            /*		Auxilary classes						*/
178:
179:            /*  	Add New Attribute Action  Class 		*/
180:
181:            public class AddNewAttributeAction extends BaseAction {
182:                public AddNewAttributeAction() {
183:                    super ("Add New Attribute", Application
184:                            .getAddIcon(Application.ATTRIBUTE_ICON));
185:                }
186:
187:                public void actionPerformed(ActionEvent arg0) {
188:                    try {
189:                        addNewAttribute();
190:                    } catch (Exception e) {
191:                        e.printStackTrace();
192:                    }
193:                }
194:            }
195:
196:            /*		Add all attributes		*/
197:
198:            public class AddAllAttributesAction extends BaseAction {
199:                public AddAllAttributesAction() {
200:                    super ("Add All Attributes",
201:                            Application.ADDALLATTRIBUTES_ICON);
202:                }
203:
204:                public void actionPerformed(ActionEvent arg0) {
205:                    try {
206:                        addAllAttributes();
207:                    } catch (Exception e) {
208:                        e.printStackTrace();
209:                    }
210:                }
211:            }
212:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.