Agent System POND 1.2 (28.2.2002)

FIM.Util.GUI
Class ReadOnlySelectionModel

java.lang.Object
  |
  +--javax.swing.DefaultListSelectionModel
        |
        +--FIM.Util.GUI.ReadOnlySelectionModel
All Implemented Interfaces:
Cloneable, ListSelectionModel, Serializable

public final class ReadOnlySelectionModel
extends DefaultListSelectionModel

This class extends the class DefaultListSelectionModel, but does only allow to set the selection if it is not marked as read-only: All requests are ignored then. Used for read-only list-boxes. They can be scrolled, but the selection cannot be changed.

Version:
1.0, 1.7.2000
Author:
Michael Sonntag
See Also:
JList, Serialized Form

Fields inherited from class javax.swing.DefaultListSelectionModel
leadAnchorNotificationEnabled, listenerList
 
Fields inherited from interface javax.swing.ListSelectionModel
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION
 
Constructor Summary
ReadOnlySelectionModel()
           
 
Method Summary
 void addSelectionInterval(int index0, int index1)
          Change the selection to be the set union of the current selection and the indices between index0 and index1 inclusive.
 void clearSelection()
          Change the selection to the empty set.
 void insertIndexInterval(int index, int length, boolean before)
          Insert length indices beginning before/after index.
 boolean isReadOnly()
          Retrieve the current mode of the selection model.
 void removeIndexInterval(int index0, int index1)
          Remove the indices in the interval index0,index1 (inclusive) from the selection model.
 void removeSelectionInterval(int index0, int index1)
          Change the selection to be the set difference of the current selection and the indices between index0 and index1 inclusive.
 void setAnchorSelectionIndex(int anchorIndex)
          Set the anchor selection index.
 void setLeadSelectionIndex(int leadIndex)
          Set the lead selection index.
 void setReadOnly(boolean readOnly)
          Sets the current mode of the selection model.
 void setSelectionInterval(int index0, int index1)
          Change the selection to be between index0 and index1 inclusive.
 
Methods inherited from class javax.swing.DefaultListSelectionModel
addListSelectionListener, clone, fireValueChanged, fireValueChanged, fireValueChanged, getAnchorSelectionIndex, getLeadSelectionIndex, getListeners, getMaxSelectionIndex, getMinSelectionIndex, getSelectionMode, getValueIsAdjusting, isLeadAnchorNotificationEnabled, isSelectedIndex, isSelectionEmpty, removeListSelectionListener, setLeadAnchorNotificationEnabled, setSelectionMode, setValueIsAdjusting, toString
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReadOnlySelectionModel

public ReadOnlySelectionModel()
Method Detail

isReadOnly

public boolean isReadOnly()
Retrieve the current mode of the selection model.
Returns:
true if the selection cannot be changed

setReadOnly

public void setReadOnly(boolean readOnly)
Sets the current mode of the selection model. The selection cannot be changed if the mode is set to true until it is set again to false.
Parameters:
readOnly - if true the selection cannot be changed anymore

clearSelection

public void clearSelection()
Change the selection to the empty set. If this represents a change to the current selection then notify each ListSelectionListener. Does nothing if the model is set to read-only.
Overrides:
clearSelection in class DefaultListSelectionModel

setSelectionInterval

public void setSelectionInterval(int index0,
                                 int index1)
Change the selection to be between index0 and index1 inclusive. If this represents a change to the current selection, then notify each ListSelectionListener. Note that index0 doesn't have to be less than or equal to index1. Does nothing if the model is set to read-only.
Overrides:
setSelectionInterval in class DefaultListSelectionModel
Parameters:
index0 - one end of the interval.
index1 - other end of the interval

addSelectionInterval

public void addSelectionInterval(int index0,
                                 int index1)
Change the selection to be the set union of the current selection and the indices between index0 and index1 inclusive. If this represents a change to the current selection, then notify each ListSelectionListener. Note that index0 doesn't have to be less than or equal to index1. Does nothing if the model is set to read-only.
Overrides:
addSelectionInterval in class DefaultListSelectionModel
Parameters:
index0 - one end of the interval.
index1 - other end of the interval

removeSelectionInterval

public void removeSelectionInterval(int index0,
                                    int index1)
Change the selection to be the set difference of the current selection and the indices between index0 and index1 inclusive. If this represents a change to the current selection, then notify each ListSelectionListener. Note that index0 doesn't have to be less than or equal to index1. Does nothing if the model is set to read-only.
Overrides:
removeSelectionInterval in class DefaultListSelectionModel
Parameters:
index0 - one end of the interval.
index1 - other end of the interval

insertIndexInterval

public void insertIndexInterval(int index,
                                int length,
                                boolean before)
Insert length indices beginning before/after index. This is typically called to sync the selection model with a corresponding change in the data model. Does nothing if the model is set to read-only.
Overrides:
insertIndexInterval in class DefaultListSelectionModel
Parameters:
index - the index before/after which to insert
length - the number of indices to insert
before - if true, the indices will be inserted before the provided index

removeIndexInterval

public void removeIndexInterval(int index0,
                                int index1)
Remove the indices in the interval index0,index1 (inclusive) from the selection model. This is typically called to sync the selection model width a corresponding change in the data model. Does nothing if the model is set to read-only.
Overrides:
removeIndexInterval in class DefaultListSelectionModel
Parameters:
index0 - the first index to be removed
index1 - the last index to be removed

setAnchorSelectionIndex

public void setAnchorSelectionIndex(int anchorIndex)
Set the anchor selection index. Does nothing if the model is set to read-only.
Overrides:
setAnchorSelectionIndex in class DefaultListSelectionModel
Parameters:
anchorIndex - the anchor selection index
See Also:
DefaultListSelectionModel.getAnchorSelectionIndex()

setLeadSelectionIndex

public void setLeadSelectionIndex(int leadIndex)
Set the lead selection index. Does nothing if the model is set to read-only.
Overrides:
setLeadSelectionIndex in class DefaultListSelectionModel
Parameters:
leadIndex - the lead selection index
See Also:
DefaultListSelectionModel.getLeadSelectionIndex()

Agent System POND 1.2 (28.2.2002)

Submit a bug

Copyright 2001,2002 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.