/* * Copyright 2005 Joe Walker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package jsx3.chart; import org.directwebremoting.ScriptBuffer; import org.directwebremoting.ScriptSessions; import org.directwebremoting.io.Context; /** * Shared functionality between BarSeries and ColumnSeries. * @author Joe Walker [joe at getahead dot org] * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator */ public class BCSeries extends jsx3.chart.Series { /** * All reverse ajax proxies need context to work from * @param context The script that got us to where we are now */ public BCSeries(Context context, String extension) { super(context, extension); } /** * The instance initializer. * @param name the GI name of the instance * @param seriesName the name of the Series, will be displayed in the Legend for most chart types */ public BCSeries(String name, String seriesName) { super((Context) null, (String) null); ScriptBuffer script = new ScriptBuffer(); script.appendCall("new BCSeries", name, seriesName); setInitScript(script); } /** * Returns the x-coordinate of a data point in this series for the given record. * @param record the <record/> node */ public void getXValue(jsx3.xml.Node record, org.directwebremoting.ui.Callback<Integer> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getXValue", record); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, Integer.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Returns the y-coordinate of a data point in this series for the given record. * @param record the <record/> node */ public void getYValue(jsx3.xml.Node record, org.directwebremoting.ui.Callback<Integer> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getYValue", record); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, Integer.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Returns the minimum value (x or y) of a data point in this series for the given record. * @param record the <record/> node */ public void getMinValue(jsx3.xml.Node record, org.directwebremoting.ui.Callback<Integer> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getMinValue", record); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, Integer.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Returns the xField field. * @param callback xField */ public void getXField(org.directwebremoting.ui.Callback<String> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getXField"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, String.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Sets the xField field. * @param xField the new value for xField */ public void setXField(String xField) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setXField", xField); ScriptSessions.addScript(script); } /** * Returns the yField field. * @param callback yField */ public void getYField(org.directwebremoting.ui.Callback<String> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getYField"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, String.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Sets the yField field. * @param yField the new value for yField */ public void setYField(String yField) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setYField", yField); ScriptSessions.addScript(script); } /** * Returns the minField field. * @param callback minField */ public void getMinField(org.directwebremoting.ui.Callback<String> callback) { ScriptBuffer script = new ScriptBuffer(); String callbackPrefix = ""; if (callback != null) { callbackPrefix = "var reply = "; } script.appendCall(callbackPrefix + getContextPath() + "getMinField"); if (callback != null) { String key = org.directwebremoting.extend.CallbackHelperFactory.get().saveCallback(callback, String.class); script.appendCall("__System.activateCallback", key, "reply"); } ScriptSessions.addScript(script); } /** * Sets the minField field. * @param minField the new value for minField */ public void setMinField(String minField) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setMinField", minField); ScriptSessions.addScript(script); } }