Adempiere 3.1.2 + marekmosiewicz , hengsin

This commit is contained in:
Carlos Ruiz 2006-12-07 23:13:04 +00:00
parent dee6003f14
commit 77d3ad8ced
10 changed files with 173 additions and 52 deletions

View File

@ -128,6 +128,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
/** Logger */ /** Logger */
protected CLogger log = CLogger.getCLogger(getClass()); protected CLogger log = CLogger.getCLogger(getClass());
private boolean m_parentNeedSave = false;
/************************************************************************** /**************************************************************************
* Tab loader for Tabs > 0 * Tab loader for Tabs > 0
@ -508,6 +510,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
// Detail Query // Detail Query
if (isDetail()) if (isDetail())
{ {
m_parentNeedSave = false;
String lc = getLinkColumnName(); String lc = getLinkColumnName();
if (lc.equals("")) if (lc.equals(""))
log.severe ("No link column"); log.severe ("No link column");
@ -520,7 +523,12 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
m_linkValue = value; m_linkValue = value;
// Check validity // Check validity
if (value.length() == 0) if (value.length() == 0)
log.severe ("No value for link column " + lc); {
//log.severe ("No value for link column " + lc);
//parent is new, can't retrieve detail
m_parentNeedSave = true;
return;
}
else else
{ {
// we have column and value // we have column and value
@ -2410,6 +2418,14 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
return m_mTable.getValueAt(row, col); return m_mTable.getValueAt(row, col);
} // getValue } // getValue
public boolean isNeedToSaveParent()
{
if (isDetail())
return m_parentNeedSave;
else
return false;
}
/** /**
* toString * toString
* @return String representation * @return String representation

View File

@ -438,7 +438,7 @@ class AcctViewerData
rm.addColumn(new RColumn(ctx, "Description", DisplayType.String)); rm.addColumn(new RColumn(ctx, "Description", DisplayType.String));
} }
if (PostingType == null || PostingType.length() == 0) if (PostingType == null || PostingType.length() == 0)
rm.addColumn(new RColumn(ctx, "PostingType", DisplayType.List, rm.addColumn(new RColumn(ctx, RModel.TABLE_ALIAS+".PostingType", DisplayType.List,
MFactAcct.POSTINGTYPE_AD_Reference_ID)); MFactAcct.POSTINGTYPE_AD_Reference_ID));
return rm; return rm;
} // createRModel } // createRModel

View File

@ -52,9 +52,11 @@ public final class APanel extends CPanel
* Constructs a new instance. * Constructs a new instance.
* Need to call initPanel for dynamic initialization * Need to call initPanel for dynamic initialization
*/ */
public APanel() public APanel(AWindow window)
{ {
super(); super();
m_window = window;
m_ctx = Env.getCtx(); m_ctx = Env.getCtx();
// //
try try
@ -71,6 +73,8 @@ public final class APanel extends CPanel
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger(APanel.class); private static CLogger log = CLogger.getCLogger(APanel.class);
private AWindow m_window;
/** /**
* Dispose * Dispose
*/ */
@ -144,6 +148,8 @@ public final class APanel extends CPanel
this.add(northPanel, BorderLayout.NORTH); this.add(northPanel, BorderLayout.NORTH);
northPanel.setLayout(northLayout); northPanel.setLayout(northLayout);
northLayout.setAlignment(FlowLayout.LEFT); northLayout.setAlignment(FlowLayout.LEFT);
toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
toolBar.setBorderPainted(false);
northPanel.add(toolBar, null); northPanel.add(toolBar, null);
} // jbInit } // jbInit
@ -160,7 +166,6 @@ public final class APanel extends CPanel
aAccount, aCalculator, aCalendar, aEditor, aPreference, aScript, aAccount, aCalculator, aCalendar, aEditor, aPreference, aScript,
aOnline, aMailSupport, aAbout, aPrintScr, aScrShot, aExit, aBPartner, aDeleteSelection; aOnline, aMailSupport, aAbout, aPrintScr, aScrShot, aExit, aBPartner, aDeleteSelection;
/************************************************************************** /**************************************************************************
* Create Menu and Toolbar and registers keyboard actions. * Create Menu and Toolbar and registers keyboard actions.
* - started from constructor * - started from constructor
@ -180,6 +185,7 @@ public final class APanel extends CPanel
aPrint = addAction("Print", mFile, KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0), false); aPrint = addAction("Print", mFile, KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0), false);
mFile.addSeparator(); mFile.addSeparator();
aEnd = addAction("End", mFile, KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.ALT_MASK), false); aEnd = addAction("End", mFile, KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.ALT_MASK), false);
aLogout = addAction("Logout", mFile, KeyStroke.getKeyStroke(KeyEvent.VK_L, Event.SHIFT_MASK+Event.ALT_MASK), false);
aExit = addAction("Exit", mFile, KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.SHIFT_MASK+Event.ALT_MASK), false); aExit = addAction("Exit", mFile, KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.SHIFT_MASK+Event.ALT_MASK), false);
// Edit // Edit
JMenu mEdit = AEnv.getMenu("Edit"); JMenu mEdit = AEnv.getMenu("Edit");
@ -249,6 +255,12 @@ public final class APanel extends CPanel
mTools.addSeparator(); mTools.addSeparator();
aPreference = addAction("Preference", mTools, null, false); aPreference = addAction("Preference", mTools, null, false);
} }
//Window
AMenu aMenu = (AMenu)Env.getWindow(0);
JMenu mWindow = new WindowMenu(aMenu.getWindowManager(), m_window);
menuBar.add(mWindow);
// Help // Help
JMenu mHelp = AEnv.getMenu("Help"); JMenu mHelp = AEnv.getMenu("Help");
menuBar.add(mHelp); menuBar.add(mHelp);
@ -812,8 +824,7 @@ public final class APanel extends CPanel
aSave.setEnabled(changed && !readOnly); aSave.setEnabled(changed && !readOnly);
// //
// No Rows // No Rows
if (e.getTotalRows() == 0 && insertRecord) if (e.getTotalRows() == 0 && insertRecord) {
{
aNew.setEnabled(true); aNew.setEnabled(true);
aDelete.setEnabled(false); aDelete.setEnabled(false);
aDeleteSelection.setEnabled(false); aDeleteSelection.setEnabled(false);
@ -920,6 +931,8 @@ public final class APanel extends CPanel
boolean back = false; boolean back = false;
boolean isAPanelTab = false; boolean isAPanelTab = false;
int previousIndex = 0;
// Workbench Tab Change // Workbench Tab Change
if (tp.isWorkbench()) if (tp.isWorkbench())
{ {
@ -946,6 +959,8 @@ public final class APanel extends CPanel
log.info("Tab=" + tp); log.info("Tab=" + tp);
m_curWinTab = tp; m_curWinTab = tp;
int tpIndex = m_curWinTab.getSelectedIndex(); int tpIndex = m_curWinTab.getSelectedIndex();
// detect no tab change
if (tpIndex == m_curTabIndex) return;
back = tpIndex < m_curTabIndex; back = tpIndex < m_curTabIndex;
GridController gc = null; GridController gc = null;
if (m_curWinTab.getSelectedComponent() instanceof GridController) if (m_curWinTab.getSelectedComponent() instanceof GridController)
@ -1001,6 +1016,7 @@ public final class APanel extends CPanel
// if (m_curTabIndex >= 0) // if (m_curTabIndex >= 0)
// m_curWinTab.setForegroundAt(m_curTabIndex, AdempierePLAF.getTextColor_Normal()); // m_curWinTab.setForegroundAt(m_curTabIndex, AdempierePLAF.getTextColor_Normal());
// m_curWinTab.setForegroundAt(tpIndex, AdempierePLAF.getTextColor_OK()); // m_curWinTab.setForegroundAt(tpIndex, AdempierePLAF.getTextColor_OK());
previousIndex = m_curTabIndex;
m_curTabIndex = tpIndex; m_curTabIndex = tpIndex;
if (!isAPanelTab) if (!isAPanelTab)
m_curGC = gc; m_curGC = gc;
@ -1025,8 +1041,15 @@ public final class APanel extends CPanel
{ {
MRole role = MRole.getDefault(); MRole role = MRole.getDefault();
m_curGC.query (m_onlyCurrentRows, m_onlyCurrentDays, role.getMaxQueryRecords()); m_curGC.query (m_onlyCurrentRows, m_onlyCurrentDays, role.getMaxQueryRecords());
if (m_curGC.isNeedToSaveParent())
{
// there is a problem, so we go back
ADialog.error(m_curWindowNo, this, "SaveParentFirst");
m_curWinTab.setSelectedIndex(previousIndex);
setBusy(false, true);
return;
}
} }
// Set initial record // Set initial record
if (m_curTab.getRowCount() == 0) if (m_curTab.getRowCount() == 0)
{ {
@ -1237,6 +1260,8 @@ public final class APanel extends CPanel
else if (cmd.equals(aHelp.getName())) else if (cmd.equals(aHelp.getName()))
cmd_help(); cmd_help();
// General Commands (Environment) // General Commands (Environment)
else if (cmd.equals(aLogout.getName()))
cmd_logout();
else if (!AEnv.actionPerformed (e.getActionCommand(), m_curWindowNo, this)) else if (!AEnv.actionPerformed (e.getActionCommand(), m_curWindowNo, this))
log.log(Level.SEVERE, "No action for: " + cmd); log.log(Level.SEVERE, "No action for: " + cmd);
} }
@ -1254,6 +1279,14 @@ public final class APanel extends CPanel
setBusy(false, true); setBusy(false, true);
} // actionPerformed } // actionPerformed
private void cmd_logout() {
JFrame top = Env.getWindow(0);
if (top instanceof AMenu) {
((AMenu)top).logout();
}
}
/** /**
* Create New Record * Create New Record
* @param copy true if current record is to be copied * @param copy true if current record is to be copied

View File

@ -159,8 +159,8 @@ public final class AppsAction extends AbstractAction
*/ */
private ImageIcon getIcon(String name, boolean small) private ImageIcon getIcon(String name, boolean small)
{ {
String fullName = name + (small ? "16.gif" : "24.gif"); String fullName = name + (small ? "16" : "24");
return Env.getImageIcon(fullName); return Env.getImageIcon2(fullName);
} // getIcon } // getIcon
/** /**

View File

@ -686,6 +686,7 @@ public abstract class Info extends CDialog
final AWindow frame = new AWindow(); final AWindow frame = new AWindow();
if (!frame.initWindow(AD_Window_ID, zoomQuery)) if (!frame.initWindow(AD_Window_ID, zoomQuery))
return; return;
AEnv.addToWindowManager(frame);
// Modal Window causes UI lock // Modal Window causes UI lock
if (isModal()) if (isModal())
{ {

View File

@ -451,6 +451,7 @@ public class VLocator extends JComponent
AWindow frame = new AWindow(); AWindow frame = new AWindow();
if (!frame.initWindow(AD_Window_ID, null)) if (!frame.initWindow(AD_Window_ID, null))
return; return;
AEnv.addToWindowManager(frame);
AEnv.showCenterScreen(frame); AEnv.showCenterScreen(frame);
frame = null; frame = null;
setCursor(Cursor.getDefaultCursor()); setCursor(Cursor.getDefaultCursor());

View File

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
@ -22,6 +22,7 @@ import java.net.*;
import java.util.logging.*; import java.util.logging.*;
import javax.jnlp.*; import javax.jnlp.*;
import javax.swing.*; import javax.swing.*;
import org.adempiere.plaf.AdempierePLAF;
import org.compiere.db.*; import org.compiere.db.*;
import org.compiere.model.*; import org.compiere.model.*;
import org.compiere.plaf.*; import org.compiere.plaf.*;
@ -33,6 +34,9 @@ import com.qoppa.pdf.*;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: Adempiere.java,v 1.8 2006/08/11 02:58:14 jjanke Exp $ * @version $Id: Adempiere.java,v 1.8 2006/08/11 02:58:14 jjanke Exp $
*
* globalqss: fix error about null pointer in OnlineHelp.Worker.run
* change the URL for online help for connection
*/ */
public final class Adempiere public final class Adempiere
{ {
@ -149,8 +153,8 @@ public final class Adempiere
s_ImplementationVersion = adempierePackage.getImplementationVersion(); s_ImplementationVersion = adempierePackage.getImplementationVersion();
if (s_ImplementationVendor == null) if (s_ImplementationVendor == null)
{ {
s_ImplementationVendor = "not supported"; s_ImplementationVendor = "Supported by ADempiere community";
s_ImplementationVersion = "unknown"; s_ImplementationVersion = "ADempiere";
} }
} // setPackageInfo } // setPackageInfo
@ -453,12 +457,7 @@ public final class Adempiere
{ {
if (CLogMgt.isLevelAll()) if (CLogMgt.isLevelAll())
log.log(Level.FINEST, System.getProperties().toString()); log.log(Level.FINEST, System.getProperties().toString());
// AdempierePLAF.setPLAF ();
//begin vpj-cd e-evolution
//CompiereTheme.load();
AdempiereThemeInnova.load();
//end vpj-cd e-evolution
AdempierePLAF.setPLAF (null);
} }
// Set Default Database Connection from Ini // Set Default Database Connection from Ini

View File

@ -48,6 +48,8 @@ public class ConfigOracle extends Config
private static OracleDriver s_oracleDriver = null; private static OracleDriver s_oracleDriver = null;
/** Discoverd TNS */ /** Discoverd TNS */
private String[] p_discovered = null; private String[] p_discovered = null;
/** Discovered Database Name */
private String[] p_dbname = null;
/** Last Connection */ /** Last Connection */
private Connection m_con = null; private Connection m_con = null;
/** Express Edition */ /** Express Edition */
@ -75,12 +77,15 @@ public class ConfigOracle extends Config
return p_discovered; return p_discovered;
// //
ArrayList<String> list = new ArrayList<String>(); ArrayList<String> list = new ArrayList<String>();
ArrayList<String> dblist = new ArrayList<String>();
// default value to lowercase or null // default value to lowercase or null
String def = selected; String def = selected;
if (def != null && def.trim().length() == 0) if (def != null && def.trim().length() == 0)
def = null; def = null;
if (def != null) if (def != null) {
list.add(def.toLowerCase()); list.add(def.toLowerCase());
dblist.add(def.toLowerCase());
}
if (m_XE) if (m_XE)
{ {
@ -88,34 +93,90 @@ public class ConfigOracle extends Config
if (!list.contains(serviceName)) if (!list.contains(serviceName))
list.add(serviceName); list.add(serviceName);
} }
// Search for Oracle Info
String path = System.getProperty("java.library.path"); String path = System.getenv("ORACLE_HOME");
String[] entries = path.split(File.pathSeparator); if (path == null)
for (int e = 0; e < entries.length; e++)
{ {
String entry = entries[e].toLowerCase(); // Search for Oracle Info
if (entry.indexOf("ora") != -1 && entry.endsWith("bin")) path = System.getProperty("java.library.path");
String[] entries = path.split(File.pathSeparator);
for (int e = 0; e < entries.length; e++)
{ {
StringBuffer sb = getTNS_File (entries[e].substring(0, entries[e].length()-4)); String entry = entries[e].toLowerCase();
String[] serviceNames = getTNS_Names (sb); if (entry.indexOf("ora") != -1 && entry.endsWith("bin"))
if (serviceNames != null)
{ {
for (int i = 0; i < serviceNames.length; i++) StringBuffer sb = getTNS_File (entries[e].substring(0, entries[e].length()-4));
String[] tnsnames = getTNS_Names (sb, true);
String[] dbNames = getTNS_Names (sb, false);
if (tnsnames != null)
{ {
String serviceName = serviceNames[i].toLowerCase(); for (int i = 0; i < tnsnames.length; i++)
if (!list.contains(serviceName)) {
list.add(serviceName); String tns = tnsnames[i]; // is lower case
String db = dbNames[i];
if (!tns.equals(def)) {
list.add(tns);
dblist.add(db);
} else {
dblist.remove(0);
dblist.add(0, db);
}
}
break;
}
}
} // for all path entries
}
else
{
StringBuffer sb = getTNS_File (path);
String[] tnsnames = getTNS_Names (sb, true);
String[] dbNames = getTNS_Names (sb, false);
if (tnsnames != null)
{
for (int i = 0; i < tnsnames.length; i++)
{
String tns = tnsnames[i]; // is lower case
String db = dbNames[i];
if (!tns.equals(def)) {
list.add(tns);
dblist.add(db);
} else {
dblist.remove(0);
dblist.add(0, db);
} }
break;
} }
} }
} // for all path entries }
p_discovered = new String[list.size()]; p_discovered = new String[list.size()];
list.toArray(p_discovered); list.toArray(p_discovered);
p_dbname = new String[dblist.size()];
dblist.toArray(p_dbname);
return p_discovered; return p_discovered;
} // discoverDatabases } // discoverDatabases
@Override
public String getDatabaseName(String nativeConnectioName)
{
int idx = -1;
if (p_discovered == null) return nativeConnectioName;
for (int i = 0; i < p_discovered.length; i++)
{
if (p_discovered[i].equals(nativeConnectioName))
{
idx = i;
break;
}
}
if (idx >= 0
&& p_dbname != null
&& idx < p_dbname.length)
return p_dbname[idx];
else
return nativeConnectioName;
}
/** /**
* Get File tnmsnames.ora in StringBuffer * Get File tnmsnames.ora in StringBuffer
* @param oraHome ORACLE_HOME * @param oraHome ORACLE_HOME
@ -157,7 +218,7 @@ public class ConfigOracle extends Config
* @param tnsnames content of tnsnames.ora * @param tnsnames content of tnsnames.ora
* @return service names or null * @return service names or null
*/ */
private String[] getTNS_Names (StringBuffer tnsnames) private String[] getTNS_Names (StringBuffer tnsnames, boolean tns)
{ {
if (tnsnames == null) if (tnsnames == null)
return null; return null;
@ -169,7 +230,7 @@ public class ConfigOracle extends Config
{ {
String line = lines[i].trim(); String line = lines[i].trim();
log.finest(i + ": " + line); log.finest(i + ": " + line);
if (false) // get TNS Name if (tns) // get TNS Name
{ {
if (line.length() > 0 if (line.length() > 0
&& Character.isLetter(line.charAt(0)) // no # ( && Character.isLetter(line.charAt(0)) // no # (
@ -304,8 +365,8 @@ public class ConfigOracle extends Config
// TNS Name Info via sqlplus - if not tomcat // TNS Name Info via sqlplus - if not tomcat
if (!p_data.getAppsServerType().equals(ConfigurationData.APPSTYPE_TOMCAT)) if (!p_data.getAppsServerType().equals(ConfigurationData.APPSTYPE_TOMCAT))
{ {
String sqlplus = "sqlplus system/" + systemPassword + "@" + databaseName String sqlplus = "sqlplus system/" + systemPassword + "@"
+ " @" + getProperty(ConfigurationData.ADEMPIERE_HOME) + databaseServer.getHostName() + "/" + databaseName
+ "/utils/oracle/Test.sql"; + "/utils/oracle/Test.sql";
log.config(sqlplus); log.config(sqlplus);
pass = testSQL(sqlplus); pass = testSQL(sqlplus);

View File

@ -234,7 +234,10 @@ public class ConfigurationData
setAppsServer(hostName); setAppsServer(hostName);
// Database Server // Database Server
initDatabase(""); initDatabase("");
setDatabaseName(getDatabaseDiscovered()); String connectionName = getDatabaseDiscovered();
if (connectionName != null) {
setDatabaseName(resolveDatabaseName(connectionName));
}
setDatabaseSystemPassword(""); setDatabaseSystemPassword("");
setDatabaseServer(hostName); setDatabaseServer(hostName);
setDatabaseUser("adempiere"); setDatabaseUser("adempiere");
@ -274,6 +277,17 @@ public class ConfigurationData
} // load } // load
public String resolveDatabaseName(String connectionName) {
int index = p_panel.fDatabaseType.getSelectedIndex();
if (index < 0 || index >= DBTYPE.length)
log.warning("DatabaseType Index invalid: " + index);
else if (m_databaseConfig[index] == null)
log.warning("DatabaseType Config missing: " + DBTYPE[index]);
else
return m_databaseConfig[index].getDatabaseName(connectionName);
return connectionName;
}
/************************************************************************** /**************************************************************************
* test * test
* @return true if test ok * @return true if test ok
@ -728,11 +742,11 @@ public class ConfigurationData
ccType = Database.DB_DB2; ccType = Database.DB_DB2;
else if (getDatabaseType().equals(DBTYPE_DERBY)) else if (getDatabaseType().equals(DBTYPE_DERBY))
ccType = Database.DB_DERBY; ccType = Database.DB_DERBY;
//begin vpj-cd e-evolution 03/17/2005 PostgreSQL //begin vpj-cd e-evolution 03/17/2005 PostgreSQL
else if (getDatabaseType().equals(DBTYPE_POSTGRESQL)) else if (getDatabaseType().equals(DBTYPE_POSTGRESQL))
ccType = Database.DB_POSTGRESQL; ccType = Database.DB_POSTGRESQL;
else if (getDatabaseType().equals(DBTYPE_FYRACLE)) else if (getDatabaseType().equals(DBTYPE_FYRACLE))
ccType = Database.DB_FYRACLE; ccType = Database.DB_FYRACLE;
//end vpj-cd e-evolution 03/17/2005 PostgreSQL //end vpj-cd e-evolution 03/17/2005 PostgreSQL
CConnection cc = null; CConnection cc = null;
@ -1132,8 +1146,8 @@ public class ConfigurationData
// begin e-evolution vpj-cd 02/07/2005 PostgreSQL // begin e-evolution vpj-cd 02/07/2005 PostgreSQL
/** PostgreSQL */ /** PostgreSQL */
private static String DBTYPE_POSTGRESQL = "postgresql"; private static String DBTYPE_POSTGRESQL = "postgresql";
private static String DBTYPE_EDB = "enterprisedb"; private static String DBTYPE_EDB = "enterprisedb";
private static String DBTYPE_FYRACLE = "fyracle"; private static String DBTYPE_FYRACLE = "fyracle";
// end e-evolution vpj-cd 02/07/2005 PostgreSQL // end e-evolution vpj-cd 02/07/2005 PostgreSQL
@ -1144,8 +1158,8 @@ public class ConfigurationData
//DBTYPE_DB2, //DBTYPE_DB2,
//DBTYPE_MS, //DBTYPE_MS,
DBTYPE_FYRACLE, DBTYPE_FYRACLE,
//begin e-evolution vpj-cd 02/07/2005 PostgreSQL //begin e-evolution vpj-cd 02/07/2005 PostgreSQL
DBTYPE_POSTGRESQL DBTYPE_POSTGRESQL
}; };
//end e-evolution vpj-cd 02/07/2005 PostgreSQL //end e-evolution vpj-cd 02/07/2005 PostgreSQL

View File

@ -134,10 +134,6 @@ public class CComboBox extends JComboBox
*/ */
private void init() private void init()
{ {
// overwrite - otherwise Label Font
setFont(AdempierePLAF.getFont_Field());
setForeground(AdempierePLAF.getTextColor_Normal());
setBackground(false);
FIELD_HIGHT = getPreferredSize().height; FIELD_HIGHT = getPreferredSize().height;
} // init } // init