Difference between revisions of "User:CTI"

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.
m
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{incomplete}}
+
'''My Contributions'''
[[File:cti1.gif]]
+
  
=Preface=
+
*Apanel change suggestion
 +
*Dashboard useless top banner
 +
*Multiple Printer for Sales order related documents.
 +
*Saving grid mods, for each user in database.
 +
*Oscommerce Integration.
 +
*Bank Deposits.
 +
*Fiscal Printer.
 +
*Login Screen better design suggestion.
 +
*Product Category enhanced.
 +
*Picture screen updated ( it doesn't work properly).
 +
*Enhance picture form for inventory products.
  
*[[This Contributions can make possible to save columns GRIDS.]]
+
All this had code ready and working, I will star posting in the wiki with explanation etc
*[[Instructions are in Spanish but is easily to translate or understand,just 3 classes need for modify a table]]
+
 
+
*[[package org.compiere.grid]]
+
*[[ package org.compiere.grid]]
+
*[[ package org.compiere.swing "class CTable"]]
+
 
+
+
 
+
*[[ Grabar en DB las columnas del CCommnadControl en GridControler asociado a un CTable en la vista por muti Filas.]]
+
 
+
*[[1.- DB. Crear un campo en la Tabla AD_Column Tipo Char(1) Nombre isMultiRow]]
+
*[[2.- Actualizar los campos en la Ventana de Tablas y Columnas, Tab Columnas, ya que se puede configurar tambien en el momento ]]
+
*[[    de diseño de la tabla.]]
+
 
+
[[File:cti2.gif]]
+
 
+
 
+
= =
+
'''Modificar las siguientes clase.'''
+
 
+
=  package org.compiere.grid;=
+
 
+
<pre>**
+
* Table Grid based on CTable.
+
* Used in GridController
+
*
+
* @author  Jorg Janke
+
* @version $Id: VTable.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $
+
*
+
* @author Teo Sarca, SC ARHIPAC SERVICE SRL - FR [ 1753943 ]
+
*/
+
public final class VTable extends CTable  implements PropertyChangeListener
+
{
+
/**
+
+ private final static String SAVE_ALL_COMMAND = CColumnControlButton.COLUMN_CONTROL_MARKER + "saveAll";
+
+ private int pTabla_Id=0;
+
+ private GridTab m_mTab = null;
+
/**
+
* Default Constructor
+
*/
+
public VTable()
+
{
+
super();
+
setAutoscrolls(true);
+
putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
+
new VTableExcelAdapter(this); // teo_sarca - FR [ 1753943 ]
+
+
getActionMap().put(PACK_ALL_COMMAND, createPackAllAction());
+
+ getActionMap().put(SAVE_ALL_COMMAND, createSaveColumnDisplay());
+
+
} // VTable
+
 
+
/**
+
* Save all column
+
*/
+
+ public void SaveAll()  S
+
+ {
+
+ SaveAll(this);
+
+ }
+
 
+
+ public void pAsgTable_id( int iValor_Id)
+
+ {
+
+ pTabla_Id=iValor_Id;
+
+ }
+
+ public int pTabla_id()
+
+ {
+
+ return pTabla_Id;
+
+ }
+
+
+ public void pSet_mTab(GridTab mTab)
+
+ {
+
+ m_mTab=mTab;
+
+ }
+
+
+ public GridTab pGet_mTab()
+
+ {
+
+ return m_mTab;
+
+ }
+
+      public void SetColVisible(VTable la_tabla)
+
        {
+
+ String SQL = "SELECT * FROM AD_Column WHERE AD_Table_ID =" +la_tabla.pTabla_id() +" and IsActive='Y' and isMultiRow='N'";
+
+    int size = la_tabla.pGet_mTab().getFieldCount ();
+
+ try
+
+ {
+
+ PreparedStatement pstmt = DB.prepareStatement(SQL, "AD_Column");
+
+ ResultSet rs = pstmt.executeQuery();
+
+ while (rs.next())
+
+ {
+
+ for (int i = 0; i < size; i++)
+
+ {
+
+ GridField mField = la_tabla.pGet_mTab().getField (i);
+
+ if(mField.getAD_Column_ID()==rs.getInt("Ad_Column_ID"))
+
+ {
+
+ TableColumn column = null;
+
+ column = la_tabla.getColumn(rs.getString("columnname"));
+
+         setColumnVisibility(column, false);
+
+     break;
+
+ }
+
+ }
+
+ }
+
+ rs.close();
+
+ pstmt.close();
+
+ }
+
+ catch (SQLException e)
+
+ {
+
+ e.printStackTrace();
+
+ }
+
+ la_tabla.configureEnclosingScrollPane();
+
+  }
+
 
+
+    public void SaveAll(VTable la_tabla)
+
+    {
+
+ pActiva_todo(la_tabla.pTabla_id());
+
+  for(int hCol=0;hCol<=gethiddenColumns().size()-1;hCol++)
+
+    {
+
+    TableColumn column = null;
+
+    column= gethiddenColumns().get(hCol);
+
+          pOculta_Seleccion(column, la_tabla);
+
+    }
+
+    }
+
 
+
+  private void pOculta_Seleccion(TableColumn column, VTable la_tabla)  // + Graba seleccion
+
+  {
+
+    int size = la_tabla.pGet_mTab().getFieldCount ();
+
+ for (int i = 0; i < size; i++)
+
+   {
+
+ GridField mField = la_tabla.pGet_mTab().getField (i);
+
+ if(mField.getHeader().toString().equalsIgnoreCase(column.getHeaderValue().toString()))
+
+ {
+
+           String sqlUpdate="Update AD_Column set isMultiRow='N'  WHERE AD_Table_ID = "+ la_tabla.pTabla_id()+ "  and + + AD_Column_ID="+mField.getAD_Column_ID();
+
+            int updated2 = DB.executeUpdate(sqlUpdate, null);
+
+          break;
+
+ }
+
+   }
+
+  }
+
 
+
 
+
+  private void pActiva_todo(int iTable_id)
+
+    {
+
+    String sqlUpdate = "";
+
+  sqlUpdate="Update AD_Column set isMultiRow='Y' WHERE AD_Table_ID =  "+iTable_id ;
+
+ int updated1 = DB.executeUpdate(sqlUpdate, null);
+
+   
+
+    }
+
} // VTable
+
</pre>
+
 
+
=  =
+
<pre>
+
* Model Independent enhanced JTable.
+
* Provides sizing and sorting.
+
*
+
* @author Jorg Janke
+
* @version $Id: CTable.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
+
*
+
* @author Teo Sarca, SC ARHIPAC SERVICE SRL - BF [ 1585369 ], FR [ 1753943 ]
+
*/
+
+++++ '''Crear esta funcion'''
+
 
+
public class CTable extends JTable
+
{
+
+    public List<TableColumn> gethiddenColumns() {
+
+ return hiddenColumns;
+
+ }
+
+    {
+
+    }
+
} // CTable
+
</pre>
+
 
+
 
+
 
+
= =
+
 
+
'''package org.compiere.grid;'''
+
 
+
public class GridController
+
 
+
En Ininit:
+
<pre>
+
private void init()
+
{
+
//  Set up Multi Row Table
+
vTable.setModel(m_mTab.getTableModel());
+
//  Update Table Info -------------------------------------------------
+
+ vTable.pAsgTable_id(m_mTab.getAD_Table_ID());
+
+ vTable.pSet_mTab(m_mTab);
+
+ vTable.SetColVisible(vTable);
+
int size = setupVTable (m_aPanel, m_mTab, vTable);
+
 
+
}
+
 
+
 
+
}  //  GridController
+
</pre>
+

Latest revision as of 20:07, 1 February 2011

My Contributions

  • Apanel change suggestion
  • Dashboard useless top banner
  • Multiple Printer for Sales order related documents.
  • Saving grid mods, for each user in database.
  • Oscommerce Integration.
  • Bank Deposits.
  • Fiscal Printer.
  • Login Screen better design suggestion.
  • Product Category enhanced.
  • Picture screen updated ( it doesn't work properly).
  • Enhance picture form for inventory products.

All this had code ready and working, I will star posting in the wiki with explanation etc