|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdata.ClusterSet
public class ClusterSet
A collection of several Cluster
s.
Field Summary | |
---|---|
private java.util.Vector<Cluster> |
clusters
The clusters. |
private java.util.Vector<Cluster> |
clustersBuffer
A buffer of clusters that is used while the user is editing this ClusterSet. |
private DataSheet |
dataSheet
The data sheet. |
private java.util.Vector<javax.swing.event.TableModelListener> |
listeners
Used for automatic update of the GUI when table contents change. |
(package private) static boolean |
printLog
Flag to enable debug message printing for this class. |
(package private) static long |
serialVersionUID
The version tracking unique identifier for Serialization. |
private int |
uniqueIdentificationNumberCounter
Counter which allows to attribute a unique identifier to each Cluster. |
private UserPreferences |
userPreferences
The user preferences. |
Constructor Summary | |
---|---|
ClusterSet(UserPreferences userPreferences,
DataSheet dataSheet)
Instantiates a new cluster set. |
Method Summary | |
---|---|
void |
addClusterToBuffer()
Adds a new cluster to the editing buffer. |
void |
addTableModelListener(javax.swing.event.TableModelListener l)
|
void |
applyChanges()
All changes made to the editing buffer are now applied by copying the buffer to the persistent Vector clusters. |
void |
createBuffer()
Creates a buffer by copying the clusters Vector. |
void |
fireTableChanged()
Called to update the display of the table |
Cluster |
getCluster(int i)
Gets a cluster by index i. |
Cluster |
getCluster(java.lang.String clusterName)
Gets a cluster by name. |
int |
getClusterCount()
Gets the cluster count. |
java.lang.Class<?> |
getColumnClass(int columnIndex)
|
int |
getColumnCount()
|
java.lang.String |
getColumnName(int columnIndex)
|
int |
getRowCount()
|
private java.lang.String |
getUniqueClusterName()
Creates a unique name for a new Cluster. |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
|
boolean |
isCellEditable(int rowIndex,
int columnIndex)
|
private boolean |
isNameUnique(java.lang.String name)
Checks if a given name is a unique Cluster name. |
private boolean |
isNameUnique(java.lang.String name,
int exception)
Checks if a given name is a unique Cluster name but does check against the name of Cluster with index exception. |
private void |
log(java.lang.String message)
Prints debug information to stdout when printLog is set to true. |
void |
removeClusterFromBuffer(Cluster cluster)
Removes the specified Cluster from the editing buffer. |
void |
removeClusterFromBuffer(int i)
Removes a cluster from the editing buffer. |
void |
removeClusterFromBuffer(java.lang.String clusterName)
Removes a cluster from buffer by name. |
void |
removeTableModelListener(javax.swing.event.TableModelListener l)
|
void |
setValueAt(java.lang.Object arg0,
int rowIndex,
int columnIndex)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final long serialVersionUID
static final boolean printLog
private UserPreferences userPreferences
private DataSheet dataSheet
private java.util.Vector<Cluster> clusters
private java.util.Vector<Cluster> clustersBuffer
While the user edits this ClusterSet all changes are only applied to this buffer.
The changes are only applied when the user confirms his actions. The method applyChanges()
is used for this purpose.
private java.util.Vector<javax.swing.event.TableModelListener> listeners
private int uniqueIdentificationNumberCounter
This is needed to keep the correct references between the clusters Vector and the editing buffer.
Constructor Detail |
---|
public ClusterSet(UserPreferences userPreferences, DataSheet dataSheet)
userPreferences
- the user preferencesdataSheet
- the data sheetMethod Detail |
---|
public java.lang.Class<?> getColumnClass(int columnIndex)
getColumnClass
in interface javax.swing.table.TableModel
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public java.lang.String getColumnName(int columnIndex)
getColumnName
in interface javax.swing.table.TableModel
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface javax.swing.table.TableModel
public boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface javax.swing.table.TableModel
public void setValueAt(java.lang.Object arg0, int rowIndex, int columnIndex)
setValueAt
in interface javax.swing.table.TableModel
public void addTableModelListener(javax.swing.event.TableModelListener l)
addTableModelListener
in interface javax.swing.table.TableModel
public void removeTableModelListener(javax.swing.event.TableModelListener l)
removeTableModelListener
in interface javax.swing.table.TableModel
public void fireTableChanged()
public void addClusterToBuffer()
public void removeClusterFromBuffer(int i)
i
- the index of the Cluster to be removed.public void removeClusterFromBuffer(Cluster cluster)
cluster
- the Cluster to be removedpublic Cluster getCluster(int i)
i
- the index
public Cluster getCluster(java.lang.String clusterName)
clusterName
- the cluster name
public int getClusterCount()
public void removeClusterFromBuffer(java.lang.String clusterName)
clusterName
- the name of the Cluster to be removed.private java.lang.String getUniqueClusterName()
private boolean isNameUnique(java.lang.String name)
name
- the name to be checked
private boolean isNameUnique(java.lang.String name, int exception)
This is needed when the user edits the Cluster name. In this case, the entered name must be checked against the names of all other Clusters, but not against the current name of this Cluster. Otherwise reentering the same name as the Cluster had before would produce an error message.
name
- the nameexception
- the exception
public void applyChanges()
public void createBuffer()
This buffer is used to store modifications that the user makes until he choose to apply the changes made.
private void log(java.lang.String message)
message
- the message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |