Adempiere 3.1.2

This commit is contained in:
vpj-cd 2006-12-07 03:22:38 +00:00
parent ee46d9e792
commit 8a0bf1e3c7
34 changed files with 10807 additions and 10451 deletions

View File

@ -171,7 +171,6 @@ public class AArchive implements ActionListener
else // all Reports
av.query(true, m_AD_Table_ID, 0);
//
AEnv.addToWindowManager(ff);
ff.pack();
AEnv.showCenterScreen(ff);
ff = null;

View File

@ -257,8 +257,7 @@ public final class AEnv
if (iconName == null)
iconName = actionName;
String text = Msg.getMsg(Env.getCtx(), actionName);
ImageIcon icon = Env.getImageIcon2(iconName + "16");
CMenuItem mi = new CMenuItem(text, icon);
CMenuItem mi = new CMenuItem(text, Env.getImageIcon(iconName + "16.gif"));
mi.setActionCommand(actionName);
if (ks != null)
mi.setAccelerator(ks);
@ -298,11 +297,6 @@ public final class AEnv
if (ADialog.ask(WindowNo, c, "ExitApplication?"))
Env.exitEnv(0);
}
else if (actionCommand.equals("Logout"))
{
AMenu aMenu = (AMenu)Env.getWindow(WindowNo);
aMenu.logout();
}
// View Menu ------------------------
else if (actionCommand.equals("InfoProduct"))
@ -379,9 +373,8 @@ public final class AEnv
}
else if (actionCommand.equals("Preference"))
{
if (role.isShowPreference()) {
if (role.isShowPreference())
AEnv.showCenterScreen(new Preference (Env.getFrame(c), WindowNo));
}
}
// Help Menu ------------------------
@ -485,7 +478,6 @@ public final class AEnv
AWindow frame = new AWindow();
if (!frame.initWindow(AD_Window_ID, MQuery.getEqualQuery(TableName + "_ID", Record_ID)))
return;
addToWindowManager(frame);
AEnv.showCenterScreen(frame);
frame = null;
} // zoom
@ -536,23 +528,11 @@ public final class AEnv
AWindow frame = new AWindow();
if (!frame.initWindow(AD_Window_ID, query))
return;
addToWindowManager(frame);
AEnv.showCenterScreen(frame);
frame = null;
} // zoom
/**
* Track open frame in window manager
* @param frame
*/
public static void addToWindowManager(CFrame frame)
{
JFrame top = Env.getWindow(0);
if (top instanceof AMenu)
{
((AMenu)top).getWindowManager().add(frame);
}
}
/**
* Exit System
* @param status System exit status (usually 0 for no error)
@ -572,26 +552,6 @@ public final class AEnv
Env.exitEnv(status);
} // exit
public static void logout()
{
if (s_server != null)
{
try
{
s_server.remove();
}
catch (Exception ex)
{
}
}
Env.logout();
Splash.getSplash().setVisible(true);
//reload
new AMenu();
}
/**
* Is Workflow Process view enabled.
* @return true if enabled
@ -648,14 +608,7 @@ public final class AEnv
AWindow frame = new AWindow();
if (!frame.initWindow(s_workflow_Window_ID, query))
return;
addToWindowManager(frame);
if (Ini.isPropertyBool(Ini.P_OPEN_WINDOW_MAXIMIZED) ) {
frame.pack();
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
frame.setVisible(true);
frame.toFront();
} else
AEnv.showCenterScreen(frame);
AEnv.showCenterScreen(frame);
frame = null;
} // startWorkflowProcess
@ -909,32 +862,4 @@ public final class AEnv
}
} // cacheReset
/**
* Update all windows after look and feel changes.
* @since 2006-11-27
*/
public static void updateUI()
{
Set<Window> updated = Env.updateUI();
JFrame top = Env.getWindow(0);
if (top instanceof AMenu)
{
CFrame[] frames = ((AMenu)top).getWindowManager().getWindows();
for (CFrame f : frames)
{
if (updated.contains(f)) continue;
SwingUtilities.updateComponentTreeUI(f);
f.validate();
RepaintManager mgr = RepaintManager.currentManager(f);
Component childs[] = f.getComponents();
for (Component c : childs) {
if (c instanceof JComponent)
mgr.markCompletelyDirty((JComponent)c);
}
f.repaint();
updated.add(f);
}
}
}
} // AEnv

View File

@ -408,7 +408,6 @@ public final class ALogin extends CDialog
connectionOK(); // first ok
else
{
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
m_okPressed = true;
defaultsOK(); // disposes
}
@ -548,7 +547,7 @@ public final class ALogin extends CDialog
m_pwd = new String (passwordField.getPassword());
// Establish connection
connectToDatabase();
DB.setDBTarget(CConnection.get());
if (!DB.isConnected())
{
statusBar.setStatusLine(txt_NoDatabase, true);

View File

@ -35,6 +35,7 @@ import org.compiere.grid.tree.*;
import org.compiere.model.*;
import org.compiere.swing.*;
import org.compiere.util.*;
/**
* Application Menu Controller
*
@ -57,9 +58,6 @@ public final class AMenu extends CFrame
// Login
initSystem (splash); // login
splash.setText(Msg.getMsg(m_ctx, "Loading"));
splash.toFront();
splash.paint(splash.getGraphics());
//
Adempiere.startupEnvironment(true); // Load Environment
MSession.get (Env.getCtx(), true); // Start Session
@ -136,8 +134,6 @@ public final class AMenu extends CFrame
/** Logger */
private static CLogger log = CLogger.getCLogger(AMenu.class);
private WindowManager windowManager = new WindowManager();
/**************************************************************************
* Init System.
@ -274,7 +270,6 @@ public final class AMenu extends CFrame
m_tabActivities++;
m_tabWorkflow++;
}
treePanel.setBorder(BorderFactory.createEmptyBorder(2,3,2,3));
centerPane.add(treePanel, Msg.getMsg(m_ctx, "Menu"));
centerPane.add(new CScrollPane(wfActivity), Msg.getMsg (m_ctx, "WorkflowActivities") + ": 0");
centerPane.add(new CScrollPane(wfPanel), Msg.getMsg (m_ctx, "WorkflowPanel"));
@ -317,7 +312,6 @@ public final class AMenu extends CFrame
AEnv.addMenuItem("PrintScreen", null, KeyStroke.getKeyStroke(KeyEvent.VK_PRINTSCREEN, 0), mFile, this);
AEnv.addMenuItem("ScreenShot", null, KeyStroke.getKeyStroke(KeyEvent.VK_PRINTSCREEN, KeyEvent.SHIFT_MASK), mFile, this);
mFile.addSeparator();
AEnv.addMenuItem("Logout", null, KeyStroke.getKeyStroke(KeyEvent.VK_L, Event.SHIFT_MASK+Event.ALT_MASK), mFile, this);
AEnv.addMenuItem("Exit", null, KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.SHIFT_MASK+Event.ALT_MASK), mFile, this);
// View
@ -352,10 +346,6 @@ public final class AMenu extends CFrame
AEnv.addMenuItem("Preference", null, null, mTools, this);
}
//Window Menu
JMenu mWindow = new WindowMenu(windowManager, this);
menuBar.add(mWindow);
// Help
JMenu mHelp = AEnv.getMenu("Help");
menuBar.add(mHelp);
@ -378,14 +368,6 @@ public final class AMenu extends CFrame
AEnv.exit(0);
} // dispose
public void logout()
{
windowManager.close();
Ini.saveProperties(true);
super.dispose();
AEnv.logout();
}
/**
* Window Events - requestFocus
* @param e event
@ -611,9 +593,6 @@ public final class AMenu extends CFrame
wfActivity.display();
} // stateChanged
public WindowManager getWindowManager() {
return windowManager;
}
/**************************************************************************
* Mouse Listener

View File

@ -206,22 +206,11 @@ public class AMenuStartItem extends Thread implements ActionListener
*/
private void startWindow(int AD_Workbench_ID, int AD_Window_ID)
{
AWindow frame = (AWindow)Env.showWindow(AD_Window_ID);
if (frame != null) {
m_menu.getWindowManager().add(frame);
if (Env.showWindow(AD_Window_ID))
return;
}
if (Ini.isPropertyBool(Ini.P_SINGLE_INSTANCE_PER_WINDOW)) {
frame = m_menu.getWindowManager().find(AD_Window_ID);
if ( frame != null ) {
frame.toFront();
return;
}
}
SwingUtilities.invokeLater(m_updatePB); // 1
frame = new AWindow();
AWindow frame = new AWindow();
boolean OK = false;
if (AD_Workbench_ID != 0)
OK = frame.initWorkbench(AD_Workbench_ID);
@ -232,19 +221,10 @@ public class AMenuStartItem extends Thread implements ActionListener
SwingUtilities.invokeLater(m_updatePB); // 2
frame.pack();
if (Ini.isPropertyBool(Ini.P_OPEN_WINDOW_MAXIMIZED) )
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
// Center the window
SwingUtilities.invokeLater(m_updatePB); // 3
if (Ini.isPropertyBool(Ini.P_OPEN_WINDOW_MAXIMIZED) ) {
frame.setVisible(true);
frame.toFront();
} else
AEnv.showCenterScreen(frame);
m_menu.getWindowManager().add(frame);
AEnv.showCenterScreen(frame);
// if (wfPanel.isVisible())
// m_WF_Window = frame; // maintain one reference
frame = null;
@ -267,11 +247,8 @@ public class AMenuStartItem extends Thread implements ActionListener
if (!pd.init())
return;
m_timer.start();
m_menu.getWindowManager().add(pd);
SwingUtilities.invokeLater(m_updatePB); // 2
pd.getContentPane().invalidate();
pd.getContentPane().validate();
pd.pack();
// Center the window
SwingUtilities.invokeLater(m_updatePB); // 3
@ -306,7 +283,7 @@ public class AMenuStartItem extends Thread implements ActionListener
return;
SwingUtilities.invokeLater(m_updatePB); // 2
m_menu.getWindowManager().add(new ATask(m_name, task));
new ATask(m_name, task);
// ATask.start(m_name, task);
} // startTask
@ -316,29 +293,14 @@ public class AMenuStartItem extends Thread implements ActionListener
*/
private void startForm (int AD_Form_ID)
{
FormFrame ff = null;
if (Ini.isPropertyBool(Ini.P_SINGLE_INSTANCE_PER_WINDOW)) {
ff = m_menu.getWindowManager().findForm(AD_Form_ID);
if ( ff != null ) {
ff.toFront();
return;
}
}
ff = new FormFrame();
m_menu.getWindowManager().add(ff);
FormFrame ff = new FormFrame();
SwingUtilities.invokeLater(m_updatePB); // 1
ff.openForm(AD_Form_ID);
SwingUtilities.invokeLater(m_updatePB); // 2
ff.pack();
// Center the window
SwingUtilities.invokeLater(m_updatePB); // 3
if (Ini.isPropertyBool(Ini.P_OPEN_WINDOW_MAXIMIZED) ) {
ff.pack();
ff.setExtendedState(Frame.MAXIMIZED_BOTH);
ff.setVisible(true);
ff.toFront();
} else
AEnv.showCenterScreen(ff);
AEnv.showCenterScreen(ff);
} // startForm
} // StartItem

