001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)XYProperties.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package org.openesb.tools.extchart.property.bar;
030:
031: import org.openesb.tools.extchart.property.JFChartConstants;
032: import org.openesb.tools.extpropertysheet.impl.ExtPropertyGroup;
033: import org.openesb.tools.extpropertysheet.impl.ExtPropertyOptions;
034:
035: /**
036: * XYProperties.java
037: *
038: * This class implements default management for xy-style charts.
039: *
040: * @author Chris Johnston
041: * @version :$Revision: 1.1 $
042: */
043:
044: public class XYProperties extends ExtPropertyGroup {
045:
046: /** the RCS id */
047: static final String RCS_ID = "$Id: XYProperties.java,v 1.1 2007/07/03 19:25:04 rahul_dwivedi Exp $";
048:
049: /** HORIZONTAL is a logical constant for calls. */
050: public static final int HORIZONTAL = 1;
051: /** VERTICAL is a logical constant for calls. */
052: public static final int VERTICAL = 0;
053:
054: /** ORIENTATION_KEY is the key for the default orientation default. */
055: public static final String ORIENTATION_KEY = "xd_orientation";
056:
057: /** DOMAIN_LABEL_KEY is the key for the domain label default. */
058: public static final String DOMAIN_LABEL_KEY = "xd_domainLabel";
059:
060: /** SHOW_DOMAIN_LABEL_KEY is the key for the show domain label default. */
061: public static final String SHOW_DOMAIN_LABEL_KEY = "xd_showDomainLabel";
062:
063: /** SHOW_RANGE_LABEL_KEY is the key for the range label default. */
064: public static final String RANGE_LABEL_KEY = "xd_rangeLabel";
065:
066: /** SHOW_RANGE_LABEL_KEY is the key for the show range label default. */
067: public static final String SHOW_RANGE_LABEL_KEY = "xd_showRangeLabel";
068:
069: /** DOMAIN_AXIS_KEY is the key for the domain axis label default. */
070: public static final String DOMAIN_AXIS_KEY = "xd_domainAxis";
071:
072: /** SHOW_DOMAIN_AXIS_KEY is the key for the show domain axis label default. */
073: public static final String SHOW_DOMAIN_AXIS_KEY = "xd_showDomainAxis";
074:
075: /** RANGE_AXIS_KEY is the key for the range axis label default. */
076: public static final String RANGE_AXIS_KEY = "xd_rangeAxis";
077:
078: /** SHOW_RANGE_AXIS_KEY is the key for the show range axis label default. */
079: public static final String SHOW_RANGE_AXIS_KEY = "xd_showRangeAxis";
080:
081: /** DEFAULT_XY_CHART_TITLE is used as a hard default. */
082: public static final String DEFAULT_XY_CHART_TITLE = "XY Chart";
083:
084: /** DEFAULT_ORIENTATION is used as a hard default. */
085: public static final int DEFAULT_ORIENTATION = VERTICAL;
086:
087: /** DEFAULT_SHOW_DOMAIN_LABEL is used as a hard default. */
088: public static final boolean DEFAULT_SHOW_DOMAIN_LABEL = true;
089:
090: /** DEFAULT_DOMAIN_LABEL is used as a hard default. */
091: public static final String DEFAULT_DOMAIN_LABEL = "domain";
092:
093: /** DEFAULT_SHOW_DOMAIN_AXIS is used as a hard default. */
094: public static final boolean DEFAULT_SHOW_DOMAIN_AXIS = true;
095:
096: /** DEFAULT_DOMAIN_AXIS is used as a hard default. */
097: public static final String DEFAULT_DOMAIN_AXIS = "domainAxis";
098:
099: /** DEFAULT_SHOW_RANGE_LABEL is used as a hard default. */
100: public static final boolean DEFAULT_SHOW_RANGE_LABEL = true;
101:
102: /** DEFAULT_RANGE_LABEL is used as a hard default. */
103: public static final String DEFAULT_RANGE_LABEL = "range";
104:
105: /** DEFAULT_SHOW_RANGE_AXIS is used as a hard default. */
106: public static final boolean DEFAULT_SHOW_RANGE_AXIS = true;
107:
108: /** DEFAULT_RANGE_AXIS is used as a hard default. */
109: public static final String DEFAULT_RANGE_AXIS = "rangeAxis";
110:
111: public static final String[] OR_HORIZONTAL = { "" + VERTICAL,
112: "" + HORIZONTAL
113:
114: };
115: public static final String[] OR_HORIZONTAL_DISPLAY = { "VERTICAL",
116: "HORIZONTAL"
117:
118: };
119: private static final ExtPropertyOptions ORIENTATION_OPTIONS = new ExtPropertyOptions(
120: OR_HORIZONTAL, OR_HORIZONTAL_DISPLAY);
121:
122: Object[] defaultObjects = { new Integer(DEFAULT_ORIENTATION),
123: DEFAULT_DOMAIN_LABEL,
124: Boolean.valueOf(DEFAULT_SHOW_DOMAIN_LABEL),
125: DEFAULT_RANGE_LABEL, Boolean.valueOf(SHOW_RANGE_LABEL_KEY),
126: DEFAULT_DOMAIN_AXIS, Boolean.valueOf(SHOW_DOMAIN_AXIS_KEY),
127: DEFAULT_RANGE_AXIS, Boolean.valueOf(SHOW_RANGE_AXIS_KEY) };
128:
129: /** MY_DEFAULT_KEYS are the keys for this object in array form. */
130: protected static final String[] MY_DEFAULT_KEYS = {
131: ORIENTATION_KEY, DOMAIN_LABEL_KEY, SHOW_DOMAIN_LABEL_KEY,
132: RANGE_LABEL_KEY, SHOW_RANGE_LABEL_KEY, DOMAIN_AXIS_KEY,
133: SHOW_DOMAIN_AXIS_KEY, RANGE_AXIS_KEY, SHOW_RANGE_AXIS_KEY };
134:
135: static final String[] XY_CHART_KEYS;
136: static {
137: //String[] superKeys = ChartDefaults.MY_DEFAULT_KEYS;
138: //String[] myKeys = new String[superKeys.length + MY_DEFAULT_KEYS.length];
139: String[] myKeys = new String[MY_DEFAULT_KEYS.length];
140: for (int n = 0; n < myKeys.length; n++) {
141: // if (n < superKeys.length) {
142: // myKeys[n] = superKeys[n];
143: // } else {
144: myKeys[n] = MY_DEFAULT_KEYS[n];
145: // }
146: }
147: XY_CHART_KEYS = myKeys;
148: }
149:
150: /**
151: * @see com.stc.ebam.server.chart.engine.view.ViewDefaults.getKeys()
152: */
153: public String[] getKeys() {
154: return XY_CHART_KEYS;
155: }
156:
157: /**
158: * The XYChartDefaults constructor is used to create an instance of this
159: * class.
160: */
161: public XYProperties() {
162: super ();
163: initDefault();
164: this .setGroupName(JFChartConstants.CHART_SPECIFIC_PROPERTIES);
165: }
166:
167: /**
168: * Init
169: */
170: public void initDefault() {
171: setOrientation(DEFAULT_ORIENTATION);
172: setShowDomainLabel(DEFAULT_SHOW_DOMAIN_LABEL);
173: setDomainLabel(DEFAULT_DOMAIN_LABEL);
174: setShowDomainAxis(DEFAULT_SHOW_DOMAIN_AXIS);
175: setDomainAxis(DEFAULT_DOMAIN_AXIS);
176: setShowRangeLabel(DEFAULT_SHOW_RANGE_LABEL);
177: setRangeLabel(DEFAULT_RANGE_LABEL);
178: setShowRangeAxis(DEFAULT_SHOW_RANGE_AXIS);
179: setRangeAxis(DEFAULT_RANGE_AXIS);
180: }
181:
182: /**
183: * Sets orientation
184: * @param orientation - orientation
185: */
186: public void setOrientation(int orientation) {
187: setProperty(ORIENTATION_KEY, new Integer(orientation),
188: ORIENTATION_OPTIONS);
189: }
190:
191: /**
192: * Returns orientation
193: * @return - orientation
194: */
195: public int getOrientation() {
196: Integer val = DEFAULT_ORIENTATION;
197: if (this .getPropertyValue(ORIENTATION_KEY) instanceof String) {
198: val = new Integer((String) this
199: .getPropertyValue(ORIENTATION_KEY));
200: } else {
201: val = (Integer) this .getPropertyValue(ORIENTATION_KEY);
202: }
203: if (val != null) {
204: return val.intValue();
205: }
206:
207: //return default??
208: return DEFAULT_ORIENTATION;
209: }
210:
211: /**
212: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.isShowDomainLabel()
213: */
214: public boolean isShowDomainLabel() {
215: Boolean val = (Boolean) this
216: .getPropertyValue(SHOW_DOMAIN_LABEL_KEY);
217: if (val != null) {
218: return val.booleanValue();
219: }
220:
221: //return default
222: return DEFAULT_SHOW_DOMAIN_LABEL;
223: }
224:
225: /**
226: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.setShowDomainLabel()
227: */
228: public void setShowDomainLabel(boolean bShow) {
229: setProperty(SHOW_DOMAIN_LABEL_KEY, Boolean.valueOf(bShow));
230: }
231:
232: /**
233: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.getDomainAxis()
234: */
235: public String getDomainLabel() {
236: String val = (String) this .getPropertyValue(DOMAIN_LABEL_KEY);
237: if (val != null) {
238: return val;
239: }
240:
241: //return default
242: return DEFAULT_DOMAIN_LABEL;
243: }
244:
245: /**
246: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.setDomainLabel()
247: */
248: public void setDomainLabel(String newDomainLabel) {
249: setProperty(DOMAIN_LABEL_KEY, newDomainLabel);
250: }
251:
252: /**
253: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.getDomainAxis()
254: */
255: public String getDomainAxis() {
256: String val = (String) this .getPropertyValue(DOMAIN_AXIS_KEY);
257: if (val != null) {
258: return val;
259: }
260:
261: //return default
262: return DEFAULT_DOMAIN_AXIS;
263: }
264:
265: /**
266: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.setDomainAxis()
267: */
268: public void setDomainAxis(String newDomainAxis) {
269: setProperty(DOMAIN_AXIS_KEY, newDomainAxis);
270: }
271:
272: /**
273: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.isShowDomainAxis()
274: */
275: public boolean isShowDomainAxis() {
276: Boolean val = (Boolean) this
277: .getPropertyValue(SHOW_DOMAIN_AXIS_KEY);
278: if (val != null) {
279: return val.booleanValue();
280: }
281:
282: //return default
283: return DEFAULT_SHOW_DOMAIN_AXIS;
284: }
285:
286: /**
287: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.setShowDomainAxis()
288: */
289: public void setShowDomainAxis(boolean bShow) {
290: setProperty(SHOW_DOMAIN_AXIS_KEY, Boolean.valueOf(bShow));
291: }
292:
293: /**
294: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.isShowRangeLabel()
295: */
296: public boolean isShowRangeLabel() {
297: Boolean val = (Boolean) this
298: .getPropertyValue(SHOW_RANGE_LABEL_KEY);
299: if (val != null) {
300: return val.booleanValue();
301: }
302:
303: //return default
304: return DEFAULT_SHOW_RANGE_LABEL;
305: }
306:
307: /**
308: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.setShowRangeLabel()
309: */
310: public void setShowRangeLabel(boolean bShow) {
311: setProperty(SHOW_RANGE_LABEL_KEY, Boolean.valueOf(bShow));
312: }
313:
314: /**
315: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.getRangeLabel()
316: */
317: public String getRangeLabel() {
318: String val = (String) this .getPropertyValue(RANGE_LABEL_KEY);
319: if (val != null) {
320: return val;
321: }
322:
323: //return default
324: return this .DEFAULT_RANGE_LABEL;
325: }
326:
327: /**
328: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.setRangeLabel()
329: */
330: public void setRangeLabel(String newRangeLabel) {
331: setProperty(RANGE_LABEL_KEY, newRangeLabel);
332: }
333:
334: /**
335: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.isShowRangeAxis()
336: */
337: public boolean isShowRangeAxis() {
338: Boolean val = (Boolean) this
339: .getPropertyValue(SHOW_RANGE_AXIS_KEY);
340: if (val != null) {
341: return val.booleanValue();
342: }
343:
344: //return default
345: return DEFAULT_SHOW_RANGE_AXIS;
346: }
347:
348: /**
349: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.setShowRangeAxis()
350: */
351: public void setShowRangeAxis(boolean bShow) {
352: setProperty(SHOW_RANGE_AXIS_KEY, Boolean.valueOf(bShow));
353: }
354:
355: /**
356: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.getRangeAxis()
357: */
358: public String getRangeAxis() {
359: String val = (String) this .getPropertyValue(RANGE_AXIS_KEY);
360: if (val != null) {
361: return val;
362: }
363:
364: //return default
365: return DEFAULT_RANGE_AXIS;
366: }
367:
368: /**
369: * @see com.stc.ebam.server.chart.engine.view.chart.xy.XYChartDefaults.setRangeAxis()
370: */
371: public void setRangeAxis(String newRangeAxis) {
372: setProperty(RANGE_AXIS_KEY, newRangeAxis);
373: }
374:
375: /**
376: * toString
377: * @return - string
378: */
379: public String toString() {
380: return "XY Chart";
381: }
382:
383: public String getPropertyTemplateName() {
384: return "XYChart";
385: }
386:
387: }
|