Revert [2853359] - Popup Menu for Lookup Record
https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2853359&group_id=176962 Explanation of the revert in tracker
This commit is contained in:
parent
d312b480a4
commit
4a8ad604cd
|
@ -123,9 +123,7 @@ import org.compiere.util.Util;
|
|||
* <li>BF [ 1996056 ] Report error message is not displayed
|
||||
* <li>BF [ 1998575 ] Document Print is discarding any error
|
||||
* @author victor.perez@e-evolution.com
|
||||
* <li>FR [ 1966328 ] New Window Info to MRP and CRP into View http://sourceforge.net/tracker/index.php?func=detail&aid=1966328&group_id=176962&atid=879335
|
||||
* <li>FR [ 2853359 ] Popup Menu for Lookup Record
|
||||
* <li>http://sourceforge.net/tracker/?func=detail&aid=2853359&group_id=176962&atid=879335
|
||||
* @see FR [ 1966328 ] New Window Info to MRP and CRP into View http://sourceforge.net/tracker/index.php?func=detail&aid=1966328&group_id=176962&atid=879335
|
||||
* @autor tobi42, metas GmBH
|
||||
* <li>BF [ 2799362 ] You can press New button a lot of times
|
||||
*
|
||||
|
@ -2057,7 +2055,26 @@ public final class APanel extends CPanel
|
|||
*/
|
||||
private void cmd_find()
|
||||
{
|
||||
new ASearch(aFind.getButton(),Env.getFrame(this), m_curWindowNo,m_curGC, m_curTab);
|
||||
if (m_curTab == null)
|
||||
return;
|
||||
cmd_save(false);
|
||||
// Gets Fields from AD_Field_v
|
||||
GridField[] findFields = GridField.createFields(m_ctx, m_curWindowNo, 0, m_curTab.getAD_Tab_ID());
|
||||
Find find = new Find (Env.getFrame(this), m_curWindowNo, m_curTab.getName(),
|
||||
m_curTab.getAD_Tab_ID(), m_curTab.getAD_Table_ID(), m_curTab.getTableName(),
|
||||
m_curTab.getWhereExtended(), findFields, 1);
|
||||
MQuery query = find.getQuery();
|
||||
find.dispose();
|
||||
find = null;
|
||||
|
||||
// Confirmed query
|
||||
if (query != null)
|
||||
{
|
||||
m_onlyCurrentRows = false; // search history too
|
||||
m_curTab.setQuery(query);
|
||||
m_curGC.query(m_onlyCurrentRows, m_onlyCurrentDays, 0); // autoSize
|
||||
}
|
||||
aFind.setPressed(m_curTab.isQueryActive());
|
||||
} // cmd_find
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,156 +0,0 @@
|
|||
/******************************************************************************
|
||||
* 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 *
|
||||
* Sponsors: *
|
||||
* - E-evolution (http://www.e-evolution.com/) *
|
||||
*****************************************************************************/
|
||||
package org.compiere.apps;
|
||||
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import org.compiere.apps.search.Find;
|
||||
import org.compiere.grid.GridController;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MUserQuery;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
/**
|
||||
* Application Search.
|
||||
* Called from APanel; Queries Search Table.
|
||||
*
|
||||
* @author victor.perez@e-evolution.com, www.e-evolution.com
|
||||
* <li>RF [ 2853359 ] Popup Menu for Lookup Record
|
||||
* <li>http://sourceforge.net/tracker/?func=detail&aid=2853359&group_id=176962&atid=879335
|
||||
*/
|
||||
public class ASearch implements ActionListener
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
* @param invoker component to display popup (optional)
|
||||
* @param tableName table name
|
||||
* @param query query
|
||||
*/
|
||||
public ASearch (JComponent invoker, Frame owner, int targetWindowNo, GridController gc ,GridTab gridTab)
|
||||
{
|
||||
m_invoker = invoker;
|
||||
m_owner = owner;
|
||||
m_targetWindowNo = targetWindowNo;
|
||||
m_gt = gridTab;
|
||||
m_gc = gc;
|
||||
// See What is there
|
||||
getSearchTargets ();
|
||||
} // AReport
|
||||
|
||||
/** The Popup */
|
||||
private JPopupMenu m_popup = new JPopupMenu("SearchMenu");
|
||||
/** The Option List */
|
||||
private ArrayList<KeyNamePair> m_list = new ArrayList<KeyNamePair>();
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(ASearch.class);
|
||||
|
||||
JComponent m_invoker;
|
||||
Frame m_owner;
|
||||
int m_targetWindowNo;
|
||||
GridTab m_gt;
|
||||
GridController m_gc;
|
||||
|
||||
/**
|
||||
* Get the UserQuery for the table.
|
||||
* Fill the list and the popup menu
|
||||
* @param invoker component to display popup (optional)
|
||||
* @param AD_Tab_ID Tab ID
|
||||
* @param AD_Table_ID Table ID
|
||||
* @param AD_User_ID User ID
|
||||
*/
|
||||
private void getSearchTargets ()
|
||||
{
|
||||
boolean baseLanguage = Env.isBaseLanguage(Env.getCtx(), "AD_Window");
|
||||
MUserQuery[] search = MUserQuery.get(Env.getCtx(), m_gt.getAD_Tab_ID());
|
||||
KeyNamePair pp = new KeyNamePair (0, Msg.translate(Env.getCtx(), "Find"));
|
||||
m_list.add(pp);
|
||||
m_popup.add(pp.toString()).addActionListener(this);
|
||||
|
||||
for (MUserQuery query: search)
|
||||
{
|
||||
pp = new KeyNamePair (query.getAD_UserQuery_ID(), query.getName());
|
||||
m_list.add(pp);
|
||||
m_popup.add(pp.toString()).addActionListener(this);
|
||||
}
|
||||
|
||||
if (m_invoker.isShowing() && m_list.size() > 1)
|
||||
{
|
||||
m_popup.show(m_invoker, 0, m_invoker.getHeight());
|
||||
}
|
||||
else
|
||||
{
|
||||
launchSearch(pp);
|
||||
}
|
||||
} // getZoomTargets
|
||||
|
||||
|
||||
/**
|
||||
* Action Listener
|
||||
* @param e event
|
||||
*/
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
m_popup.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
String cmd = e.getActionCommand();
|
||||
for (int i = 0; i < m_list.size(); i++)
|
||||
{
|
||||
KeyNamePair pp = (KeyNamePair)m_list.get(i);
|
||||
if (cmd.equals(pp.getName()))
|
||||
{
|
||||
launchSearch (pp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} // actionPerformed
|
||||
|
||||
/**
|
||||
* Launch Search
|
||||
* @param pp KeyPair
|
||||
*/
|
||||
private void launchSearch (KeyNamePair pp)
|
||||
{
|
||||
Find find = new Find (m_owner, m_targetWindowNo, m_gc , m_gt, 1);
|
||||
if(pp.getName().equals(Msg.getMsg(Env.getCtx(), "Find")))
|
||||
{
|
||||
AEnv.showCenterWindow(m_owner, find);
|
||||
}
|
||||
else
|
||||
{
|
||||
int AD_UserQuery_ID = pp.getKey();
|
||||
MUserQuery userQuery = null;
|
||||
if(AD_UserQuery_ID > 0)
|
||||
{
|
||||
userQuery = new MUserQuery(Env.getCtx(),AD_UserQuery_ID, null);
|
||||
}
|
||||
find.initFindAdvanced();
|
||||
find.parseUserQuery(userQuery);
|
||||
find.cmd_ok_Advanced();
|
||||
}
|
||||
}
|
||||
} // ASearch
|
|
@ -50,7 +50,6 @@ import javax.swing.DefaultComboBoxModel;
|
|||
import javax.swing.ImageIcon;
|
||||
import javax.swing.InputMap;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
|
@ -65,9 +64,9 @@ import javax.swing.table.TableCellRenderer;
|
|||
import javax.swing.table.TableColumn;
|
||||
|
||||
import org.compiere.apps.ADialog;
|
||||
import org.compiere.apps.AEnv;
|
||||
import org.compiere.apps.ConfirmPanel;
|
||||
import org.compiere.apps.StatusBar;
|
||||
import org.compiere.grid.GridController;
|
||||
import org.compiere.grid.ed.AutoCompletion;
|
||||
import org.compiere.grid.ed.VEditor;
|
||||
import org.compiere.grid.ed.VEditorFactory;
|
||||
|
@ -76,7 +75,6 @@ import org.compiere.model.DataStatusEvent;
|
|||
import org.compiere.model.DataStatusListener;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.GridFieldVO;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MQuery;
|
||||
|
@ -96,7 +94,6 @@ import org.compiere.util.CLogger;
|
|||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
|
@ -110,9 +107,6 @@ import org.compiere.util.ValueNamePair;
|
|||
*
|
||||
* @author Teo Sarca, www.arhipac.ro
|
||||
* <li>BF [ 2564070 ] Saving user queries can produce unnecessary db errors
|
||||
* @author victor.perez@e-evolution.com, www.e-evolution.com
|
||||
* <li>RF [ 2853359 ] Popup Menu for Lookup Record
|
||||
* <li>http://sourceforge.net/tracker/?func=detail&aid=2853359&group_id=176962&atid=879335
|
||||
*/
|
||||
public final class Find extends CDialog
|
||||
implements ActionListener, ChangeListener, DataStatusListener
|
||||
|
@ -120,24 +114,7 @@ public final class Find extends CDialog
|
|||
private static final long serialVersionUID = 6414604433732835410L;
|
||||
|
||||
private int m_AD_Tab_ID;
|
||||
|
||||
/**
|
||||
* Find Constructor
|
||||
* @param owner Frame Dialog Onwer
|
||||
* @param targetWindowNo WindowNo of target window
|
||||
* @param gc Grid Controller
|
||||
* @param gridTab GridTab
|
||||
* @param minRecords number of minimum records
|
||||
*/
|
||||
public Find (Frame owner, int targetWindowNo, GridController gc ,GridTab gridTab, int minRecords)
|
||||
{
|
||||
this(owner, targetWindowNo, gridTab.getName(), gridTab.getAD_Tab_ID(),
|
||||
gridTab.getAD_Table_ID(), gridTab.getTableName(), gridTab.getWhereExtended(),
|
||||
GridField.createFields(Env.getCtx(), targetWindowNo, 0, gridTab.getAD_Tab_ID()), minRecords);
|
||||
m_gt = gridTab;
|
||||
m_gc = gc;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find Constructor
|
||||
* @param owner Frame Dialog Onwer
|
||||
|
@ -153,6 +130,7 @@ public final class Find extends CDialog
|
|||
int AD_Table_ID, String tableName, String whereExtended,
|
||||
GridField[] findFields, int minRecords)
|
||||
{
|
||||
super(owner, Msg.getMsg(Env.getCtx(), "Find") + ": " + title, true);
|
||||
log.info(title);
|
||||
//
|
||||
m_targetWindowNo = targetWindowNo;
|
||||
|
@ -185,11 +163,9 @@ public final class Find extends CDialog
|
|||
}
|
||||
//
|
||||
this.getRootPane().setDefaultButton(confirmPanelS.getOKButton());
|
||||
AEnv.showCenterWindow(owner, this);
|
||||
} // Find
|
||||
|
||||
GridController m_gc ;
|
||||
GridTab m_gt;
|
||||
|
||||
|
||||
/** Target Window No */
|
||||
private int m_targetWindowNo;
|
||||
/** Table ID */
|
||||
|
@ -230,11 +206,6 @@ public final class Find extends CDialog
|
|||
/** Reference ID for Yes/No */
|
||||
public static final int AD_REFERENCE_ID_YESNO = 319;
|
||||
|
||||
/** The Popup */
|
||||
private JPopupMenu m_popup = new JPopupMenu("SearchMenu");
|
||||
/** The Option List */
|
||||
private ArrayList<KeyNamePair> m_list = new ArrayList<KeyNamePair>();
|
||||
|
||||
//
|
||||
private CPanel southPanel = new CPanel();
|
||||
private BorderLayout southLayout = new BorderLayout();
|
||||
|
@ -580,7 +551,7 @@ public final class Find extends CDialog
|
|||
/**
|
||||
* Init Find GridController
|
||||
*/
|
||||
public void initFindAdvanced()
|
||||
private void initFindAdvanced()
|
||||
{
|
||||
log.config("");
|
||||
advancedTable.setModel(new DefaultTableModel(0, 4));
|
||||
|
@ -747,7 +718,7 @@ public final class Find extends CDialog
|
|||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
log.info(e.getActionCommand());
|
||||
|
||||
//
|
||||
if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL))
|
||||
cmd_cancel();
|
||||
else if (e.getActionCommand().equals(ConfirmPanel.A_REFRESH))
|
||||
|
@ -825,7 +796,7 @@ public final class Find extends CDialog
|
|||
}
|
||||
} // actionPerformed
|
||||
|
||||
public void parseUserQuery(MUserQuery userQuery) {
|
||||
private void parseUserQuery(MUserQuery userQuery) {
|
||||
String code = userQuery.getCode();
|
||||
String[] segments = code.split(Pattern.quote(SEGMENT_SEPARATOR));
|
||||
advancedTable.stopEditor(true);
|
||||
|
@ -974,7 +945,7 @@ public final class Find extends CDialog
|
|||
/**
|
||||
* Advanced OK Button pressed
|
||||
*/
|
||||
public void cmd_ok_Advanced()
|
||||
private void cmd_ok_Advanced()
|
||||
{
|
||||
m_isCancel = false; // teo_sarca [ 1708717 ]
|
||||
// save pending
|
||||
|
@ -1136,7 +1107,7 @@ public final class Find extends CDialog
|
|||
}
|
||||
} // cmd_save
|
||||
|
||||
public void refreshUserQueries()
|
||||
private void refreshUserQueries()
|
||||
{
|
||||
Object selected = fQueryName.getSelectedItem();
|
||||
userQueries = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID);
|
||||
|
@ -1491,11 +1462,6 @@ public final class Find extends CDialog
|
|||
//
|
||||
if (query != null)
|
||||
statusBar.setStatusToolTip (query.getWhereClause());
|
||||
if(m_gt != null && m_gc!= null)
|
||||
{
|
||||
m_gt.setQuery(getQuery());
|
||||
m_gc.query(false, 0, 0);
|
||||
}
|
||||
return m_total;
|
||||
} // getNoOfRecords
|
||||
|
||||
|
@ -1569,4 +1535,5 @@ public final class Find extends CDialog
|
|||
return comp;
|
||||
}
|
||||
} // ProxyRenderer
|
||||
|
||||
} // Find
|
||||
|
|
Loading…
Reference in New Issue