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 org.cougaar.logistics.ui.inventory.data.InventoryData;
049: import org.cougaar.logistics.ui.inventory.data.InventoryPreferenceData;
050:
051: /**
052: * <pre>
053: *
054: * The InventoryRefillChart class is the chart class for
055: * displaying refill information. It plots in
056: * 2 views, 2 series apiece: resupply requisitions, and
057: * their corresponding allocation results and resupply
058: * projection and their allocation results.
059: *
060: * @see InventoryChart
061: * @see RequisitionsChartDataModel
062: * @see ProjectionsChartDataModel
063: *
064: *
065: **/
066:
067: public class InventoryRefillChart extends InventoryBarChart {
068:
069: ChartDataView projChartDataView;
070: ChartDataView reqChartDataView;
071:
072: public final static String RESUPPLY_TASKS = LogisticsInventoryFormatter.RESUPPLY_SUPPLY_TASKS_TAG;
073: public final static String RESUPPLY_ARS = LogisticsInventoryFormatter.RESUPPLY_SUPPLY_TASK_ARS_TAG;
074: public final static String RESUPPLY_PROJ_TASKS = LogisticsInventoryFormatter.RESUPPLY_PROJECTSUPPLY_TASKS_TAG;
075: public final static String RESUPPLY_PROJ_ARS = LogisticsInventoryFormatter.RESUPPLY_PROJECTSUPPLY_TASK_ARS_TAG;
076:
077: public InventoryRefillChart(boolean initialDisplayCDay,
078: InventoryPreferenceData prefData) {
079: super (prefData);
080: initialize("Refill", initialDisplayCDay);
081: }
082:
083: public void initializeChart() {
084: reqDM = new RequisitionsChartDataModel("", RESUPPLY_TASKS,
085: RESUPPLY_ARS);
086:
087: projDM = new ProjectionsChartDataModel(
088: "Refill from Suppliers ", RESUPPLY_PROJ_TASKS,
089: RESUPPLY_PROJ_ARS, RESUPPLY_TASKS, reqDM, true);
090: shortfallDM = new ShortfallChartDataModel("", reqDM, projDM);
091:
092: projChartDataView = addChartView(JCChart.BAR, projDM);
093: reqChartDataView = addChartView(JCChart.BAR, reqDM);
094: shortfallChartDataView = addChartView(JCChart.PLOT, shortfallDM);
095:
096: setBarChartColors(prefData.getColorScheme());
097: setShortfallChartColors(prefData.getColorScheme());
098:
099: displayShortfall = false;
100: updateShortfall();
101: }
102:
103: }
|