Class MLookup

All Implemented Interfaces:
Serializable, ComboBoxModel<Object>, ListModel<Object>, MutableComboBoxModel<Object>

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:
  • Field Details

  • Constructor Details

    • MLookup

      public MLookup(MLookupInfo info, int TabNo)
      MLookup Constructor
      Parameters:
      info - info
      TabNo - tab no
  • Method Details

    • dispose

      public void dispose()
      Dispose
      Overrides:
      dispose in class Lookup
    • loadComplete

      public void loadComplete()
      Wait until asynchronous Load Complete
      Overrides:
      loadComplete in class Lookup
    • get

      public NamePair get(Object key, boolean includeDirect)
      Get NamePair/KeyNamePair for key. If not found return null.
      Parameters:
      key - key value (Integer for Keys or String for Lists)
      Returns:
      NamePair/KeyNamePair
    • get

      public NamePair get(Object key)
      Get NamePair/KeyNamePair for key.
      Specified by:
      get in class Lookup
      Parameters:
      key -
      Returns:
      NamePair/KeyNamePair or null
    • getNoDirect

      public NamePair getNoDirect(Object key)
      Get NamePair/KeyNamePair for key.
      If not found in local lookup cache, do not try to load direct from DB.
      Parameters:
      key -
      Returns:
      NamePair/KeyNamePair or null
    • getDisplay

      public String getDisplay(Object key)
      Get Display Text.
      If not found, return key embedded in "<>".
      Specified by:
      getDisplay in class Lookup
      Parameters:
      key - key value
      Returns:
      display text
    • containsKey

      public boolean containsKey(Object key)
      Description copied from class: Lookup
      The Lookup contains the key
      Specified by:
      containsKey in class Lookup
      Parameters:
      key - key
      Returns:
      true if key exists in local lookup cache or in DB
    • containsKeyNoDirect

      public boolean containsKeyNoDirect(Object key)
      Description copied from class: Lookup
      The Lookup contains the key (do not check the direct lookup list)
      Specified by:
      containsKeyNoDirect in class Lookup
      Parameters:
      key - key
      Returns:
      true if key exists in local lookup cache (do not check DB)
    • toString

      public String toString()
      Overrides:
      toString in class Object
      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.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • size

      public int size()
      Return Size
      Returns:
      size
    • isAllLoaded

      public boolean isAllLoaded()
      Is it all loaded
      Returns:
      true if all loaded
    • isValidated

      public boolean isValidated()
      Is the List fully Validated
      Overrides:
      isValidated in class Lookup
      Returns:
      true if validated (i.e validation code have been parsed)
    • 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 ID
      Returns:
      AD_Reference_Value_ID
    • hasInactive

      public boolean hasInactive()
      Has inactive elements in list
      Overrides:
      hasInactive in class Lookup
      Returns:
      true if list contains inactive values
    • getAD_InfoWindow_ID

      public int getAD_InfoWindow_ID()
      Returns:
      AD_InfoWindow_ID
    • getData

      public ArrayList<Object> getData(boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary, boolean shortlist)
      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
      shortlist -
      Returns:
      list
    • getDirect

      public NamePair getDirect(Object key, boolean saveInCache, boolean cacheLocal)
      Description copied from class: Lookup
      Perform Direct Lookup from Table.
      Overrides:
      getDirect in class Lookup
      Returns:
      NamePair
    • getDirect

      public NamePair getDirect(Object key, boolean saveInCache, boolean cacheLocal, String trxName)
      Get Data Direct from DB.
      Overrides:
      getDirect in class Lookup
      Parameters:
      key - key
      saveInCache - true save in local lookup cache
      cacheLocal - true to save in direct lookup cache
      trxName - the transaction name
      Returns:
      NamePair/KeyNamePir
    • getDirect

      public NamePair[] getDirect(Object[] keys)
      Description copied from class: Lookup
      Perform direct lookup for keys
      Overrides:
      getDirect in class Lookup
      Returns:
      name pair arrays
    • getZoom

      public int getZoom()
      Get Zoom
      Overrides:
      getZoom in class Lookup
      Returns:
      Zoom AD_Window_ID
    • getZoom

      public int getZoom(MQuery query)
      Get Zoom
      Overrides:
      getZoom in class Lookup
      Parameters:
      query - query
      Returns:
      Zoom Window
    • getZoom

      public int getZoom(boolean isSOTrx)
      Overrides:
      getZoom in class Lookup
      Returns:
      Zoom AD_Window_ID
    • getZoomQuery

      public MQuery 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 and return number of items read.
      Overrides:
      refresh in class Lookup
      Returns:
      no of items read
    • refreshItemsAndCache

      public int refreshItemsAndCache()
      Returns:
      number of items read
    • refresh

      public int refresh(boolean loadParent)
      Refresh and return number of items read
      Parameters:
      loadParent - true to load data of lookup with IsParent=true
      Returns:
      no of items refresh
    • removeAllElements

      public void removeAllElements()
      Remove All cached Elements
      Overrides:
      removeAllElements in class Lookup
      See Also:
    • getLookupInfo

      public MLookupInfo getLookupInfo()
      Returns:
      lookup info
    • getRecordsLookup

      public static MLookup getRecordsLookup(int tableID, int windowNo, int tabNo)
      Get Lookup
      Parameters:
      tableID -
      windowNo -
      tabNo -
      Returns:
      null if tableID <= 0 or the table doesn't have any key column, else MLookup
    • getRecordsLookup

      public static MLookup getRecordsLookup(int tableID, int windowNo, int tabNo, boolean useUUIDKey)
      Get Lookup
      Parameters:
      tableID -
      windowNo -
      tabNo -
      useUUIDKey - - default false
      Returns:
      null if tableID <= 0 or the table doesn't have any key column, else MLookup
    • getIdentifier

      public static String getIdentifier(int tableID, Serializable recordID)
      Get Identifier String from AD_Table_ID and Record_ID
      Parameters:
      tableID -
      recordID -
      Returns:
      String
    • getIdentifier

      public static String getIdentifier(int tableID, Serializable recordID, int windowNo, int tabNo)
      Get Identifier String from AD_Table_ID and Record_ID
      Parameters:
      tableID -
      recordID -
      windowNo -
      tabNo -
      Returns:
      String
    • getIdentifier

      public static String getIdentifier(int tableID, Serializable recordID, int windowNo, int tabNo, boolean useUUIDKey)
      Get Identifier String from AD_Table_ID and Record_ID
      Parameters:
      tableID -
      recordID -
      windowNo -
      tabNo -
      useUUIDKey - - default false
      Returns:
      String