quoggles.auxiliary
Class RowListener

java.lang.Object
  |
  +--quoggles.auxiliary.RowListener

public class RowListener
extends java.lang.Object

Changes the selection in the Graffiti system according to the rows or cells that get marked / unmarked.


Field Summary
private  int markedRows
          Count number of marked rows.
private  java.util.Map selElementsCnt
          Saves the number of times an element is marked.
 
Constructor Summary
RowListener()
           
 
Method Summary
 void cellMarked(java.lang.Object val)
          Called if one single cell is marked.
 void cellUnmarked(java.lang.Object val)
          Called if one single cell is unmarked.
private  void changeSelectionCell(java.lang.Object val, org.graffiti.selection.Selection sel, boolean add)
          Every graph element found in the given object (searched recursively if any collections are involved) is added to or removed from the given selection, according to the given boolean value.
private  boolean decElementCount(java.lang.Object ge)
          If the element has previously been selected, decrease the number of times it had been selected by one.
private  org.graffiti.selection.SelectionModel getSelectionModel()
          Get the selection model of the active editor session.
private  void incElementCount(java.lang.Object ge)
          Add the element to the list of selected elements.
 void reset()
          Resets the listener.
 void rowMarked(java.lang.Object[] row)
          Add GraphElements contained in the row to the active selection.
 void rowUnmarked(java.lang.Object[] row)
          Remove GraphElements contained in the row from the active selection (if not selected by other rows).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

markedRows

private int markedRows
Count number of marked rows.


selElementsCnt

private java.util.Map selElementsCnt
Saves the number of times an element is marked. Avoids removing an element from the selection too early.

Constructor Detail

RowListener

public RowListener()
Method Detail

reset

public void reset()
Resets the listener.


incElementCount

private void incElementCount(java.lang.Object ge)
Add the element to the list of selected elements. If it already registered, add the saved number by one.

Parameters:
ge -

decElementCount

private boolean decElementCount(java.lang.Object ge)
If the element has previously been selected, decrease the number of times it had been selected by one. If this number then reaches zero, the element should vanish from the selection and this method returns true.

Parameters:
ge -
Returns:
true if the element should be removed from the selection.

changeSelectionCell

private void changeSelectionCell(java.lang.Object val,
                                 org.graffiti.selection.Selection sel,
                                 boolean add)
Every graph element found in the given object (searched recursively if any collections are involved) is added to or removed from the given selection, according to the given boolean value. Updates selElementsCnt.

Parameters:
val - the object to be searched
sel - the selection to be changed
add - if true, elements are added, otherwise they are removed from the selection

getSelectionModel

private org.graffiti.selection.SelectionModel getSelectionModel()
Get the selection model of the active editor session.

Returns:

cellMarked

public void cellMarked(java.lang.Object val)
Called if one single cell is marked.

Parameters:
val -

cellUnmarked

public void cellUnmarked(java.lang.Object val)
Called if one single cell is unmarked.

Parameters:
val -

rowMarked

public void rowMarked(java.lang.Object[] row)
Add GraphElements contained in the row to the active selection.

Parameters:
row -

rowUnmarked

public void rowUnmarked(java.lang.Object[] row)
Remove GraphElements contained in the row from the active selection (if not selected by other rows).

Parameters:
row -