1// BEGIN LICENSE BLOCK
2// Version: CMPL 1.1
3//
4// The contents of this file are subject to the Cisco-style Mozilla Public
5// License Version 1.1 (the "License"); you may not use this file except
6// in compliance with the License.  You may obtain a copy of the License
7// at www.eclipse-clp.org/license.
8//
9// Software distributed under the License is distributed on an "AS IS"
10// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
11// the License for the specific language governing rights and limitations
12// under the License.
13//
14// The Original Code is  CPViz Constraint Visualization System
15// The Initial Developer of the Original Code is  Helmut Simonis
16// Portions created by the Initial Developer are
17// Copyright (C) 2009-2010 Helmut Simonis
18//
19// Contributor(s): 	Helmut Simonis, 4C, Univerity College Cork, Cork
20//
21//
22// END LICENSE BLOCK
23// ----------------------------------------------------------------------
24package ie.ucc.cccc.viz;
25
26/**
27 * Utility class to store the parameter information about a visualizer
28 * @author hsimonis
29 *
30 */
31public class VisualContext {
32	private int id;
33	private String type;
34	private String display;
35	private int x;
36	private int y;
37	private int width;
38	private int height;
39	private String group;
40	private int min;
41	private int max;
42	private int indexStart;
43	/**
44	 * the width of the total drawing area for this visualizer
45	 */
46	private int boxWidth=1;
47	/**
48	 * the height of the total drawing area of this visualizer
49	 */
50	private int boxHeight=1;
51
52	@Override public String toString() {
53		return "Context Id "+ id + " type "+ type + " display "+ display +
54		" x "+ x + " y "+ y + " width "+ width + " height "+ height +
55		" group "+ group + " min "+ min + " max "+ max;
56	}
57	public VisualContext(int id,String type,String display,
58			int x, int y, int width, int height,
59			String group,
60			int min,int max,int indexStart) {
61		this.id = id;
62		this.type = type;
63		this.display = display;
64		this.x = x;
65		this.y = y;
66		setWidth(width);
67		setHeight(height);
68		this.group = group;
69		this.min = min;
70		this.max = max;
71		this.indexStart = indexStart;
72//		System.out.println("Index start "+indexStart);
73	}
74
75	public int getId() {
76		return id;
77	}
78	public String getType() {
79		return type;
80	}
81	public String getDisplay() {
82		return display;
83	}
84	public int getX() {
85		return x;
86	}
87	public int getY() {
88		return y;
89	}
90	public int getWidth() {
91		return width;
92	}
93	public int getHeight() {
94		return height;
95	}
96	public int getBoxWidth() {
97		return boxWidth;
98	}
99	public int getBoxHeight() {
100		return boxHeight;
101	}
102	public int getMin() {
103		return min;
104	}
105	public int getMax() {
106		return max;
107	}
108	public int getIndexStart() {
109		return indexStart;
110	}
111	public String getGroup() {
112		return group;
113	}
114
115	public void setWidth(int width) {
116		this.width = width;
117		boxWidth = Math.max(boxWidth,width+2);
118	}
119	public void setHeight(int height) {
120		this.height = height;
121		boxHeight = Math.max(boxHeight,height+2);
122	}
123	public void setBoxWidth(int width) {
124		this.boxWidth = width;
125	}
126	public void setBoxHeight(int height) {
127		this.boxHeight = height;
128	}
129	public void setMin(int min) {
130		this.min = min;
131	}
132	public void setMax(int max) {
133		this.max = max;
134	}
135	public Box getBox() {
136		return new Box(getX(),getY(),getBoxWidth(),getBoxHeight());
137	}
138}
139