KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jcckit > graphic > BasicGraphicalElement


1 /*
2  * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
3  *
4  * This library is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation; either version 2.1 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details
13  * (http://www.gnu.org/copyleft/lesser.html).
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package jcckit.graphic;
20
21 /**
22  * Abstract superclass of all basic {@link GraphicalElement
23  * GraphicalElements}. Concrete subclasses have to implement
24  * the method {@link GraphicalElement#renderWith}.
25  *
26  * @author Franz-Josef Elmer
27  */

28 public abstract class BasicGraphicalElement implements GraphicalElement {
29   private final GraphicAttributes _attributes;
30
31   /**
32    * Creates an instance with the specified drawing attributes.
33    * Note, that a {@link Renderer} should use default attributes
34    * in the case no attributes are defined.
35    * @param attributes Drawing attributes or <tt>null</tt> if undefined.
36    */

37   public BasicGraphicalElement(GraphicAttributes attributes) {
38     _attributes = attributes;
39   }
40
41   /**
42    * Returns the drawing attributes.
43    * @return <tt>null</tt> if undefined.
44    */

45   public GraphicAttributes getGraphicAttributes() {
46     return _attributes;
47   }
48
49   /**
50    * Returns whether this basic graphical element has a closed shape
51    * or not. By default always <tt>true</tt>. Subclasses may override
52    * this behaviour.
53    * @return <tt>true</tt> if the shape is closed.
54    */

55   public boolean isClosed() {
56     return true;
57   }
58 }
59
Popular Tags