View File

@ -52,11 +52,9 @@ public final class APanel extends CPanel
* Constructs a new instance.
* Need to call initPanel for dynamic initialization
*/
public APanel(AWindow window)
public APanel()
{
super();
m_window = window;
m_ctx = Env.getCtx();
//
try
@ -73,8 +71,6 @@ public final class APanel extends CPanel
/** Logger */
private static CLogger log = CLogger.getCLogger(APanel.class);
private AWindow m_window;
/**
* Dispose
*/
@ -148,8 +144,6 @@ 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
@ -186,7 +180,6 @@ 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");
@ -256,12 +249,6 @@ 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);
@ -330,10 +317,10 @@ public final class APanel extends CPanel
if (menu != null)
menu.add(action.getMenuItem());
action.setDelegate(this);
AbstractButton b = action.getButton();
String s = null;
if (b != null)
s = b.getToolTipText();
// AbstractButton b = action.getButton();
// String s = null;
// if (b != null)
// s = b.getToolTipText();
// Key Strokes
if (accelerator != null)
@ -825,7 +812,8 @@ 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);
@ -932,8 +920,6 @@ public final class APanel extends CPanel
boolean back = false;
boolean isAPanelTab = false;
int previousIndex = 0;
// Workbench Tab Change
if (tp.isWorkbench())
{
@ -960,8 +946,6 @@ 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)
@ -1017,7 +1001,6 @@ 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;
@ -1042,14 +1025,6 @@ 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
@ -1262,8 +1237,6 @@ 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);
}
@ -1281,15 +1254,6 @@ 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
@ -1373,7 +1337,8 @@ public final class APanel extends CPanel
Arrays.sort(indices);
int offset = 0;
for (int i = 0; i < indices.length; i++) {
m_curTab.setCurrentRow(indices[i]-offset);
//m_curTab.setCurrentRow(indices[i]-offset);
m_curTab.navigate(indices[i]-offset);
int keyID = m_curTab.getRecord_ID();
if (m_curTab.dataDelete()){
m_curGC.rowChanged(false, keyID);
@ -1398,7 +1363,6 @@ public final class APanel extends CPanel
log.config("Manual=" + manualCmd);
m_errorDisplayed = false;
m_curGC.stopEditor(true);
boolean saveOK = true;
if (m_curAPanelTab != null)
{
@ -1578,6 +1542,8 @@ public final class APanel extends CPanel
int table_ID = m_curTab.getAD_Table_ID();
int record_ID = m_curTab.getRecord_ID();
ProcessInfo pi = new ProcessInfo (getTitle(), AD_Process_ID, table_ID, record_ID);
pi.setAD_User_ID (Env.getAD_User_ID(m_ctx));
pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx));
ProcessCtl.process(this, m_curWindowNo, pi, null); // calls lockUI, unlockUI
} // cmd_print
@ -1621,7 +1587,8 @@ public final class APanel extends CPanel
return;
}
Attachment va = new Attachment (Env.getFrame(this), m_curWindowNo,
// Attachment va =
new Attachment (Env.getFrame(this), m_curWindowNo,
m_curTab.getAD_AttachmentID(), m_curTab.getAD_Table_ID(), record_ID, null);
//
m_curTab.loadAttachments(); // reload
@ -1656,7 +1623,8 @@ public final class APanel extends CPanel
}
String description = infoName + ": " + infoDisplay;
//
AChat va = new AChat (Env.getFrame(this), m_curWindowNo,
// AChat va =
new AChat (Env.getFrame(this), m_curWindowNo,
m_curTab.getCM_ChatID(), m_curTab.getAD_Table_ID(), record_ID,
description, null);
//

View File

@ -184,7 +184,6 @@ public class ARequest implements ActionListener
AWindow frame = new AWindow();
if (!frame.initWindow(AD_Window_ID, query))
return;
AEnv.addToWindowManager(frame);
// New - set Table/Record
if (e.getSource() == m_new)
{

View File

@ -49,8 +49,7 @@ public class AWindow extends CFrame
/** The GlassPane */
private AGlassPane m_glassPane = new AGlassPane();
/** Application Window */
private APanel m_APanel = new APanel(this);
private APanel m_APanel = new APanel();
/** Logger */
private static CLogger log = CLogger.getCLogger(AWindow.class);

View File

@ -190,7 +190,6 @@ public class AZoomAcross implements ActionListener
AWindow frame = new AWindow();
if (!frame.initWindow(AD_Window_ID, m_query))
return;
AEnv.addToWindowManager(frame);
AEnv.showCenterScreen(frame);
frame = null;
} // launchZoom

View File

@ -130,7 +130,7 @@ public final class AppsAction extends AbstractAction
//
if (accelerator != null)
{
m_button.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW).put(accelerator, action);
m_button.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(accelerator, action);
m_button.getActionMap().put(action, this);
}
} // Action
@ -159,8 +159,8 @@ public final class AppsAction extends AbstractAction
*/
private ImageIcon getIcon(String name, boolean small)
{
String fullName = name + (small ? "16" : "24");
return Env.getImageIcon2(fullName);
String fullName = name + (small ? "16.gif" : "24.gif");
return Env.getImageIcon(fullName);
} // getIcon
/**

View File

@ -0,0 +1,662 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* 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 *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.apps;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import java.util.logging.*;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.event.*;
import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.metal.MetalTheme;
import javax.swing.table.*;
//
import org.adempiere.plaf.PLAFEditor;
import org.adempiere.plaf.PLAFEditorPanel;
import org.adempiere.plaf.AdempierePLAF;
import org.compiere.db.*;
import org.compiere.grid.ed.*;
import org.compiere.minigrid.*;
import org.compiere.model.*;
import org.compiere.plaf.*;
import org.compiere.print.*;
import org.compiere.swing.*;
import org.compiere.util.*;
/**
* Customize settings like L&F, AutoCommit, etc. & Diagnostics
*
* @author Jorg Janke
* @version $Id: Preference.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
*
* @author Low Heng Sin
* @version 2006-11-27
*/
public final class Preference extends CDialog
implements ActionListener, ListSelectionListener
{
/**
* Standard Constructor
* @param frame frame
* @param WindowNo window
*/
public Preference(Frame frame, int WindowNo)
{
super(frame, Msg.getMsg(Env.getCtx(), "Preference"), true);
log.config("Preference");
try
{
jbInit();
}
catch(Exception ex)
{
log.log(Level.SEVERE, ex.getMessage());
}
load();
//
StringBuffer sta = new StringBuffer("#");
sta.append(Env.getCtx().size()).append(" - ")
.append(Msg.translate(Env.getCtx(), "AD_Window_ID"))
.append("=").append(WindowNo);
statusBar.setStatusLine(sta.toString());
statusBar.setStatusDB("");
AEnv.positionCenterWindow(frame, this);
} // Preference
/** Logger */
private static CLogger log = CLogger.getCLogger(Preference.class);
private CPanel panel = new CPanel();
private BorderLayout panelLayout = new BorderLayout();
private CTabbedPane tabPane = new CTabbedPane();
private CPanel customizePane = new CPanel();
private CPanel contextPane = new CPanel();
private GridBagLayout customizeLayout = new GridBagLayout();
private CCheckBox autoCommit = new CCheckBox();
private CCheckBox autoNew = new CCheckBox();
private CCheckBox printPreview = new CCheckBox();
private CCheckBox validateConnectionOnStartup = new CCheckBox();
private CCheckBox singleInstancePerWindow = new CCheckBox();
private CCheckBox openWindowMaximized = new CCheckBox();
private CPanel southPanel = new CPanel();
private BorderLayout southLayout = new BorderLayout();
private BorderLayout icontextLayout = new BorderLayout();
private JList infoList = new JList();
private JScrollPane contextListScrollPane = new JScrollPane(infoList);
private CPanel contextSouthPanel = new CPanel();
private CTextArea contextHeader = new CTextArea(4,15);
private CTextArea contextDetail = new CTextArea(4,35);
private CTextArea infoArea = new CTextArea(5, 30);
private BorderLayout contextSouthLayout = new BorderLayout();
private StatusBar statusBar = new StatusBar();
private ConfirmPanel confirm = new ConfirmPanel(true);
private CComboBox traceLevel = new CComboBox(CLogMgt.LEVELS);
private CLabel traceLabel = new CLabel();
private CCheckBox traceFile = new CCheckBox();
private CCheckBox autoLogin = new CCheckBox();
private CCheckBox adempiereSys = new CCheckBox();
private CCheckBox storePassword = new CCheckBox();
private CCheckBox showTrl = new CCheckBox();
private CCheckBox showAcct = new CCheckBox();
private CCheckBox showAdvanced = new CCheckBox();
private CCheckBox cacheWindow = new CCheckBox();
private CButton uiTheme = new CButton();
private CLabel lPrinter = new CLabel();
private CPrinter fPrinter = new CPrinter();
private CLabel lDate = new CLabel();
private VDate fDate = new VDate();
private CComboBox connectionProfile = new CComboBox(CConnection.CONNECTIONProfiles);
private CLabel connectionProfileLabel = new CLabel();
private CPanel errorPane = new CPanel();
private BorderLayout errorLayout = new BorderLayout();
private JScrollPane errorScrollPane = new JScrollPane();
private MiniTable errorTable = new MiniTable();
private CPanel errorPanel = new CPanel(new FlowLayout(FlowLayout.TRAILING));
private CToggleButton bErrorsOnly = new CToggleButton(Msg.getMsg(Env.getCtx(), "ErrorsOnly"));
private CButton bErrorReset = new CButton(Msg.getMsg(Env.getCtx(), "Reset"));
private CButton bErrorEMail = new CButton(Msg.getMsg(Env.getCtx(), "SendEMail"));
private CButton bErrorSave = new CButton(Msg.getMsg(Env.getCtx(), "SaveFile"));
private CButton bRoleInfo = new CButton(Msg.translate(Env.getCtx(), "AD_Role_ID"));
private CPanel configPanel = new CPanel();
private PLAFEditorPanel plafEditor = new PLAFEditorPanel();
/**
* Static Init.
* <pre>
* - panel
* - tabPane
* - customizePane
* - infoArea
* - fields ...
* - contextPane
* - contextList
* - contextSouthPanel
* - contextHeader
* - contextDetail
* - errorPane
* - errorScollPane
* - errorTable
* - southPanel
* </pre>
* @throws Exception
*/
void jbInit() throws Exception
{
traceLabel.setRequestFocusEnabled(false);
traceLabel.setText(Msg.getMsg(Env.getCtx(), "TraceLevel", true));
traceLabel.setToolTipText(Msg.getMsg(Env.getCtx(), "TraceLevel", false));
traceFile.setText(Msg.getMsg(Env.getCtx(), "TraceFile", true));
traceFile.setToolTipText(Msg.getMsg(Env.getCtx(), "TraceFile", false));
uiTheme.setText(Msg.getMsg(Env.getCtx(), "UITheme", true));
uiTheme.setToolTipText(Msg.getMsg(Env.getCtx(), "UITheme", false));
autoCommit.setText(Msg.getMsg(Env.getCtx(), "AutoCommit", true));
autoCommit.setToolTipText(Msg.getMsg(Env.getCtx(), "AutoCommit", false));
autoNew.setText(Msg.getMsg(Env.getCtx(), "AutoNew", true));
autoNew.setToolTipText(Msg.getMsg(Env.getCtx(), "AutoNew", false));
adempiereSys.setText(Msg.getMsg(Env.getCtx(), "AdempiereSys", true));
adempiereSys.setToolTipText(Msg.getMsg(Env.getCtx(), "AdempiereSys", false));
printPreview.setText(Msg.getMsg(Env.getCtx(), "AlwaysPrintPreview", true));
printPreview.setToolTipText(Msg.getMsg(Env.getCtx(), "AlwaysPrintPreview", false));
validateConnectionOnStartup.setText(Msg.getMsg(Env.getCtx(), "ValidateConnectionOnStartup", true));
validateConnectionOnStartup.setToolTipText(Msg.getMsg(Env.getCtx(), "ValidateConnectionOnStartup", false));
singleInstancePerWindow.setText(Msg.getMsg(Env.getCtx(), "SingleInstancePerWindow", true));
singleInstancePerWindow.setToolTipText(Msg.getMsg(Env.getCtx(), "SingleInstancePerWindow", false));
openWindowMaximized.setText(Msg.getMsg(Env.getCtx(), "OpenWindowMaximized", true));
openWindowMaximized.setToolTipText(Msg.getMsg(Env.getCtx(), "OpenWindowMaximized", false));
autoLogin.setText(Msg.getMsg(Env.getCtx(), "AutoLogin", true));
autoLogin.setToolTipText(Msg.getMsg(Env.getCtx(), "AutoLogin", false));
storePassword.setText(Msg.getMsg(Env.getCtx(), "StorePassword", true));
storePassword.setToolTipText(Msg.getMsg(Env.getCtx(), "StorePassword", false));
showTrl.setText(Msg.getMsg(Env.getCtx(), "ShowTrlTab", true));
showTrl.setToolTipText(Msg.getMsg(Env.getCtx(), "ShowTrlTab", false));
showAcct.setText(Msg.getMsg(Env.getCtx(), "ShowAcctTab", true));
showAcct.setToolTipText(Msg.getMsg(Env.getCtx(), "ShowAcctTab", false));
showAdvanced.setText(Msg.getMsg(Env.getCtx(), "ShowAdvancedTab", true));
showAdvanced.setToolTipText(Msg.getMsg(Env.getCtx(), "ShowAdvancedTab", false));
connectionProfileLabel.setText(Msg.getElement(Env.getCtx(), "ConnectionProfile"));
cacheWindow.setText(Msg.getMsg(Env.getCtx(), "CacheWindow", true));
cacheWindow.setToolTipText(Msg.getMsg(Env.getCtx(), "CacheWindow", false));
lPrinter.setText(Msg.getMsg(Env.getCtx(), "Printer"));
lDate.setText(Msg.getMsg(Env.getCtx(), "Date"));
infoArea.setReadWrite(false);
getContentPane().add(panel);
panel.setLayout(panelLayout);
panel.add(tabPane, BorderLayout.CENTER);
// Customize
// tabPane.add(customizePane, Msg.getMsg(Env.getCtx(), "Preference"));
tabPane.add(customizePane, Msg.getMsg(Env.getCtx(), "Preference"));
customizePane.setLayout(customizeLayout);
customizePane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
Border insetBorder = BorderFactory.createEmptyBorder(2, 2, 2, 0);
CPanel loginPanel = new CPanel();
loginPanel.setBorder(BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "Login")));
loginPanel.setLayout(new GridLayout(1, 2));
autoLogin.setBorder(insetBorder);
storePassword.setBorder(insetBorder);
loginPanel.add(autoLogin);
loginPanel.add(storePassword);
customizePane.add(loginPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0));
CPanel windowPanel = new CPanel();
windowPanel.setBorder(BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "Window")));
windowPanel.setLayout(new GridLayout(4, 2));
windowPanel.add(showAcct);showAcct.setBorder(insetBorder);
windowPanel.add(showTrl);showTrl.setBorder(insetBorder);
windowPanel.add(showAdvanced);showAdvanced.setBorder(insetBorder);
windowPanel.add(autoCommit);autoCommit.setBorder(insetBorder);
windowPanel.add(autoNew);autoNew.setBorder(insetBorder);
windowPanel.add(cacheWindow);cacheWindow.setBorder(insetBorder);
windowPanel.add(openWindowMaximized);openWindowMaximized.setBorder(insetBorder);
windowPanel.add(singleInstancePerWindow);singleInstancePerWindow.setBorder(insetBorder);
customizePane.add(windowPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0));
CPanel connPanel = new CPanel();
connPanel.setBorder(BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "Connection")));
connPanel.setLayout(new GridBagLayout());
connPanel.add(connectionProfileLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
connPanel.add(connectionProfile, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
connPanel.add(validateConnectionOnStartup, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
customizePane.add(connPanel, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0));
CPanel tracePanel = new CPanel();
tracePanel.setBorder(BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "TraceInfo")));
tracePanel.setLayout(new GridBagLayout());
tracePanel.add(traceLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
tracePanel.add(traceLevel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
tracePanel.add(traceFile, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
customizePane.add(tracePanel, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0));
CPanel printPanel = new CPanel();
printPanel.setBorder(BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "Printing")));
printPanel.setLayout(new GridBagLayout());
printPanel.add(lPrinter, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
printPanel.add(fPrinter, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
printPanel.add(printPreview, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
customizePane.add(printPanel, new GridBagConstraints(0, 4, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0));
CPanel otherPanel = new CPanel();
otherPanel.setBorder(BorderFactory.createEmptyBorder());
otherPanel.setLayout(new GridLayout());
CPanel datePanel = new CPanel();
datePanel.setLayout(new FlowLayout());
((FlowLayout)datePanel.getLayout()).setAlignment(FlowLayout.LEFT);
datePanel.add(lDate);
datePanel.add(fDate);
otherPanel.add(datePanel);datePanel.setBorder(insetBorder);
otherPanel.add(adempiereSys);adempiereSys.setBorder(insetBorder);
customizePane.add(otherPanel, new GridBagConstraints(0, 5, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0));
CPanel themePanel = new CPanel();
themePanel.setLayout(new GridLayout(1, 1));
themePanel.add(plafEditor);
tabPane.add(themePanel, Msg.getMsg(Env.getCtx(), "UITheme", true));
configPanel.setLayout(new BorderLayout());
configPanel.add(infoArea, BorderLayout.CENTER);
CPanel configSouth = new CPanel();
configSouth.setLayout(new FlowLayout());
((FlowLayout)configSouth.getLayout()).setAlignment(FlowLayout.RIGHT);
configSouth.add(bRoleInfo);
configPanel.add(configSouth, BorderLayout.SOUTH);
tabPane.add(configPanel, Msg.getMsg(Env.getCtx(), "Info"));
customizePane.add(lDate, new GridBagConstraints(0, 9, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
customizePane.add(fDate, new GridBagConstraints(1, 9, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
customizePane.add(printPreview, new GridBagConstraints(2, 9, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
// Info
// tabPane.add(contextPane, Msg.getMsg(Env.getCtx(), "Context"));
tabPane.add(contextPane, Msg.getMsg(Env.getCtx(), "Context"));
contextPane.setLayout(icontextLayout);
contextPane.add(contextListScrollPane, BorderLayout.CENTER);
contextListScrollPane.setPreferredSize(new Dimension(200, 300));
infoList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
infoList.setBackground(AdempierePLAF.getFieldBackground_Inactive());
infoList.addListSelectionListener(this);
infoList.setFixedCellWidth(30);
contextPane.add(contextSouthPanel, BorderLayout.SOUTH);
contextSouthPanel.setLayout(contextSouthLayout);
contextSouthPanel.add(contextHeader, BorderLayout.WEST);
contextHeader.setBackground(SystemColor.info);
contextHeader.setReadWrite(false);
contextHeader.setLineWrap(true);
contextHeader.setWrapStyleWord(true);
contextHeader.setBorder(BorderFactory.createLoweredBevelBorder());
contextSouthPanel.add(contextDetail, BorderLayout.CENTER);
contextDetail.setBackground(SystemColor.info);
contextDetail.setReadWrite(false);
contextDetail.setLineWrap(true);
contextDetail.setWrapStyleWord(true);
contextDetail.setBorder(BorderFactory.createLoweredBevelBorder());
// Error Pane
errorPane.setLayout(errorLayout);
// tabPane.add(errorPane, Msg.getMsg(Env.getCtx(), "Errors"));
tabPane.add(errorPane, "Errors");
errorPane.add(errorScrollPane, BorderLayout.CENTER);
errorScrollPane.getViewport().add(errorTable, null);
//
errorPanel.add(bErrorsOnly);
errorPanel.add(bErrorReset);
errorPanel.add(bErrorEMail);
errorPanel.add(bErrorSave);
errorPane.add(errorPanel, BorderLayout.SOUTH);
// South
panel.add(southPanel, BorderLayout.SOUTH);
southPanel.setLayout(southLayout);
southPanel.add(statusBar, BorderLayout.SOUTH);
southPanel.add(confirm, BorderLayout.CENTER);
//
bRoleInfo.addActionListener(this);
confirm.addActionListener(this);
} // jbInit
/**
* List Selection Listener - show info in header/detail fields
* @param e evant
*/
public void valueChanged(ListSelectionEvent e)
{
if (e.getValueIsAdjusting())
return;
String value = (String)infoList.getSelectedValue();
if (value == null)
return;
int pos = value.indexOf("==");
if (pos == -1)
{
contextHeader.setText("");
contextDetail.setText(value);
}
else
{
contextHeader.setText(value.substring(0, pos).replace('|','\n'));
contextDetail.setText(value.substring(pos+3));
}
} // valueChanged
/**
* ActionListener
* @param e event
*/
public void actionPerformed(ActionEvent e)
{
// UI Change
/*if (e.getSource() == uiTheme)
{
new AdempierePLAFEditor(this, false);
}
else */ if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL))
dispose();
else if (e.getActionCommand().equals(ConfirmPanel.A_OK))
cmd_save();
//
else if (e.getSource() == bErrorsOnly)
cmd_displayErrors();
else if (e.getSource() == bErrorReset)
cmd_errorReset();
else if (e.getSource() == bErrorEMail)
cmd_errorEMail();
else if (e.getSource() == bErrorSave)
cmd_errorSave();
//
else if (e.getSource() == bRoleInfo)
ADialog.info(0, this, "RoleInfo", MRole.getDefault().toStringX(Env.getCtx()));
} // actionPerformed
/**
* Load Settings - and Context
*/
private void load()
{
log.config("");
infoArea.setText(CLogMgt.getInfo(null).toString());
infoArea.setCaretPosition(0);
// -- Load Settings --
// UI
uiTheme.addActionListener(this);
// AutoCommit
autoCommit.setSelected(Env.isAutoCommit(Env.getCtx()));
autoNew.setSelected(Env.isAutoNew(Env.getCtx()));
// AdempiereSys
adempiereSys.setSelected(Ini.isPropertyBool(Ini.P_ADEMPIERESYS));
if (Env.getAD_Client_ID(Env.getCtx()) > 20)
{
adempiereSys.setSelected(false);
adempiereSys.setEnabled(false);
}
// AutoLogin
autoLogin.setSelected(Ini.isPropertyBool(Ini.P_A_LOGIN));
// Save Password
storePassword.setSelected(Ini.isPropertyBool(Ini.P_STORE_PWD));
// Show Acct Tab
if (MRole.getDefault().isShowAcct())
showAcct.setSelected(Ini.isPropertyBool(Ini.P_SHOW_ACCT));
else
{
showAcct.setSelected(false);
showAcct.setReadWrite(false);
}
// Show Trl/Advanced Tab
showTrl.setSelected(Ini.isPropertyBool(Ini.P_SHOW_TRL));
showAdvanced.setSelected(Ini.isPropertyBool(Ini.P_SHOW_ADVANCED));
// Connection Profile
MUser user = MUser.get(Env.getCtx());
String cp = user.getConnectionProfile();
if (cp == null)
cp = MRole.getDefault().getConnectionProfile();
if (cp != null)
{
CConnection.get().setConnectionProfile(cp);
connectionProfile.setReadWrite(false);
}
connectionProfile.setSelectedItem(CConnection.get().getConnectionProfilePair());
cacheWindow.setSelected(Ini.isCacheWindow());
// Print Preview
printPreview.setSelected(Ini.isPropertyBool(Ini.P_PRINTPREVIEW));
// Validate Connection on Startup
validateConnectionOnStartup.setSelected(Ini.isPropertyBool(Ini.P_VALIDATE_CONNECTION_ON_STARTUP));
// Single Instance per Window
singleInstancePerWindow.setSelected(Ini.isPropertyBool(Ini.P_SINGLE_INSTANCE_PER_WINDOW));
// Open Window Maximized
openWindowMaximized.setSelected(Ini.isPropertyBool(Ini.P_OPEN_WINDOW_MAXIMIZED));
// TraceLevel
traceLevel.setSelectedItem(CLogMgt.getLevel());
traceFile.setSelected(Ini.isPropertyBool(Ini.P_TRACEFILE));
// Printer
fPrinter.setValue(Env.getContext(Env.getCtx(), "#Printer"));
// Date
fDate.setValue(Env.getContextAsDate(Env.getCtx(), "#Date"));
// -- Load and sort Context --
String[] context = Env.getEntireContext(Env.getCtx());
Arrays.sort(context);
infoList.setListData(context);
// Load Errors
// CLogMgt mgt = new CLogMgt(); // creates test trace
bErrorsOnly.setSelected(true);
errorTable.setCellSelectionEnabled(true);
cmd_displayErrors();
// for (int i = 2; i < 6; i++)
// errorTable.setColumnReadOnly(i, false);
//
bErrorsOnly.addActionListener(this);
bErrorReset.addActionListener(this);
bErrorSave.addActionListener(this);
bErrorEMail.addActionListener(this);
} // load
/**
* Save Settings
*/
private void cmd_save()
{
log.config("");
// UI
// AutoCommit
Ini.setProperty(Ini.P_A_COMMIT, (autoCommit.isSelected()));
Env.setAutoCommit(Env.getCtx(), autoCommit.isSelected());
Ini.setProperty(Ini.P_A_NEW, (autoNew.isSelected()));
Env.setAutoNew(Env.getCtx(), autoNew.isSelected());
// AdempiereSys
Ini.setProperty(Ini.P_ADEMPIERESYS, adempiereSys.isSelected());
// AutoLogin
Ini.setProperty(Ini.P_A_LOGIN, (autoLogin.isSelected()));
// Save Password
Ini.setProperty(Ini.P_STORE_PWD, (storePassword.isSelected()));
// Show Acct Tab
Ini.setProperty(Ini.P_SHOW_ACCT, (showAcct.isSelected()));
Env.setContext(Env.getCtx(), "#ShowAcct", (showAcct.isSelected()));
// Show Trl Tab
Ini.setProperty(Ini.P_SHOW_TRL, (showTrl.isSelected()));
Env.setContext(Env.getCtx(), "#ShowTrl", (showTrl.isSelected()));
// Show Advanced Tab
Ini.setProperty(Ini.P_SHOW_ADVANCED, (showAdvanced.isSelected()));
Env.setContext(Env.getCtx(), "#ShowAdvanced", (showAdvanced.isSelected()));
// ConnectionProfile
ValueNamePair ppNew = (ValueNamePair)connectionProfile.getSelectedItem();
String cpNew = ppNew.getValue();
String cpOld = CConnection.get().getConnectionProfile();
CConnection.get().setConnectionProfile(cpNew);
if (!cpNew.equals(cpOld)
&& (cpNew.equals(CConnection.PROFILE_WAN) || cpOld.equals(CConnection.PROFILE_WAN)))
ADialog.info(0, this, "ConnectionProfileChange");
Ini.setProperty(Ini.P_CACHE_WINDOW, cacheWindow.isSelected());
// Print Preview
Ini.setProperty(Ini.P_PRINTPREVIEW, (printPreview.isSelected()));
// Validate Connection on Startup
Ini.setProperty(Ini.P_VALIDATE_CONNECTION_ON_STARTUP, (validateConnectionOnStartup.isSelected()));
// Single Instance per Window
Ini.setProperty(Ini.P_SINGLE_INSTANCE_PER_WINDOW, (singleInstancePerWindow.isSelected()));
// Open Window Maximized
Ini.setProperty(Ini.P_OPEN_WINDOW_MAXIMIZED, (openWindowMaximized.isSelected()));
// TraceLevel/File
Level level = (Level)traceLevel.getSelectedItem();
CLogMgt.setLevel(level);
Ini.setProperty(Ini.P_TRACELEVEL, level.getName());
Ini.setProperty(Ini.P_TRACEFILE, traceFile.isSelected());
// Printer
String printer = (String)fPrinter.getSelectedItem();
Env.setContext(Env.getCtx(), "#Printer", printer);
Ini.setProperty(Ini.P_PRINTER, printer);
// Date (remove seconds)
java.sql.Timestamp ts = (java.sql.Timestamp)fDate.getValue();
if (ts != null)
Env.setContext(Env.getCtx(), "#Date", ts);
//UI
ValueNamePair laf = plafEditor.getSelectedLook();
ValueNamePair theme = plafEditor.getSelectedTheme();
if ( laf != null ) {
String clazz = laf.getValue();
String currentLaf = UIManager.getLookAndFeel().getClass().getName();
if (clazz != null && clazz.length() > 0 && !currentLaf.equals(clazz))
{
//laf changed
AdempierePLAF.setPLAF(laf, theme, true);
//AEnv.updateUI();
}
else
{
if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel)
{
MetalTheme currentTheme = MetalLookAndFeel.getCurrentTheme();
String themeClass = currentTheme.getClass().getName();
String sTheme = theme.getValue();
if (sTheme != null && sTheme.length() > 0 && !sTheme.equals(themeClass))
{
ValueNamePair plaf = new ValueNamePair(
UIManager.getLookAndFeel().getClass().getName(),
UIManager.getLookAndFeel().getName());
AdempierePLAF.setPLAF(plaf, theme, true);
//AEnv.updateUI();
}
}
}
}
Ini.saveProperties(Ini.isClient());
dispose();
} // cmd_save
/**
* (Re)Display Errors
*/
private void cmd_displayErrors()
{
Vector data = CLogErrorBuffer.get(true).getLogData(bErrorsOnly.isSelected());
Vector columnNames = CLogErrorBuffer.get(true).getColumnNames(Env.getCtx());
DefaultTableModel model = new DefaultTableModel(data, columnNames);
errorTable.setModel(model);
//
if (bErrorsOnly.isSelected())
tabPane.setTitleAt(2, Msg.getMsg(Env.getCtx(), "Errors") + " (" + data.size() + ")");
else
tabPane.setTitleAt(2, Msg.getMsg(Env.getCtx(), "TraceInfo") + " (" + data.size() + ")");
errorTable.autoSize();
} // cmd_errorsOnly
/**
* Reset Errors
*/
private void cmd_errorReset()
{
CLogErrorBuffer.get(true).resetBuffer(bErrorsOnly.isSelected());
cmd_displayErrors();
} // cmd_errorReset
/**
* EMail Errors
*/
private void cmd_errorEMail()
{
EMailDialog emd = new EMailDialog(this,
"EMail Trace",
MUser.get(Env.getCtx()),
"", // to
"Adempiere Trace Info",
CLogErrorBuffer.get(true).getErrorInfo(Env.getCtx(), bErrorsOnly.isSelected()),
null);
} // cmd_errorEMail
/**
* Save Error to File
*/
private void cmd_errorSave()
{
JFileChooser chooser = new JFileChooser();
chooser.setDialogType(JFileChooser.SAVE_DIALOG);
chooser.setDialogTitle("Adempiere Trace File");
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setSelectedFile(new File ("traceInfo.log"));
int returnVal = chooser.showSaveDialog(this);
if(returnVal != JFileChooser.APPROVE_OPTION)
return;
try
{
File file = chooser.getSelectedFile();
FileWriter writer = new FileWriter(file);
writer.write(CLogErrorBuffer.get(true).getErrorInfo(Env.getCtx(), bErrorsOnly.isSelected()));
writer.flush();
writer.close();
}
catch (Exception e)
{
log.log(Level.SEVERE, "", e);
}
} // cmd_errorSave
} // Preference

View File

@ -548,7 +548,7 @@ public final class Preference extends CDialog
{
//laf changed
AdempierePLAF.setPLAF(laf, theme, true);
AEnv.updateUI();
//AEnv.updateUI();
}
else
{
@ -563,7 +563,7 @@ public final class Preference extends CDialog
UIManager.getLookAndFeel().getClass().getName(),
UIManager.getLookAndFeel().getName());
AdempierePLAF.setPLAF(plaf, theme, true);
AEnv.updateUI();
//AEnv.updateUI();
}
}
}

View File

@ -49,8 +49,8 @@ public class ProcessCtl extends Thread
* Creates a ProcessCtl instance, which calls
* lockUI and unlockUI if parent is a ASyncProcess
* <br>
* Called from ProcessCtl.startProcess, APanel.cmd_print,
* APanel.actionButton, VPaySelect.cmd_generate
* Called from ProcessCtl.startProcess, ProcessDialog.actionPerformed,
* APanel.cmd_print, APanel.actionButton, VPaySelect.cmd_generate
*
* @param parent ASyncProcess & Container
* @param WindowNo window no

View File

@ -77,46 +77,15 @@ public class ProcessDialog extends CFrame
private static CLogger log = CLogger.getCLogger(ProcessDialog.class);
//
private CPanel dialog = new CPanel()
{
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
Dimension m = getMinimumSize();
if ( d.height < m.height || d.width < m.width ) {
Dimension d1 = new Dimension();
d1.height = Math.max(d.height, m.height);
d1.width = Math.max(d.width, m.width);
return d1;
} else
return d;
}
};
private CPanel dialog = new CPanel();
private BorderLayout mainLayout = new BorderLayout();
private CPanel southPanel = new CPanel();
private CButton bOK = ConfirmPanel.createOKButton(true);
private FlowLayout southLayout = new FlowLayout();
private JEditorPane message = new JEditorPane()
{
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
Dimension m = getMaximumSize();
if ( d.height > m.height || d.width > m.width ) {
Dimension d1 = new Dimension();
d1.height = Math.min(d.height, m.height);
d1.width = Math.min(d.width, m.width);
return d1;
} else
return d;
}
};
private JEditorPane message = new JEditorPane();
private JScrollPane messagePane = new JScrollPane(message);
private CButton bPrint = ConfirmPanel.createPrintButton(true);
private CPanel centerPanel = null;
private ProcessParameterPanel parameterPanel = null;
private JSeparator separator = new JSeparator();
private ProcessInfo m_pi = null;
/**
* Static Layout
* @throws Exception
@ -126,27 +95,21 @@ public class ProcessDialog extends CFrame
setIconImage(Env.getImage("mProcess.gif"));
//
dialog.setLayout(mainLayout);
dialog.setMinimumSize(new Dimension(500, 200));
bOK.addActionListener(this);
bPrint.addActionListener(this);
//
southPanel.setLayout(southLayout);
southLayout.setAlignment(FlowLayout.RIGHT);
dialog.setPreferredSize(new Dimension(500, 150));
message.setContentType("text/html");
message.setEditable(false);
message.setBackground(Color.white);
message.setBackground(AdempierePLAF.getFieldBackground_Inactive());
message.setFocusable(false);
getContentPane().add(dialog);
dialog.add(southPanel, BorderLayout.SOUTH);
southPanel.add(bPrint, null);
southPanel.add(bOK, null);
dialog.add(messagePane, BorderLayout.NORTH);
messagePane.setBorder(null);
message.setMaximumSize(new Dimension(600, 300));
centerPanel = new CPanel();
centerPanel.setBorder(null);
centerPanel.setLayout(new BorderLayout());
dialog.add(centerPanel, BorderLayout.CENTER);
dialog.add(messagePane, BorderLayout.CENTER);
//
this.getRootPane().setDefaultButton(bOK);
} // jbInit
@ -159,9 +122,8 @@ public class ProcessDialog extends CFrame
public void setVisible (boolean visible)
{
super.setVisible(visible);
if (visible) {
if (visible)
bOK.requestFocus();
}
} // setVisible
/**
@ -238,17 +200,6 @@ public class ProcessDialog extends CFrame
return false; // don't show
}
**/
// Similar to APanel.actionButton
m_pi = new ProcessInfo(m_Name, m_AD_Process_ID);
m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi);
centerPanel.removeAll();
if (parameterPanel.init()) {
centerPanel.add(separator, BorderLayout.NORTH);
centerPanel.add(parameterPanel, BorderLayout.CENTER);
}
dialog.revalidate();
return true;
} // init
@ -264,8 +215,14 @@ public class ProcessDialog extends CFrame
dispose();
else
{
// Similar to APanel.actionButton
ProcessInfo pi = new ProcessInfo(m_Name, m_AD_Process_ID);
pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
m_messageText.append("<p>** ").append(m_Name).append("</p>");
message.setText(m_messageText.toString());
// Trx trx = Trx.get(Trx.createTrxName("ProcessDialog"), true);
ProcessCtl.process(this, m_WindowNo, parameterPanel, m_pi, null);
ProcessCtl.process(this, m_WindowNo, pi, null);
}
}

