IDEMPIERE 90

This commit is contained in:
Nicolas Micoud 2013-01-24 12:15:23 +01:00
parent c2941041fe
commit 92a269f200
21 changed files with 317 additions and 32 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_loaded;
private boolean m_shortList; // IDEMPIERE 90
/** /**
* Get Display Type * Get Display Type
* @return display type * @return display type
@ -259,7 +261,7 @@ public abstract class Lookup extends AbstractListModel
* @param temporary save current values - restore via fillComboBox (true) * @param temporary save current values - restore via fillComboBox (true)
*/ */
public void fillComboBox (boolean mandatory, boolean onlyValidated, public void fillComboBox (boolean mandatory, boolean onlyValidated,
boolean onlyActive, boolean temporary) boolean onlyActive, boolean temporary, boolean shortList) // IDEMPIERE 90
{ {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
m_loaded = false; m_loaded = false;
@ -279,7 +281,7 @@ public abstract class Lookup extends AbstractListModel
p_data.clear(); p_data.clear();
// may cause delay *** The Actual Work *** // 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 // Selected Object changed
if (obj != m_selectedObject) if (obj != m_selectedObject)
@ -335,7 +337,7 @@ public abstract class Lookup extends AbstractListModel
return; return;
} }
if (p_data != null) if (p_data != null)
fillComboBox(isMandatory(), true, true, false); fillComboBox(isMandatory(), true, true, false, false); // IDEMPIERE 90
} // fillComboBox } // fillComboBox
@ -363,7 +365,7 @@ public abstract class Lookup extends AbstractListModel
* @return ArrayList * @return ArrayList
*/ */
public abstract ArrayList<Object> getData (boolean mandatory, 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. * Get underlying fully qualified Table.Column Name.
@ -504,4 +506,15 @@ public abstract class Lookup extends AbstractListModel
return m_loaded; return m_loaded;
} }
// IDEMPIERE 90
public void setShortList(boolean shortlist)
{
m_shortList = shortlist;
}
public boolean isShortList()
{
return m_shortList;
}
// IDEMPIERE 90
} // Lookup } // Lookup

View File

