de.mguennewig.pobjform
Class ReferenceModel

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by de.mguennewig.pobjform.ReferenceModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.ComboBoxModel, javax.swing.ListModel

public final class ReferenceModel
extends javax.swing.AbstractListModel
implements javax.swing.ComboBoxModel

The model for the combo box used by ReferenceElement's.

As PObject.toString() is nothing more then AbstractType.format(Object) this just uses the PObject instances.

NOTE: This model is not serializable!


Field Summary
static java.lang.String NULL_VISUAL
           
 
Constructor Summary
ReferenceModel(ReferenceElement element, ClassDecl[] tableExprs, Predicate[] filters)
           
 
Method Summary
static PObject fromString(Container db, ClassDecl cd, java.lang.String v)
          Returns a database object for the given value string.
 java.util.List<java.lang.Object> getDomainSet()
          Returns the filtered domain set for the given tables and includes null if allowed by this form element.
 java.lang.Object getElementAt(int index)
          
 java.lang.Object getSelectedItem()
          
 int getSize()
          
 boolean isGrouped()
           
 void setGroupBy(Member designator, boolean ascending)
           
 void setRestriction(ClassDecl[] tableExprs, Predicate[] filters)
           
 void setSelectedItem(java.lang.Object anItem)
          
static java.lang.String toString(PObject obj)
          Returns a visual string for the given object.
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
 

Field Detail

NULL_VISUAL

public static final java.lang.String NULL_VISUAL
See Also:
Constant Field Values
Constructor Detail

ReferenceModel

public ReferenceModel(ReferenceElement element,
                      ClassDecl[] tableExprs,
                      Predicate[] filters)
Method Detail

getDomainSet

public java.util.List<java.lang.Object> getDomainSet()
Returns the filtered domain set for the given tables and includes null if allowed by this form element.

Throws:
PObjReadError - if any database error occurs.

isGrouped

public final boolean isGrouped()

setGroupBy

public void setGroupBy(Member designator,
                       boolean ascending)

setRestriction

public void setRestriction(ClassDecl[] tableExprs,
                           Predicate[] filters)

getElementAt

public java.lang.Object getElementAt(int index)

Specified by:
getElementAt in interface javax.swing.ListModel

getSize

public int getSize()

Specified by:
getSize in interface javax.swing.ListModel

getSelectedItem

public java.lang.Object getSelectedItem()

Specified by:
getSelectedItem in interface javax.swing.ComboBoxModel

setSelectedItem

public void setSelectedItem(java.lang.Object anItem)

Specified by:
setSelectedItem in interface javax.swing.ComboBoxModel

fromString

public static PObject fromString(Container db,
                                 ClassDecl cd,
                                 java.lang.String v)
                          throws java.text.ParseException
Returns a database object for the given value string.

Throws:
java.text.ParseException - if the value string can not be parsed into a database object.
PObjReadError - if any database error occurs.

toString

public static java.lang.String toString(PObject obj)
Returns a visual string for the given object.