View File

@ -265,16 +265,10 @@ public class ProcessParameter extends CDialog
{
// To Label
gbc.gridx = 2;
gbc.weightx = 0;
gbc.fill = GridBagConstraints.NONE;
centerPanel.add (new JLabel(" - "), gbc);
// To Field
gbc.gridx = 3;
gbc.insets = fieldInsetRight;
gbc.weightx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.WEST;
//
GridFieldVO voF2 = GridFieldVO.createParameter(voF);
GridField mField2 = new GridField (voF2);

View File

@ -123,7 +123,7 @@ public class WindowManager {
for ( CFrame w : windows ) {
if ( w instanceof FormFrame ) {
FormFrame ff = (FormFrame)w;
if ( ff.getAD_Form_ID() == AD_FORM_ID )
//if ( ff.getAD_Form_ID() == AD_FORM_ID )
return ff;
}
}

View File

@ -82,9 +82,6 @@ public class FormFrame extends CFrame
/** Logger */
private static CLogger log = CLogger.getCLogger(FormFrame.class);
/** Form ID */
private int p_AD_Form_ID = 0;
/**
* Static Init
* @throws Exception
@ -137,11 +134,6 @@ public class FormFrame extends CFrame
AEnv.addMenuItem("Preference", null, null, mTools, this);
}
// Window
AMenu aMenu = (AMenu)Env.getWindow(0);
JMenu mWindow = new WindowMenu(aMenu.getWindowManager(), this);
menuBar.add(mWindow);
// Help
JMenu mHelp = AEnv.getMenu("Help");
menuBar.add(mHelp);
@ -241,7 +233,6 @@ public class FormFrame extends CFrame
}
//
m_panel.init(m_WindowNo, this);
p_AD_Form_ID = AD_Form_ID;
return true;
} // openForm
@ -363,12 +354,4 @@ public class FormFrame extends CFrame
return worker;
} // startBatch
/**
* @return Returns the AD_Form_ID.
*/
public int getAD_Form_ID ()
{
return p_AD_Form_ID;
} // getAD_Window_ID
} // FormFrame

View File

@ -209,7 +209,7 @@ public class VFileImport extends CPanel
confirmPanel.setEnabled(false);
m_frame.setBusy(true);
//
SwingWorker worker = new SwingWorker()
org.compiere.apps.SwingWorker worker = new org.compiere.apps.SwingWorker()
{
public Object construct()
{

View File

@ -45,7 +45,7 @@ public class VPayPrint extends CPanel
*/
public void init (int WindowNo, FormFrame frame)
{
log.info( "VPayPrint.init");
log.info("");
m_WindowNo = WindowNo;
m_frame = frame;
try
@ -440,7 +440,8 @@ public class VPayPrint extends CPanel
if (ADialog.ask(m_WindowNo, this, "VPayPrintSuccess?"))
{
int lastDocumentNo = MPaySelectionCheck.confirmPrint (m_checks, m_batch);
// int lastDocumentNo =
MPaySelectionCheck.confirmPrint (m_checks, m_batch);
// document No not updated
}
dispose();
@ -468,7 +469,6 @@ public class VPayPrint extends CPanel
if (!getChecks(PaymentRule))
return;
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
boolean somethingPrinted = false;
@ -535,7 +535,7 @@ public class VPayPrint extends CPanel
//
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
// get Checks
// get Slecetions
m_checks = MPaySelectionCheck.get(C_PaySelection_ID, PaymentRule, startDocumentNo, null);
this.setCursor(Cursor.getDefaultCursor());

View File

@ -137,6 +137,7 @@ public class VPaySelect extends CPanel
bRefresh.addActionListener(this);
labelPayDate.setText(Msg.translate(Env.getCtx(), "PayDate"));
labelPaymentRule.setText(Msg.translate(Env.getCtx(), "PaymentRule"));
fieldPaymentRule.addActionListener(this);
//
labelBankBalance.setText(Msg.translate(Env.getCtx(), "CurrentBalance"));
labelBalance.setText("0");
@ -237,8 +238,11 @@ public class VPaySelect extends CPanel
"SELECT bp.C_BPartner_ID, bp.Name FROM C_BPartner bp", "bp",
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO)
+ " AND EXISTS (SELECT * FROM C_Invoice i WHERE bp.C_BPartner_ID=i.C_BPartner_ID"
+ " AND i.IsSOTrx='N' AND i.IsPaid<>'Y') "
// X_C_Order.PAYMENTRULE_DirectDebit
+ " AND (i.IsSOTrx='N' OR (i.IsSOTrx='Y' AND i.PaymentRule='D'))"
+ " AND i.IsPaid<>'Y') "
+ "ORDER BY 2";
try
{
PreparedStatement pstmt = DB.prepareStatement(sql, null);
@ -278,7 +282,7 @@ public class VPaySelect extends CPanel
m_sql = miniTable.prepareTable(new ColumnInfo[] {
// 0..4
new ColumnInfo(" ", "i.C_Invoice_ID", IDColumn.class, false, false, null),
new ColumnInfo(Msg.translate(ctx, "DateDue"), "i.DateInvoiced+p.NetDays AS DateDue", Timestamp.class, true, true, null),
new ColumnInfo(Msg.translate(ctx, "DueDate"), "i.DateInvoiced+p.NetDays AS DateDue", Timestamp.class, true, true, null),
new ColumnInfo(Msg.translate(ctx, "C_BPartner_ID"), "bp.Name", KeyNamePair.class, true, false, "i.C_BPartner_ID"),
new ColumnInfo(Msg.translate(ctx, "DocumentNo"), "i.DocumentNo", String.class),
new ColumnInfo(Msg.translate(ctx, "C_Currency_ID"), "c.ISO_Code", KeyNamePair.class, true, false, "i.C_Currency_ID"),
@ -295,7 +299,7 @@ public class VPaySelect extends CPanel
+ " INNER JOIN C_Currency c ON (i.C_Currency_ID=c.C_Currency_ID)"
+ " INNER JOIN C_PaymentTerm p ON (i.C_PaymentTerm_ID=p.C_PaymentTerm_ID)",
// WHERE
"i.IsSOTrx='N' AND IsPaid='N'"
"i.IsSOTrx=? AND IsPaid='N'"
// Different Payment Selection
+ " AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl"
+ " WHERE i.C_Invoice_ID=psl.C_Invoice_ID AND psl.C_PaySelectionCheck_ID IS NOT NULL)"
@ -371,6 +375,14 @@ public class VPaySelect extends CPanel
log.config("PayDate=" + payDate);
BankInfo bi = (BankInfo)fieldBankAccount.getSelectedItem();
//
String isSOTrx = "N";
ValueNamePair vp = (ValueNamePair)fieldPaymentRule.getSelectedItem();
if (vp != null && X_C_Order.PAYMENTRULE_DirectDebit.equals(vp.getValue()))
{
isSOTrx = "Y";
sql += " AND i.PaymentRule='" + X_C_Order.PAYMENTRULE_DirectDebit + "'";
}
//
if (onlyDue.isSelected())
sql += " AND i.DateInvoiced+p.NetDays <= ?";
//
@ -393,7 +405,8 @@ public class VPaySelect extends CPanel
pstmt.setTimestamp(index++, payDate); // PayAmt
pstmt.setInt(index++, bi.C_Currency_ID);
pstmt.setTimestamp(index++, payDate);
pstmt.setInt(index++, m_AD_Client_ID); //
pstmt.setString(index++, isSOTrx); // IsSOTrx
pstmt.setInt(index++, m_AD_Client_ID); // Client
if (onlyDue.isSelected())
pstmt.setTimestamp(index++, payDate);
if (C_BPartner_ID != 0)
@ -513,7 +526,9 @@ public class VPaySelect extends CPanel
// Create Header
m_ps = new MPaySelection(Env.getCtx(), 0, trxName);
m_ps.setName (Msg.getMsg(Env.getCtx(), "VPaySelect") + " - " + fieldPayDate.getTimestamp());
m_ps.setName (Msg.getMsg(Env.getCtx(), "VPaySelect")
+ " - " + ((ValueNamePair)fieldPaymentRule.getSelectedItem()).getName()
+ " - " + fieldPayDate.getTimestamp());
m_ps.setPayDate (fieldPayDate.getTimestamp());
BankInfo bi = (BankInfo)fieldBankAccount.getSelectedItem();
m_ps.setC_BankAccount_ID(bi.C_BankAccount_ID);
@ -557,9 +572,10 @@ public class VPaySelect extends CPanel
if (!ADialog.ask(m_WindowNo, this, "VPaySelectGenerate?", "(" + m_ps.getName() + ")"))
return;
// Prepare Process PaySelectionCreateCheck
ProcessInfo pi = new ProcessInfo (m_frame.getTitle(), 155,
MPaySelection.Table_ID, m_ps.getC_PaySelection_ID());
// Prepare Process
int AD_Proces_ID = 155; // C_PaySelection_CreatePayment
ProcessInfo pi = new ProcessInfo (m_frame.getTitle(), AD_Proces_ID,
X_C_PaySelection.Table_ID, m_ps.getC_PaySelection_ID());
pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
@ -606,7 +622,6 @@ public class VPaySelect extends CPanel
//
ff.pack();
this.setVisible(false);
AEnv.addToWindowManager(ff);
AEnv.showCenterScreen(ff);
this.dispose();
} // unlockUI

View File

@ -403,7 +403,6 @@ public class VTrxMaterial extends CPanel
setCursor(Cursor.getDefaultCursor());
return;
}
AEnv.addToWindowManager(frame);
AEnv.showCenterScreen(frame);
frame = null;
setCursor(Cursor.getDefaultCursor());

View File

@ -686,7 +686,6 @@ 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())
{

View File

@ -509,7 +509,6 @@ public class WFActivity extends CPanel
AWindow frame = new AWindow();
if (!frame.initWindow(AD_Window_ID, query))
return;
AEnv.addToWindowManager(frame);
AEnv.showCenterScreen(frame);
frame = null;
}
@ -519,7 +518,6 @@ public class WFActivity extends CPanel
FormFrame ff = new FormFrame();
ff.openForm(AD_Form_ID);
ff.pack();
AEnv.addToWindowManager(ff);
AEnv.showCenterScreen(ff);
}
else if (MWFNode.ACTION_UserWorkbench.equals(node.getAction()))

View File

@ -432,7 +432,6 @@ public class WFPanel extends CPanel
AWindow frame = new AWindow();
if (!frame.initWindow (AD_Window_ID, query))
return;
AEnv.addToWindowManager(frame);
AEnv.showCenterScreen(frame);
frame = null;
} // zoom

View File

@ -121,7 +121,7 @@ public class VCreateFromStatement extends VCreateFrom implements VetoableChangeL
+ "FROM C_BankAccount ba"
+ " INNER JOIN C_Payment_v p ON (p.C_BankAccount_ID=ba.C_BankAccount_ID)"
+ " INNER JOIN C_Currency c ON (p.C_Currency_ID=c.C_Currency_ID)"
+ " INNER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) "
+ " LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) "
+ "WHERE p.Processed='Y' AND p.IsReconciled='N'"
+ " AND p.DocStatus IN ('CO','CL','RE','VO') AND p.PayAmt<>0" // Bug 1564453 Added Voided payment to bank statement payement selection
+ " AND p.C_BankAccount_ID=?" // #2
@ -239,7 +239,7 @@ public class VCreateFromStatement extends VCreateFrom implements VetoableChangeL
pp = (KeyNamePair)model.getValueAt(i, 3); // 3-Currency
int C_Currency_ID = pp.getKey();
BigDecimal TrxAmt = (BigDecimal)model.getValueAt(i, 4); // 4-PayAmt
BigDecimal StmtAmt = (BigDecimal)model.getValueAt(i, 5);// 5-Conv Amt
// BigDecimal StmtAmt = (BigDecimal)model.getValueAt(i, 5);// 5-Conv Amt
//
log.fine("Line Date=" + trxDate
+ ", Payment=" + C_Payment_ID + ", Currency=" + C_Currency_ID + ", Amt=" + TrxAmt);

View File

@ -193,13 +193,8 @@ public class VPayment extends CDialog
private CLabel bCashBookLabel = new CLabel();
private CComboBox bCashBookCombo = new CComboBox();
private GridBagLayout tPanelLayout = new GridBagLayout();
private CButton tOnline = new CButton();
private CLabel kStatus = new CLabel();
private CTextField tRoutingField = new CTextField();
private CTextField tNumberField = new CTextField();
private CLabel tStatus = new CLabel();
private CLabel tRoutingText = new CLabel();
private CLabel tNumberText = new CLabel();
private CLabel sStatus = new CLabel();
/**
@ -220,7 +215,7 @@ public class VPayment extends CDialog
northPanel.add(paymentCombo, null);
//
centerPanel.setLayout(centerLayout);
//
// CreditCard
kPanel.setLayout(kLayout);
kNumberField.setPreferredSize(new Dimension(120, 21));
kExpField.setPreferredSize(new Dimension(40, 21));
@ -254,14 +249,9 @@ public class VPayment extends CDialog
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
kPanel.add(kOnline, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
//
// DircetDebit/Credit
tPanel.setLayout(tPanelLayout);
tAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BP_BankAccount_ID"));
tRoutingField.setColumns(8);
tNumberField.setColumns(10);
tRoutingText.setText(Msg.translate(Env.getCtx(), "RoutingNo"));
tNumberText.setText(Msg.translate(Env.getCtx(), "AccountNo"));
tOnline.setText(Msg.getMsg(Env.getCtx(), "Online"));
tStatus.setText(" ");
centerPanel.add(tPanel, "tPanel");
centerLayout.addLayoutComponent(tPanel, "tPanel");
@ -269,18 +259,8 @@ public class VPayment extends CDialog
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0));
tPanel.add(tAccountCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
tPanel.add(tRoutingField, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
tPanel.add(tNumberField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
tPanel.add(tStatus, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
tPanel.add(tRoutingText, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
tPanel.add(tNumberText, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
tPanel.add(tOnline, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
//
sPanel.setLayout(sPanelLayout);
sBankAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
@ -374,7 +354,7 @@ public class VPayment extends CDialog
* S (Check) (Currency) CheckNo, Routing
*
* Currencies are shown, if member of EMU
* @param button button
* @param button payment type button
* @return true if init OK
* @throws Exception
*/
@ -462,8 +442,6 @@ public class VPayment extends CDialog
sCheckField.setText(m_mPayment.getCheckNo());
sStatus.setText(m_mPayment.getR_PnRef());
// Transfer
tRoutingField.setText(m_mPayment.getRoutingNo());
tNumberField.setText(m_mPayment.getAccountNo());
tStatus.setText(m_mPayment.getR_PnRef());
}
}
@ -529,7 +507,13 @@ public class VPayment extends CDialog
Object[] a = values.keySet().toArray();
for (int i = 0; i < a.length; i++)
{
String PaymentRule = (String)a[i];
String PaymentRule = (String)a[i]; // used for Panel selection
if (X_C_Order.PAYMENTRULE_DirectDebit.equals(PaymentRule) // SO
&& !m_isSOTrx)
continue;
else if (X_C_Order.PAYMENTRULE_DirectDeposit.equals(PaymentRule) // PO
&& m_isSOTrx)
continue;
ValueNamePair pp = new ValueNamePair(PaymentRule, (String)values.get(a[i]));
paymentCombo.addItem(pp);
if (PaymentRule.toString().equals(m_PaymentRule)) // to select
@ -762,7 +746,10 @@ public class VPayment extends CDialog
ValueNamePair pp = (ValueNamePair)paymentCombo.getSelectedItem();
if (pp != null)
{
String s = pp.getValue().toLowerCase() + "Panel";
String s = pp.getValue().toLowerCase();
if (X_C_Order.PAYMENTRULE_DirectDebit.equalsIgnoreCase(s))
s = X_C_Order.PAYMENTRULE_DirectDeposit.toLowerCase();
s += "Panel";
centerLayout.show(centerPanel, s); // switch to panel
}
}
@ -785,7 +772,7 @@ public class VPayment extends CDialog
}
// Online
else if (e.getSource() == kOnline || e.getSource() == sOnline || e.getSource() == tOnline)
else if (e.getSource() == kOnline || e.getSource() == sOnline)
processOnline();
} // actionPerformed
@ -1022,7 +1009,7 @@ public class VPayment extends CDialog
/***********************
* Payments
*/
if ("KTSD".indexOf(newPaymentRule) != -1)
if ("KS".indexOf(newPaymentRule) != -1)
{
log.fine("Payment - " + newPaymentRule);
// Set Amount
@ -1033,12 +1020,6 @@ public class VPayment extends CDialog
kNumberField.getText(), "", kExpField.getText());
m_mPayment.setPaymentProcessor();
}
else if (newPaymentRule.equals(MOrder.PAYMENTRULE_DirectDeposit)
|| newPaymentRule.equals(MOrder.PAYMENTRULE_DirectDebit))
{
m_mPayment.setBankACH(newC_BankAccount_ID, m_isSOTrx, newPaymentRule,
tRoutingField.getText(), tNumberField.getText());
}
else if (newPaymentRule.equals(MOrder.PAYMENTRULE_Check))
{
m_mPayment.setBankCheck(newC_BankAccount_ID, m_isSOTrx, sRoutingField.getText(),
@ -1168,28 +1149,20 @@ public class VPayment extends CDialog
}
// T (Transfer) BPartner_Bank
else if (PaymentRule.equals(MOrder.PAYMENTRULE_DirectDeposit)
|| PaymentRule.equals(MOrder.PAYMENTRULE_DirectDebit))
else if (PaymentRule.equals(X_C_Order.PAYMENTRULE_DirectDeposit)
|| PaymentRule.equals(X_C_Order.PAYMENTRULE_DirectDebit))
{
tAccountCombo.getSelectedItem();
String error = MPaymentValidate.validateRoutingNo(tRoutingField.getText());
if (error.length() != 0)
KeyNamePair bpba = (KeyNamePair)tAccountCombo.getSelectedItem();
if (bpba == null)
{
tRoutingField.setBackground(AdempierePLAF.getFieldBackground_Error());
ADialog.error(m_WindowNo, this, error);
tAccountCombo.setBackground(AdempierePLAF.getFieldBackground_Error());
ADialog.error(m_WindowNo, this, "PaymentBPBankNotFound");
dataOK = false;
}
error = MPaymentValidate.validateAccountNo(tNumberField.getText());
if (error.length() != 0)
{
tNumberField.setBackground(AdempierePLAF.getFieldBackground_Error());
ADialog.error(m_WindowNo, this, error);
dataOK = false;
}
}
} // Direct
// P (PaymentTerm) PaymentTerm
else if (PaymentRule.equals(MOrder.PAYMENTRULE_OnCredit))
else if (PaymentRule.equals(X_C_Order.PAYMENTRULE_OnCredit))
{
KeyNamePair kp = (KeyNamePair)pTermCombo.getSelectedItem();
if (kp != null)
@ -1241,8 +1214,8 @@ public class VPayment extends CDialog
tender = MPayment.TENDERTYPE_DirectDebit;
else if (PaymentRule.equals(MOrder.PAYMENTRULE_Check))
tender = MPayment.TENDERTYPE_Check;
// ACH & Check must have a bank account
if (C_BankAccount_ID == 0 && "TS".indexOf(PaymentRule) != -1)
// Check must have a bank account
if (C_BankAccount_ID == 0 && "S".equals(PaymentRule))
{
ADialog.error(m_WindowNo, this, "PaymentNoProcessor");
dataOK = false;

View File

@ -132,16 +132,7 @@ public final class VCellEditor extends AbstractCellEditor
// Other UI
m_editor.setFont(table.getFont());
if ( m_editor instanceof VLookup) {
VLookup lookup = (VLookup)m_editor;
if (lookup.getComponents()[0] instanceof JComboBox) {
lookup.setBorder(BorderFactory.createEmptyBorder());
} else {
lookup.setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
}
} else {
m_editor.setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
}
m_editor.setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
//
return (Component)m_editor;
} // getTableCellEditorComponent

View File

@ -112,8 +112,7 @@ public final class VCellRenderer extends DefaultTableCellRenderer
else
{ // returns JLabel
c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
//c.setFont(AdempierePLAF.getFont_Field());
c.setFont(table.getFont());
c.setFont(AdempierePLAF.getFont_Field());
}
// Background & Foreground

View File

@ -113,7 +113,7 @@ public class VColor extends CButton
else
{
setOpaque(false);
putClientProperty(CompiereLookAndFeel.BACKGROUND, null);
putClientProperty(AdempierePLAF.BACKGROUND, null);
}
repaint();
} // setValue

