Source Code Cross Referenced for BoxImpl.java in  » GIS » udig-1.1 » net » refractions » udig » printing » model » impl » 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 » GIS » udig 1.1 » net.refractions.udig.printing.model.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * <copyright>
003:         * </copyright>
004:         *
005:         * $Id$
006:         */package net.refractions.udig.printing.model.impl;
007:
008:        import java.util.Collection;
009:        import java.util.List;
010:        import java.util.concurrent.CopyOnWriteArraySet;
011:
012:        import net.refractions.udig.printing.model.Box;
013:        import net.refractions.udig.printing.model.BoxPrinter;
014:        import net.refractions.udig.printing.model.Connection;
015:        import net.refractions.udig.printing.model.ModelPackage;
016:
017:        import org.eclipse.core.runtime.IAdaptable;
018:        import org.eclipse.draw2d.geometry.Dimension;
019:        import org.eclipse.draw2d.geometry.Point;
020:        import org.eclipse.emf.common.notify.Notification;
021:        import org.eclipse.emf.common.util.EList;
022:        import org.eclipse.emf.ecore.EClass;
023:        import org.eclipse.emf.ecore.EStructuralFeature;
024:        import org.eclipse.emf.ecore.impl.ENotificationImpl;
025:        import org.eclipse.emf.ecore.util.EObjectResolvingEList;
026:        import org.eclipse.jface.util.IPropertyChangeListener;
027:        import org.eclipse.jface.util.PropertyChangeEvent;
028:        import org.eclipse.swt.widgets.Display;
029:
030:        /**
031:         * <!-- begin-user-doc --> An implementation of the model object '<em><b>Box</b></em>'. <!--
032:         * end-user-doc -->
033:         * <p>
034:         * The following features are implemented:
035:         * <ul>
036:         *   <li>{@link net.refractions.udig.printing.model.impl.BoxImpl#getSourceConnections <em>Source Connections</em>}</li>
037:         *   <li>{@link net.refractions.udig.printing.model.impl.BoxImpl#getTargetConnections <em>Target Connections</em>}</li>
038:         *   <li>{@link net.refractions.udig.printing.model.impl.BoxImpl#getBoxPrinter <em>Box Printer</em>}</li>
039:         *   <li>{@link net.refractions.udig.printing.model.impl.BoxImpl#getID <em>ID</em>}</li>
040:         * </ul>
041:         * </p>
042:         *
043:         * @generated
044:         */
045:        public class BoxImpl extends ElementImpl implements  Box, IAdaptable {
046:
047:            /**
048:             * The cached value of the '{@link #getSourceConnections() <em>Source Connections</em>}' reference list.
049:             * <!-- begin-user-doc --> <!-- end-user-doc -->
050:             * @see #getSourceConnections()
051:             * @generated
052:             * @ordered
053:             */
054:            protected EList sourceConnections = null;
055:
056:            /**
057:             * The cached value of the '{@link #getTargetConnections() <em>Target Connections</em>}' reference list.
058:             * <!-- begin-user-doc --> <!-- end-user-doc -->
059:             * @see #getTargetConnections()
060:             * @generated
061:             * @ordered
062:             */
063:            protected EList targetConnections = null;
064:
065:            /**
066:             * The default value of the '{@link #getBoxPrinter() <em>Box Printer</em>}' attribute. <!--
067:             * begin-user-doc --> <!-- end-user-doc -->
068:             * 
069:             * @see #getBoxPrinter()
070:             * @generated
071:             * @ordered
072:             */
073:            protected static final BoxPrinter BOX_PRINTER_EDEFAULT = null;
074:
075:            /**
076:             * The cached value of the '{@link #getBoxPrinter() <em>Box Printer</em>}' attribute. <!--
077:             * begin-user-doc --> <!-- end-user-doc -->
078:             * 
079:             * @see #getBoxPrinter()
080:             * @generated
081:             * @ordered
082:             */
083:            protected BoxPrinter boxPrinter = BOX_PRINTER_EDEFAULT;
084:
085:            /**
086:             * The default value of the '{@link #getID() <em>ID</em>}' attribute.
087:             * <!-- begin-user-doc -->
088:             * <!-- end-user-doc -->
089:             * @see #getID()
090:             * @generated
091:             * @ordered
092:             */
093:            protected static final String ID_EDEFAULT = null;
094:
095:            /**
096:             * The cached value of the '{@link #getID() <em>ID</em>}' attribute.
097:             * <!-- begin-user-doc -->
098:             * <!-- end-user-doc -->
099:             * @see #getID()
100:             * @generated
101:             * @ordered
102:             */
103:            protected String iD = ID_EDEFAULT;
104:
105:            /**
106:             * <!-- begin-user-doc --> <!-- end-user-doc -->
107:             * 
108:             * @generated NOT
109:             */
110:            public BoxImpl() {
111:                super ();
112:            }
113:
114:            /**
115:             * <!-- begin-user-doc --> <!-- end-user-doc -->
116:             * @generated
117:             */
118:            protected EClass eStaticClass() {
119:                return ModelPackage.eINSTANCE.getBox();
120:            }
121:
122:            /**
123:             * <!-- begin-user-doc --> <!-- end-user-doc -->
124:             * @generated
125:             */
126:            public List getSourceConnections() {
127:                if (sourceConnections == null) {
128:                    sourceConnections = new EObjectResolvingEList(
129:                            Connection.class, this ,
130:                            ModelPackage.BOX__SOURCE_CONNECTIONS);
131:                }
132:                return sourceConnections;
133:            }
134:
135:            /**
136:             * <!-- begin-user-doc --> <!-- end-user-doc -->
137:             * @generated
138:             */
139:            public List getTargetConnections() {
140:                if (targetConnections == null) {
141:                    targetConnections = new EObjectResolvingEList(
142:                            Connection.class, this ,
143:                            ModelPackage.BOX__TARGET_CONNECTIONS);
144:                }
145:                return targetConnections;
146:            }
147:
148:            /**
149:             * <!-- begin-user-doc --> <!-- end-user-doc -->
150:             * @generated
151:             */
152:            public BoxPrinter getBoxPrinter() {
153:                return boxPrinter;
154:            }
155:
156:            public void setBoxPrinter(BoxPrinter value) {
157:                value.setBox(this );
158:                setBoxPrinterGen(value);
159:            }
160:
161:            /**
162:             * <!-- begin-user-doc --> <!-- end-user-doc -->
163:             * @generated
164:             */
165:            public void setBoxPrinterGen(BoxPrinter newBoxPrinter) {
166:                BoxPrinter oldBoxPrinter = boxPrinter;
167:                boxPrinter = newBoxPrinter;
168:                if (eNotificationRequired())
169:                    eNotify(new ENotificationImpl(this , Notification.SET,
170:                            ModelPackage.BOX__BOX_PRINTER, oldBoxPrinter,
171:                            boxPrinter));
172:            }
173:
174:            /**
175:             * <!-- begin-user-doc -->
176:             * <!-- end-user-doc -->
177:             * @generated
178:             */
179:            public String getID() {
180:                return iD;
181:            }
182:
183:            /**
184:             * <!-- begin-user-doc -->
185:             * <!-- end-user-doc -->
186:             * @generated
187:             */
188:            public void setID(String newID) {
189:                String oldID = iD;
190:                iD = newID;
191:                if (eNotificationRequired())
192:                    eNotify(new ENotificationImpl(this , Notification.SET,
193:                            ModelPackage.BOX__ID, oldID, iD));
194:            }
195:
196:            /**
197:             * <!-- begin-user-doc --> <!-- end-user-doc -->
198:             * @generated
199:             */
200:            public Object eGet(EStructuralFeature eFeature, boolean resolve) {
201:                switch (eDerivedStructuralFeatureID(eFeature)) {
202:                case ModelPackage.BOX__LOCATION:
203:                    return getLocation();
204:                case ModelPackage.BOX__SIZE:
205:                    return getSize();
206:                case ModelPackage.BOX__SOURCE_CONNECTIONS:
207:                    return getSourceConnections();
208:                case ModelPackage.BOX__TARGET_CONNECTIONS:
209:                    return getTargetConnections();
210:                case ModelPackage.BOX__BOX_PRINTER:
211:                    return getBoxPrinter();
212:                case ModelPackage.BOX__ID:
213:                    return getID();
214:                }
215:                return eDynamicGet(eFeature, resolve);
216:            }
217:
218:            /**
219:             * <!-- begin-user-doc --> <!-- end-user-doc -->
220:             * @generated
221:             */
222:            public void eSet(EStructuralFeature eFeature, Object newValue) {
223:                switch (eDerivedStructuralFeatureID(eFeature)) {
224:                case ModelPackage.BOX__LOCATION:
225:                    setLocation((Point) newValue);
226:                    return;
227:                case ModelPackage.BOX__SIZE:
228:                    setSize((Dimension) newValue);
229:                    return;
230:                case ModelPackage.BOX__SOURCE_CONNECTIONS:
231:                    getSourceConnections().clear();
232:                    getSourceConnections().addAll((Collection) newValue);
233:                    return;
234:                case ModelPackage.BOX__TARGET_CONNECTIONS:
235:                    getTargetConnections().clear();
236:                    getTargetConnections().addAll((Collection) newValue);
237:                    return;
238:                case ModelPackage.BOX__BOX_PRINTER:
239:                    setBoxPrinter((BoxPrinter) newValue);
240:                    return;
241:                case ModelPackage.BOX__ID:
242:                    setID((String) newValue);
243:                    return;
244:                }
245:                eDynamicSet(eFeature, newValue);
246:            }
247:
248:            /**
249:             * <!-- begin-user-doc --> <!-- end-user-doc -->
250:             * @generated
251:             */
252:            public void eUnset(EStructuralFeature eFeature) {
253:                switch (eDerivedStructuralFeatureID(eFeature)) {
254:                case ModelPackage.BOX__LOCATION:
255:                    setLocation(LOCATION_EDEFAULT);
256:                    return;
257:                case ModelPackage.BOX__SIZE:
258:                    setSize(SIZE_EDEFAULT);
259:                    return;
260:                case ModelPackage.BOX__SOURCE_CONNECTIONS:
261:                    getSourceConnections().clear();
262:                    return;
263:                case ModelPackage.BOX__TARGET_CONNECTIONS:
264:                    getTargetConnections().clear();
265:                    return;
266:                case ModelPackage.BOX__BOX_PRINTER:
267:                    setBoxPrinter(BOX_PRINTER_EDEFAULT);
268:                    return;
269:                case ModelPackage.BOX__ID:
270:                    setID(ID_EDEFAULT);
271:                    return;
272:                }
273:                eDynamicUnset(eFeature);
274:            }
275:
276:            /**
277:             * <!-- begin-user-doc --> <!-- end-user-doc -->
278:             * @generated
279:             */
280:            public boolean eIsSet(EStructuralFeature eFeature) {
281:                switch (eDerivedStructuralFeatureID(eFeature)) {
282:                case ModelPackage.BOX__LOCATION:
283:                    return LOCATION_EDEFAULT == null ? location != null
284:                            : !LOCATION_EDEFAULT.equals(location);
285:                case ModelPackage.BOX__SIZE:
286:                    return SIZE_EDEFAULT == null ? size != null
287:                            : !SIZE_EDEFAULT.equals(size);
288:                case ModelPackage.BOX__SOURCE_CONNECTIONS:
289:                    return sourceConnections != null
290:                            && !sourceConnections.isEmpty();
291:                case ModelPackage.BOX__TARGET_CONNECTIONS:
292:                    return targetConnections != null
293:                            && !targetConnections.isEmpty();
294:                case ModelPackage.BOX__BOX_PRINTER:
295:                    return BOX_PRINTER_EDEFAULT == null ? boxPrinter != null
296:                            : !BOX_PRINTER_EDEFAULT.equals(boxPrinter);
297:                case ModelPackage.BOX__ID:
298:                    return ID_EDEFAULT == null ? iD != null : !ID_EDEFAULT
299:                            .equals(iD);
300:                }
301:                return eDynamicIsSet(eFeature);
302:            }
303:
304:            /**
305:             * <!-- begin-user-doc --> <!-- end-user-doc -->
306:             * @generated
307:             */
308:            public String toString() {
309:                if (eIsProxy())
310:                    return super .toString();
311:
312:                StringBuffer result = new StringBuffer(super .toString());
313:                result.append(" (boxPrinter: "); //$NON-NLS-1$
314:                result.append(boxPrinter);
315:                result.append(", iD: "); //$NON-NLS-1$
316:                result.append(iD);
317:                result.append(')');
318:                return result.toString();
319:            }
320:
321:            public void add(Connection connection) {
322:                if (connection == null) {
323:                    throw new IllegalArgumentException(
324:                            "Connection cannot be null"); //$NON-NLS-1$
325:                }
326:
327:                if (connection.getTarget() == connection.getSource()) {
328:                    throw new IllegalArgumentException(
329:                            "Connection source and target cannot be the same"); //$NON-NLS-1$
330:                }
331:
332:                if (connection.getSource() == this ) {
333:                    getSourceConnections().add(connection);
334:                } else if (connection.getTarget() == this ) {
335:                    getTargetConnections().add(connection);
336:                }
337:            }
338:
339:            public void remove(Connection connection) {
340:                if (connection == null) {
341:                    throw new IllegalArgumentException(
342:                            "Connection cannot be null"); //$NON-NLS-1$
343:                }
344:
345:                if (connection.getSource() == this ) {
346:                    getSourceConnections().remove(connection);
347:                } else if (connection.getTarget() == this ) {
348:                    getTargetConnections().remove(connection);
349:                }
350:            }
351:
352:            CopyOnWriteArraySet<IPropertyChangeListener> listeners = new CopyOnWriteArraySet<IPropertyChangeListener>();
353:
354:            public void notifyPropertyChange(final PropertyChangeEvent event) {
355:                Display display = Display.getCurrent();
356:                if (display == null) {
357:                    Display.getDefault().asyncExec(new Runnable() {
358:                        public void run() {
359:                            for (IPropertyChangeListener l : listeners) {
360:                                l.propertyChange(event);
361:                            }
362:                        }
363:                    });
364:                } else {
365:                    for (IPropertyChangeListener l : listeners) {
366:                        l.propertyChange(event);
367:                    }
368:
369:                }
370:            }
371:
372:            public void addPropertyChangeListener(IPropertyChangeListener l) {
373:                listeners.add(l);
374:            }
375:
376:            public void removePropertyChangeListener(IPropertyChangeListener l) {
377:                listeners.remove(l);
378:            }
379:
380:            public Object getAdapter(Class adapter) {
381:                if (getBoxPrinter() instanceof  IAdaptable) {
382:                    return ((IAdaptable) getBoxPrinter()).getAdapter(adapter);
383:                }
384:                return null;
385:            }
386:
387:        } // BoxImpl
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.