View Javadoc

1   /**********************************************
2    * Copyright (C) 2009 Lukas Laag
3    * This file is part of Vectomatic.
4    * 
5    * Vectomatic is free software: you can redistribute it and/or modify
6    * it under the terms of the GNU General Public License as published by
7    * the Free Software Foundation, either version 3 of the License, or
8    * (at your option) any later version.
9    * 
10   * Vectomatic 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
13   * GNU General Public License for more details.
14   * 
15   * You should have received a copy of the GNU General Public License
16   * along with Vectomatic.  If not, see http://www.gnu.org/licenses/
17   **********************************************/
18  package org.vectomatic.common.rpc;
19  
20  import org.vectomatic.common.model.Shape;
21  import org.vectomatic.common.model.style.PaletteList;
22  
23  import com.google.gwt.user.client.rpc.IsSerializable;
24  
25  public class Representation implements IsSerializable {
26  	private int _width;						// WIDTH
27  	private int _height;					// HEIGHT
28  	private String _description;			// DESCRIPTION
29  	private String _name;
30  	private Shape[] _shapeArray;
31  	private PaletteList _palettes;
32  	public static final int DEFAULT_DRAWING_WIDTH = 640;
33  	public static final int DEFAULT_DRAWING_HEIGHT = 400;
34  
35  	///////////////////////////////////////
36  	// Constructors
37  	///////////////////////////////////////
38  	
39  	public Representation() {
40  	}
41  	
42  	public Representation(int width, int height, String description) {
43  		_width = width;
44  		_height = height;
45  		_description = description;
46  	}
47  	
48  	///////////////////////////////////////
49  	// Persistent Properties
50  	///////////////////////////////////////
51  	public void setWidth(int width) {
52  		_width = width;
53  	}
54  	public int getWidth() {
55  		return _width;
56  	}
57  	public void setHeight(int height) {
58  		_height = height;
59  	}
60  	public int getHeight() {
61  		return _height;
62  	}
63  	public void setDescription(String description) {
64  		_description = description;
65  	}
66  	public String getDescription() {
67  		return _description;
68  	}
69  	public String getName() {
70  		return _name;
71  	}
72  	public void setName(String name) {
73  		_name = name;
74  	}
75  
76  	///////////////////////////////////////
77  	// Non Persistent Properties
78  	///////////////////////////////////////
79  	
80  	public void setShapes(Shape[] shapeArray) {
81  		_shapeArray = shapeArray;
82  	}
83  	public Shape[] getShapes() {
84  		return _shapeArray;
85  	}
86  	public void setPalettes(PaletteList palettes) {
87  		_palettes = palettes;
88  	}
89  	public PaletteList getPalettes() {
90  		return _palettes;
91  	}
92  	
93  	///////////////////////////////////////
94  	// Debugging
95  	///////////////////////////////////////
96  	@Override
97  	public String toString() {
98  		StringBuffer buffer = new StringBuffer("Representation {width = ");
99  		buffer.append(_width);
100 		buffer.append("; height = ");
101 		buffer.append(_height);
102 		buffer.append("; description = ");
103 		buffer.append(_description);
104 		buffer.append(" }");
105 		return buffer.toString();
106 	}
107 
108 }