package org.jallinone.registers.vat.client;
import org.openswing.swing.mdi.client.InternalFrame;
import org.openswing.swing.tree.client.*;
import java.awt.*;
import org.openswing.swing.mdi.client.MDIFrame;
import javax.swing.*;
import org.openswing.swing.client.*;
import org.openswing.swing.table.java.ServerGridDataLocator;
import org.openswing.swing.table.columns.client.*;
import org.openswing.swing.util.client.ClientSettings;
import org.openswing.swing.table.client.GridController;
import org.jallinone.commons.client.CustomizedColumns;
import java.math.BigDecimal;
/**
* <p>Title: JAllInOne ERP/CRM application</p>
* <p>Description: This class is the vats grid frame.</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 VatsGridFrame extends InternalFrame {
JPanel buttonsPanel = new JPanel();
FlowLayout flowLayout1 = new FlowLayout();
InsertButton insertButton = new InsertButton();
ReloadButton reloadButton = new ReloadButton();
DeleteButton deleteButton = new DeleteButton();
NavigatorBar navigatorBar = new NavigatorBar();
GridControl grid = new GridControl();
EditButton editButton = new EditButton();
SaveButton saveButton = new SaveButton();
/** grid data locator */
private ServerGridDataLocator gridDataLocator = new ServerGridDataLocator();
TextColumn colVat = new TextColumn();
TextColumn colDescr = new TextColumn();
PercentageColumn colValue = new PercentageColumn();
PercentageColumn colDeductible = new PercentageColumn();
ExportButton exportButton = new ExportButton();
public VatsGridFrame(GridController controller) {
grid.setController(controller);
grid.setGridDataLocator(gridDataLocator);
gridDataLocator.setServerMethodName("loadVats");
try {
jbInit();
setSize(620,300);
setMinimumSize(new Dimension(620,300));
CustomizedColumns cust = new CustomizedColumns(new BigDecimal(162),grid);
}
catch(Exception e) {
e.printStackTrace();
}
}
public final void reloadData() {
grid.reloadData();
}
private void jbInit() throws Exception {
grid.setMaxNumberOfRowsOnInsert(50);
grid.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
saveButton.setExecuteAsThread(true);
grid.setValueObjectClassName("org.jallinone.registers.vat.java.VatVO");
this.setTitle(ClientSettings.getInstance().getResources().getResource("vats"));
buttonsPanel.setLayout(flowLayout1);
flowLayout1.setAlignment(FlowLayout.LEFT);
grid.setDeleteButton(deleteButton);
grid.setEditButton(editButton);
grid.setExportButton(exportButton);
grid.setFunctionId("REG01");
grid.setMaxSortedColumns(3);
grid.setInsertButton(insertButton);
grid.setNavBar(navigatorBar);
grid.setReloadButton(reloadButton);
grid.setSaveButton(saveButton);
colVat.setMaxCharacters(20);
colVat.setTrimText(true);
colVat.setUpperCase(true);
colVat.setColumnFilterable(true);
colVat.setColumnName("vatCodeREG01");
colVat.setColumnSortable(true);
colVat.setEditableOnInsert(true);
colVat.setSortVersus(org.openswing.swing.util.java.Consts.ASC_SORTED);
colVat.setSortingOrder(1);
colDescr.setColumnFilterable(false);
colDescr.setColumnName("descriptionSYS10");
colDescr.setColumnSortable(true);
colDescr.setEditableOnEdit(true);
colDescr.setEditableOnInsert(true);
colDescr.setHeaderColumnName("vatDescription");
colDescr.setPreferredWidth(290);
colValue.setColumnFilterable(true);
colValue.setColumnName("valueREG01");
colValue.setColumnSortable(true);
colValue.setEditableOnEdit(true);
colValue.setEditableOnInsert(true);
colDeductible.setColumnFilterable(true);
colDeductible.setColumnName("deductibleREG01");
colDeductible.setColumnSortable(true);
colDeductible.setEditableOnEdit(true);
colDeductible.setEditableOnInsert(true);
this.getContentPane().add(buttonsPanel, BorderLayout.NORTH);
buttonsPanel.add(insertButton, null);
buttonsPanel.add(editButton, null);
buttonsPanel.add(saveButton, null);
buttonsPanel.add(reloadButton, null);
buttonsPanel.add(deleteButton, null);
buttonsPanel.add(exportButton, null);
buttonsPanel.add(navigatorBar, null);
this.getContentPane().add(grid, BorderLayout.CENTER);
grid.getColumnContainer().add(colVat, null);
grid.getColumnContainer().add(colDescr, null);
grid.getColumnContainer().add(colValue, null);
grid.getColumnContainer().add(colDeductible, null);
}
public GridControl getGrid() {
return grid;
}
}