package org.jallinone.scheduler.callouts.client;
import org.openswing.swing.table.client.GridController;
import java.util.*;
import org.openswing.swing.message.receive.java.*;
import org.openswing.swing.message.send.java.FilterWhereClause;
import org.openswing.swing.table.java.GridDataLocator;
import org.openswing.swing.mdi.client.MDIFrame;
import org.openswing.swing.util.client.ClientUtils;
import java.math.BigDecimal;
import javax.swing.*;
import org.openswing.swing.client.GridControl;
import org.jallinone.scheduler.callouts.java.CallOutItemVO;
import org.jallinone.commons.java.ApplicationConsts;
import org.jallinone.scheduler.callouts.java.CallOutPK;
/**
* <p>Title: JAllInOne ERP/CRM application</p>
* <p>Description: This class is the grid controller for call-out items grid</p>
* <p>Copyright: Copyright (C) 2006 Mauro Carniel</p>
*
* <p> This file is part of JAllInOne ERP/CRM application.
* This application is free software; you can redistribute it and/or
* modify it under the terms of the (LGPL) Lesser General Public
* License as published by the Free Software Foundation;
*
* GNU LESSER GENERAL PUBLIC LICENSE
* Version 2.1, February 1999
*
* This application 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* The author may be contacted at:
* maurocarniel@tin.it</p>
*
* @author Mauro Carniel
* @version 1.0
*/
public class CallOutItemsController extends GridController {
/** grid */
private GridControl grid = null;
public CallOutItemsController(GridControl grid) {
this.grid = grid;
}
/**
* Method invoked when the user has clicked on save button and the grid is in INSERT mode.
* @param rowNumbers row indexes related to the new rows to save
* @param newValueObjects list of new value objects to save
* @return an ErrorResponse value object in case of errors, VOListResponse if the operation is successfully completed
*/
public Response insertRecords(int[] rowNumbers, ArrayList newValueObjects) throws Exception {
CallOutItemVO vo = null;
CallOutPK pk = (CallOutPK)grid.getOtherGridParams().get(ApplicationConsts.CALL_OUT_PK);
for(int i=0;i<newValueObjects.size();i++) {
vo = (CallOutItemVO)newValueObjects.get(i);
vo.setCompanyCodeSys01SCH14(pk.getCompanyCodeSys01SCH10());
vo.setCallOutCodeSch10SCH14(pk.getCallOutCodeSCH10());
}
return ClientUtils.getData("insertCallOutItems",newValueObjects);
}
/**
* Method invoked when the user has clicked on delete button and the grid is in READONLY mode.
* @param persistentObjects value objects to delete (related to the currently selected rows)
* @return an ErrorResponse value object in case of errors, VOResponse if the operation is successfully completed
*/
public Response deleteRecords(ArrayList persistentObjects) throws Exception {
return ClientUtils.getData("deleteCallOutItems",persistentObjects);
}
}