Refactor - indentation - improve readability - translate comments - organize imports - fix warnings
This commit is contained in:
parent
d75cc47746
commit
d7648d34cf
|
|
@ -16,13 +16,20 @@
|
|||
|
||||
package org.eevolution.model;
|
||||
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
import java.sql.*;
|
||||
import java.math.*;
|
||||
import java.util.logging.*;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -31,7 +38,6 @@ import org.compiere.util.*;
|
|||
public class QueryDB {
|
||||
|
||||
private String classname;
|
||||
private String trxName;
|
||||
private static CLogger log = CLogger.getCLogger (QueryDB.class);
|
||||
/** Creates a new instance of POQuery */
|
||||
|
||||
|
|
@ -97,7 +103,7 @@ public class QueryDB {
|
|||
return object;
|
||||
}
|
||||
|
||||
public List execute(String filter) {
|
||||
public List<Object> execute(String filter) {
|
||||
|
||||
//String tablename = POClass.getName();
|
||||
//System.out.print(classname.indexOf("X_"));
|
||||
|
|
@ -111,7 +117,7 @@ public class QueryDB {
|
|||
|
||||
//System.out.println("Query " + sql.toString());
|
||||
|
||||
List results = new ArrayList();
|
||||
List<Object> results = new ArrayList<Object>();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -136,7 +142,7 @@ public class QueryDB {
|
|||
}
|
||||
|
||||
|
||||
public List execute() {
|
||||
public List<Object> execute() {
|
||||
|
||||
//String tablename = POClass.getName();
|
||||
//System.out.print(classname.indexOf("X_"));
|
||||
|
|
@ -150,7 +156,7 @@ public class QueryDB {
|
|||
|
||||
//System.out.println("Query " + sql.toString());
|
||||
|
||||
List results = new ArrayList();
|
||||
List<Object> results = new ArrayList<Object>();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -175,5 +181,3 @@ public class QueryDB {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,10 +30,8 @@ import org.compiere.minigrid.MiniTable;
|
|||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MUOM;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.X_C_UOM;
|
||||
import org.eevolution.model.MPPOrder;
|
||||
import org.eevolution.model.X_PP_Product_BOM;
|
||||
import org.eevolution.model.X_PP_Product_BOMLine;
|
||||
import org.compiere.model.X_M_Product;
|
||||
|
|
@ -64,8 +62,10 @@ import java.math.BigDecimal;
|
|||
import java.sql.Timestamp;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSplitPane;
|
||||
|
|
@ -78,7 +78,6 @@ import javax.swing.event.TreeSelectionEvent;
|
|||
import javax.swing.event.TreeSelectionListener;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.util.logging.*;
|
||||
|
||||
/**
|
||||
* Tree Maintenance
|
||||
|
|
@ -87,12 +86,12 @@ import java.util.logging.*;
|
|||
* @version $Id: VTreeMaintenance.java,v 1.1 2004/03/20 04:35:51 jjanke Exp $
|
||||
*
|
||||
* 4Layers - MODIFICATIONS --------------------------------------------------------
|
||||
* 2005/04/12 Vorious improvements to the standard form (Sergio Ramazzina)
|
||||
* 2005/04/12 Various improvements to the standard form (Sergio Ramazzina)
|
||||
* 4Layers -------------------------------------------------------------------- end
|
||||
*/
|
||||
public class VTreeBOM extends CPanel
|
||||
implements FormPanel, ActionListener, ListSelectionListener, PropertyChangeListener , VetoableChangeListener, TreeSelectionListener , TableModelListener
|
||||
{
|
||||
public class VTreeBOM extends CPanel implements FormPanel, ActionListener,
|
||||
ListSelectionListener, PropertyChangeListener, VetoableChangeListener,
|
||||
TreeSelectionListener, TableModelListener {
|
||||
/**
|
||||
* Tree Maintenance
|
||||
*/
|
||||
|
|
@ -119,7 +118,7 @@ public class VTreeBOM extends CPanel
|
|||
//private CButton bAdd = new CButton (Env.getImageIcon("StepBack24.gif"));
|
||||
//private CButton bDelete = new CButton (Env.getImageIcon("StepForward24.gif"));
|
||||
//private CButton bDeleteAll = new CButton (Env.getImageIcon("FastForward24.gif"));
|
||||
private CCheckBox implotion = new CCheckBox ();
|
||||
private CCheckBox implosion = new CCheckBox ();
|
||||
private CLabel treeInfo = new CLabel ();
|
||||
//
|
||||
private JSplitPane splitPane = new JSplitPane ();
|
||||
|
|
@ -142,11 +141,10 @@ public class VTreeBOM extends CPanel
|
|||
protected StatusBar statusBar = new StatusBar();
|
||||
|
||||
private MiniTable tableBOM = new MiniTable();
|
||||
private Vector dataBOM = new Vector();
|
||||
private Vector layout = new Vector();
|
||||
private Vector columnNames;
|
||||
private Vector<Vector<Object>> dataBOM = new Vector<Vector<Object>>();
|
||||
private Vector<String> columnNames;
|
||||
//private VDate fieldGuaranteeDate =
|
||||
//4Layers - Set diveder location variable
|
||||
//4Layers - Set divider location variable
|
||||
private final int DIVIDER_LOCATION = 240;
|
||||
// 4Layers - end
|
||||
|
||||
|
|
@ -197,10 +195,8 @@ public class VTreeBOM extends CPanel
|
|||
m_tree = new JTree(parent);
|
||||
splitPane.add (m_tree, JSplitPane.LEFT);
|
||||
|
||||
|
||||
} // preInit
|
||||
|
||||
|
||||
/**
|
||||
* Static Init.
|
||||
* <pre>
|
||||
|
|
@ -217,8 +213,7 @@ public class VTreeBOM extends CPanel
|
|||
private void loadTableBOM()
|
||||
{
|
||||
// Header Info
|
||||
columnNames = new Vector(18);
|
||||
|
||||
columnNames = new Vector<String>(18);
|
||||
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Select")); // 0
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "IsActive")); // 1
|
||||
|
|
@ -266,14 +261,11 @@ public class VTreeBOM extends CPanel
|
|||
tableBOM.setColumnClass( 16, BigDecimal.class,false); // 16 Forecast
|
||||
tableBOM.autoSize();
|
||||
|
||||
|
||||
|
||||
//tableBOM.prepareTable(layout, "", "", false, "");
|
||||
|
||||
// Visual
|
||||
//CompiereColor.setBackground (this);
|
||||
|
||||
|
||||
//tableBOM.getSelectionModel().addListSelectionListener(this);
|
||||
} // dynInit
|
||||
|
||||
|
|
@ -296,8 +288,8 @@ public class VTreeBOM extends CPanel
|
|||
//labelECN.setText (Msg.translate(Env.getCtx(), "ECN"));
|
||||
|
||||
labelProduct.setText (Msg.translate(Env.getCtx(), "M_Product_ID"));
|
||||
//implotion.setEnabled (false);
|
||||
implotion.setText (Msg.translate(Env.getCtx(), "Implosion"));
|
||||
//implosion.setEnabled (false);
|
||||
implosion.setText (Msg.translate(Env.getCtx(), "Implosion"));
|
||||
//treeInfo.setText (" ");
|
||||
//bAdd.setToolTipText("Add to Tree");
|
||||
//bAddAll.setToolTipText("Add ALL to Tree");
|
||||
|
|
@ -312,11 +304,9 @@ public class VTreeBOM extends CPanel
|
|||
//
|
||||
this.add (northPanel, BorderLayout.NORTH);
|
||||
|
||||
|
||||
|
||||
northPanel.add (labelProduct, null);
|
||||
northPanel.add (fieldProduct, null);
|
||||
northPanel.add (implotion, null);
|
||||
northPanel.add (implosion, null);
|
||||
//northPanel.add (cbAllNodes, null);
|
||||
northPanel.add (treeInfo, null);
|
||||
|
||||
|
|
@ -328,7 +318,6 @@ public class VTreeBOM extends CPanel
|
|||
//northPanel.add (fieldRevision, null);
|
||||
//northPanel.add (fieldECN, null);
|
||||
|
||||
|
||||
//northPanel.add (bAddAll, null);
|
||||
//northPanel.add (bAdd, null);
|
||||
//northPanel.add (bDelete, null);
|
||||
|
|
@ -345,8 +334,6 @@ public class VTreeBOM extends CPanel
|
|||
// 4Layers - Set divider location
|
||||
splitPane.setDividerLocation(DIVIDER_LOCATION);
|
||||
|
||||
|
||||
|
||||
//centerList.setSelectionMode (ListSelectionModel.SINGLE_SELECTION);
|
||||
//centerList.addListSelectionListener(this);
|
||||
|
||||
|
|
@ -384,7 +371,7 @@ public class VTreeBOM extends CPanel
|
|||
*/
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
//System.out.println("Evento " + e.getSource());
|
||||
//System.out.println("Event " + e.getSource());
|
||||
//System.out.println("Source Event" + e.getSource());
|
||||
if (e.getSource().equals(fieldProduct))
|
||||
{
|
||||
|
|
@ -424,10 +411,8 @@ public class VTreeBOM extends CPanel
|
|||
if (Product == null)
|
||||
return;
|
||||
|
||||
|
||||
int M_Product_ID = Product.intValue();
|
||||
|
||||
|
||||
if (M_Product_ID == 0)
|
||||
return;
|
||||
//System.out.println("Product ID" + Product);
|
||||
|
|
@ -435,15 +420,14 @@ public class VTreeBOM extends CPanel
|
|||
X_C_UOM C_UOM = new X_C_UOM(Env.getCtx() , M_Product.getC_UOM_ID(), "C_UOM");
|
||||
DefaultMutableTreeNode parent = new DefaultMutableTreeNode(Msg.translate(Env.getCtx(), "M_Product_ID") + Msg.translate(Env.getCtx(), "Value") + ": " + M_Product.getValue() + " " + Msg.translate(Env.getCtx(), "Name") + ": " +M_Product.getName() + " " + Msg.translate(Env.getCtx(), "C_UOM_ID") + ": " + C_UOM.getName());
|
||||
|
||||
|
||||
dataBOM.clear();
|
||||
|
||||
if (implotion.isSelected())
|
||||
if (implosion.isSelected())
|
||||
{
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOMLine");
|
||||
String filter = "M_Product_ID=" + M_Product_ID;
|
||||
java.util.List results = query.execute(filter);
|
||||
Iterator select = results.iterator();
|
||||
List<Object> results = query.execute(filter);
|
||||
Iterator<Object> select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOMLine bomline = (X_PP_Product_BOMLine) select.next();
|
||||
|
|
@ -455,8 +439,8 @@ public class VTreeBOM extends CPanel
|
|||
{
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOM");
|
||||
String filter = " IsActive='Y' AND M_Product_ID =" + M_Product_ID;
|
||||
java.util.List results = query.execute(filter);
|
||||
Iterator select = results.iterator();
|
||||
List<Object> results = query.execute(filter);
|
||||
Iterator<Object> select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOM bom = (X_PP_Product_BOM) select.next();
|
||||
|
|
@ -467,11 +451,11 @@ public class VTreeBOM extends CPanel
|
|||
}
|
||||
|
||||
m_tree.addTreeSelectionListener(this);
|
||||
//System.out.println("numero de hijos:" + m_tree.getRowCount());
|
||||
//System.out.println("number of children:" + m_tree.getRowCount());
|
||||
|
||||
splitPane.add (m_tree, JSplitPane.LEFT);
|
||||
|
||||
//System.out.println("Tama<EFBFBD>o de la tabla " + dataBOM.size());
|
||||
//System.out.println("Table size " + dataBOM.size());
|
||||
|
||||
loadTableBOM();
|
||||
splitPane.add (new JScrollPane(dataPane), JSplitPane.RIGHT);
|
||||
|
|
@ -485,15 +469,14 @@ public class VTreeBOM extends CPanel
|
|||
public DefaultMutableTreeNode parent(X_PP_Product_BOMLine bomline)
|
||||
{
|
||||
|
||||
//System.out.println("-------------------------Padre:" + bom.getName());
|
||||
//System.out.println("-------------------------Parent:" + bom.getName());
|
||||
X_M_Product M_Product = new X_M_Product(Env.getCtx(), bomline.getM_Product_ID(),"M_Product");
|
||||
X_C_UOM C_UOM = new X_C_UOM(Env.getCtx() , M_Product.getC_UOM_ID(),"C_UOM");
|
||||
|
||||
X_PP_Product_BOM bomproduct = new X_PP_Product_BOM(Env.getCtx(),bomline.getPP_Product_BOM_ID(),"PP_Product_BOM");
|
||||
DefaultMutableTreeNode parent = new DefaultMutableTreeNode(Msg.translate(Env.getCtx(), "M_Product_ID") + Msg.translate(Env.getCtx(), "key") + ": " + M_Product.getValue() + " " + Msg.translate(Env.getCtx(), "Name") + ": " +M_Product.getName() + " " + Msg.translate(Env.getCtx(), "C_UOM_ID") + ": " + C_UOM.getName());
|
||||
|
||||
|
||||
Vector line = new Vector(17);
|
||||
Vector<Object> line = new Vector<Object>(17);
|
||||
line.add( new Boolean(false)); // 0 Select
|
||||
line.add( new Boolean(true)); // 1 IsActive
|
||||
line.add( new Integer(bomline.getLine())); // 2 Line
|
||||
|
|
@ -517,8 +500,8 @@ public class VTreeBOM extends CPanel
|
|||
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOM");
|
||||
String filter = "M_Product_ID = " + bomproduct.getM_Product_ID();
|
||||
java.util.List results = query.execute(filter);
|
||||
Iterator select = results.iterator();
|
||||
List<Object> results = query.execute(filter);
|
||||
Iterator<Object> select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOM bom = (X_PP_Product_BOM) select.next();
|
||||
|
|
@ -531,8 +514,8 @@ public class VTreeBOM extends CPanel
|
|||
public DefaultMutableTreeNode parent(X_PP_Product_BOM bom)
|
||||
{
|
||||
|
||||
//System.out.println("Padre:" + bom.getName());
|
||||
X_M_Product product = new X_M_Product(Env.getCtx(), bom.getM_Product_ID(),"M_Product");
|
||||
// System.out.println("Parent:" + bom.getName());
|
||||
// X_M_Product product = new X_M_Product(Env.getCtx(), bom.getM_Product_ID(),"M_Product");
|
||||
|
||||
//vparent.setValue(m_product_id);
|
||||
String data = Msg.translate(Env.getCtx(), "PP_Product_BOM_ID") + " " + Msg.translate(Env.getCtx(), "Value") + ":"+ bom.getValue()+ " " + Msg.translate(Env.getCtx(), "Name") + ": " + bom.getName();
|
||||
|
|
@ -540,15 +523,15 @@ public class VTreeBOM extends CPanel
|
|||
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOMLine");
|
||||
String filter = "PP_Product_BOM_ID=" + bom.getPP_Product_BOM_ID();
|
||||
java.util.List results = query.execute(filter);
|
||||
Iterator select = results.iterator();
|
||||
List<Object> results = query.execute(filter);
|
||||
Iterator<Object> select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOMLine bomline = (X_PP_Product_BOMLine) select.next();
|
||||
X_M_Product component = new X_M_Product(Env.getCtx(), bomline.getM_Product_ID(),"M_Product");
|
||||
//System.out.println("Componente :" + component.getValue() + "[" + component.getName() + "]");
|
||||
//component(component);
|
||||
Vector line = new Vector(17);
|
||||
Vector<Object> line = new Vector<Object>(17);
|
||||
line.add( new Boolean(false)); // 0 Select
|
||||
line.add( new Boolean(true)); // 1 IsActive
|
||||
line.add( new Integer(bomline.getLine())); // 2 Line
|
||||
|
|
@ -576,23 +559,21 @@ public class VTreeBOM extends CPanel
|
|||
return parent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DefaultMutableTreeNode component(X_M_Product M_Product)
|
||||
{
|
||||
|
||||
if (implotion.isSelected())
|
||||
if (implosion.isSelected())
|
||||
{
|
||||
//vparent.setValue(m_product_id);
|
||||
//String data = Msg.translate(Env.getCtx(), "PP_ProductBOM_ID") + ":" + Msg.translate(Env.getCtx(), "Search Key") + ":"+ bom.getValue()+ " " + Msg.translate(Env.getCtx(), "Name") + ": " + bom.getName();
|
||||
X_C_UOM C_UOM = new X_C_UOM(Env.getCtx() , M_Product.getC_UOM_ID(),"C_UOM");
|
||||
X_C_UOM C_UOM = new X_C_UOM(Env.getCtx(), M_Product.getC_UOM_ID(), "C_UOM");
|
||||
DefaultMutableTreeNode parent = new DefaultMutableTreeNode(Msg.translate(Env.getCtx(), "M_Product_ID") + Msg.translate(Env.getCtx(), "Value") + ": " + M_Product.getValue() + " " + Msg.translate(Env.getCtx(), "Name") + ": " +M_Product.getName() + " " + Msg.translate(Env.getCtx(), "C_UOM_ID") + ": " + C_UOM.getName());
|
||||
|
||||
//System.out.print("Componet Product:" + M_Product.getName());
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOMLine");
|
||||
String filter = "M_Product_ID=" + M_Product.getM_Product_ID();
|
||||
java.util.List results = query.execute(filter);
|
||||
Iterator select = results.iterator();
|
||||
List<Object> results = query.execute(filter);
|
||||
Iterator<Object> select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOMLine bomline = (X_PP_Product_BOMLine) select.next();
|
||||
|
|
@ -604,16 +585,16 @@ public class VTreeBOM extends CPanel
|
|||
}
|
||||
else
|
||||
{
|
||||
//System.out.print("--------------------------------------Componet Product:" + M_Product.getName());
|
||||
//System.out.print("--------------------------------------Component Product:" + M_Product.getName());
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOM");
|
||||
String filter = "Value='" + M_Product.getValue() + "'";
|
||||
X_C_UOM C_UOM = new X_C_UOM(Env.getCtx() , M_Product.getC_UOM_ID(),"C_UOM");
|
||||
java.util.List results = query.execute(filter);
|
||||
Iterator select = results.iterator();
|
||||
List<Object> results = query.execute(filter);
|
||||
Iterator<Object> select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOM bom = (X_PP_Product_BOM) select.next();
|
||||
//System.out.print("--------------------------------------Componet BOM:" + bom.getName());
|
||||
//System.out.print("--------------------------------------Component BOM:" + bom.getName());
|
||||
return parent(bom);
|
||||
}
|
||||
|
||||
|
|
@ -633,12 +614,8 @@ public class VTreeBOM extends CPanel
|
|||
*/
|
||||
public void valueChanged (ListSelectionEvent e)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (e.getValueIsAdjusting())
|
||||
return;
|
||||
|
||||
} // valueChanged
|
||||
|
||||
/**
|
||||
|
|
@ -673,7 +650,7 @@ public class VTreeBOM extends CPanel
|
|||
{
|
||||
//centerTree.nodeChanged(true, item.id, item.name,
|
||||
// item.description, item.isSummary, item.imageIndicator);
|
||||
/* if (m_tree.isProduct())
|
||||
/* if (m_tree.isProduct())
|
||||
{
|
||||
MTree_NodePR node = new MTree_NodePR (m_tree, item.id);
|
||||
node.save();
|
||||
|
|
|
|||
Loading…
Reference in New Issue