Package org.compiere.model
Class Lookup
- All Implemented Interfaces:
Serializable
,ComboBoxModel<Object>
,ListModel<Object>
,MutableComboBoxModel<Object>
- Direct Known Subclasses:
GetListLookup
,MAccountLookup
,MCOFRSurveyLookup
,MLBRTaxesLookup
,MLocationLookup
,MLocatorLookup
,MLookup
,MLookupApontamentoPeso
,MPAttributeLookup
,MPaymentLookup
,MTaxesLookup
,QueryDataLookup
public abstract class Lookup
extends AbstractListModel<Object>
implements MutableComboBoxModel<Object>, Serializable
Base Class for MLookup, MLocator, MLocation and MAccount (only single value).
Maintains selectable data as NamePairs in ArrayList.
The objects itself may be shared by the lookup implementation (usually HashMap).
Maintains selectable data as NamePairs in ArrayList.
The objects itself may be shared by the lookup implementation (usually HashMap).
- Version:
- $Id: Lookup.java,v 1.3 2006/07/30 00:58:18 jjanke Exp $
- Author:
- Jorg Janke
- See Also:
-
Field Summary
Fields inherited from class javax.swing.AbstractListModel
listenerList
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addElement
(Object anObject) Add Element at the endabstract boolean
containsKey
(Object key) The Lookup contains the keyabstract boolean
The Lookup contains the key (do not check the direct lookup list)void
dispose()
Dispose - clear items w/o firing eventsvoid
fillComboBox
(boolean restore) Fill UI component with temporary buffered data (if exists) or load from DBvoid
fillComboBox
(boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary, boolean shortList) Fill ComboBox with lookup data (asynchronous using Worker).
- try to maintain selected itemabstract NamePair
GetNamePair
of Key Valueabstract String
Get underlying fully qualified Table.Column Name.getData
(boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary, boolean shortlist) Load Data (Value/KeyNamePair) from DB.NamePair[]
Perform direct lookup for keysPerform Direct Lookup from Table.Perform Direct Lookup from Table.abstract String
getDisplay
(Object key) Get Display Text of Key Valueint
Get Display TypegetElementAt
(int index) Get Element at Indexint
getIndexOf
(Object anObject) Returns the index-position of the specified object in the list.Return selected Itemint
getSize()
Get Size of ModelGet dynamic Validation SQL (none)int
Get Window Noint
getZoom()
Get Zoom - default implementationint
getZoom
(boolean isSOTrx) int
Get Zoom - default implementationGet Zoom Query Objectboolean
Has Inactive records - default implementationvoid
insertElementAt
(Object anObject, int index) Insert Element Atboolean
isLoaded()
Is this lookup model populatedboolean
Is lookup model mandatoryboolean
boolean
Is Validated - default implementationvoid
Wait until asynchronous loading completevoid
AppendKeyNamePair
to listvoid
AppendValueNamePair
to listint
refresh()
Refresh Values - default implementationvoid
Empties the list.void
removeElement
(Object anObject) Remove Itemvoid
removeElementAt
(int index) Remove Item at indexvoid
setMandatory
(boolean flag) Set lookup model as mandatory, use in loading datavoid
setSelectedItem
(Object anObject) Set selected item by value.void
setShortList
(boolean shortlist) Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
-
Field Details
-
p_data
The Data List -
log
Logger
-
-
Constructor Details
-
Lookup
public Lookup(int displayType, int windowNo) Lookup- Parameters:
displayType
- display typewindowNo
- window no
-
-
Method Details
-
getDisplayType
public int getDisplayType()Get Display Type- Returns:
- display type
-
getWindowNo
public int getWindowNo()Get Window No- Returns:
- Window No
-
setSelectedItem
Set selected item by value. The selected item may be null.- Specified by:
setSelectedItem
in interfaceComboBoxModel<Object>
- Parameters:
anObject
- Value of selected item or null for no selection.
-
getSelectedItem
Return selected Item- Specified by:
getSelectedItem
in interfaceComboBoxModel<Object>
- Returns:
- value of selected item
-
getSize
public int getSize()Get Size of Model -
getElementAt
Get Element at Index- Specified by:
getElementAt
in interfaceListModel<Object>
- Parameters:
index
- index- Returns:
- value at index
-
getIndexOf
Returns the index-position of the specified object in the list.- Parameters:
anObject
- object- Returns:
- index position, where 0 is the first position
-
addElement
Add Element at the end- Specified by:
addElement
in interfaceMutableComboBoxModel<Object>
- Parameters:
anObject
- object
-
insertElementAt
Insert Element At- Specified by:
insertElementAt
in interfaceMutableComboBoxModel<Object>
- Parameters:
anObject
- objectindex
- index
-
removeElementAt
public void removeElementAt(int index) Remove Item at index- Specified by:
removeElementAt
in interfaceMutableComboBoxModel<Object>
- Parameters:
index
- index
-
removeElement
Remove Item- Specified by:
removeElement
in interfaceMutableComboBoxModel<Object>
- Parameters:
anObject
- object
-
removeAllElements
public void removeAllElements()Empties the list. -
put
AppendValueNamePair
to list- Parameters:
key
- keyvalue
- value
-
put
AppendKeyNamePair
to list- Parameters:
key
- keyvalue
- value
-
fillComboBox
public void fillComboBox(boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary, boolean shortList) Fill ComboBox with lookup data (asynchronous using Worker).
- try to maintain selected item- Parameters:
mandatory
- has mandatory data only (i.e. no "null" selection)onlyValidated
- only validatedonlyActive
- onlt activetemporary
- save current values - restore via fillComboBox (true)shortList
-
-
fillComboBox
public void fillComboBox(boolean restore) Fill UI component with temporary buffered data (if exists) or load from DB- Parameters:
restore
- if true, use temporary buffered data - else load from DB
-
getDisplay
Get Display Text of Key Value- Parameters:
key
- key value- Returns:
- Display Text
-
get
GetNamePair
of Key Value- Parameters:
key
- key value- Returns:
- NamePair or null
-
getData
public abstract ArrayList<Object> getData(boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary, boolean shortlist) Load Data (Value/KeyNamePair) from DB.- Parameters:
mandatory
- has mandatory data only (i.e. no "null" selection)onlyValidated
- only validatedonlyActive
- only activetemporary
- force load for temporary displayshortlist
-- Returns:
- ArrayList
-
getColumnName
Get underlying fully qualified Table.Column Name.- Returns:
- column name
-
containsKey
The Lookup contains the key- Parameters:
key
- key- Returns:
- true if contains key
-
containsKeyNoDirect
The Lookup contains the key (do not check the direct lookup list)- Parameters:
key
- key- Returns:
- true if contains key
-
refresh
public int refresh()Refresh Values - default implementation- Returns:
- size
-
isValidated
public boolean isValidated()Is Validated - default implementation- Returns:
- true if validated
-
getValidation
Get dynamic Validation SQL (none)- Returns:
- validation SQL
-
hasInactive
public boolean hasInactive()Has Inactive records - default implementation- Returns:
- true if has inactive records
-
getZoom
public int getZoom()Get Zoom - default implementation- Returns:
- Zoom AD_Window_ID
-
getZoom
public int getZoom(boolean isSOTrx) - Parameters:
isSOTrx
-- Returns:
- Zoom AD_Window_ID
-
getZoom
Get Zoom - default implementation- Parameters:
query
- query- Returns:
- Zoom AD_Window_ID
-
getZoomQuery
Get Zoom Query Object- Returns:
- Zoom Query
-
getDirect
Perform Direct Lookup from Table.- Parameters:
key
- key valuesaveInCache
- save in cache for r/wcacheLocal
- cache locally for r/otrxName
- the transaction name- Returns:
- NamePair
-
getDirect
Perform Direct Lookup from Table.- Parameters:
key
-saveInCache
-cacheLocal
-- Returns:
- NamePair
-
getDirect
Perform direct lookup for keys- Parameters:
keys
-- Returns:
- name pair arrays
-
dispose
public void dispose()Dispose - clear items w/o firing events -
loadComplete
public void loadComplete()Wait until asynchronous loading complete -
setMandatory
public void setMandatory(boolean flag) Set lookup model as mandatory, use in loading data- Parameters:
flag
-
-
isMandatory
public boolean isMandatory()Is lookup model mandatory- Returns:
- boolean
-
isLoaded
public boolean isLoaded()Is this lookup model populated- Returns:
- boolean
-
setShortList
public void setShortList(boolean shortlist) -
isShortList
public boolean isShortList()- Returns:
- true if lookup should return a short list
-