Source Code Cross Referenced for PrimaryKeyTableModel.java in  » UML » MetaBoss » com » metaboss » applications » designstudio » primarykeytable » 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.primarykeytable 
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.primarykeytable;
016:
017:        import java.util.ArrayList;
018:
019:        import javax.swing.table.AbstractTableModel;
020:
021:        import com.metaboss.applications.designstudio.Application;
022:        import com.metaboss.applications.designstudio.userobjects.PrimaryKeyElementUserObject;
023:        import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
024:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.AssociationRole;
025:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Attribute;
026:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Entity;
027:
028:        /*		Primary Key Table model		*/
029:
030:        public class PrimaryKeyTableModel extends AbstractTableModel {
031:            private Entity mEntity = null;
032:            private ArrayList mList = new ArrayList();
033:
034:            // load primary key elements
035:            public void loadElements(Entity pEntity) {
036:                mEntity = pEntity;
037:                mList.clear();
038:                mList.addAll(pEntity.getAttributes());
039:                mList.addAll(pEntity.getCombinedReferences());
040:            }
041:
042:            public int getRowCount() {
043:                return mList.size();
044:            }
045:
046:            public int getColumnCount() {
047:                return 4;
048:            }
049:
050:            public Object getValueAt(int r, int c) {
051:                ModelElement lElement = (ModelElement) mList.get(r);
052:                if (lElement != null) {
053:                    switch (c) {
054:                    case 0:
055:                        return isRowInPrimaryKey(r);
056:                    case 1:
057:                        if (lElement instanceof  Attribute)
058:                            return Application.ATTRIBUTE_ICON;
059:                        else if (lElement instanceof  AssociationRole)
060:                            return Application.ASSOCIATIONROLE_ICON;
061:                    case 2:
062:                        return lElement.getName();
063:                    case 3:
064:                        if (lElement instanceof  Attribute) {
065:                            Attribute lAttribute = (Attribute) lElement;
066:                            if (lAttribute.getDataType() != null)
067:                                return lAttribute.getDataType().getName();
068:                        } else if (lElement instanceof  AssociationRole)
069:                            return "Association Role";
070:                    }
071:                }
072:                return null;
073:            }
074:
075:            public String getColumnName(int c) {
076:                switch (c) {
077:                case 0:
078:                    return "..";
079:                case 1:
080:                    return "..";
081:                case 2:
082:                    return "Element Name";
083:                case 3:
084:                    return "Element Type";
085:                }
086:                return null;
087:            }
088:
089:            public boolean isCellEditable(int rowIndex, int columnIndex) {
090:                if (columnIndex == 0)
091:                    return true;
092:                else
093:                    return false;
094:            }
095:
096:            public Class getColumnClass(int columnIndex) {
097:                if (columnIndex == 0)
098:                    return Boolean.class;
099:                else
100:                    return super .getColumnClass(columnIndex);
101:            }
102:
103:            public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
104:                if (columnIndex == 0) {
105:                    try {
106:                        ModelElement lElement = (ModelElement) mList
107:                                .get(rowIndex);
108:                        Boolean lValue = (Boolean) aValue;
109:                        if (lValue.equals(Boolean.TRUE))
110:                            PrimaryKeyElementUserObject
111:                                    .createNewPrimaryKeyElement(mEntity,
112:                                            lElement);
113:                        else
114:                            PrimaryKeyElementUserObject
115:                                    .deletePrimaryKeyElement(mEntity, lElement);
116:                    } catch (Exception e) {
117:                        e.printStackTrace();
118:                    }
119:                }
120:                super .setValueAt(aValue, rowIndex, columnIndex);
121:            }
122:
123:            // check element included into primary key
124:            private Boolean isRowInPrimaryKey(int pIndex) {
125:                ModelElement lElement = (ModelElement) mList.get(pIndex);
126:                if (lElement != null && mEntity != null) {
127:                    Object[] lList = mEntity.getPrimaryKeyElements().toArray();
128:                    for (int i = 0; i < lList.length; i++)
129:                        if (lList[i].equals(lElement))
130:                            return Boolean.TRUE;
131:                }
132:                return Boolean.FALSE;
133:            }
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.