QJCC homepage

biz.chitec.quarterback.swing
Class UnwantWantModel

java.lang.Object
  extended bybiz.chitec.quarterback.swing.UnwantWantModel

public class UnwantWantModel
extends java.lang.Object

Model for wanted and unwanted selections.

Version:
$Id: 50c46c3b865ab475f31843ad9fd39cb9cdc8deb0 $
Author:
chitec/Dirk Hillbrecht 2001. Distributed under the terms of the GNU LGPL.

Nested Class Summary
private  class UnwantWantModel.LDL
          Data listener listening for list changes in the underlying lists.
 
Field Summary
private  boolean andselectable
           
static int DONTCARE
           
private  ChangeableListModel dontcaremodel
           
private  boolean[] listchanged
           
private  java.beans.PropertyChangeSupport pcs
           
static int UNWANT
           
private  boolean unwantand
           
private  ChangeableListModel unwantmodel
           
static int WANT
           
private  boolean wantand
           
private  ChangeableListModel wantmodel
           
 
Constructor Summary
UnwantWantModel()
          Basic constructor.
UnwantWantModel(ChangeableListModel umx, ChangeableListModel dmx, ChangeableListModel wmx)
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
           
 void clear()
           
private  void fireListChanged()
           
 ChangeableListModel[] getListModels()
           
 java.util.List getUnwantedElements()
           
 java.util.List getWantedElements()
           
 boolean isAndSelectable()
           
 boolean isUnwantAnd()
           
 boolean isWantAnd()
           
protected  void moveElements(int[] fromindices, int fromidx, int toidx)
          Moves elements from one list to another.
 void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
           
 void setAndSelectable(boolean b)
           
 void setListModels(ChangeableListModel umx, ChangeableListModel dmx, ChangeableListModel wmx)
           
 void setLists(javax.swing.JList ul, javax.swing.JList dl, javax.swing.JList wl)
           
 void setUnwantAnd(boolean b)
           
 void setWantAnd(boolean b)
           
 void trimContent(java.util.List v)
          Extends or shrinks the content of the three base models with respect to the given List.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNWANT

public static final int UNWANT
See Also:
Constant Field Values

DONTCARE

public static final int DONTCARE
See Also:
Constant Field Values

WANT

public static final int WANT
See Also:
Constant Field Values

pcs

private java.beans.PropertyChangeSupport pcs

unwantmodel

private ChangeableListModel unwantmodel

dontcaremodel

private ChangeableListModel dontcaremodel

wantmodel

private ChangeableListModel wantmodel

listchanged

private boolean[] listchanged

unwantand

private boolean unwantand

wantand

private boolean wantand

andselectable

private boolean andselectable
Constructor Detail

UnwantWantModel

public UnwantWantModel()
Basic constructor.


UnwantWantModel

public UnwantWantModel(ChangeableListModel umx,
                       ChangeableListModel dmx,
                       ChangeableListModel wmx)
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)

fireListChanged

private void fireListChanged()

setListModels

public void setListModels(ChangeableListModel umx,
                          ChangeableListModel dmx,
                          ChangeableListModel wmx)

setLists

public void setLists(javax.swing.JList ul,
                     javax.swing.JList dl,
                     javax.swing.JList wl)

getListModels

public ChangeableListModel[] getListModels()

getUnwantedElements

public java.util.List getUnwantedElements()

getWantedElements

public java.util.List getWantedElements()

setAndSelectable

public void setAndSelectable(boolean b)

isAndSelectable

public boolean isAndSelectable()

setUnwantAnd

public void setUnwantAnd(boolean b)

isUnwantAnd

public boolean isUnwantAnd()

setWantAnd

public void setWantAnd(boolean b)

isWantAnd

public boolean isWantAnd()

moveElements

protected void moveElements(int[] fromindices,
                            int fromidx,
                            int toidx)
Moves elements from one list to another. Does the main work of this object. Moves Elements between lists based on the selection of the source list. The used methods of the ChangeableListModel interface take care of handling the selection of the target list and right ordering etc.


trimContent

public void trimContent(java.util.List v)
Extends or shrinks the content of the three base models with respect to the given List. All three list models are trimmed to the external List. After that, the remaining elements of the List are appended to the dontcare list. After this, the UnwantWantSelector shows exactly the elements of the given List.


clear

public void clear()

QJCC homepage