/*-------------------------------------------
* 工程別進捗監視画面
* 作成日: 2006/02/11
*
* Copyright (C) 2006
* FFC Systems Limited All rights reserved
------------------------------------------*/
package app.gantt.applet;
import java.util.*;
import java.util.List;
import java.awt.*;
import java.awt.event.*;
import java.io.EOFException;
import javax.swing.*;
import java.text.SimpleDateFormat;
import app.gantt.beans.*;
/**
* 工程別進捗監視画面
* @author zuochuanmin
*/
public class GanttApplet
extends JApplet
implements AdjustmentListener {
private static final long serialVersionUID = 1L;
/** 進捗凡例・時刻パネル */
public static JPanel SamplePanel = null;
/** 時刻目盛パネル ※外枠 */
public static JPanel HeaderPanel = null;
/** 進捗画面左上のラベル */
public static JLabel ChartLabel = null;
/** 時刻目盛描画パネル */
public static GanttHeader Header = null;
/** 項目欄(設備)パネル ※外枠 */
public static JPanel ItemPanel = null;
/** 項目欄(設備)パネルリスト */
public static ArrayList GanttItems = null;
/** ガントチャートパネル ※外枠 */
public static JPanel ChartPanel = null;
/** ガントチャートパネルリスト */
public static ArrayList GanttCharts = null;
/** 縦スクロールバー */
public static JScrollBar VScrollBar = null;
/** 設備項目縦スクロールバー */
public static JScrollBar VScrollBarDevice = null;
/** 横スクロールバー */
public static JScrollBar HScrollBar = null;
/** 設備状態欄パネル:凡例色文字とイメージの表示 */
public static JPanel SStatPanel = null;
/** 設備項目欄パネル */
public static JPanel DevicePanel = null;
/** 設備状態ラベルリスト */
public static ArrayList SStatLabel = null;
/** 表示日変更 */
public static GanttDataControl DataControl=null;
/** 工程リスト */
public static List prc_list = null;
/** 親工程id */
public static String pprc_id = "";
/** 系列Id */
public static String serialId = "";
/** 進捗データリスト */
public List progresslist = null;
/** 過去実績表示中なら true */
public static boolean _past = false;
/** 毎個工程の進捗データリスト */
public static List showChartList = null;
/** アプレート起動フラグ */
public static String applet_start_flag = "";
/** ロットno */
public static String lot_no = "";
/** バッチトno */
public static String bat_no = "";
/** アプレートエラー情報 */
public static String errorInfo = "";
/** 工程id */
public static String proc = "";
/** 選択のデータの日付 */
public static Date cDate = null;
/** リフレッシュタイマー */
private static RefreshTimer RefTimer = null;
/** データマネージャ */
private static GanttManager dMng = null;
/** プロパティインスタンス */
private static GanttProperties props = null;
/** host URL "http://アドレス/xxxxx/" */
private static String url = null;
/**凡例色文字:運転中*/
private static final String STATUS_TEXT_RUN = "運転中";
/**凡例色文字:先行*/
private static final String STATUS_TEXT_AHEAD = "先行";
/**凡例色文字:遅延*/
private static final String STATUS_TEXT_LATE = "遅延";
/**凡例色文字:完了*/
private static final String STATUS_TEXT_OVER = "完了";
/**凡例色文字:設備状態*/
private static final String STATUS_SHOWTEXT = "設備状態";
/**凡例色文字:停止中*/
private static final String STATUS_TEXT_STOP = "停止中";
/**凡例色文字:伝送異常*/
private static final String STATUS_TEXT_EXP = "伝送異常";
public static String contextPath = "";
/**データの取得が成功かどうか*/
private boolean isLoad = false;//Add by zuochuanmin at 2006/04/27
/**毎1時間の幅*/
public static int hourwidth = 0;
public static int f = 0;
/**
* アプレット初期処理
* 起動パラメータ処理,プロパティロード後,マスタデータ受信し
* マスタデータ・プロパティから進捗画面を作成する。
* @version 1.0
* @author zuochuanmin
*/
public void init() {
try {
//アプレート起動フラグ
applet_start_flag = "0";
//注:getCodeBase():アプレットありかのディレクトリを取得する
url = getCodeBase().toString();
int i = url.lastIndexOf("/applet");
if (i > 0) {
url = url.substring(0, i + 1);
}
//親工程idを取得する
String tmp = getParameter("parentProjectId");
if (tmp != null)
//親工程idを保存する
pprc_id = tmp;
else
pprc_id = "P001";
//系列Id
String serid = getParameter("serialId");
//系列Idを保存する
serialId = serid;
//プロパティファイル名を取得する
String sProp = getParameter("properties");
if (sProp == null || sProp.length()==0) {
sProp = "applet.properties";
}
//システム時間を取得する
if( cDate==null ){
cDate = new Date( System.currentTimeMillis() );
GanttManager.curDate = cDate;
}
//データマネージャ生成
dMng = new GanttManager(pprc_id,this);
boolean getData = dMng.ProgressDataList(pprc_id,cDate);
if(!getData){
throw new Exception();
}
boolean isOk = dMng.projectListData();
isLoad = isOk;
if(!isOk){
throw new EOFException();
}
//ヘッダンのパラメータを設定する
GanttManager.headerwidth = dMng.headerData.span*(dMng.headerData.beforeHour + dMng.headerData.afterHour);
if( GanttManager.headerwidth<GanttManager.minHeaderWidth ){
GanttManager.headerwidth = GanttManager.minHeaderWidth;
}
//プロパティ生成
Dimension dm = getSize(); //アプレットサイズ
props = new GanttProperties(sProp, dm,GanttManager.prc_list);
jbInit();
} catch ( Exception e ) {
e.printStackTrace();
GanttLogController.log( GanttErrorMessage.APPLET_ERROR_START_INIT + e );
errorInfo = GanttErrorMessage.APPLET_ERROR_START_INIT;
}
}