package demo5.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 demo5.java.*;
import org.openswing.swing.util.client.ClientUtils;
import org.openswing.swing.table.client.Grid;
import org.openswing.swing.client.GridControl;
/**
* <p>Title: OpenSwing Framework</p>
* <p>Description: Grid controller.</p>
* <p>Copyright: Copyright (C) 2006 Mauro Carniel</p>
* <p> </p>
* @author Mauro Carniel
* @version 1.0
*/
public class GridFrameController extends GridController {
private GridFrame grid = null;
public GridFrameController() {
grid = new GridFrame(this);
MDIFrame.add(grid);
}
/**
* Callback method invoked before saving data when the grid was in INSERT mode (on pressing save button).
* @return <code>true</code> allows the saving to continue, <code>false</code> the saving is interrupted
*/
public boolean beforeInsertGrid(GridControl grid) {
new DetailFrameController(this.grid,null);
return false;
}
/**
* Callback method invoked when the user has double clicked on the selected row of the grid.
* @param rowNumber selected row index
* @param persistentObject v.o. related to the selected row
*/
public void doubleClick(int rowNumber,ValueObject persistentObject) {
TestVO vo = (TestVO)persistentObject;
new DetailFrameController(grid,vo.getStringValue());
}
/**
* 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("deleteGrid",persistentObjects);
}
}