KickJava   Java API By Example, From Geeks To Geeks.

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


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.Layer;
32
33 public class LayerImpl
34 extends DrawComponentContainerImpl
35 implements Layer
36 {
37   protected static final boolean VISIBLE_EDEFAULT = true;
38   protected boolean visible = VISIBLE_EDEFAULT;
39
40   protected static final boolean EDITABLE_EDEFAULT = true;
41   protected boolean editable = EDITABLE_EDEFAULT;
42
43   public LayerImpl() {
44         super();
45     }
46
47   public boolean isVisible() {
48         return visible;
49     }
50   public void setVisible(boolean newVisible) {
51         boolean oldVisible = visible;
52         visible = newVisible;
53         firePropertyChange(PROP_VISIBLE, oldVisible, visible);
54     }
55
56   public boolean isEditable() {
57         return editable;
58     }
59   public void setEditable(boolean newEditable) {
60         boolean oldEditable = editable;
61         editable = newEditable;
62         firePropertyChange(PROP_EDITABLE, oldEditable, editable);
63     }
64
65   public String JavaDoc toString()
66   {
67         StringBuffer JavaDoc result = new StringBuffer JavaDoc(super.toString());
68         result.append(" (visible: ");
69         result.append(visible);
70         result.append(", editable: ");
71         result.append(editable);
72         result.append(')');
73         return result.toString();
74     }
75
76 // public String getTypeName() {
77
// return ModelPlugin.getResourceString("type.layer");
78
// }
79
public String JavaDoc getTypeName() {
80     return "Layer";
81   }
82   
83   // does noting to avoid bounds calculation each time something
84
public void notifyChildTransform(DrawComponent child)
85     {
86         
87     }
88     
89     public Object JavaDoc clone(DrawComponentContainer parent)
90     {
91         LayerImpl layer = (LayerImpl) super.clone(parent);
92         return layer;
93     }
94     
95 // public DrawComponent clone()
96
// {
97
// Layer layer = new LayerImpl();
98
// layer = (Layer) assign(layer);
99
// layer.setVisible(isVisible());
100
// layer.setEditable(isEditable());
101
// return layer;
102
// }
103

104 } //LayerImpl
105
Popular Tags