Source Code Cross Referenced for AccessTableModel.java in  » Content-Management-System » contelligent » de » finix » contelligent » client » gui » access » 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 » Content Management System » contelligent » de.finix.contelligent.client.gui.access 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2006 C:1 Financial Services GmbH
003:         *
004:         * This software is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License Version 2.1, as published by the Free Software Foundation.
007:         *
008:         * This software is distributed in the hope that it will be useful,
009:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
010:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011:         * Lesser General Public License for more details.
012:         *
013:         * You should have received a copy of the GNU Lesser General Public
014:         * License along with this library; if not, write to the Free Software
015:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
016:         */
017:
018:        package de.finix.contelligent.client.gui.access;
019:
020:        import java.util.Iterator;
021:        import java.util.List;
022:        import java.util.TreeMap;
023:
024:        import javax.swing.table.AbstractTableModel;
025:
026:        import de.finix.contelligent.client.base.ContelligentComponent;
027:        import de.finix.contelligent.client.i18n.Resources;
028:        import de.finix.contelligent.client.security.ComponentAccess;
029:
030:        class AccessTableModel extends AbstractTableModel {
031:
032:            private Object[][] data = new Object[0][4];
033:
034:            private String[] columnNames = {
035:                    Resources.getLocalString("principal"),
036:                    Resources.getLocalString("permission"),
037:                    Resources.getLocalString("mode"),
038:                    Resources.getLocalString("acl_time_header") };
039:
040:            private boolean editable;
041:
042:            private ContelligentComponent component;
043:
044:            public AccessTableModel(ContelligentComponent component) {
045:                this .component = component;
046:                updateData();
047:            }
048:
049:            public void updateData() {
050:                List acl = component.getACL();
051:                data = new Object[acl.size()][4];
052:                TreeMap<String, ComponentAccess> sorter = new TreeMap<String, ComponentAccess>();
053:                for (int i = 0; i < acl.size(); i++) {
054:                    ComponentAccess aclEntry = (ComponentAccess) acl.get(i);
055:                    String baseKey = aclEntry.getPrincipal().getGroupId() + ":"
056:                            + aclEntry.getPrincipal().getId();
057:                    int j = 0;
058:                    do {
059:                        j++;
060:                    } while (sorter.get(baseKey + new Integer(j).toString()) != null);
061:                    sorter.put(baseKey + new Integer(j).toString(), aclEntry);
062:                }
063:                Iterator it = sorter.values().iterator();
064:                for (int i = 0; it.hasNext(); i++) {
065:                    ComponentAccess aclEntry = (ComponentAccess) it.next();
066:                    data[i][0] = aclEntry;
067:                    data[i][1] = aclEntry;
068:                    data[i][2] = aclEntry;
069:                    data[i][3] = aclEntry;
070:                }
071:                fireTableDataChanged();
072:            }
073:
074:            public int getColumnCount() {
075:                return columnNames.length;
076:            }
077:
078:            public int getRowCount() {
079:                return data.length;
080:            }
081:
082:            public String getColumnName(int col) {
083:                return columnNames[col];
084:            }
085:
086:            public Object getValueAt(int row, int col) {
087:                return data[row][col];
088:            }
089:
090:            public Class getColumnClass(int c) {
091:                return getValueAt(0, c).getClass();
092:            }
093:
094:            public boolean isCellEditable(int row, int col) {
095:                // Note that the data/cell address is constant,
096:                // no matter where the cell appears onscreen.
097:                if ((col == 2) || (col == 3)) {
098:                    return editable;
099:                }
100:                return false;
101:            }
102:
103:            public void setEditable(boolean editable) {
104:                this .editable = editable;
105:            }
106:
107:            public void setValueAt(Object value, int row, int col) {
108:                if (value != null) {
109:                    data[row][col] = value;
110:                    addAclEntry((ComponentAccess) value);
111:                    fireTableCellUpdated(row, col);
112:                }
113:            }
114:
115:            public ContelligentComponent getComponent() {
116:                return component;
117:            }
118:
119:            public void addAclEntry(ComponentAccess entry) {
120:                component.addAclEntry(entry);
121:                updateData();
122:            }
123:
124:            public void removeAclEntry(ComponentAccess entry) {
125:                component.removeAclEntry(entry);
126:                updateData();
127:            }
128:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.