Source Code Cross Referenced for PermissionsTreeCell.java in  » Content-Management-System » harmonise » org » openharmonise » him » serverconfig » permissions » tree » 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 » harmonise » org.openharmonise.him.serverconfig.permissions.tree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.him.serverconfig.permissions.tree;
020:
021:        import java.awt.Color;
022:        import java.awt.Component;
023:        import java.awt.Container;
024:        import java.awt.Dimension;
025:        import java.awt.LayoutManager;
026:        import java.awt.event.MouseEvent;
027:        import java.awt.event.MouseListener;
028:
029:        import javax.swing.Icon;
030:        import javax.swing.JCheckBox;
031:        import javax.swing.JLabel;
032:        import javax.swing.JPanel;
033:        import javax.swing.UIManager;
034:
035:        import org.openharmonise.vfs.metadata.value.*;
036:
037:        /**
038:         * Cell component for the permissions tree.
039:         * 
040:         * @author Matthew Large
041:         * @version $Revision: 1.1 $
042:         *
043:         */
044:        public class PermissionsTreeCell extends JPanel implements 
045:                MouseListener, LayoutManager {
046:
047:            /**
048:             * Icon for the cell.
049:             */
050:            private Icon m_icon = null;
051:
052:            /**
053:             * Name of the object/permission.
054:             */
055:            private String m_sText = null;
056:
057:            /**
058:             * Cell icon label.
059:             */
060:            private JLabel m_iconLabel = new JLabel();
061:
062:            /**
063:             * Cell text label.
064:             */
065:            private JLabel m_textLabel = new JLabel();
066:
067:            /**
068:             * Checkbox.
069:             */
070:            private JCheckBox m_checkBox = new JCheckBox();
071:
072:            /**
073:             * Tree node this cell is for.
074:             */
075:            private PermissionsTreeNode m_node = null;
076:
077:            /**
078:             * Constructs a new permissions tree cell.
079:             * 
080:             * @param node tree node this cell is for.
081:             * @param icon icon for this cell.
082:             * @param sText name of the object/permission.
083:             */
084:            public PermissionsTreeCell(PermissionsTreeNode node, Icon icon,
085:                    String sText) {
086:                super ();
087:                this .m_node = node;
088:                this .m_icon = icon;
089:                this .m_sText = sText;
090:                this .setup();
091:            }
092:
093:            /**
094:             * @param arg0
095:             */
096:            private PermissionsTreeCell(boolean arg0) {
097:                super (arg0);
098:            }
099:
100:            /**
101:             * @param arg0
102:             */
103:            private PermissionsTreeCell(LayoutManager arg0) {
104:                super (arg0);
105:            }
106:
107:            /**
108:             * @param arg0
109:             * @param arg1
110:             */
111:            private PermissionsTreeCell(LayoutManager arg0, boolean arg1) {
112:                super (arg0, arg1);
113:            }
114:
115:            /**
116:             * Initialises this component.
117:             *
118:             */
119:            private void setup() {
120:
121:                boolean bChecked = false;
122:
123:                this .setLayout(this );
124:                this .setBackground(Color.WHITE);
125:                this .m_textLabel.setFont(UIManager.getFont("Tree.font"));
126:
127:                this .m_textLabel.setEnabled(this .m_node.getEnabled());
128:
129:                this .m_iconLabel.setIcon(this .m_icon);
130:                this .m_iconLabel.setPreferredSize(new Dimension(20, 20));
131:                this .add(this .m_iconLabel);
132:                if (this .m_node.isLeaf()) {
133:                    this .m_textLabel.setText(this .m_sText);
134:                } else {
135:                    this .m_textLabel.setText(this .m_node.getDisplayName());
136:                }
137:                this .m_textLabel.setPreferredSize(new Dimension(
138:                        this .m_textLabel.getPreferredSize().width, 20));
139:                this .add(this .m_textLabel);
140:                this .m_checkBox.setPreferredSize(new Dimension(17, 20));
141:
142:                this .m_checkBox.setBackground(Color.WHITE);
143:                if (this .m_node.isLeaf()) {
144:                    this .add(this .m_checkBox);
145:                }
146:                if (this .m_node.isLeaf()) {
147:                    ValueValue valInst = (ValueValue) this .m_node
148:                            .getPropertyInstance().getNewValueInstance();
149:                    valInst.setValue(this .m_node.getValue().getHREF());
150:                    bChecked = this .m_node.getPropertyInstance().getValues()
151:                            .contains(valInst);
152:                    if (bChecked) {
153:                        this .m_checkBox.setSelected(true);
154:                    }
155:                } else if (!this .m_node.isLeaf()) {
156:
157:                }
158:            }
159:
160:            /* (non-Javadoc)
161:             * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
162:             */
163:            public void removeLayoutComponent(Component arg0) {
164:            }
165:
166:            /* (non-Javadoc)
167:             * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
168:             */
169:            public void layoutContainer(Container arg0) {
170:                int nWidth = 0;
171:                if (this .m_node.isLeaf()) {
172:                    this .m_checkBox.setSize(20, 20);
173:                }
174:                this .m_textLabel.setSize(this .m_textLabel.getPreferredSize());
175:                this .m_iconLabel.setSize(this .m_iconLabel.getPreferredSize());
176:
177:                this .m_iconLabel.setLocation(0, 0);
178:                nWidth = nWidth + 17;
179:                if (this .m_node.isLeaf()) {
180:                    this .m_checkBox.setLocation(nWidth, 0);
181:                    nWidth = nWidth + 22;
182:                }
183:                this .m_textLabel.setLocation(nWidth, 0);
184:            }
185:
186:            /* (non-Javadoc)
187:             * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
188:             */
189:            public void addLayoutComponent(String arg0, Component arg1) {
190:            }
191:
192:            /* (non-Javadoc)
193:             * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
194:             */
195:            public Dimension minimumLayoutSize(Container arg0) {
196:                return this .getPreferredSize();
197:            }
198:
199:            /* (non-Javadoc)
200:             * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
201:             */
202:            public Dimension preferredLayoutSize(Container arg0) {
203:                return this .getPreferredSize();
204:            }
205:
206:            /* (non-Javadoc)
207:             * @see java.awt.Component#getPreferredSize()
208:             */
209:            public Dimension getPreferredSize() {
210:                int nWidth = this .m_checkBox.getPreferredSize().width
211:                        + this .m_iconLabel.getPreferredSize().width
212:                        + this .m_textLabel.getPreferredSize().width;
213:                return new Dimension(nWidth + 3, 20);
214:            }
215:
216:            /* (non-Javadoc)
217:             * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
218:             */
219:            public void mouseClicked(MouseEvent me) {
220:                if (me.getPoint().x > this .m_checkBox.getLocation().x
221:                        && me.getPoint().x < this .m_checkBox.getLocation().x
222:                                + this .m_checkBox.getWidth()
223:                        && me.getPoint().y > this .m_checkBox.getLocation().y
224:                        && me.getPoint().y < this .m_checkBox.getLocation().y
225:                                + this .m_checkBox.getHeight()) {
226:                    if (this .m_checkBox.isSelected()) {
227:                        this .m_checkBox.setSelected(false);
228:                    } else {
229:                        this .m_checkBox.setSelected(true);
230:                    }
231:                }
232:            }
233:
234:            /* (non-Javadoc)
235:             * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
236:             */
237:            public void mouseEntered(MouseEvent arg0) {
238:            }
239:
240:            /* (non-Javadoc)
241:             * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
242:             */
243:            public void mouseExited(MouseEvent arg0) {
244:            }
245:
246:            /* (non-Javadoc)
247:             * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
248:             */
249:            public void mousePressed(MouseEvent arg0) {
250:            }
251:
252:            /* (non-Javadoc)
253:             * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
254:             */
255:            public void mouseReleased(MouseEvent arg0) {
256:            }
257:
258:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.