package nc.ui.wa.ruleex.action;

import java.awt.event.ActionEvent;

import nc.hr.utils.ResHelper;
import nc.ui.hr.uif2.action.DelLineAction;
import nc.ui.pub.beans.MessageDialog;
import nc.ui.pub.bill.BillCardPanel;
import nc.ui.pub.bill.BillModel;
import nc.ui.wa.ruleex.model.WaRuleModel;
import nc.ui.wa.ruleex.view.WaRuleForm;
import nc.vo.hrwa.waruleex.WageformdetExVO;
import nc.vo.pub.VOStatus;

/**
 * WaRuleDelRowAction<BR>
 * <BR>
 * @author: xuhw
 * @date: 2009-11-10
 * @since: eHR V6.0
 * @走查人:
 * @走查日期:
 * @修改人:
 * @修改日期:
 */
public class WaRuleDelLineAction extends DelLineAction
{
	@Override
	public void doAction(ActionEvent e) throws Exception
	{
		BillCardPanel billCardPanel = ((WaRuleForm)this.getCardPanel()).getBillCardPanel();
		BillModel billModel = billCardPanel.getBillModel();
		// 取得选中的子表的vo
		int intSselectRow = billCardPanel.getBillTable().getSelectedRow();
		if (intSselectRow < 0)
		{
			MessageDialog.showHintDlg(getModel().getContext().getEntranceUI(), null, ResHelper.getString("60130payrule","060130payrule0001")/*@res "请先选中欲删除的行！"*/);
			return;
		}
		WageformdetExVO wageFormDetVO = (WageformdetExVO) billModel.getBodyValueRowVO(intSselectRow, WageformdetExVO.class.getName());
		wageFormDetVO.setStatus(VOStatus.DELETED);
		((WaRuleModel) this.getModel()).addDelSubVo(wageFormDetVO);
		billCardPanel.delLine();

		int iRowCount = billCardPanel.getBillTable().getRowCount();

		for (int i = 0; i < iRowCount; i++)
		{
			billModel.setValueAt(i + 1, i, WageformdetExVO.ILEVEL);
		}

		billCardPanel.setBillModel(billModel);
	}
}