Compiere 3.1

org.compiere.model
Class MLookup

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by org.compiere.framework.Lookup
          extended by org.compiere.model.MLookup
All Implemented Interfaces:
Serializable, ComboBoxModel, ListModel, MutableComboBoxModel

public final class MLookup
extends Lookup
implements Serializable

An intelligent MutableComboBoxModel, which determines what can be cached.

      Validated   - SQL is final / not dynamic
      AllLoaded   - All Records are loaded

                Get Info about Lookup
                -       SQL
                -       KeyColumn
                -       Zoom Target
  

Version:
$Id: MLookup.java,v 1.4 2006/10/07 00:58:57 jjanke Exp $
Author:
Jorg Janke
See Also:
Serialized Form

Field Summary
static String INACTIVE_E
          Inactive Marker End
static String INACTIVE_S
          Inactive Marker Start
 
Fields inherited from class org.compiere.framework.Lookup
log, m_WindowNo, p_data
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
MLookup(Ctx ctx, int windowNo, int displayType)
          MLookup Constructor.
 
Method Summary
 boolean containsKey(Object key)
          The Lookup contains the key
 void disableValidation()
          Disable Validation (for Search/Find)
 void dispose()
          Dispose
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 NamePair get(Object key)
          Get value (name) for key.
 int getAD_Reference_Value_ID()
          Get Reference Value
 String getColumnName()
          Get underlying fully qualified Table.Column Name
 ArrayList<NamePair> getData(boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary)
          Return data as Array containing Value/KeyNamePair
 NamePair getDirect(Object key, boolean saveInCache, boolean cacheLocal)
          Get Data Direct from Table.
 String getDisplay(Object key)
          Get Display value (name).
 String getValidation()
          Get Validation SQL
 Query getZoomQuery()
          Get Zoom Query String
 int getZoomWindow()
          Get Zoom
 int getZoomWindow(Query query)
          Get Zoom
 boolean hasInactive()
          Has inactive elements in list
 MLookup initialize(MLookupInfo info)
          Initialize
 boolean isAllLoaded()
          Is it all loaded
 boolean isValidated()
          Is the List fully Validated
 void loadComplete()
          Wait until async Load Complete
 int refresh()
          Refresh & return number of items read.
 int refresh(boolean loadParent)
          Refresh & return number of items read
 void removeAllElements()
          Remove All cached Elements
 int size()
          Return Size
 String toString()
          String Representation
 
Methods inherited from class org.compiere.framework.Lookup
addElement, addElement, fillComboBox, fillComboBox, getCtx, getDisplayType, getElementAt, getIndexOf, getSelectedItem, getSize, getWindowNo, insertElementAt, insertElementAt, isValidationDisabled, put, put, removeElement, removeElementAt, setContext, setDisplayType, setSelectedItem, setSelectedItemAlways
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
 

Field Detail

INACTIVE_S

public static final String INACTIVE_S
Inactive Marker Start

See Also:
Constant Field Values

INACTIVE_E

public static final String INACTIVE_E
Inactive Marker End

See Also:
Constant Field Values
Constructor Detail

MLookup

public MLookup(Ctx ctx,
               int windowNo,
               int displayType)
MLookup Constructor. Must call initialize

Parameters:
ctx - context
windowNo - window
displayType - display type
Method Detail

initialize

public MLookup initialize(MLookupInfo info)
Initialize

Parameters:
info - info
Returns:
this

dispose

public void dispose()
Dispose

Overrides:
dispose in class Lookup

loadComplete

public void loadComplete()
Wait until async Load Complete

Overrides:
loadComplete in class Lookup

get

public NamePair get(Object key)
Get value (name) for key. If not found return null;

Specified by:
get in class Lookup
Parameters:
key - key (Integer for Keys or String for Lists)
Returns:
value

getDisplay

public String getDisplay(Object key)
Get Display value (name). If not found return key embedded in inactive signs.

Specified by:
getDisplay in class Lookup
Parameters:
key - key
Returns:
value

containsKey

public boolean containsKey(Object key)
The Lookup contains the key

Specified by:
containsKey in class Lookup
Parameters:
key - key
Returns:
true if key is known

toString

public String toString()
Description copied from class: Lookup
String Representation

Overrides:
toString in class Lookup
Returns:
a string representation of the object.

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

size

public int size()
Return Size

Returns:
size

isAllLoaded

public boolean isAllLoaded()
Is it all loaded

Returns:
true, if all loaded

disableValidation

public void disableValidation()
Disable Validation (for Search/Find)

Overrides:
disableValidation in class Lookup

isValidated

public boolean isValidated()
Is the List fully Validated

Overrides:
isValidated in class Lookup
Returns:
true, if validated

getValidation

public String getValidation()
Get Validation SQL

Overrides:
getValidation in class Lookup
Returns:
Validation SQL

getAD_Reference_Value_ID

public int getAD_Reference_Value_ID()
Get Reference Value

Returns:
Reference Value

hasInactive

public boolean hasInactive()
Has inactive elements in list

Overrides:
hasInactive in class Lookup
Returns:
true, if list contains inactive values

getData

public ArrayList<NamePair> getData(boolean mandatory,
                                   boolean onlyValidated,
                                   boolean onlyActive,
                                   boolean temporary)
Return data as Array containing Value/KeyNamePair

Specified by:
getData in class Lookup
Parameters:
mandatory - if not mandatory, an additional empty value is inserted
onlyValidated - only validated
onlyActive - only active
temporary - force load for temporary display e.g. parent
Returns:
list

getDirect

public NamePair getDirect(Object key,
                          boolean saveInCache,
                          boolean cacheLocal)
Get Data Direct from Table.

Overrides:
getDirect in class Lookup
Parameters:
key - key
saveInCache - save in cache for r/w
cacheLocal - cache locally for r/o
Returns:
value

getZoomWindow

public int getZoomWindow()
Get Zoom

Overrides:
getZoomWindow in class Lookup
Returns:
Zoom AD_Window_ID

getZoomWindow

public int getZoomWindow(Query query)
Get Zoom

Overrides:
getZoomWindow in class Lookup
Parameters:
query - query
Returns:
Zoom Window

getZoomQuery

public Query getZoomQuery()
Get Zoom Query String

Overrides:
getZoomQuery in class Lookup
Returns:
Zoom SQL Where Clause

getColumnName

public String getColumnName()
Get underlying fully qualified Table.Column Name

Specified by:
getColumnName in class Lookup
Returns:
Key Column

refresh

public int refresh()
Refresh & return number of items read. Get get data of parent lookups

Overrides:
refresh in class Lookup
Returns:
no of items read

refresh

public int refresh(boolean loadParent)
Refresh & return number of items read

Parameters:
loadParent - get data of parent lookups
Returns:
no of items read

removeAllElements

public void removeAllElements()
Remove All cached Elements

Overrides:
removeAllElements in class Lookup
See Also:
org.compiere.model.Lookup#removeAllElements()

Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.