1 /* 2 * Copyright (c) 2006 Stiftung Deutsches Elektronen-Synchroton, 3 * Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY. 4 * 5 * THIS SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "../AS IS" BASIS. 6 * WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED 7 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSE AND 8 * NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 9 * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 10 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 11 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. SHOULD THE SOFTWARE PROVE DEFECTIVE 12 * IN ANY RESPECT, THE USER ASSUMES THE COST OF ANY NECESSARY SERVICING, REPAIR OR 13 * CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. 14 * NO USE OF ANY SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 15 * DESY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, 16 * OR MODIFICATIONS. 17 * THE FULL LICENSE SPECIFYING FOR THE SOFTWARE THE REDISTRIBUTION, MODIFICATION, 18 * USAGE AND OTHER RIGHTS AND OBLIGATIONS IS INCLUDED WITH THE DISTRIBUTION OF THIS 19 * PROJECT IN THE FILE LICENSE.HTML. IF THE LICENSE IS NOT INCLUDED YOU MAY FIND A COPY 20 * AT HTTP://WWW.DESY.DE/LEGAL/LICENSE.HTM 21 */ 22 23 package de.desy.acop.displayers.tools; 24 25 import java.awt.Color; 26 27 import com.cosylab.gui.adapters.Converter; 28 29 import de.desy.acop.chart.Acop; 30 import de.desy.acop.chart.AcopDisplayMode; 31 import de.desy.acop.chart.AcopDrawStyleEnum; 32 import de.desy.acop.transport.ConnectionParameters; 33 34 /** 35 * <code>AcopGraphParameters</code> is an extension of 36 * <code>AcopDisplayerParameters</code> which also hold data about 37 * visualization of a single graph in a chart. This parameters are intended 38 * for use with <code>AcopChart</code> and only hold information that can be 39 * read by the AcopChart object. 40 * 41 * @author <a href="mailto:jaka.bobnar@cosylab.com">Jaka Bobnar</a> 42 * @version $Id: Templates.xml,v 1.10 2004/01/13 16:17:13 jbobnar Exp $ 43 * 44 */ 45 public class AcopGraphParameters extends AcopDisplayerParameters { 46 47 private static final long serialVersionUID = -7187249526651411944L; 48 49 /** 50 * Constructs a new AcopGraphParameters object. 51 * 52 */ 53 public AcopGraphParameters() { 54 this((ConnectionParameters)null, null, -1, -1, -1, 1, false, 100, null); 55 } 56 57 /** 58 * Constructs a new AcopGraphParameters object with the given connection point. 59 * 60 * @param param remote connection point 61 */ 62 public AcopGraphParameters(ConnectionParameters param) { 63 this (param, null, -1, -1, -1,1, false, 100, null); 64 } 65 66 /** 67 * Constructs a new AcopGraphParameters object with the specified parameters values 68 * 69 * @param parameters remote connection point 70 * @param color color of the graph 71 * @param fft acop fft mode 72 * @param drawStyle style of the graph 73 * @param mode acop graph mode 74 * @param width the width of the line 75 * @param trend a flag indicating if this is a trend graph 76 * @param trendLength number of trend points if this is a trend 77 * @see Acop 78 */ 79 public AcopGraphParameters(ConnectionParameters parameters, Color color, int fft, int drawStyle, int mode, int width, boolean trend, int trendLength) { 80 this(parameters,-1,Double.NaN,Double.NaN,null,null,color, fft, drawStyle, mode, width, trend, trendLength, null); 81 } 82 83 /** 84 * Constructs a new AcopGraphParameters object with the specified parameters values 85 * 86 * @param parameters remote connection point 87 * @param color color of the graph 88 * @param fft acop fft mode 89 * @param drawStyle style of the graph 90 * @param mode acop graph mode 91 * @param width the width of the line 92 * @param trend a flag indicating if this is a trend graph 93 * @param trendLength number of trend points if this is a trend 94 * @param converter converter associated with this connection point 95 * @see Acop 96 */ 97 public AcopGraphParameters(ConnectionParameters parameters, Color color, int fft, int drawStyle, int mode, int width, boolean trend, int trendLength, Converter converter) { 98 this(parameters,-1,Double.NaN,Double.NaN,null,null,color, fft, drawStyle, mode, width, trend, trendLength, converter); 99 } 100 101 /** 102 * Constructs a new AcopGraphParameters object with the specified parameters values 103 * 104 * @param parameters remote connection point 105 * @param index index of the value in the array if this is a spectrum 106 * @param min minimum value 107 * @param max maximum value 108 * @param units physical units 109 * @param format C-style format 110 * @param color color of the graph 111 * @param fft acop fft mode 112 * @param drawStyle style of the graph 113 * @param mode acop graph mode 114 * @param width the width of the line 115 * @param trend a flag indicating if this is a trend graph 116 * @param trendLength number of trend points if this is a trend 117 * @param converter converter associated with this connection point 118 * @see Acop 119 * 120 */ 121 protected AcopGraphParameters(ConnectionParameters parameters, int index, double min, double max, String units, String format, Color color, int fft, int drawStyle, int mode, int width, boolean trend, int trendLength, Converter converter) { 122 super(parameters,index,min,max,units,format, converter); 123 values.put("color",color); 124 values.put("fft",fft); 125 values.put("drawStyle",drawStyle); 126 values.put("mode",mode); 127 values.put("width",width); 128 values.put("trend",trend); 129 values.put("trendLength",trendLength); 130 } 131 132 /** 133 * Constructs new AcopGraphParameters using the supplied parameters. 134 * 135 * @param adp 136 */ 137 public AcopGraphParameters (AcopDisplayerParameters adp) { 138 this(adp, null, -1, -1, -1, 1, false, 100, null); 139 } 140 141 /** 142 * Constructs a new AcopGraphParameters object with the specified parameters values 143 * 144 * @param adp additional displayer parameters 145 * @param color color of the graph 146 * @param fft acop fft mode 147 * @param drawStyle style of the graph 148 * @param mode acop graph mode 149 * @param width the width of the line 150 * @param trend a flag indicating if this is a trend graph 151 * @param trendLength number of trend points if this is a trend 152 * @see Acop 153 */ 154 public AcopGraphParameters(AcopDisplayerParameters adp, Color color, int fft, int drawStyle, int mode, int width, boolean trend, int trendLength) { 155 this(adp.getConnectionParameters(), adp.getArrayIndex(), adp.getMinimum(), adp.getMaximum(), adp.getUnits(), adp.getFormat(), color, fft, drawStyle, mode, width, trend, trendLength, adp.getConverter()); 156 } 157 158 /** 159 * Constructs a new AcopGraphParameters object with the specified parameters values 160 * 161 * @param adp additional displayer parameters 162 * @param color color of the graph 163 * @param fft acop fft mode 164 * @param drawStyle style of the graph 165 * @param mode acop graph mode 166 * @param width the width of the line 167 * @param trend a flag indicating if this is a trend graph 168 * @param trendLength number of trend points if this is a trend 169 * @param converter converter associated with this connection point 170 * @see Acop 171 */ 172 public AcopGraphParameters(AcopDisplayerParameters adp, Color color, int fft, int drawStyle, int mode, int width, boolean trend, int trendLength, Converter converter) { 173 this(adp.getConnectionParameters(), adp.getArrayIndex(), adp.getMinimum(), adp.getMaximum(), adp.getUnits(), adp.getFormat(), color, fft, drawStyle, mode, width, trend, trendLength, converter); 174 } 175 176 /** 177 * Sets the color of the graph. 178 * 179 * @return the color 180 * @see Acop#setForeground(Color) 181 */ 182 public Color getColor() { 183 return (Color)values.get("color"); 184 } 185 186 /** 187 * Returns the acop fft mode. 188 * 189 * @return the fFT 190 * @see Acop#setFFT(int) 191 */ 192 public int getFFT() { 193 return getInt("fft"); 194 } 195 196 /** 197 * Returns the acop draw style. 198 * 199 * @return the graphStyle 200 * @see AcopDrawStyleEnum 201 * @see Acop#setDrawStyle(int) 202 */ 203 public int getDrawStyle() { 204 return getInt("drawStyle"); 205 } 206 207 /** 208 * Returns true if this is shown as a trend graph. 209 * 210 * @return is trend 211 */ 212 public boolean isTrend() { 213 return getBool("trend"); 214 } 215 216 /** 217 * Returns the number of points if this is a trend. 218 * 219 * @return the trend length 220 */ 221 public int getTrendLength() { 222 return getInt("trendLength"); 223 } 224 225 /** 226 * Returns the acop display mode. 227 * 228 * @return the mode 229 * @see AcopDisplayMode 230 * @see Acop#setDisplayMode(int) 231 */ 232 public int getMode() { 233 return getInt("mode"); 234 } 235 236 /** 237 * Returns the width of the graph line. 238 * 239 * @return the width 240 * @see Acop#setDrawWidth(int) 241 */ 242 public int getWidth() { 243 return getInt("width"); 244 } 245 } 246 247 248 /* __oOo__ */