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
 
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"]]
+
 
+
+
 
+
*[[Crear la columna:isColumnViewControl en AdColumn tipo Si/No defaultd ='Y']]
+
*[["ISCOLUMNVIEWCONTROL" CHAR(1 BYTE) DEFAULT 'Y' NOT NULL ENABLE, ]]
+
 
+
 
+
[[File:cti2.gif]]
+
 
+
 
+
 
+
'''Modificar las siguientes clases'''
+
 
+
=  client > src > org > compiere > grid  VTable.java =
+
 
+
<pre>
+
 
+
+ private final static String SAVE_ALL_COMMAND = CColumnControlButton.COLUMN_CONTROL_MARKER + "saveAll";
+
+ private int AD_Table_ID=0;
+
+ private GridTab m_mTab = null;
+
 
+
 
+
// Modificar lo Siguiente
+
 
+
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());
+
      }
+
 
+
 
+
// Crear o agregar estas funciones:
+
private Action createSaveColumnDisplay()
+
{
+
//TODO: localization
+
BoundAction action = new BoundAction("Guardar Seleccion", SAVE_ALL_COMMAND);
+
action.setLongDescription("Guardar Seleccion de Columnas");
+
action.registerCallback(this, "SaveAll");
+
return action;
+
+
}
+
public void SaveAll()
+
{
+
SaveAllColumnView();
+
}
+
public void SetTable_ID( int i_AD_Table_ID)
+
{
+
AD_Table_ID=i_AD_Table_ID;
+
}
+
public int GetTable_ID()
+
{
+
return AD_Table_ID;
+
}
+
public void SetmTab(GridTab mTab)
+
{
+
m_mTab=mTab;
+
}
+
+
public GridTab GetmTab()
+
{
+
return m_mTab;
+
}
+
    public void SetColVisibleOff()  // columnas ocultas
+
    {
+
 
+
    String SQL = "SELECT * FROM AD_Column WHERE AD_Table_ID =" + AD_Table_ID +"  and IsActive='Y' and isColumnViewControl='N'";
+
    int size = GetmTab().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 =  GetmTab().getField (i);
+
if(mField.getAD_Column_ID()==rs.getInt("Ad_Column_ID"))
+
{
+
+
TableColumn column = null;
+
column = getColumn(rs.getString("columnname"));
+
        setColumnVisibility(column, false);
+
    break;
+
}
+
}
+
}
+
rs.close();
+
pstmt.close();
+
}
+
catch (SQLException e)
+
{
+
e.printStackTrace();
+
}
+
    }
+
    public void SaveAllColumnView()
+
    {
+
SetOnColumnViewSelect(AD_Table_ID);
+
    for(int hCol=0;hCol<=gethiddenColumns().size()-1;hCol++)
+
    {
+
    TableColumn column = null;
+
    column= gethiddenColumns().get(hCol);
+
          SetOffColumnViewSelect(column);
+
         
+
    }
+
    }
+
    private void SetOffColumnViewSelect(TableColumn column)  // + Graba seleccion
+
    {
+
    int size = GetmTab().getFieldCount ();
+
for (int i = 0; i < size; i++)
+
{
+
GridField mField = GetmTab().getField (i);
+
if(mField.getHeader().toString().equalsIgnoreCase(column.getHeaderValue().toString()))
+
{
+
            String sqlUpdate="Update AD_Column set isColumnViewControl='N'  WHERE AD_Table_ID = "+ AD_Table_ID+ "  and AD_Column_ID="+mField.getAD_Column_ID();
+
            int updated2 = DB.executeUpdate(sqlUpdate, null);
+
            break;
+
}
+
}
+
}
+
private void SetOnColumnViewSelect(int iTable_id)
+
    {
+
    String sqlUpdate = "";
+
  sqlUpdate="Update AD_Column set isColumnViewControl='Y' WHERE AD_Table_ID =  "+iTable_id ;
+
int updated1 = DB.executeUpdate(sqlUpdate, null);
+
   
+
    }
+
 
+
</pre>
+
 
+
=base > src > org > compiere > swing > CTable.java  =
+
<pre>
+
 
+
  public List<TableColumn> gethiddenColumns() { // "*isColumnViewControl"
+
return hiddenColumns;
+
}
+
 
+
</pre>
+
 
+
 
+
=client > src > org > compiere > grid  GridController.java=
+
 
+
 
+
<pre>
+
private void init()
+
{
+
//  Set up Multi Row Table
+
vTable.setModel(m_mTab.getTableModel());
+
//  Update Table Info -------------------------------------------------
+
 
+
+ vTable.SetTable_ID(m_mTab.getAD_Table_ID());
+
+ vTable.SetmTab(m_mTab);
+
+ vTable.SetColVisibleOff();  // Futuramente preguntar por mTab control Columna
+
 
+
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