@ -173,7 +173,7 @@ public final class MAccountLookup extends Lookup implements Serializable
* @return ArrayList with KeyNamePair * @return ArrayList with KeyNamePair
*/ */
public ArrayList<Object> getData (boolean mandatory, boolean onlyValidated, 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>(); ArrayList<Object> list = new ArrayList<Object>();
if (!mandatory) if (!mandatory)

View File

@ -144,7 +144,7 @@ public final class MLocationLookup extends Lookup
* @param temporary force load for temporary display * @param temporary force load for temporary display
* @return null * @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"); log.log(Level.SEVERE, "not implemented");
return null; return null;

View File

@ -414,7 +414,7 @@ public final class MLocatorLookup extends Lookup implements Serializable
* @param temporary force load for temporary display * @param temporary force load for temporary display
* @return ArrayList of lookup values * @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 // create list
Collection<MLocator> collection = getData(); Collection<MLocator> collection = getData();

View File

@ -103,7 +103,6 @@ public final class MLookup extends Lookup implements Serializable
/** Indicator for Null */ /** Indicator for Null */
private static Integer MINUS_ONE = new Integer(-1); private static Integer MINUS_ONE = new Integer(-1);
/** The Lookup Info Value Object */ /** The Lookup Info Value Object */
private MLookupInfo m_info = null; private MLookupInfo m_info = null;
@ -123,6 +122,13 @@ public final class MLookup extends Lookup implements Serializable
/** Next Read for Parent */ /** Next Read for Parent */
private long m_nextRead = 0; 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 * Dispose
*/ */
@ -391,9 +397,10 @@ public final class MLookup extends Lookup implements Serializable
* @param onlyValidated only validated * @param onlyValidated only validated
* @param onlyActive only active * @param onlyActive only active
* @param temporary force load for temporary display * @param temporary force load for temporary display
* @param isshortlist
* @return list * @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 // create list
ArrayList<Object> list = getData (onlyValidated, true); 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 // Add Optional (empty) selection
if (!mandatory) if (!mandatory)
{ {
@ -597,7 +621,7 @@ public final class MLookup extends Lookup implements Serializable
m_refreshing = true; m_refreshing = true;
//force refresh //force refresh
m_lookup.clear(); m_lookup.clear();
fillComboBox(isMandatory(), true, true, false); fillComboBox(isMandatory(), true, true, false, isShortList()); // idempiere 90
m_refreshing = false; m_refreshing = false;
return m_lookup.size(); return m_lookup.size();
} // refresh } // refresh
@ -677,6 +701,17 @@ public final class MLookup extends Lookup implements Serializable
MLookupCache.loadStart (m_info); MLookupCache.loadStart (m_info);
StringBuilder sql = new StringBuilder().append(m_info.Query); 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 // not validated
if (!m_info.IsValidated) 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); name = new StringBuilder(INACTIVE_S).append(name).append(INACTIVE_E);
m_hasInactive = true; 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) if (isNumber)
{ {
int key = rs.getInt(1); int key = rs.getInt(1);

View File

@ -168,7 +168,7 @@ public class MPAttributeLookup extends Lookup
* @param temporary force load for temporary display * @param temporary force load for temporary display
* @return null * @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"); log.log(Level.SEVERE, "Not implemented");
return null; return null;

View File

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

View File

@ -125,7 +125,7 @@ public class XLookup extends Lookup
* @return list of data * @return list of data
*/ */
public ArrayList<Object> getData (boolean mandatory, 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); ArrayList<Object> list = new ArrayList<Object>(p_data);

View File

@ -243,7 +243,7 @@ public class VLocatorDialog extends CDialog
log.fine("Warehouses=" + fWarehouse.getItemCount()); log.fine("Warehouses=" + fWarehouse.getItemCount());
// Load existing Locators // 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()); log.fine(m_mLocator.toString());
fLocator.setModel(m_mLocator); fLocator.setModel(m_mLocator);
fLocator.setValue(m_M_Locator_ID); fLocator.setValue(m_M_Locator_ID);

View File

@ -64,6 +64,7 @@ import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.model.MTable;
import org.compiere.swing.CButton; import org.compiere.swing.CButton;
import org.compiere.swing.CMenuItem; import org.compiere.swing.CMenuItem;
import org.compiere.swing.CTextField; import org.compiere.swing.CTextField;
@ -272,12 +273,39 @@ public class VLookup extends JComponent
else else
m_button.setIcon(Env.getImageIcon("PickOpen10.gif")); 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"));
}
}
// IDEMPIERE 90
// *** VComboBox *** // *** VComboBox ***
if (m_lookup != null && m_lookup.getDisplayType() != DisplayType.Search) // No Search if (m_lookup != null && m_lookup.getDisplayType() != DisplayType.Search) // No Search
{ {
// Don't have to fill up combobox if it is readonly // Don't have to fill up combobox if it is readonly
if (!isReadOnly && isUpdateable) 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); m_combo.setModel(m_lookup);
// //
// AutoCompletion.enable(m_combo); // AutoCompletion.enable(m_combo);
@ -342,6 +370,7 @@ public class VLookup extends JComponent
m_button = null; m_button = null;
m_lookup = null; m_lookup = null;
m_mField = null; m_mField = null;
m_buttonSL = null; // IDEMPIERE 90
// //
m_combo.getEditor().getEditorComponent().removeFocusListener(this); m_combo.getEditor().getEditorComponent().removeFocusListener(this);
m_combo.getEditor().getEditorComponent().removeMouseListener(mouseAdapter); m_combo.getEditor().getEditorComponent().removeMouseListener(mouseAdapter);
@ -394,6 +423,11 @@ public class VLookup extends JComponent
// Mouse Listener // Mouse Listener
private VLookup_mouseAdapter mouseAdapter; 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 // Field for Value Preference
private GridField m_mField = null; private GridField m_mField = null;
@ -417,11 +451,13 @@ public class VLookup extends JComponent
m_text.setBorder(null); m_text.setBorder(null);
Dimension bSize = new Dimension(size.height, size.height); Dimension bSize = new Dimension(size.height, size.height);
m_button.setPreferredSize (bSize); m_button.setPreferredSize (bSize);
m_buttonSL.setPreferredSize (bSize); // IDEMPIERE 90
} }
// What to show // What to show
this.remove(m_combo); this.remove(m_combo);
this.remove(m_button); this.remove(m_button);
this.remove(m_buttonSL); // IDEMPIERE 90
this.remove(m_text); this.remove(m_text);
// //
if (!isReadWrite()) // r/o - show text only if (!isReadWrite()) // r/o - show text only
@ -437,6 +473,9 @@ public class VLookup extends JComponent
this.setBorder(null); this.setBorder(null);
this.add(m_combo, BorderLayout.CENTER); this.add(m_combo, BorderLayout.CENTER);
m_comboActive = true; 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 else // Search or unstable - show text & button
{ {
@ -761,6 +800,8 @@ public class VLookup extends JComponent
actionBPartner(false); actionBPartner(false);
else if (e.getSource() == m_location) else if (e.getSource() == m_location)
actionLocation(); actionLocation();
else if (e.getSource() == m_buttonSL) // IDEMPIERE 90
actionShortList();
} // actionPerformed } // actionPerformed
/** /**
@ -1463,7 +1504,7 @@ public class VLookup extends JComponent
else else
{ {
m_lookup.refresh(); 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.setSelectedItem(obj);
//m_combo.revalidate(); //m_combo.revalidate();
} }
@ -1501,7 +1542,7 @@ public class VLookup extends JComponent
+ " - Start Count=" + m_combo.getItemCount() + ", Selected=" + obj); + " - Start Count=" + m_combo.getItemCount() + ", Selected=" + obj);
// log.fine( "VLookupHash=" + this.hashCode()); // log.fine( "VLookupHash=" + this.hashCode());
boolean popupVisible = m_combo.isPopupVisible(); 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) if (popupVisible)
{ {
//refresh //refresh
@ -1525,6 +1566,7 @@ public class VLookup extends JComponent
{ {
if (e.isTemporary() if (e.isTemporary()
|| m_lookup == null || m_lookup == null
|| !m_buttonSL.isEnabled() // IDEMPIERE 90
|| !m_button.isEnabled() ) // set by actionButton || !m_button.isEnabled() ) // set by actionButton
return; return;
// Text Lost focus // Text Lost focus
@ -1642,5 +1684,36 @@ public class VLookup extends JComponent
m_stopediting = stopediting; 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 } // 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 // Don't have to fill up combobox if it is readonly
if (!isReadOnly && isUpdateable) 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); m_combo.setModel(m_lookup);
// //
// AutoCompletion.enable(m_combo); // AutoCompletion.enable(m_combo);
@ -472,7 +472,7 @@ public class VPaymentEditor extends JComponent implements VEditor, ActionListene
+ " - Start Count=" + m_combo.getItemCount() + ", Selected=" + obj); + " - Start Count=" + m_combo.getItemCount() + ", Selected=" + obj);
// log.fine( "VLookupHash=" + this.hashCode()); // log.fine( "VLookupHash=" + this.hashCode());
boolean popupVisible = m_combo.isPopupVisible(); 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) if (popupVisible)
{ {
//refresh //refresh

View File

@ -250,7 +250,7 @@ public class PosPayment extends CDialog implements PosKeyListener, VetoableChang
// Payment type selection // Payment type selection
int AD_Column_ID = COLUMN_C_PAYMENT_V_TENDERTYPE; //C_Payment_v.TenderType 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); 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()); DefaultComboBoxModel typeModel = new DefaultComboBoxModel(types.toArray());
tenderTypePick.setModel(typeModel); tenderTypePick.setModel(typeModel);

View File

@ -984,4 +984,21 @@ public class CComboBox extends JComboBox
} }
} // ReducibleKeyListener } // 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 } // CComboBox

View File

@ -407,16 +407,16 @@ public final class AEnv
} // canAccessInfo } // 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) if (lookup == null)
return; return;
lookup.refresh(); lookup.refresh();
if (lookup.isValidated()) if (lookup.isValidated())
lookup.fillComboBox(mandatory, false, false, false); lookup.fillComboBox(mandatory, false, false, false, shortList); // IDEMPIERE 90
else 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.Lookup;
import org.compiere.model.MBPartnerLocation; import org.compiere.model.MBPartnerLocation;
import org.compiere.model.MLocation; import org.compiere.model.MLocation;
import org.compiere.model.MTable;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; 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.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Comboitem; import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Menuitem;
/** /**
* *
@ -70,6 +73,9 @@ ContextMenuListener, IZoomableEditor
private Lookup lookup; private Lookup lookup;
private Object oldValue; private Object oldValue;
public static final String SHORT_LIST_EVENT = "SHORT_LIST"; // IDEMPIERE 90
protected boolean onlyShortListItems; // IDEMPIERE 90
public WTableDirEditor(GridField gridField) public WTableDirEditor(GridField gridField)
{ {
super(new Combobox(), gridField); super(new Combobox(), gridField);
@ -159,6 +165,37 @@ ContextMenuListener, IZoomableEditor
popupMenu = new WEditorPopupMenu(zoom, true, isShowPreference(), false, false, false, lookup); popupMenu = new WEditorPopupMenu(zoom, true, isShowPreference(), false, false, false, lookup);
} }
addChangeLogMenu(popupMenu); 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(); 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) public void propertyChange(PropertyChangeEvent evt)

View File

@ -328,7 +328,7 @@ public class WLocatorDialog extends Window implements EventListener<Event>
// Load existing Locators // 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()); log.fine(m_mLocator.toString());

View File

@ -19,12 +19,12 @@ public class ADLookup {
protected static CLogger log = CLogger.getCLogger(ADLookup.class); 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) if(lookup.getSize() == 0)
lookup.refresh(); 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++) 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) if (lookup.getSize() == 0)
lookup.refresh(); 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) { for (Object pair : list) {
if (pair instanceof KeyNamePair) { if (pair instanceof KeyNamePair) {

View File

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