001: /*
002: * <copyright>
003: *
004: * Copyright 1997-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026:
027: package org.cougaar.logistics.ui.inventory;
028:
029: import java.util.Date;
030:
031: import java.awt.Color;
032: import java.awt.Insets;
033:
034: import com.klg.jclass.chart.JCChart;
035: import com.klg.jclass.chart.JCPickListener;
036: import com.klg.jclass.chart.data.JCDefaultDataSource;
037: import com.klg.jclass.util.swing.JCExitFrame;
038: import com.klg.jclass.chart.JCSymbolStyle;
039:
040: import com.klg.jclass.chart.ChartDataView;
041: import com.klg.jclass.chart.ChartDataViewSeries;
042: import com.klg.jclass.chart.ChartDataModel;
043: import com.klg.jclass.chart.ChartDataEvent;
044:
045: import org.cougaar.logistics.plugin.inventory.LogisticsInventoryFormatter;
046: import org.cougaar.logistics.plugin.inventory.TimeUtils;
047:
048: import com.klg.jclass.util.legend.JCLegend;
049: import com.klg.jclass.util.legend.JCMultiColLegend;
050:
051: import org.cougaar.logistics.ui.inventory.data.InventoryData;
052: import org.cougaar.logistics.ui.inventory.data.InventoryPreferenceData;
053:
054: /**
055: * <pre>
056: *
057: * The InventoryDemandChart class is the chart class for
058: * displaying demand information. It plots in
059: * 2 views, 2 series apiece: demand requisitions, and
060: * their corresponding allocation results and demand
061: * projection and their allocation results.
062: *
063: * @see InventoryChart
064: *
065: **/
066:
067: public class InventoryDemandChart extends InventoryBarChart {
068: public final static String DEMAND_TASKS = LogisticsInventoryFormatter.WITHDRAW_TASKS_TAG;
069: public final static String DEMAND_ARS = LogisticsInventoryFormatter.WITHDRAW_TASK_ARS_TAG;
070: public final static String DEMAND_PROJ_TASKS = LogisticsInventoryFormatter.COUNTED_PROJECTWITHDRAW_TASKS_TAG;
071: public final static String DEMAND_PROJ_ARS = LogisticsInventoryFormatter.COUNTED_PROJECTWITHDRAW_TASK_ARS_TAG;
072:
073: public InventoryDemandChart(boolean initialDisplayCDay,
074: InventoryPreferenceData prefData) {
075: super (prefData);
076: initialize("Demand", initialDisplayCDay);
077: }
078:
079: public void initializeChart() {
080: reqDM = new RequisitionsChartDataModel("", DEMAND_TASKS,
081: DEMAND_ARS);
082:
083: projDM = new ProjectionsChartDataModel("Demand from Customers",
084: DEMAND_PROJ_TASKS, DEMAND_PROJ_ARS, DEMAND_TASKS,
085: reqDM, false);
086:
087: shortfallDM = new ShortfallChartDataModel("", reqDM, projDM);
088:
089: projChartDataView = addChartView(JCChart.BAR, projDM);
090: reqChartDataView = addChartView(JCChart.BAR, reqDM);
091: shortfallChartDataView = addChartView(JCChart.PLOT, shortfallDM);
092:
093: setBarChartColors(prefData.getColorScheme());
094: setShortfallChartColors(prefData.getColorScheme());
095:
096: displayShortfall = false;
097: updateShortfall();
098: }
099:
100: }
|