Code cleanup thank's to Felix!

This commit is contained in:
trifonnt 2009-10-05 12:57:01 +00:00
parent 3f31efe02c
commit 12697db738
11 changed files with 22 additions and 24 deletions

View File

@ -285,11 +285,11 @@ public class CLogErrorBuffer extends Handler
* @param errorsOnly if true errors otherwise log * @param errorsOnly if true errors otherwise log
* @return data array * @return data array
*/ */
public Vector<Vector> getLogData (boolean errorsOnly) public Vector<Vector<Object>> getLogData (boolean errorsOnly)
{ {
LogRecord[] records = getRecords(errorsOnly); LogRecord[] records = getRecords(errorsOnly);
// System.out.println("getLogData - " + events.length); // System.out.println("getLogData - " + events.length);
Vector<Vector> rows = new Vector<Vector>(records.length); Vector<Vector<Object>> rows = new Vector<Vector<Object>>(records.length);
for (int i = 0; i < records.length; i++) for (int i = 0; i < records.length; i++)
{ {

View File

@ -36,7 +36,7 @@ import org.posterita.exceptions.SystemException;
public class AttributeValueKeyNamePair extends KeyNamePairUtil public class AttributeValueKeyNamePair extends KeyNamePairUtil
{ {
public static ArrayList getKeyPairs(Properties ctx, String attributeName) throws OperationException, SystemException public static ArrayList<KeyNamePair> getKeyPairs(Properties ctx, String attributeName) throws OperationException, SystemException
{ {
ArrayList<KeyNamePair> keyNamePairs = new ArrayList<KeyNamePair>(); ArrayList<KeyNamePair> keyNamePairs = new ArrayList<KeyNamePair>();

View File

@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Properties; import java.util.Properties;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.posterita.core.KeyNamePairUtil; import org.posterita.core.KeyNamePairUtil;
import org.posterita.exceptions.OperationException; import org.posterita.exceptions.OperationException;
@ -32,7 +33,7 @@ import org.compiere.model.MBank;
public class BankKeyNamePair extends KeyNamePairUtil public class BankKeyNamePair extends KeyNamePairUtil
{ {
public static ArrayList getKeyNamePairs(Properties ctx) throws OperationException public static ArrayList<KeyNamePair> getKeyNamePairs(Properties ctx) throws OperationException
{ {
String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and ad_org_id=" + Env.getAD_Org_ID(ctx) + " and isactive = 'Y'"; String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and ad_org_id=" + Env.getAD_Org_ID(ctx) + " and isactive = 'Y'";

View File

@ -59,7 +59,7 @@ public class BaseDispatchAction extends DispatchAction
MenuItem menuItem = (MenuItem) request.getSession().getAttribute(Constants.MENUS); MenuItem menuItem = (MenuItem) request.getSession().getAttribute(Constants.MENUS);
Integer menuId = Integer.valueOf(df.getMenuId()); Integer menuId = Integer.valueOf(df.getMenuId());
ArrayList list = menuItem.getBreadCrumb(menuId.intValue()); ArrayList<MenuItem> list = menuItem.getBreadCrumb(menuId.intValue());
request.getSession().setAttribute(Constants.BREADCRUMB, list); request.getSession().setAttribute(Constants.BREADCRUMB, list);
} }

View File

@ -230,7 +230,7 @@ public class ConcreteElement extends ElementAttributes implements Cloneable
/** /**
Get the keys of this element. Get the keys of this element.
*/ */
public Enumeration keys() public Enumeration<String> keys()
{ {
return(registryList.elements()); return(registryList.elements());
} }
@ -238,7 +238,7 @@ public class ConcreteElement extends ElementAttributes implements Cloneable
/** /**
Get an enumeration of the elements that this element contains. Get an enumeration of the elements that this element contains.
*/ */
public Enumeration elements() public Enumeration<Element> elements()
{ {
return(registry.elements()); return(registry.elements());
} }
@ -253,7 +253,7 @@ public class ConcreteElement extends ElementAttributes implements Cloneable
} }
/** /**
Override output(OutputStream) incase any elements are in the registry. Override output(OutputStream) in case any elements are in the registry.
@param out OutputStream to write to. @param out OutputStream to write to.
*/ */
public void output(OutputStream out) public void output(OutputStream out)
@ -279,7 +279,7 @@ public class ConcreteElement extends ElementAttributes implements Cloneable
if(getTagText() != null) if(getTagText() != null)
out.write(getTagText().getBytes()); out.write(getTagText().getBytes());
Enumeration en = registryList.elements(); Enumeration<String> en = registryList.elements();
while(en.hasMoreElements()) while(en.hasMoreElements())
{ {
@ -365,7 +365,7 @@ public class ConcreteElement extends ElementAttributes implements Cloneable
if(getTagText() != null) if(getTagText() != null)
out.write(getTagText()); out.write(getTagText());
Enumeration en = registryList.elements(); Enumeration<String> en = registryList.elements();
while(en.hasMoreElements()) while(en.hasMoreElements())
{ {
Object obj = registry.get(en.nextElement()); Object obj = registry.get(en.nextElement());

View File

@ -93,7 +93,7 @@ public class ElementContainer extends ConcreteElement implements Printable
Enumeration<Element> data = ec.elements(); Enumeration<Element> data = ec.elements();
while ( data.hasMoreElements() ) while ( data.hasMoreElements() )
{ {
element = (Element) data.nextElement(); element = data.nextElement();
element.output(out); element.output(out);
} }
} }
@ -107,7 +107,7 @@ public class ElementContainer extends ConcreteElement implements Printable
Enumeration<Element> data = ec.elements(); Enumeration<Element> data = ec.elements();
while ( data.hasMoreElements() ) while ( data.hasMoreElements() )
{ {
element = (Element) data.nextElement(); element = data.nextElement();
element.output(out); element.output(out);
} }
} }

View File

@ -168,7 +168,7 @@ public class ValuePreference extends Window implements EventListener
* @param Attribute attribute * @param Attribute attribute
* @param DisplayAttribute attribute display * @param DisplayAttribute attribute display
* @param Value value * @param Value value
* @param DisplayValue calue display * @param DisplayValue value display
* @param displayType display type * @param displayType display type
* @param AD_Reference_ID reference * @param AD_Reference_ID reference
*/ */

View File

@ -18,9 +18,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.desktop.AbstractDesktop;
import org.adempiere.webui.panel.ADWindowPanel;
import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.window.ADWindow; import org.adempiere.webui.window.ADWindow;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;

View File

@ -366,11 +366,11 @@ public class WAcctViewerData
{ {
// get values (Queries) // get values (Queries)
Iterator it = whereInfo.values().iterator(); Iterator<String> it = whereInfo.values().iterator();
while (it.hasNext()) while (it.hasNext())
{ {
String where = (String)it.next(); String where = it.next();
if (where != null && where.length() > 0) // add only if not empty if (where != null && where.length() > 0) // add only if not empty
{ {
@ -477,7 +477,7 @@ public class WAcctViewerData
// Add Key (Lookups) // Add Key (Lookups)
ArrayList keys = createKeyColumns(); ArrayList<String> keys = createKeyColumns();
int max = m_leadingColumns; int max = m_leadingColumns;
if (max == 0) if (max == 0)
@ -485,7 +485,7 @@ public class WAcctViewerData
for (int i = 0; i < max; i++) for (int i = 0; i < max; i++)
{ {
String column = (String)keys.get(i); String column = keys.get(i);
if (column != null && column.startsWith("Date")) if (column != null && column.startsWith("Date"))
rm.addColumn(new RColumn(ctx, column, DisplayType.Date)); rm.addColumn(new RColumn(ctx, column, DisplayType.Date));
@ -514,7 +514,7 @@ public class WAcctViewerData
for (int i = max; i < keys.size(); i++) for (int i = max; i < keys.size(); i++)
{ {
String column = (String)keys.get(i); String column = keys.get(i);
if (column != null && column.startsWith("Date")) if (column != null && column.startsWith("Date"))
rm.addColumn(new RColumn(ctx, column, DisplayType.Date)); rm.addColumn(new RColumn(ctx, column, DisplayType.Date));
@ -563,7 +563,7 @@ public class WAcctViewerData
* @return List of Key Columns * @return List of Key Columns
*/ */
private ArrayList createKeyColumns() private ArrayList<String> createKeyColumns()
{ {
ArrayList<String> columns = new ArrayList<String>(); ArrayList<String> columns = new ArrayList<String>();
m_leadingColumns = 0; m_leadingColumns = 0;

View File

@ -657,7 +657,7 @@ public class WPayment extends Window
if (m_PaymentRule == null) if (m_PaymentRule == null)
m_PaymentRule = ""; m_PaymentRule = "";
ValueNamePair vp = null; ValueNamePair vp = null;
HashMap values = button.getValues(); HashMap<String,String> values = button.getValues();
Object[] a = values.keySet().toArray(); Object[] a = values.keySet().toArray();
for (int i = 0; i < a.length; i++) for (int i = 0; i < a.length; i++)
{ {

View File

@ -183,7 +183,7 @@ public class AboutWindow extends Window implements EventListener {
} }
private void updateLogTable() { private void updateLogTable() {
Vector<Vector> data = CLogErrorBuffer.get(true).getLogData(bErrorsOnly.isChecked()); Vector<Vector<Object>> data = CLogErrorBuffer.get(true).getLogData(bErrorsOnly.isChecked());
SimpleListModel model = new SimpleListModel(data); SimpleListModel model = new SimpleListModel(data);
model.setMaxLength(new int[]{0, 0, 0, 200, 0, 200}); model.setMaxLength(new int[]{0, 0, 0, 200, 0, 200});
logTable.setItemRenderer(model); logTable.setItemRenderer(model);