/*
 * TaskGridFrame.java
 *
 * Created on 7 aprile 2007, 22.31
 */

package demo13;

import javax.swing.*;
import org.openswing.swing.client.*;
import java.awt.*;
import org.openswing.swing.table.columns.client.*;
import org.openswing.swing.lookup.client.LookupController;
import java.sql.*;
import java.awt.event.*;
import org.openswing.swing.table.java.*;
import org.openswing.swing.mdi.client.InternalFrame;
import org.openswing.swing.mdi.client.MDIFrame;
import org.openswing.swing.util.client.ClientSettings;


/**
 *
 * @author  Administrator
 */
public class TaskGridFrame extends org.openswing.swing.mdi.client.InternalFrame {

    private Connection conn = null;


    /** Creates new form BeanForm */
    public TaskGridFrame(Connection conn,TaskGridFrameController controller) {
    this.conn = conn;
    try {
      initComponents();
      setSize(500,300);
      gridControl1.setController(controller);
      gridControl1.setGridDataLocator(controller);
      MDIFrame.add(this);
      setTitle(ClientSettings.getInstance().getResources().getResource("tasks"));

    }
    catch(Exception e) {
      e.printStackTrace();
    }
    }

  public void reloadData() {
    gridControl1.reloadData();
  }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        gridControl1 = new org.openswing.swing.client.GridControl();
        textColumn1 = new org.openswing.swing.table.columns.client.TextColumn();
        textColumn2 = new org.openswing.swing.table.columns.client.TextColumn();
        buttonsPanel = new javax.swing.JPanel();
        insertButton1 = new org.openswing.swing.client.InsertButton();
        copyButton1 = new org.openswing.swing.client.CopyButton();
        editButton1 = new org.openswing.swing.client.EditButton();
        saveButton1 = new org.openswing.swing.client.SaveButton();
        reloadButton1 = new org.openswing.swing.client.ReloadButton();
        exportButton1 = new org.openswing.swing.client.ExportButton();
        deleteButton1 = new org.openswing.swing.client.DeleteButton();

        gridControl1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 0));

        gridControl1.setCopyButton(copyButton1);
        gridControl1.setDeleteButton(deleteButton1);
        gridControl1.setEditButton(editButton1);
        gridControl1.setExportButton(exportButton1);
        gridControl1.setInsertButton(insertButton1);
        gridControl1.setMaxSortedColumns(2);
        gridControl1.setReloadButton(reloadButton1);
        gridControl1.setSaveButton(saveButton1);
        gridControl1.setValueObjectClassName("demo13.TaskVO");
        textColumn1.setColumnDuplicable(true);
        textColumn1.setColumnFilterable(true);
        textColumn1.setColumnName("taskCode");
        textColumn1.setColumnSortable(true);
        textColumn1.setEditableOnInsert(true);
        textColumn1.setMaxCharacters(20);
        textColumn1.setSortVersus("ASC");
        textColumn1.setTrimText(true);
        textColumn1.setUpperCase(true);
        gridControl1.add(textColumn1);

        textColumn2.setColumnFilterable(true);
        textColumn2.setColumnName("description");
        textColumn2.setColumnSortable(true);
        textColumn2.setEditableOnEdit(true);
        textColumn2.setEditableOnInsert(true);
        textColumn2.setPreferredWidth(250);
        gridControl1.add(textColumn2);

        getContentPane().add(gridControl1, java.awt.BorderLayout.CENTER);

        buttonsPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

        buttonsPanel.add(insertButton1);

        buttonsPanel.add(copyButton1);

        buttonsPanel.add(editButton1);

        buttonsPanel.add(saveButton1);

        buttonsPanel.add(reloadButton1);

        buttonsPanel.add(exportButton1);

        buttonsPanel.add(deleteButton1);

        getContentPane().add(buttonsPanel, java.awt.BorderLayout.NORTH);

    }
    // </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel buttonsPanel;
    private org.openswing.swing.client.CopyButton copyButton1;
    private org.openswing.swing.client.DeleteButton deleteButton1;
    private org.openswing.swing.client.EditButton editButton1;
    private org.openswing.swing.client.ExportButton exportButton1;
    private org.openswing.swing.client.GridControl gridControl1;
    private org.openswing.swing.client.InsertButton insertButton1;
    private org.openswing.swing.client.ReloadButton reloadButton1;
    private org.openswing.swing.client.SaveButton saveButton1;
    private org.openswing.swing.table.columns.client.TextColumn textColumn1;
    private org.openswing.swing.table.columns.client.TextColumn textColumn2;
    // End of variables declaration//GEN-END:variables

}