View File

@ -30,13 +30,6 @@ import org.compiere.util.*;
*/
public final class VHeaderRenderer implements TableCellRenderer
{
public VHeaderRenderer()
{
m_button = new CButton();
m_button.setMargin(new Insets(0,0,0,0));
m_button.putClientProperty("Plastic.is3D", Boolean.FALSE);
}
/**
* Constructor
* @param displayType
@ -46,17 +39,16 @@ public final class VHeaderRenderer implements TableCellRenderer
super();
// Alignment
if (DisplayType.isNumeric(displayType))
m_alignment = JLabel.RIGHT;
m_button.setHorizontalAlignment(JLabel.RIGHT);
else if (displayType == DisplayType.YesNo)
m_alignment = JLabel.CENTER;
m_button.setHorizontalAlignment(JLabel.CENTER);
else
m_alignment = JLabel.LEFT;
m_button.setHorizontalAlignment(JLabel.LEFT);
m_button.setMargin(new Insets(0,0,0,0));
} // VHeaderRenderer
// for 3D effect in Windows
private CButton m_button;
private int m_alignment;
private CButton m_button = new CButton();
/**
* Get TableCell RendererComponent
@ -73,25 +65,6 @@ public final class VHeaderRenderer implements TableCellRenderer
{
// Log.trace(this,10, "VHeaderRenderer.getTableCellRendererComponent", value==null ? "null" : value.toString());
// indicator for invisible column
TableCellRenderer headerRenderer = table.getTableHeader().getDefaultRenderer();
Component headerComponent = headerRenderer == null ? null :
headerRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (headerComponent != null && headerComponent instanceof JComponent) {
if (headerComponent instanceof JLabel ) {
JLabel label = (JLabel)headerComponent;
label.setHorizontalAlignment(m_alignment);
if (value == null)
label.setPreferredSize(new Dimension(0,0));
else
label.setText(value.toString());
return label;
}
m_button.setBorder(((JComponent)headerComponent).getBorder());
} else {
m_button.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
}
if (value == null)
{
m_button.setPreferredSize(new Dimension(0,0));

View File

@ -379,7 +379,7 @@ public class VLocator extends JComponent
if (getOnly_Product_ID() != 0)
sql.append(" AND (IsDefault='Y' ") // Default Locator
.append("OR EXISTS (SELECT * FROM M_Product p ") // Product Locator
.append("WHERE p.M_Locator_ID=M_Locator.M_Locator_ID AND s.M_Product_ID=?)")
.append("WHERE p.M_Locator_ID=M_Locator.M_Locator_ID AND p.M_Product_ID=?)")
.append("OR EXISTS (SELECT * FROM M_Storage s ") // Storage Locator
.append("WHERE s.M_Locator_ID=M_Locator.M_Locator_ID AND s.M_Product_ID=?))");
String finalSql = MRole.getDefault(Env.getCtx(), false).addAccessSQL(
@ -451,7 +451,6 @@ 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());

View File

@ -1134,7 +1134,6 @@ public class VLookup extends JComponent
}
else
{
AEnv.addToWindowManager(frame);
AEnv.showCenterScreen(frame);
}
// async window - not able to get feedback

View File

@ -320,13 +320,6 @@ public final class VString extends CTextField
setText(getText()); // obscure
} // focus Lost
@Override
public void setFont(Font f) {
super.setFont(f);
m_stdFont = f;
m_obscureFont = new Font("SansSerif", Font.ITALIC, m_stdFont.getSize());
}
} // VString

View File

@ -111,7 +111,7 @@ public class ReportCtl
re.print();
}
else
preview(re);
new Viewer(re);
return true;
} // startStandardReport
@ -140,7 +140,7 @@ public class ReportCtl
PrintInfo info = new PrintInfo(pi);
ReportEngine re = new ReportEngine(Env.getCtx(), format, query, info);
preview(re);
new Viewer(re);
return true;
} // startFinReport
@ -167,7 +167,7 @@ public class ReportCtl
ReportEngine.printConfirm (type, Record_ID);
}
else
preview(re);
new Viewer(re);
return true;
} // StartDocumentPrint
@ -193,10 +193,4 @@ public class ReportCtl
return startDocumentPrint (ReportEngine.CHECK, C_PaySelectionCheck_ID, IsDirectPrint);
} // startCheckPrint
private static void preview(ReportEngine re) {
Viewer viewer = new Viewer(re);
JFrame top = Env.getWindow(0);
if (top instanceof AMenu)
((AMenu)top).getWindowManager().add(viewer);
}
} // ReportCtl