KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nightlabs > editor2d > impl > LineDrawComponentImpl


1 /* *****************************************************************************
2  * NightLabs Editor2D - Graphical editor framework *
3  * Copyright (C) 2004-2005 NightLabs - http://NightLabs.org *
4  * *
5  * This library is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or (at your option) any later version. *
9  * *
10  * This library is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
13  * Lesser General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU Lesser General Public *
16  * License along with this library; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin St, Fifth Floor, *
19  * Boston, MA 02110-1301 USA *
20  * *
21  * Or get it online : *
22  * http://www.gnu.org/copyleft/lesser.html *
23  * *
24  * *
25  ******************************************************************************/

26
27 package org.nightlabs.editor2d.impl;
28
29 import org.nightlabs.editor2d.DrawComponent;
30 import org.nightlabs.editor2d.DrawComponentContainer;
31 import org.nightlabs.editor2d.EllipseDrawComponent;
32 import org.nightlabs.editor2d.LineDrawComponent;
33
34
35 public class LineDrawComponentImpl
36 extends ShapeDrawComponentImpl
37 implements LineDrawComponent
38 {
39     /**
40      * The default value of the '{@link #isConnect() <em>Connect</em>}' attribute.
41      * <!-- begin-user-doc -->
42    * <!-- end-user-doc -->
43      * @see #isConnect()
44      * @generated
45      * @ordered
46      */

47   protected static final boolean CONNECT_EDEFAULT = false;
48
49     /**
50      * The cached value of the '{@link #isConnect() <em>Connect</em>}' attribute.
51      * <!-- begin-user-doc -->
52    * <!-- end-user-doc -->
53      * @see #isConnect()
54      * @generated
55      * @ordered
56      */

57   protected boolean connect = CONNECT_EDEFAULT;
58
59     /**
60      * <!-- begin-user-doc -->
61    * <!-- end-user-doc -->
62      *
63      */

64   public LineDrawComponentImpl() {
65         super();
66     }
67
68     /**
69      * <!-- begin-user-doc -->
70    * <!-- end-user-doc -->
71      * @generated
72      */

73   public boolean isConnect() {
74         return connect;
75     }
76
77   /**
78    * <!-- begin-user-doc -->
79    * <!-- end-user-doc -->
80    *
81    */

82   public void setConnect(boolean newConnect)
83   {
84     boolean oldConnect = connect;
85     connect = newConnect;
86     
87     if (connect == true)
88       getGeneralShape().closePath();
89 // else
90
// generalShape = J2DUtil.removePathSegment(getGeneralShape(), getGeneralShape().getSize()-1);
91

92     firePropertyChange(PROP_CONNECT, oldConnect, connect);
93   }
94
95     /**
96      * <!-- begin-user-doc -->
97    * <!-- end-user-doc -->
98      * @generated
99      */

100   public String JavaDoc toString()
101   {
102         StringBuffer JavaDoc result = new StringBuffer JavaDoc(super.toString());
103         result.append(" (connect: ");
104         result.append(connect);
105         result.append(')');
106         return result.toString();
107     }
108
109 // public String getTypeName() {
110
// return ModelPlugin.getResourceString("type.line");
111
// }
112

113   public String JavaDoc getTypeName() {
114     return "Line";
115   }
116   
117 // public Object clone()
118
// {
119
// LineDrawComponentImpl line = (LineDrawComponentImpl) super.clone();
120
// return line;
121
// }
122

123   public Object JavaDoc clone(DrawComponentContainer parent)
124   {
125     LineDrawComponentImpl line = (LineDrawComponentImpl) super.clone(parent);
126     line.connect = connect;
127     return line;
128   }
129   
130 // public DrawComponent clone()
131
// {
132
// LineDrawComponent line = new LineDrawComponentImpl();
133
// line = (LineDrawComponent) assign(line);
134
// return line;
135
// }
136
//
137
// protected DrawComponent assign(DrawComponent dc)
138
// {
139
// super.assign(dc);
140
// if (dc instanceof LineDrawComponent) {
141
// LineDrawComponent line = (LineDrawComponent) dc;
142
// line.setConnect(isConnect());
143
// }
144
// return dc;
145
// }
146
} //LineDrawComponentImpl
147
Popular Tags