/*
 * MosP - Mind Open Source Project         http://www.mosp.jp/
 * Copyright (C) 1987-2008 MIND Co., Ltd.  http://www.e-mind.co.jp/
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package jp.mosp.kintai.vo;

import javax.servlet.http.HttpServletRequest;

import jp.mosp.common.common.MospException;

public class ScheduleEditCardVo extends ScheduleMenuVo {

	private static final long serialVersionUID = 1989126275272023178L;

	// URL、CSS
	private static final String RETURN_URL = "/jsp/kintai/scheduleEditCard.jsp";
	private static final String EXTRA_JS   = "/pub/kintai/js/scheduleEditCard.js";
	private static final String EXTRA_CSS  = "/pub/kintai/css/scheduleEditCard.css";

	// 画面サブタイトル
	public final String SUB_TITLE = TTL_SCHEDULE_EDIT;

	// パラメータ名
	public static final String PRM_PLT_WORK_TYPE 		= "pltWorkType";
	public static final String PRM_CKB_DELETE_FLAG 	= "ckbDeleteFlag";

	// フィールド
	private String[] arySelectWorktype;

	private String[][] arySchedule;

	// プルダウンリスト
	public String[][] aryPltYear ;
	public String[][] aryPltMonth;
	public String[][] aryPltWorkType;

	/**
	 * コンストラクタ
	 */
	public ScheduleEditCardVo() {
		super();
		setRetUrl(RETURN_URL);
		addExtraJs(EXTRA_JS);
		setExtraCss(EXTRA_CSS);
		arySelectWorktype 		= new String[0];
		arySchedule 			= new String[0][0];
	}

	/**
	 * パラメータ設定
	 * @param request リクエスト
	 */
	public void setParams(HttpServletRequest request) {
		super.setParams(request);
		arySelectWorktype 	= request.getParameterValues(PRM_PLT_WORK_TYPE);
	}

	/**
	 * フィールド設定
	 * @param arySchedule 予定一覧配列
	 */
	public void setFields(String[][] arySchedule) {
		this.arySchedule = escapeArray(arySchedule.clone());
	}

	/**
	 * フィールドの妥当性確認
	 * @throws MospException
	 */
	//妥当性確認開始時処理
	public void validate() throws MospException {
		// 妥当性確認開始時処理
		startValidation();
		// 妥当性確認終了時処理
		endValidation();
	}

	/**
	 * JavaScript設定
	 * @param cls 情報取得クラス
	 * @throws IllegalAccessException
	 */
	@Override
	public String getDirectJs(Class cls) throws IllegalAccessException {
		StringBuffer sb = new StringBuffer();
		sb.append(super.getDirectJs(cls));
		return sb.toString();
	}

	// アクセサメソッド
	public String[][]	getEscArySchedule	() { return arySchedule.clone()			; }
	public String[] 	getArySelectWorktype() { return arySelectWorktype.clone()	; }

}
