Adempiere 3.1.2 + marekmosiewicz , hengsin
This commit is contained in:
parent
dee6003f14
commit
77d3ad8ced
|
@ -128,6 +128,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
/** Logger */
|
||||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
private boolean m_parentNeedSave = false;
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Tab loader for Tabs > 0
|
||||
|
@ -508,6 +510,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
// Detail Query
|
||||
if (isDetail())
|
||||
{
|
||||
m_parentNeedSave = false;
|
||||
String lc = getLinkColumnName();
|
||||
if (lc.equals(""))
|
||||
log.severe ("No link column");
|
||||
|
@ -520,7 +523,12 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
m_linkValue = value;
|
||||
// Check validity
|
||||
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
|
||||
{
|
||||
// we have column and value
|
||||
|
@ -2410,6 +2418,14 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
return m_mTable.getValueAt(row, col);
|
||||
} // getValue
|
||||
|
||||
public boolean isNeedToSaveParent()
|
||||
{
|
||||
if (isDetail())
|
||||
return m_parentNeedSave;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* toString
|
||||
* @return String representation
|
||||
|
|
|
@ -438,7 +438,7 @@ class AcctViewerData
|
|||
rm.addColumn(new RColumn(ctx, "Description", DisplayType.String));
|
||||
}
|
||||
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));
|
||||
return rm;
|
||||
} // createRModel
|
||||
|
|
|
@ -52,9 +52,11 @@ public final class APanel extends CPanel
|
|||
* Constructs a new instance.
|
||||
* Need to call initPanel for dynamic initialization
|
||||
*/
|
||||
public APanel()
|
||||
public APanel(AWindow window)
|
||||
{
|
||||
super();
|
||||
m_window = window;
|
||||
|
||||
m_ctx = Env.getCtx();
|
||||
//
|
||||
try
|
||||
|
@ -71,6 +73,8 @@ public final class APanel extends CPanel
|
|||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(APanel.class);
|
||||
|
||||
private AWindow m_window;
|
||||
|
||||
/**
|
||||
* Dispose
|
||||
*/
|
||||
|
@ -144,6 +148,8 @@ public final class APanel extends CPanel
|
|||
this.add(northPanel, BorderLayout.NORTH);
|
||||
northPanel.setLayout(northLayout);
|
||||
northLayout.setAlignment(FlowLayout.LEFT);
|
||||
toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
|
||||
toolBar.setBorderPainted(false);
|
||||
northPanel.add(toolBar, null);
|
||||
} // jbInit
|
||||
|
||||
|
@ -160,7 +166,6 @@ public final class APanel extends CPanel
|
|||
aAccount, aCalculator, aCalendar, aEditor, aPreference, aScript,
|
||||
aOnline, aMailSupport, aAbout, aPrintScr, aScrShot, aExit, aBPartner, aDeleteSelection;
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Create Menu and Toolbar and registers keyboard actions.
|
||||
* - started from constructor
|
||||
|
@ -180,6 +185,7 @@ public final class APanel extends CPanel
|
|||
aPrint = addAction("Print", mFile, KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0), false);
|
||||
mFile.addSeparator();
|
||||
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);
|
||||
// Edit
|
||||
JMenu mEdit = AEnv.getMenu("Edit");
|
||||
|
@ -249,6 +255,12 @@ public final class APanel extends CPanel
|
|||
mTools.addSeparator();
|
||||
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
|
||||
JMenu mHelp = AEnv.getMenu("Help");
|
||||
menuBar.add(mHelp);
|
||||
|
@ -812,8 +824,7 @@ public final class APanel extends CPanel
|
|||
aSave.setEnabled(changed && !readOnly);
|
||||
//
|
||||
// No Rows
|
||||
if (e.getTotalRows() == 0 && insertRecord)
|
||||
{
|
||||
if (e.getTotalRows() == 0 && insertRecord) {
|
||||
aNew.setEnabled(true);
|
||||
aDelete.setEnabled(false);
|
||||
aDeleteSelection.setEnabled(false);
|
||||
|
@ -920,6 +931,8 @@ public final class APanel extends CPanel
|
|||
boolean back = false;
|
||||
boolean isAPanelTab = false;
|
||||
|
||||
int previousIndex = 0;
|
||||
|
||||
// Workbench Tab Change
|
||||
if (tp.isWorkbench())
|
||||
{
|
||||
|
@ -946,6 +959,8 @@ public final class APanel extends CPanel
|
|||
log.info("Tab=" + tp);
|
||||
m_curWinTab = tp;
|
||||
int tpIndex = m_curWinTab.getSelectedIndex();
|
||||
// detect no tab change
|
||||
if (tpIndex == m_curTabIndex) return;
|
||||
back = tpIndex < m_curTabIndex;
|
||||
GridController gc = null;
|
||||
if (m_curWinTab.getSelectedComponent() instanceof GridController)
|
||||
|
@ -1001,6 +1016,7 @@ public final class APanel extends CPanel
|
|||
// if (m_curTabIndex >= 0)
|
||||
// m_curWinTab.setForegroundAt(m_curTabIndex, AdempierePLAF.getTextColor_Normal());
|
||||
// m_curWinTab.setForegroundAt(tpIndex, AdempierePLAF.getTextColor_OK());
|
||||
previousIndex = m_curTabIndex;
|
||||
m_curTabIndex = tpIndex;
|
||||
if (!isAPanelTab)
|
||||
m_curGC = gc;
|
||||
|
@ -1025,8 +1041,15 @@ public final class APanel extends CPanel
|
|||
{
|
||||
MRole role = MRole.getDefault();
|
||||
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
|
||||
if (m_curTab.getRowCount() == 0)
|
||||
{
|
||||
|
@ -1237,6 +1260,8 @@ public final class APanel extends CPanel
|
|||
else if (cmd.equals(aHelp.getName()))
|
||||
cmd_help();
|
||||
// General Commands (Environment)
|
||||
else if (cmd.equals(aLogout.getName()))
|
||||
cmd_logout();
|
||||
else if (!AEnv.actionPerformed (e.getActionCommand(), m_curWindowNo, this))
|
||||
log.log(Level.SEVERE, "No action for: " + cmd);
|
||||
}
|
||||
|
@ -1254,6 +1279,14 @@ public final class APanel extends CPanel
|
|||
setBusy(false, true);
|
||||
} // actionPerformed
|
||||
|
||||
private void cmd_logout() {
|
||||
JFrame top = Env.getWindow(0);
|
||||
if (top instanceof AMenu) {
|
||||
((AMenu)top).logout();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create New Record
|
||||
* @param copy true if current record is to be copied
|
||||
|
|
|
@ -159,8 +159,8 @@ public final class AppsAction extends AbstractAction
|
|||
*/
|
||||
private ImageIcon getIcon(String name, boolean small)
|
||||
{
|
||||
String fullName = name + (small ? "16.gif" : "24.gif");
|
||||
return Env.getImageIcon(fullName);
|
||||
String fullName = name + (small ? "16" : "24");
|
||||
return Env.getImageIcon2(fullName);
|
||||
} // getIcon
|
||||
|
||||
/**
|
||||
|
|
|
@ -686,6 +686,7 @@ public abstract class Info extends CDialog
|
|||
final AWindow frame = new AWindow();
|
||||
if (!frame.initWindow(AD_Window_ID, zoomQuery))
|
||||
return;
|
||||
AEnv.addToWindowManager(frame);
|
||||
// Modal Window causes UI lock
|
||||
if (isModal())
|
||||
{
|
||||
|
|
|
@ -451,6 +451,7 @@ public class VLocator extends JComponent
|
|||
AWindow frame = new AWindow();
|
||||
if (!frame.initWindow(AD_Window_ID, null))
|
||||
return;
|
||||
AEnv.addToWindowManager(frame);
|
||||
AEnv.showCenterScreen(frame);
|
||||
frame = null;
|
||||
setCursor(Cursor.getDefaultCursor());
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.net.*;
|
|||
import java.util.logging.*;
|
||||
import javax.jnlp.*;
|
||||
import javax.swing.*;
|
||||
import org.adempiere.plaf.AdempierePLAF;
|
||||
import org.compiere.db.*;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.plaf.*;
|
||||
|
@ -33,6 +34,9 @@ import com.qoppa.pdf.*;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @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
|
||||
{
|
||||
|
@ -149,8 +153,8 @@ public final class Adempiere
|
|||
s_ImplementationVersion = adempierePackage.getImplementationVersion();
|
||||
if (s_ImplementationVendor == null)
|
||||
{
|
||||
s_ImplementationVendor = "not supported";
|
||||
s_ImplementationVersion = "unknown";
|
||||
s_ImplementationVendor = "Supported by ADempiere community";
|
||||
s_ImplementationVersion = "ADempiere";
|
||||
}
|
||||
} // setPackageInfo
|
||||
|
||||
|
@ -453,12 +457,7 @@ public final class Adempiere
|
|||
{
|
||||
if (CLogMgt.isLevelAll())
|
||||
log.log(Level.FINEST, System.getProperties().toString());
|
||||
//
|
||||
//begin vpj-cd e-evolution
|
||||
//CompiereTheme.load();
|
||||
AdempiereThemeInnova.load();
|
||||
//end vpj-cd e-evolution
|
||||
AdempierePLAF.setPLAF (null);
|
||||
AdempierePLAF.setPLAF ();
|
||||
}
|
||||
|
||||
// Set Default Database Connection from Ini
|
||||
|
|
|
@ -48,6 +48,8 @@ public class ConfigOracle extends Config
|
|||
private static OracleDriver s_oracleDriver = null;
|
||||
/** Discoverd TNS */
|
||||
private String[] p_discovered = null;
|
||||
/** Discovered Database Name */
|
||||
private String[] p_dbname = null;
|
||||
/** Last Connection */
|
||||
private Connection m_con = null;
|
||||
/** Express Edition */
|
||||
|
@ -75,12 +77,15 @@ public class ConfigOracle extends Config
|
|||
return p_discovered;
|
||||
//
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
ArrayList<String> dblist = new ArrayList<String>();
|
||||
// default value to lowercase or null
|
||||
String def = selected;
|
||||
if (def != null && def.trim().length() == 0)
|
||||
def = null;
|
||||
if (def != null)
|
||||
if (def != null) {
|
||||
list.add(def.toLowerCase());
|
||||
dblist.add(def.toLowerCase());
|
||||
}
|
||||
|
||||
if (m_XE)
|
||||
{
|
||||
|
@ -88,8 +93,12 @@ public class ConfigOracle extends Config
|
|||
if (!list.contains(serviceName))
|
||||
list.add(serviceName);
|
||||
}
|
||||
|
||||
String path = System.getenv("ORACLE_HOME");
|
||||
if (path == null)
|
||||
{
|
||||
// Search for Oracle Info
|
||||
String path = System.getProperty("java.library.path");
|
||||
path = System.getProperty("java.library.path");
|
||||
String[] entries = path.split(File.pathSeparator);
|
||||
for (int e = 0; e < entries.length; e++)
|
||||
{
|
||||
|
@ -97,25 +106,77 @@ public class ConfigOracle extends Config
|
|||
if (entry.indexOf("ora") != -1 && entry.endsWith("bin"))
|
||||
{
|
||||
StringBuffer sb = getTNS_File (entries[e].substring(0, entries[e].length()-4));
|
||||
String[] serviceNames = getTNS_Names (sb);
|
||||
if (serviceNames != null)
|
||||
String[] tnsnames = getTNS_Names (sb, true);
|
||||
String[] dbNames = getTNS_Names (sb, false);
|
||||
if (tnsnames != null)
|
||||
{
|
||||
for (int i = 0; i < serviceNames.length; i++)
|
||||
for (int i = 0; i < tnsnames.length; i++)
|
||||
{
|
||||
String serviceName = serviceNames[i].toLowerCase();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_discovered = new String[list.size()];
|
||||
list.toArray(p_discovered);
|
||||
p_dbname = new String[dblist.size()];
|
||||
dblist.toArray(p_dbname);
|
||||
return p_discovered;
|
||||
} // 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
|
||||
* @param oraHome ORACLE_HOME
|
||||
|
@ -157,7 +218,7 @@ public class ConfigOracle extends Config
|
|||
* @param tnsnames content of tnsnames.ora
|
||||
* @return service names or null
|
||||
*/
|
||||
private String[] getTNS_Names (StringBuffer tnsnames)
|
||||
private String[] getTNS_Names (StringBuffer tnsnames, boolean tns)
|
||||
{
|
||||
if (tnsnames == null)
|
||||
return null;
|
||||
|
@ -169,7 +230,7 @@ public class ConfigOracle extends Config
|
|||
{
|
||||
String line = lines[i].trim();
|
||||
log.finest(i + ": " + line);
|
||||
if (false) // get TNS Name
|
||||
if (tns) // get TNS Name
|
||||
{
|
||||
if (line.length() > 0
|
||||
&& Character.isLetter(line.charAt(0)) // no # (
|
||||
|
@ -304,8 +365,8 @@ public class ConfigOracle extends Config
|
|||
// TNS Name Info via sqlplus - if not tomcat
|
||||
if (!p_data.getAppsServerType().equals(ConfigurationData.APPSTYPE_TOMCAT))
|
||||
{
|
||||
String sqlplus = "sqlplus system/" + systemPassword + "@" + databaseName
|
||||
+ " @" + getProperty(ConfigurationData.ADEMPIERE_HOME)
|
||||
String sqlplus = "sqlplus system/" + systemPassword + "@"
|
||||
+ databaseServer.getHostName() + "/" + databaseName
|
||||
+ "/utils/oracle/Test.sql";
|
||||
log.config(sqlplus);
|
||||
pass = testSQL(sqlplus);
|
||||
|
|
|
@ -234,7 +234,10 @@ public class ConfigurationData
|
|||
setAppsServer(hostName);
|
||||
// Database Server
|
||||
initDatabase("");
|
||||
setDatabaseName(getDatabaseDiscovered());
|
||||
String connectionName = getDatabaseDiscovered();
|
||||
if (connectionName != null) {
|
||||
setDatabaseName(resolveDatabaseName(connectionName));
|
||||
}
|
||||
setDatabaseSystemPassword("");
|
||||
setDatabaseServer(hostName);
|
||||
setDatabaseUser("adempiere");
|
||||
|
@ -274,6 +277,17 @@ public class ConfigurationData
|
|||
} // 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
|
||||
* @return true if test ok
|
||||
|
|
|
@ -134,10 +134,6 @@ public class CComboBox extends JComboBox
|
|||
*/
|
||||
private void init()
|
||||
{
|
||||
// overwrite - otherwise Label Font
|
||||
setFont(AdempierePLAF.getFont_Field());
|
||||
setForeground(AdempierePLAF.getTextColor_Normal());
|
||||
setBackground(false);
|
||||
FIELD_HIGHT = getPreferredSize().height;
|
||||
} // init
|
||||
|
||||
|
|
Loading…
Reference in New Issue