Merged tbayen/idempiere-swing into development

This commit is contained in:
Carlos Ruiz 2013-02-06 10:25:38 -05:00
commit 9d593123c9
24 changed files with 530 additions and 52 deletions

View File

@ -0,0 +1,40 @@
-- Jan 24, 2013 12:10:51 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Element_UU,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,202202,'7d389ba2-a5c9-4a9f-a93c-a42588b6e62d',0,'IsShortList',TO_DATE('2013-01-24 12:10:49','YYYY-MM-DD HH24:MI:SS'),100,'This record is in the short list','D','The most used records could be set into the short list in order to be selected faster','Y','Short list','Short list',TO_DATE('2013-01-24 12:10:49','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jan 24, 2013 12:10:51 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=202202 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Jan 24, 2013 12:11:24 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200136,'a8e26155-174f-4fdb-b575-ba4bd3fe0523',0,TO_DATE('2013-01-24 12:11:23','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','All records','I',TO_DATE('2013-01-24 12:11:23','YYYY-MM-DD HH24:MI:SS'),100,'ShortListListAllItems')
;
-- Jan 24, 2013 12:11:24 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200136 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Jan 24, 2013 12:11:32 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200137,'eb83b9c3-95c6-4324-870b-975965aa033f',0,TO_DATE('2013-01-24 12:11:32','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Short list items','I',TO_DATE('2013-01-24 12:11:32','YYYY-MM-DD HH24:MI:SS'),100,'ShortListShortListItems')
;
-- Jan 24, 2013 12:11:32 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200137 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Jan 24, 2013 12:11:41 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200138,'ac962f08-3465-4be3-b330-ba0b4e8e388f',0,TO_DATE('2013-01-24 12:11:40','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Short list / All','I',TO_DATE('2013-01-24 12:11:40','YYYY-MM-DD HH24:MI:SS'),100,'ShortListSwitchSearchMode')
;
-- Jan 24, 2013 12:11:41 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200138 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;

View File

@ -0,0 +1,40 @@
-- Jan 24, 2013 12:10:51 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Element_UU,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,202202,'7d389ba2-a5c9-4a9f-a93c-a42588b6e62d',0,'IsShortList',TO_TIMESTAMP('2013-01-24 12:10:49','YYYY-MM-DD HH24:MI:SS'),100,'This record is in the short list','D','The most used records could be set into the short list in order to be selected faster','Y','Short list','Short list',TO_TIMESTAMP('2013-01-24 12:10:49','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Jan 24, 2013 12:10:51 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=202202 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Jan 24, 2013 12:11:24 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200136,'a8e26155-174f-4fdb-b575-ba4bd3fe0523',0,TO_TIMESTAMP('2013-01-24 12:11:23','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','All records','I',TO_TIMESTAMP('2013-01-24 12:11:23','YYYY-MM-DD HH24:MI:SS'),100,'ShortListListAllItems')
;
-- Jan 24, 2013 12:11:24 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200136 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Jan 24, 2013 12:11:32 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200137,'eb83b9c3-95c6-4324-870b-975965aa033f',0,TO_TIMESTAMP('2013-01-24 12:11:32','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Short list items','I',TO_TIMESTAMP('2013-01-24 12:11:32','YYYY-MM-DD HH24:MI:SS'),100,'ShortListShortListItems')
;
-- Jan 24, 2013 12:11:32 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200137 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Jan 24, 2013 12:11:41 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200138,'ac962f08-3465-4be3-b330-ba0b4e8e388f',0,TO_TIMESTAMP('2013-01-24 12:11:40','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Short list / All','I',TO_TIMESTAMP('2013-01-24 12:11:40','YYYY-MM-DD HH24:MI:SS'),100,'ShortListSwitchSearchMode')
;
-- Jan 24, 2013 12:11:41 PM CET
-- IDEMPIERE 90
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200138 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;

View File

@ -76,6 +76,8 @@ public abstract class Lookup extends AbstractListModel
private boolean m_loaded;
private boolean m_shortList; // IDEMPIERE 90
/**
* Get Display Type
* @return display type
@ -259,7 +261,7 @@ public abstract class Lookup extends AbstractListModel
* @param temporary save current values - restore via fillComboBox (true)
*/
public void fillComboBox (boolean mandatory, boolean onlyValidated,
boolean onlyActive, boolean temporary)
boolean onlyActive, boolean temporary, boolean shortList) // IDEMPIERE 90
{
long startTime = System.currentTimeMillis();
m_loaded = false;
@ -279,7 +281,7 @@ public abstract class Lookup extends AbstractListModel
p_data.clear();
// may cause delay *** The Actual Work ***
p_data = getData (mandatory, onlyValidated, onlyActive, temporary);
p_data = getData (mandatory, onlyValidated, onlyActive, temporary, shortList); // IDEMPIERE 90
// Selected Object changed
if (obj != m_selectedObject)
@ -335,7 +337,7 @@ public abstract class Lookup extends AbstractListModel
return;
}
if (p_data != null)
fillComboBox(isMandatory(), true, true, false);
fillComboBox(isMandatory(), true, true, false, false); // IDEMPIERE 90
} // fillComboBox
@ -363,7 +365,7 @@ public abstract class Lookup extends AbstractListModel
* @return ArrayList
*/
public abstract ArrayList<Object> getData (boolean mandatory,
boolean onlyValidated, boolean onlyActive, boolean temporary);
boolean onlyValidated, boolean onlyActive, boolean temporary, boolean shortlist); // IDEMPIERE 90
/**
* Get underlying fully qualified Table.Column Name.
@ -503,5 +505,16 @@ public abstract class Lookup extends AbstractListModel
{
return m_loaded;
}
// IDEMPIERE 90
public void setShortList(boolean shortlist)
{
m_shortList = shortlist;
}
public boolean isShortList()
{
return m_shortList;
}
// IDEMPIERE 90
} // Lookup

View File

@ -173,7 +173,7 @@ public final class MAccountLookup extends Lookup implements Serializable
* @return ArrayList with KeyNamePair
*/
public ArrayList<Object> getData (boolean mandatory, boolean onlyValidated,
boolean onlyActive, boolean temporary)
boolean onlyActive, boolean temporary, boolean isshortlist) // IDEMPIERE 90
{
ArrayList<Object> list = new ArrayList<Object>();
if (!mandatory)

View File

@ -144,7 +144,7 @@ public final class MLocationLookup extends Lookup
* @param temporary force load for temporary display
* @return null
*/
public ArrayList<Object> getData (boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary)
public ArrayList<Object> getData (boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary, boolean shortlist) // IDEMPIERE 90
{
log.log(Level.SEVERE, "not implemented");
return null;

View File

@ -414,7 +414,7 @@ public final class MLocatorLookup extends Lookup implements Serializable
* @param temporary force load for temporary display
* @return ArrayList of lookup values
*/
public ArrayList<Object> getData (boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary)
public ArrayList<Object> getData (boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary, boolean shortlist) // IDEMPIERE 90
{
// create list
Collection<MLocator> collection = getData();

View File

@ -103,7 +103,6 @@ public final class MLookup extends Lookup implements Serializable
/** Indicator for Null */
private static Integer MINUS_ONE = new Integer(-1);
/** The Lookup Info Value Object */
private MLookupInfo m_info = null;
@ -122,7 +121,14 @@ public final class MLookup extends Lookup implements Serializable
private boolean m_refreshing = false;
/** Next Read for Parent */
private long m_nextRead = 0;
/** Not in short List item Marker Start IDEMPIERE 90 */
public static final String SHORTLIST_S = "*";
/** Not in short List item Marker End IDEMPIERE 90 */
public static final String SHORTLIST_E = "*";
private boolean m_hasShortListItems = false; // IDEMPIERE 90
/**
* Dispose
*/
@ -391,9 +397,10 @@ public final class MLookup extends Lookup implements Serializable
* @param onlyValidated only validated
* @param onlyActive only active
* @param temporary force load for temporary display
* @param isshortlist
* @return list
*/
public ArrayList<Object> getData (boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary)
public ArrayList<Object> getData (boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary, boolean shortlist) // idempiere 90
{
// create list
ArrayList<Object> list = getData (onlyValidated, true);
@ -414,6 +421,23 @@ public final class MLookup extends Lookup implements Serializable
}
}
// Remove non short list items IDEMPIERE 90
if (shortlist && m_hasShortListItems)
{
// list from the back
for (int i = list.size(); i > 0; i--)
{
Object o = list.get(i-1);
if (o != null)
{
String s = o.toString();
if (s.startsWith(SHORTLIST_S) && s.endsWith(SHORTLIST_E))
list.remove(i-1);
}
}
}
// End Remove non short list items IDEMPIERE 90
// Add Optional (empty) selection
if (!mandatory)
{
@ -597,7 +621,7 @@ public final class MLookup extends Lookup implements Serializable
m_refreshing = true;
//force refresh
m_lookup.clear();
fillComboBox(isMandatory(), true, true, false);
fillComboBox(isMandatory(), true, true, false, isShortList()); // idempiere 90
m_refreshing = false;
return m_lookup.size();
} // refresh
@ -677,6 +701,17 @@ public final class MLookup extends Lookup implements Serializable
MLookupCache.loadStart (m_info);
StringBuilder sql = new StringBuilder().append(m_info.Query);
// IDEMPIERE 90
if (isShortList())
{
// Adding ", IsShortList" to the sql SELECT clause
int posFirstPoint = sql.indexOf(".");
String tableName = sql.substring(7, posFirstPoint);
int posFirstFrom = sql.indexOf(tableName+".IsActive FROM "+tableName) + tableName.length() + 9 ; // 9 = .IsActive
String ClauseFromWhereOrder = sql.substring(posFirstFrom, sql.length());
sql = new StringBuilder(sql.substring(0, posFirstFrom) + ", " + tableName + ".IsShortList" + ClauseFromWhereOrder);
} // IDEMPIERE 90
// not validated
if (!m_info.IsValidated)
{
@ -768,6 +803,17 @@ public final class MLookup extends Lookup implements Serializable
name = new StringBuilder(INACTIVE_S).append(name).append(INACTIVE_E);
m_hasInactive = true;
}
// IDEMPIERE 90
if (isShortList())
{
boolean isShortListItem = rs.getString(5).equals("Y");
if (!isShortListItem)
{
name = new StringBuilder(SHORTLIST_S).append(name).append(SHORTLIST_S);
m_hasShortListItems = true;
}
}
// IDEMPIERE 90
if (isNumber)
{
int key = rs.getInt(1);

View File

@ -168,7 +168,7 @@ public class MPAttributeLookup extends Lookup
* @param temporary force load for temporary display
* @return null
*/
public ArrayList<Object> getData (boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary)
public ArrayList<Object> getData (boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary, boolean shortlist) // IDEMPIERE 90
{
log.log(Level.SEVERE, "Not implemented");
return null;

View File

@ -199,7 +199,7 @@ public class MPaymentLookup extends Lookup implements Serializable {
@Override
public ArrayList<Object> getData(boolean mandatory, boolean onlyValidated,
boolean onlyActive, boolean temporary) {
boolean onlyActive, boolean temporary, boolean shortlist) { // IDEMPIERE 90
ArrayList<Object> list = new ArrayList<Object>();
ValueNamePair[] values = getData();
@ -220,7 +220,7 @@ public class MPaymentLookup extends Lookup implements Serializable {
@Override
public int refresh() {
fillComboBox(isMandatory(), true, true, false);
fillComboBox(isMandatory(), true, true, false, false); // IDEMPIERE 90
return super.getSize();
}
}

View File

@ -924,12 +924,11 @@ public final class ALogin extends CDialog
{
clientCombo.setSelectedIndex(0);
clientCombo.setVisible(false);
clientCombo.setVisible(false);
clientLabel.setVisible(false);
}
else
{
clientCombo.setVisible(true);
clientLabel.setVisible(true);
clientCombo.setVisible(true);
}
@ -973,6 +972,10 @@ public final class ALogin extends CDialog
}
//
KeyNamePair[] roles = m_login.getRoles(userTextField.getText(), client);
// Make role Combo visible
roleCombo.setVisible(true);
roleLabel.setVisible(true);
// delete existing rol/org items
if (roleCombo.getItemCount() > 0)
roleCombo.removeAllItems();
@ -1005,7 +1008,6 @@ public final class ALogin extends CDialog
{
roleCombo.setSelectedIndex(0);
roleCombo.setVisible(false);
roleCombo.setVisible(false);
roleLabel.setVisible(false);
}

View File

@ -19,8 +19,12 @@ package org.compiere.apps;
import static org.compiere.model.SystemIDs.PROCESS_AD_CHANGELOG_REDO;
import static org.compiere.model.SystemIDs.PROCESS_AD_CHANGELOG_UNDO;
import static org.compiere.model.SystemIDs.REFERENCE_DOCUMENTACTION;
import static org.compiere.model.SystemIDs.REFERENCE_PAYMENTRULE;
import static org.compiere.model.SystemIDs.REFERENCE_POSTED;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
@ -33,6 +37,9 @@ import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.io.File;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -46,13 +53,16 @@ import java.util.logging.Level;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
@ -62,6 +72,8 @@ import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import org.adempiere.util.Callback;
import org.adempiere.util.IProcessUI;
@ -87,6 +99,7 @@ import org.compiere.model.GridWindow;
import org.compiere.model.GridWindowVO;
import org.compiere.model.GridWorkbench;
import org.compiere.model.Lookup;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MProcess;
import org.compiere.model.MQuery;
@ -104,9 +117,11 @@ import org.compiere.swing.CPanel;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Language;
import org.compiere.util.Msg;
import org.compiere.util.NamePair;
import org.compiere.util.Util;
/**
@ -258,7 +273,7 @@ public final class APanel extends CPanel
// Prepare GC
this.removeAll();
} // dispose
/**
* The Layout.
*/
@ -308,7 +323,8 @@ public final class APanel extends CPanel
aNew, aCopy, aDelete, aPrint, aPrintPreview,
aExport = null,
aRefresh, aHistory, aAttachment, aChat, aMulti, aFind,
aWorkflow, aZoomAcross, aRequest, aWinSize, aArchive;
aWorkflow, aZoomAcross, aRequest, aWinSize, aArchive,
aProcess;
/** Ignore Button */
public AppsAction aIgnore;
/** Save Button */
@ -482,6 +498,9 @@ public final class APanel extends CPanel
aOnline = addAction("Online", mHelp, null, false);
aMailSupport = addAction("EMailSupport", mHelp, null, false);
aAbout = addAction("About", mHelp, null, false);
//
aProcess=addAction("Process",null,null,false);
/**
* ToolBar
@ -495,6 +514,7 @@ public final class APanel extends CPanel
toolBar.add(aDeleteSelection.getButton());
toolBar.add(aSave.getButton());
toolBar.add(aSaveAndCreate.getButton());
toolBar.add(aProcess.getButton());
toolBar.addSeparator();
toolBar.add(aRefresh.getButton()); // F5
toolBar.add(aFind.getButton());
@ -1573,7 +1593,20 @@ public final class APanel extends CPanel
aRefresh.setEnabled(true);
aAttachment.setEnabled(true);
aChat.setEnabled(true);
// IDEMPIERE-587 - Swing: Toolbar Button to start Process from button fields
// tbayen - 2013-01-22
GridField[] fields = m_curGC.getMTab().getFields();
boolean processEnabled=false;
for(GridField field:fields){
if (field.isToolbarButton() && field.isDisplayed()){
processEnabled=true;
break;
}
}
aProcess.setEnabled(processEnabled);
}
//
m_curWinTab.requestFocusInWindow();
setBusy(false, true);
@ -1725,6 +1758,8 @@ public final class APanel extends CPanel
cmd_find();
else if (m_isPersonalLock && cmd.equals(aLock.getName()))
cmd_lock();
else if (cmd.equals(aProcess.getName()))
cmd_process();
// View
else if (cmd.equals(aAttachment.getName()))
cmd_attachment();
@ -2088,6 +2123,143 @@ public final class APanel extends CPanel
return retValue;
}
private long m_popup_closingtime=0;
/**
* opens a pulldown menu to start processes from "Button" type fields.
*/
// IDEMPIERE-587 - Swing: Toolbar Button to start Process from button fields
// tbayen - 2013-01-22
public void cmd_process() {
if(System.currentTimeMillis()-m_popup_closingtime<200)
return; // closed through the same click - user has clicked to close the menu
GridField[] fields = m_curGC.getMTab().getFields();
final ArrayList<GridField> processFields = new ArrayList<GridField>();
for (GridField field : fields) {
if (field.isToolbarButton() && field.isDisplayed()) {
processFields.add(field);
}
}
JPopupMenu popup = new JPopupMenu();
popup.addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
m_popup_closingtime=System.currentTimeMillis();
}
@Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) {}
@Override public void popupMenuCanceled(PopupMenuEvent e) {}
});
for (GridField field : processFields) {
if (field.isDisplayed(true)) {
ImageIcon icon = Env.getImageIcon2("Process16");
String text = field.getHeader();
Color color = null;
// preparing data like lookup tables
// code to find the text and icons to display is shameless
// stolen from org.compiere.grid.ed.VButton
MLookup m_lookup = null;
// Record_ID for Zoom Buttons (see
// http://www.adempiere.com/Entering_Data_-_Fields_and_Buttons#Button)
if (field.getColumnName().endsWith("_ID")
&& !field.getColumnName().equals("Record_ID")) {
m_lookup = MLookupFactory.get(Env.getCtx(),
field.getWindowNo(), 0, field.getAD_Column_ID(),
DisplayType.Search);
} else if (field.getAD_Reference_Value_ID() != 0) {
// Assuming List
m_lookup = MLookupFactory.get(Env.getCtx(),
field.getWindowNo(), 0, field.getAD_Column_ID(),
DisplayType.List);
}
// Special Buttons
int AD_Reference_ID = -1;
String columnName = field.getColumnName();
if (columnName.equals("PaymentRule")) {
AD_Reference_ID = REFERENCE_PAYMENTRULE;
color = Color.blue;
icon = Env.getImageIcon("Payment16.gif"); // 29*14
} else if (columnName.equals("DocAction")) {
AD_Reference_ID = REFERENCE_DOCUMENTACTION;
color = Color.blue;
icon = Env.getImageIcon("Process16.gif"); // 16*16
} else if (columnName.equals("CreateFrom")) {
icon = Env.getImageIcon("Copy16.gif"); // 16*16
} else if (columnName.equals("Record_ID")) {
icon = Env.getImageIcon("Zoom16.gif"); // 16*16
text = Msg.getMsg(Env.getCtx(), "ZoomDocument");
} else if (columnName.equals("Posted")) {
AD_Reference_ID = REFERENCE_POSTED;
color = Color.magenta;
icon = Env.getImageIcon("InfoAccount16.gif"); // 16*16
}
Map<String, String> values = null;
if (AD_Reference_ID > 0) {
values = new HashMap<String, String>();
String SQL;
if (Env.isBaseLanguage(Env.getCtx(), "AD_Ref_List"))
SQL = "SELECT Value, Name FROM AD_Ref_List WHERE AD_Reference_ID=?";
else
SQL = "SELECT l.Value, t.Name FROM AD_Ref_List l, AD_Ref_List_Trl t "
+ "WHERE l.AD_Ref_List_ID=t.AD_Ref_List_ID"
+ " AND t.AD_Language='"
+ Env.getAD_Language(Env.getCtx())
+ "'"
+ " AND l.AD_Reference_ID=?";
try {
PreparedStatement pstmt = DB
.prepareStatement(SQL, null);
pstmt.setInt(1, AD_Reference_ID);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
String value = rs.getString(1);
String name = rs.getString(2);
values.put(value, name);
}
rs.close();
pstmt.close();
} catch (SQLException e) {
log.log(Level.SEVERE, SQL, e);
}
// Nothing to show or Record_ID
if (field.getValue() == null
|| field.getColumnName().equals("Record_ID"))
;
else if (values != null)
text = (String) values.get(field.getValue());
else if (m_lookup != null) {
NamePair pp = m_lookup.get(field.getValue());
if (pp != null)
text = pp.getName();
}
// Display it
} // setValue
JMenuItem item = new JMenuItem(text, icon);
item.setForeground(color);
item.setName(field.getColumnName());
popup.add(item);
item.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JMenuItem menuItem = ((JMenuItem)e.getSource());
String columnName=menuItem.getName();
GridField callingField = m_curTab.getField(columnName);
//
setStatusLine(m_curTab.processCallout(callingField), true);
actionButtonCleanUp(menuItem.getName(),
callingField.getAD_Process_ID(), callingField.getHeader());
}
});
}
}
popup.show(aProcess.getButton(), -1, aProcess.getButton().getHeight());
}
/**
* Ignore
*/
@ -2469,9 +2641,16 @@ public final class APanel extends CPanel
* Start Button Process
* @param vButton button
*/
private void actionButton (VButton vButton)
{
private void actionButton (VButton vButton){
log.info(vButton.toString());
String title = vButton.getDescription();
if (title == null || title.length() == 0)
title = vButton.getName();
actionButtonCleanUp(vButton.getColumnName(), vButton.getProcess_ID(), title);
}
private void actionButtonCleanUp(String columnName, int processID, String title)
{
if (m_curTab.hasChangedCurrentTabAndParents()) {
String msg = CLogger.retrieveErrorString("Please ReQuery Window");
@ -2481,7 +2660,7 @@ public final class APanel extends CPanel
boolean startWOasking = false;
// boolean batch = false;
String col = vButton.getColumnName();
String col = columnName;
// Zoom
if (col.equals("Record_ID"))
@ -2512,7 +2691,7 @@ public final class APanel extends CPanel
record_ID = Env.getContextAsInt (m_ctx, m_curWindowNo, "AD_Language_ID");
// Record_ID - Change Log ID
if (record_ID == -1
&& (vButton.getProcess_ID() == PROCESS_AD_CHANGELOG_UNDO || vButton.getProcess_ID() == PROCESS_AD_CHANGELOG_REDO))
&& (processID == PROCESS_AD_CHANGELOG_UNDO || processID == PROCESS_AD_CHANGELOG_REDO))
{
Integer id = (Integer)m_curTab.getValue("AD_ChangeLog_ID");
record_ID = id.intValue();
@ -2529,7 +2708,7 @@ public final class APanel extends CPanel
if (col.equals("DocAction"))
{
isProcessMandatory = true;
VDocAction vda = new VDocAction(m_curWindowNo, m_curTab, vButton, record_ID);
VDocAction vda = new VDocAction(m_curWindowNo, m_curTab, null, record_ID);
// Something to select from?
if (vda.getNumberOfOptions() == 0)
{
@ -2552,7 +2731,7 @@ public final class APanel extends CPanel
else if (col.equals("CreateFrom"))
{
// Run form only if the button has no process defined - teo_sarca [ 1974354 ]
if (vButton.getProcess_ID() <= 0)
if (processID <= 0)
{
ICreateFrom cf = VCreateFromFactory.create(m_curTab);
if(cf != null)
@ -2628,8 +2807,8 @@ public final class APanel extends CPanel
* or invoke user form
*/
log.config("Process_ID=" + vButton.getProcess_ID() + ", Record_ID=" + record_ID);
if (vButton.getProcess_ID() == 0)
log.config("Process_ID=" + processID + ", Record_ID=" + record_ID);
if (processID == 0)
{
if (isProcessMandatory)
{
@ -2643,7 +2822,7 @@ public final class APanel extends CPanel
return;
// call form
MProcess pr = new MProcess(m_ctx, vButton.getProcess_ID(), null);
MProcess pr = new MProcess(m_ctx, processID, null);
int form_ID = pr.getAD_Form_ID();
if (form_ID != 0 )
{
@ -2653,10 +2832,7 @@ public final class APanel extends CPanel
return;
FormFrame ff = new FormFrame(getGraphicsConfiguration());
String title = vButton.getDescription();
if (title == null || title.length() == 0)
title = vButton.getName();
ProcessInfo pi = new ProcessInfo (title, vButton.getProcess_ID(), table_ID, record_ID);
ProcessInfo pi = new ProcessInfo (title, processID, table_ID, record_ID);
pi.setAD_User_ID (Env.getAD_User_ID(m_ctx));
pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx));
ff.setProcessInfo(pi);
@ -2667,7 +2843,7 @@ public final class APanel extends CPanel
}
else {
ProcessModalDialog dialog = new ProcessModalDialog(m_ctx, AEnv.getWindow(m_curWindowNo), Env.getHeader(m_ctx, m_curWindowNo),
this, m_curWindowNo, vButton.getProcess_ID(), table_ID,
this, m_curWindowNo, processID, table_ID,
record_ID, startWOasking);
if (dialog.isValidDialog())
{

View File

@ -415,7 +415,12 @@ public class GridController extends CPanel
for (int i = 0; i < size; i++)
{
GridField mField = m_mTab.getField(i);
if (mField.isDisplayed())
if (mField.isDisplayed()
// IDEMPIERE-587 Swing: Toolbar Button to start Process from button fields
&& !(
mField.getDisplayType()==DisplayType.Button
&& mField.isToolbarButton())
)
{
VEditor vEditor = VEditorFactory.getEditor(m_mTab, mField, false);
if (vEditor == null)

View File

@ -125,7 +125,7 @@ public class XLookup extends Lookup
* @return list of data
*/
public ArrayList<Object> getData (boolean mandatory,
boolean onlyValidated, boolean onlyActive, boolean temporary)
boolean onlyValidated, boolean onlyActive, boolean temporary, boolean shortlist) // IDEMPIERE 90
{
ArrayList<Object> list = new ArrayList<Object>(p_data);

View File

@ -243,7 +243,7 @@ public class VLocatorDialog extends CDialog
log.fine("Warehouses=" + fWarehouse.getItemCount());
// Load existing Locators
m_mLocator.fillComboBox(m_mandatory, true, true, false);
m_mLocator.fillComboBox(m_mandatory, true, true, false, false); // IDEMPIERE 90
log.fine(m_mLocator.toString());
fLocator.setModel(m_mLocator);
fLocator.setValue(m_M_Locator_ID);

View File

@ -40,6 +40,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.DefaultComboBoxModel;
@ -64,6 +65,7 @@ import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery;
import org.compiere.model.MRole;
import org.compiere.model.MTable;
import org.compiere.swing.CButton;
import org.compiere.swing.CMenuItem;
import org.compiere.swing.CTextField;
@ -272,12 +274,48 @@ public class VLookup extends JComponent
else
m_button.setIcon(Env.getImageIcon("PickOpen10.gif"));
// IDEMPIERE 90
boolean isShortListAvailable = false; // Short List available for this lookup
if (m_lookup != null && (m_lookup.getDisplayType() == DisplayType.TableDir || m_lookup.getDisplayType() == DisplayType.Table)) // only for Table & TableDir
{
String tableName_temp = m_lookup.getColumnName(); // Returns AD_Org.AD_Org_ID
int posPoint = tableName_temp.indexOf(".");
String tableName = tableName_temp.substring(0, posPoint);
int table_id = MTable.getTable_ID(tableName); // now we got the ad_table_id
String sql = "SELECT COUNT(*) FROM AD_Column WHERE ColumnName = 'IsShortList' AND IsActive='Y' AND AD_Table_ID = " + table_id;
isShortListAvailable = DB.getSQLValue(null, sql) == 1; // if the table has an active IsShortList column, we could use the restrict search !
if (isShortListAvailable)
{
setComboShortList(true);
m_lookup.setShortList(true);
m_buttonSL.addActionListener(this);
m_buttonSL.addMouseListener(mouseAdapter);
m_buttonSL.setFocusable(false); // don't focus when tabbing
m_buttonSL.setMargin(new Insets(0, 0, 0, 0));
m_buttonSL.setIcon(Env.getImageIcon("LockX16.gif"));
m_buttonSL.setToolTipText(Msg.getMsg(Env.getCtx(), "ShortListShortListItems"));
ActionMap am = m_combo.getActionMap();
am.put("shortlist", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
actionShortList();
}
});
m_combo.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, KeyEvent.CTRL_DOWN_MASK), "shortlist");
}
}
// IDEMPIERE 90
// *** VComboBox ***
if (m_lookup != null && m_lookup.getDisplayType() != DisplayType.Search) // No Search
{
// Don't have to fill up combobox if it is readonly
if (!isReadOnly && isUpdateable)
m_lookup.fillComboBox (isMandatory(), true, true, false);
m_lookup.fillComboBox (isMandatory(), true, true, false, isShortListAvailable); // IDEMPIERE 90
m_combo.setModel(m_lookup);
//
// AutoCompletion.enable(m_combo);
@ -342,6 +380,7 @@ public class VLookup extends JComponent
m_button = null;
m_lookup = null;
m_mField = null;
m_buttonSL = null; // IDEMPIERE 90
//
m_combo.getEditor().getEditorComponent().removeFocusListener(this);
m_combo.getEditor().getEditorComponent().removeMouseListener(mouseAdapter);
@ -394,6 +433,11 @@ public class VLookup extends JComponent
// Mouse Listener
private VLookup_mouseAdapter mouseAdapter;
/** ShortList button IDEMPIERE 90 */
private CButton m_buttonSL = new CButton();
/** All items or only those of the short list ?*/
boolean onlyShortListItems = false;
// Field for Value Preference
private GridField m_mField = null;
@ -417,11 +461,13 @@ public class VLookup extends JComponent
m_text.setBorder(null);
Dimension bSize = new Dimension(size.height, size.height);
m_button.setPreferredSize (bSize);
m_buttonSL.setPreferredSize (bSize); // IDEMPIERE 90
}
// What to show
this.remove(m_combo);
this.remove(m_button);
this.remove(m_buttonSL); // IDEMPIERE 90
this.remove(m_text);
//
if (!isReadWrite()) // r/o - show text only
@ -437,6 +483,9 @@ public class VLookup extends JComponent
this.setBorder(null);
this.add(m_combo, BorderLayout.CENTER);
m_comboActive = true;
// IDEMPIERE 90
if (isComboShortList())
this.add(m_buttonSL, BorderLayout.EAST); // add a button for short list items <-> all items
}
else // Search or unstable - show text & button
{
@ -761,6 +810,8 @@ public class VLookup extends JComponent
actionBPartner(false);
else if (e.getSource() == m_location)
actionLocation();
else if (e.getSource() == m_buttonSL) // IDEMPIERE 90
actionShortList();
} // actionPerformed
/**
@ -1463,7 +1514,7 @@ public class VLookup extends JComponent
else
{
m_lookup.refresh();
m_lookup.fillComboBox(isMandatory(), true, true, false);
m_lookup.fillComboBox(isMandatory(), true, true, false, isComboShortList()); // IDEMPIERE 90
m_combo.setSelectedItem(obj);
//m_combo.revalidate();
}
@ -1501,7 +1552,7 @@ public class VLookup extends JComponent
+ " - Start Count=" + m_combo.getItemCount() + ", Selected=" + obj);
// log.fine( "VLookupHash=" + this.hashCode());
boolean popupVisible = m_combo.isPopupVisible();
m_lookup.fillComboBox(isMandatory(), true, true, false); // only validated & active
m_lookup.fillComboBox(isMandatory(), true, true, false, isComboShortList()); // only validated & active + IDEMPIERE 90
if (popupVisible)
{
//refresh
@ -1525,6 +1576,7 @@ public class VLookup extends JComponent
{
if (e.isTemporary()
|| m_lookup == null
|| !m_buttonSL.isEnabled() // IDEMPIERE 90
|| !m_button.isEnabled() ) // set by actionButton
return;
// Text Lost focus
@ -1642,5 +1694,36 @@ public class VLookup extends JComponent
m_stopediting = stopediting;
}
// IDEMPIERE 90
private void actionShortList ()
{
if (onlyShortListItems)
{
onlyShortListItems = false;
m_lookup.setShortList(true);
refresh();
m_lookup.fillComboBox(isMandatory(), true, true, false, isComboShortList());
m_buttonSL.setIcon(Env.getImageIcon("LockX16.gif"));
m_buttonSL.setToolTipText(Msg.getMsg(Env.getCtx(), "ShortListOnlyShortListItems"));
}else{
onlyShortListItems = true;
m_lookup.setShortList(false);
m_buttonSL.setIcon(Env.getImageIcon("Lock16.gif"));
m_buttonSL.setToolTipText(Msg.getMsg(Env.getCtx(), "ShortListAllItems"));
}
actionRefresh();
} // actionShortList
public void setComboShortList (boolean shortList)
{
m_combo.setShortListSearch(shortList);
} // setComboShortList
public boolean isComboShortList()
{
return m_combo.isShortListSearch();
} // isComboShortList
// IDEMPIERE 90
} // VLookup

View File

@ -104,7 +104,7 @@ public class VPaymentEditor extends JComponent implements VEditor, ActionListene
{
// Don't have to fill up combobox if it is readonly
if (!isReadOnly && isUpdateable)
m_lookup.fillComboBox (isMandatory(), true, true, false);
m_lookup.fillComboBox (isMandatory(), true, true, false, false); // IDEMPIERE 90
m_combo.setModel(m_lookup);
//
// AutoCompletion.enable(m_combo);
@ -472,7 +472,7 @@ public class VPaymentEditor extends JComponent implements VEditor, ActionListene
+ " - Start Count=" + m_combo.getItemCount() + ", Selected=" + obj);
// log.fine( "VLookupHash=" + this.hashCode());
boolean popupVisible = m_combo.isPopupVisible();
m_lookup.fillComboBox(isMandatory(), true, true, false); // only validated & active
m_lookup.fillComboBox(isMandatory(), true, true, false, false); // only validated & active + IDEMPIERE 90
if (popupVisible)
{
//refresh

View File

@ -250,7 +250,7 @@ public class PosPayment extends CDialog implements PosKeyListener, VetoableChang
// Payment type selection
int AD_Column_ID = COLUMN_C_PAYMENT_V_TENDERTYPE; //C_Payment_v.TenderType
MLookup lookup = MLookupFactory.get(Env.getCtx(), 0, 0, AD_Column_ID, DisplayType.List);
ArrayList<Object> types = lookup.getData(true, false, true, true);
ArrayList<Object> types = lookup.getData(true, false, true, true, false); // IDEMPIERE 90
DefaultComboBoxModel typeModel = new DefaultComboBoxModel(types.toArray());
tenderTypePick.setModel(typeModel);

View File

@ -986,4 +986,21 @@ public class CComboBox extends JComboBox
}
} // ReducibleKeyListener
// IDEMPIERE 90
/** show only short list items or all ? */
private boolean m_ShortListSearch = false;
/** set the editor to return only short list items */
public void setShortListSearch (boolean shortList)
{
m_ShortListSearch = shortList;
} // setShortListSearch
/** does the search should return only short list items ? */
public boolean isShortListSearch()
{
return m_ShortListSearch;
} // isShortListSearch
// IDEMPIERE 90
} // CComboBox

View File

@ -407,16 +407,16 @@ public final class AEnv
} // canAccessInfo
public static void actionRefresh(Lookup lookup, Object value, boolean mandatory)
public static void actionRefresh(Lookup lookup, Object value, boolean mandatory, boolean shortList) // IDEMPIERE 90
{
if (lookup == null)
return;
lookup.refresh();
if (lookup.isValidated())
lookup.fillComboBox(mandatory, false, false, false);
lookup.fillComboBox(mandatory, false, false, false, shortList); // IDEMPIERE 90
else
lookup.fillComboBox(mandatory, true, false, false);
lookup.fillComboBox(mandatory, true, false, false, shortList); // IDEMPIERE 90
}
/**
*

View File

@ -36,7 +36,9 @@ import org.compiere.model.GridField;
import org.compiere.model.Lookup;
import org.compiere.model.MBPartnerLocation;
import org.compiere.model.MLocation;
import org.compiere.model.MTable;
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;
@ -47,6 +49,7 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Menuitem;
/**
*
@ -69,7 +72,10 @@ ContextMenuListener, IZoomableEditor
private Lookup lookup;
private Object oldValue;
public static final String SHORT_LIST_EVENT = "SHORT_LIST"; // IDEMPIERE 90
protected boolean onlyShortListItems; // IDEMPIERE 90
public WTableDirEditor(GridField gridField)
{
super(new Combobox(), gridField);
@ -159,6 +165,37 @@ ContextMenuListener, IZoomableEditor
popupMenu = new WEditorPopupMenu(zoom, true, isShowPreference(), false, false, false, lookup);
}
addChangeLogMenu(popupMenu);
// IDEMPIERE 90
boolean isShortListAvailable = false; // Short List available for this lookup
if (lookup != null && (lookup.getDisplayType() == DisplayType.TableDir || lookup.getDisplayType() == DisplayType.Table)) // only for Table & TableDir
{
String tableName_temp = lookup.getColumnName(); // Returns AD_Org.AD_Org_ID
int posPoint = tableName_temp.indexOf(".");
String tableName = tableName_temp.substring(0, posPoint);
int table_id = MTable.getTable_ID(tableName); // now we got the ad_table_id
String sql = "SELECT COUNT(*) FROM AD_Column WHERE ColumnName = 'IsShortList' AND IsActive='Y' AND AD_Table_ID = " + table_id;
isShortListAvailable = DB.getSQLValue(null, sql) == 1; // if the table has an active isShortList column, we could use the restrict search !
if (isShortListAvailable)
{
onlyShortListItems=true;
lookup.setShortList(true);
getLabel().setText(">" + getGridField().getHeader() + "<");
actionRefresh();
// add in popup menu
Menuitem searchMode;
searchMode = new Menuitem();
searchMode.setAttribute(WEditorPopupMenu.EVENT_ATTRIBUTE, SHORT_LIST_EVENT);
searchMode.setLabel(Msg.getMsg(Env.getCtx(), "ShortListSwitchSearchMode"));
searchMode.setImage("/images/Lock16.png");
searchMode.addEventListener(Events.ON_CLICK, popupMenu);
popupMenu.appendChild(searchMode);
}
}
// IDEMPIERE 90
}
}
@ -493,6 +530,25 @@ ContextMenuListener, IZoomableEditor
{
actionLocation();
}
// IDEMPIERE 90
else if (SHORT_LIST_EVENT.equals(evt.getContextEvent()))
{
String champ = getGridField().getHeader();
if(onlyShortListItems)
{
onlyShortListItems=false;
lookup.setShortList(false);
actionRefresh();
getLabel().setText(champ);
}else{
onlyShortListItems=true;
lookup.setShortList(true);
actionRefresh();
getLabel().setText(">" + champ + "<");
}
}
// IDEMPIERE 90
}
public void propertyChange(PropertyChangeEvent evt)

View File

@ -328,7 +328,7 @@ public class WLocatorDialog extends Window implements EventListener<Event>
// Load existing Locators
m_mLocator.fillComboBox(m_mandatory, true, true, false);
m_mLocator.fillComboBox(m_mandatory, true, true, false, false); // IDEMPIERE 90
log.fine(m_mLocator.toString());

View File

@ -19,12 +19,12 @@ public class ADLookup {
protected static CLogger log = CLogger.getCLogger(ADLookup.class);
public static void fillLookupValues( LookupValues lvs, Lookup lookup, boolean isMandatory, boolean isReadOnly )
public static void fillLookupValues( LookupValues lvs, Lookup lookup, boolean isMandatory, boolean isReadOnly, boolean isShortList) // IDEMPIERE 90
{
if(lookup.getSize() == 0)
lookup.refresh();
Object[] list = lookup.getData(isMandatory, true, !isReadOnly, false).toArray();
Object[] list = lookup.getData(isMandatory, true, !isReadOnly, false, isShortList).toArray(); // IDEMPIERE 90
for (int i=0; i<list.length; i++)
{

View File

@ -966,7 +966,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
}
if (lookup.getSize() == 0)
lookup.refresh();
Object[] list = lookup.getData(true, true, true, false).toArray();
Object[] list = lookup.getData(true, true, true, false,false).toArray(); // IDEMPIERE 90
for (Object pair : list) {
if (pair instanceof KeyNamePair) {

View File

@ -137,7 +137,7 @@ public class Process {
LookupValues lvs = p.addNewLookup();
Lookup lookup = para.getLookup();
try {
ADLookup.fillLookupValues( lvs, lookup, para.isMandatory(), false /*isReadOnly*/ );
ADLookup.fillLookupValues( lvs, lookup, para.isMandatory(), false /*isReadOnly*/, false ); // IDEMPIERE 90
} catch (Exception ex) {
System.out.println("getProcessParams exception: " +ex.getMessage());
ex.printStackTrace();