Source Code Cross Referenced for GroupElement.java in  » IDE-Eclipse » ui-examples » org » eclipse » ui » examples » propertysheet » 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 » IDE Eclipse » ui examples » org.eclipse.ui.examples.propertysheet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2006 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.ui.examples.propertysheet;
011:
012:        import java.util.Vector;
013:
014:        import org.eclipse.swt.graphics.RGB;
015:
016:        /**
017:         * A Group Element
018:         */
019:        public class GroupElement extends OrganizationElement {
020:            public static String P_USERS = "users"; //$NON-NLS-1$
021:
022:            public static String P_SUBGROUPS = "subgroups"; //$NON-NLS-1$
023:
024:            public static String P_CONTENTS = "contents"; //$NON-NLS-1$
025:
026:            private Vector subGroups;
027:
028:            private Vector users;
029:
030:            // must be synchronized to contain both the references of subGroups and users
031:            private Vector contents;
032:
033:            /**
034:             * Constructor.
035:             * Creates a new GroupElement within the passed parent GroupElement,
036:             * gives it the passed name property, sets Icon.
037:             *
038:             * @param name the name 
039:             * @param parent the parent
040:             */
041:            public GroupElement(String name, GroupElement parent) {
042:                super (name, parent);
043:            }
044:
045:            /**
046:             * Adds an OrganizationElement to this GroupElement.
047:             *
048:             * @param userGroup The Organization Element
049:             */
050:            public void add(OrganizationElement userGroup) {
051:                if (userGroup.isUser() || userGroup.isGroup()) {
052:                    getContents().add(userGroup);
053:                }
054:                if (userGroup.isGroup()) {
055:                    getSubGroups().add(userGroup);
056:                    // synchronizes backpointer of userGroup: defensive
057:                    userGroup.setParent(this );
058:                }
059:                if (userGroup.isUser()) {
060:                    getUsers().add(userGroup);
061:                    // synchronizes backpointer of userGroup: defensive
062:                    userGroup.setParent(this );
063:                }
064:
065:            }
066:
067:            /**
068:             * Creates a new <code>GroupElement</code>
069:             * nested in this <code>GroupElement<code>
070:             *
071:             * @param name the name of the sub group
072:             */
073:            public GroupElement createSubGroup(String name) {
074:                GroupElement newGroup = new GroupElement(name, this );
075:                add(newGroup);
076:                return newGroup;
077:            }
078:
079:            /**
080:             * Creates a new <code>UserElement</code>
081:             *
082:             * @param the name of the user element
083:             */
084:            public UserElement createUser(String name) {
085:                UserElement newUser = new UserElement(name, this );
086:                add(newUser);
087:                return newUser;
088:            }
089:
090:            /**
091:             * Deletes an OrganizationElement from this GroupElement.
092:             *
093:             * @param userGroup the Organization Element
094:             */
095:            public void delete(OrganizationElement userGroup) {
096:                if (userGroup.isUser() || userGroup.isGroup()) {
097:                    getContents().remove(userGroup);
098:                }
099:                if (userGroup.isGroup()) {
100:                    getSubGroups().remove(userGroup);
101:                    // synchronizes backpointer of userGroup: defensive
102:                }
103:                if (userGroup.isUser()) {
104:                    getUsers().remove(userGroup);
105:                    // synchronizes backpointer of userGroup: defensive
106:                }
107:            }
108:
109:            /* (non-Javadoc)
110:             * Method declared on IWorkbenchAdapter
111:             */
112:            public Object[] getChildren(Object o) {
113:                return getContents().toArray();
114:            }
115:
116:            /**
117:             * Returns the content
118:             */
119:            private Vector getContents() {
120:                if (contents == null)
121:                    contents = new Vector();
122:                return contents;
123:            }
124:
125:            /* (non-Javadoc)
126:             * Method declared on IPropertySource
127:             */
128:            public Object getEditableValue() {
129:                return this .toString();
130:            }
131:
132:            /**
133:             * Returns the error message
134:             */
135:            public String getErrorMessage() {
136:                return null;
137:            }
138:
139:            /**
140:             * Returns the subgroups
141:             */
142:            private Vector getSubGroups() {
143:                if (subGroups == null)
144:                    subGroups = new Vector();
145:                return subGroups;
146:            }
147:
148:            /**
149:             * Returns the users
150:             */
151:            private Vector getUsers() {
152:                if (users == null)
153:                    users = new Vector();
154:                return users;
155:            }
156:
157:            /* (non-Javadoc)
158:             * Method declared on OrganizationElement
159:             */
160:            public boolean isGroup() {
161:                return true;
162:            }
163:
164:            /* (non-Javadoc)
165:             * @see org.eclipse.ui.model.IWorkbenchAdapter#getForeground(java.lang.Object)
166:             */
167:            public RGB getForeground(Object element) {
168:                return null;
169:            }
170:
171:            /* (non-Javadoc)
172:             * @see org.eclipse.ui.model.IWorkbenchAdapter#getBackground(java.lang.Object)
173:             */
174:            public RGB getBackground(Object element) {
175:                return null;
176:            }
177:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.