de.jaret.util.ui.timebars.model
Class TimeBarSelectionModelImpl

java.lang.Object
  extended by de.jaret.util.ui.timebars.model.TimeBarSelectionModelImpl
All Implemented Interfaces:
TimeBarSelectionModel

public class TimeBarSelectionModelImpl
extends java.lang.Object
implements TimeBarSelectionModel

Implementation of TimeBarSelectionModel: straight forward.

Version:
$Id: TimeBarSelectionModelImpl.java 757 2008-04-27 22:42:37Z kliem $
Author:
Peter Kliem

Field Summary
protected  boolean _intervalSelectAllow
          flag indicatig that the selection of intervals is allowed.
protected  java.util.List<TimeBarSelectionListener> _listenerList
          listener list.
protected  boolean _multiAllowed
          flag indicating that the selection of multiple elements is allowed.
protected  boolean _relationSelectAllow
          flag indicatig that the selection of relations is allowed.
protected  boolean _rowSelectAllowed
          flag indicating that row selection is allowed.
protected  boolean _rowSelectionToggleMode
          flag indicating activated toggle mode for row selections.
protected  java.util.List<de.jaret.util.date.Interval> _selectedIntervals
          list of selecetd intervals.
protected  java.util.List<IIntervalRelation> _selectedRelations
          list of selecetd relations.
protected  java.util.List<TimeBarRow> _selectedRows
          list of selecetd rows.
 
Constructor Summary
TimeBarSelectionModelImpl()
           
 
Method Summary
 void addSelectedInterval(de.jaret.util.date.Interval interval)
          Add an interval to the selection.
 void addSelectedRelation(IIntervalRelation relation)
          Add an relation to the selection.
 void addSelectedRow(TimeBarRow row)
          Add a row to the collection of selected rows.
 void addTimeBarSelectionListener(TimeBarSelectionListener tbsl)
          Add a TimeBarSelectionListener to be informed if the selection is altered.
 void clearIntervalSelection()
          Clears the selected intervals.
 void clearRelationSelection()
          Clears the selected relations.
 void clearRowSelection()
          Clears the selected rows.
 void clearSelection()
          Clears all selections.
protected  void fireElementAdded(java.lang.Object element)
          Inform listeners about the addition of a new element in the selection.
protected  void fireElementRemoved(java.lang.Object element)
          Inform listeners about the removal of an element from the selection.
protected  void fireSelectionChanged()
          Inform listeners about a general change of the selection.
 boolean getMultipleSelectionAllowed()
          Retrieves the multiple selection allowance.
 boolean getRowSelectionToggleMode()
          Retrieve the row selection toggle mode.
 java.util.List<de.jaret.util.date.Interval> getSelectedIntervals()
          Retrieves the list of currently selected intervals.
 java.util.List<IIntervalRelation> getSelectedRelations()
          Retrieves the list of currently selected relations.
 java.util.List<TimeBarRow> getSelectedRows()
          Retrieves the list of currently selected rows.
 boolean hasIntervalSelection()
          Check whether there are selected intervals.
 boolean hasRelationSelection()
          Check whether there are selected relations.
 boolean hasRowSelection()
          Check whether there are selected rows.
 boolean isEmpty()
          Check whether the selection is completely empty.
 boolean isIntervalSelectionAllowed()
          Check allowance of interval selections.
 boolean isRelationSelectionAllowed()
          Check allowance of relation selections.
 boolean isRowSelectionAllowed()
          Check allowance of row selections.
 boolean isSelected(IIntervalRelation relation)
          Check whether an inetrval is in the selection.
 boolean isSelected(de.jaret.util.date.Interval interval)
          Check whether an interval is in the selection.
 boolean isSelected(TimeBarRow row)
          Check whether a given row is selected.
 void remSelectedInterval(de.jaret.util.date.Interval interval)
          Remove an interval from the selection.
 void remSelectedIntervals(java.util.List<de.jaret.util.date.Interval> intervals)
          Remove a list of intervals from the seletion.
 void remSelectedRelation(IIntervalRelation relation)
          Remove an relation from the selection.
 void remSelectedRelations(java.util.List<IIntervalRelation> relations)
          Remove a list of relations from the seletion.
 void remSelectedRow(TimeBarRow row)
          Remove a row from the collection of selected rows.
 void remTimeBarSelectionListener(TimeBarSelectionListener tbsl)
          Remove a registered Listener.
 void setIntervalSelectionAllowed(boolean allowed)
          Enable/disable interval selection.
 void setMultipleSelectionAllowed(boolean allowed)
          If multiple selction is not allowed only one row and one interval may be selected at one time.
 void setRelationSelectionAllowed(boolean allowed)
          Enable/Disable relation selection.
 void setRowSelectionAllowed(boolean allowed)
          Enable/Disable row selection.
 void setRowSelectionToggleMode(boolean activated)
          Enable/dible row selection toggle mode (click toggles selection without modifier keys).
 void setSelectedInterval(de.jaret.util.date.Interval interval)
          Set the interval as the oly selected interval.
 void setSelectedRelation(IIntervalRelation relation)
          Set the relation as the oly selected relation.
 void setSelectedRow(TimeBarRow row)
          Set the row selection to a given row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_listenerList

protected java.util.List<TimeBarSelectionListener> _listenerList
listener list.


_selectedIntervals

protected java.util.List<de.jaret.util.date.Interval> _selectedIntervals
list of selecetd intervals.


_selectedRows

protected java.util.List<TimeBarRow> _selectedRows
list of selecetd rows.


_selectedRelations

protected java.util.List<IIntervalRelation> _selectedRelations
list of selecetd relations.


_rowSelectAllowed

protected boolean _rowSelectAllowed
flag indicating that row selection is allowed.


_intervalSelectAllow

protected boolean _intervalSelectAllow
flag indicatig that the selection of intervals is allowed.


_relationSelectAllow

protected boolean _relationSelectAllow
flag indicatig that the selection of relations is allowed.


_multiAllowed

protected boolean _multiAllowed
flag indicating that the selection of multiple elements is allowed.


_rowSelectionToggleMode

protected boolean _rowSelectionToggleMode
flag indicating activated toggle mode for row selections.

Constructor Detail

TimeBarSelectionModelImpl

public TimeBarSelectionModelImpl()
Method Detail

isEmpty

public boolean isEmpty()
Check whether the selection is completely empty.

Specified by:
isEmpty in interface TimeBarSelectionModel
Returns:
true id the selection is empty

hasRowSelection

public boolean hasRowSelection()
Check whether there are selected rows.

Specified by:
hasRowSelection in interface TimeBarSelectionModel
Returns:
true if the selection contains rows

hasIntervalSelection

public boolean hasIntervalSelection()
Check whether there are selected intervals.

Specified by:
hasIntervalSelection in interface TimeBarSelectionModel
Returns:
true if the selection contains intervals

hasRelationSelection

public boolean hasRelationSelection()
Check whether there are selected relations.

Specified by:
hasRelationSelection in interface TimeBarSelectionModel
Returns:
true if the selection contains relations

getSelectedRows

public java.util.List<TimeBarRow> getSelectedRows()
Retrieves the list of currently selected rows.

Specified by:
getSelectedRows in interface TimeBarSelectionModel
Returns:
List containing the selected TimeBarRows

getSelectedIntervals

public java.util.List<de.jaret.util.date.Interval> getSelectedIntervals()
Retrieves the list of currently selected intervals.

Specified by:
getSelectedIntervals in interface TimeBarSelectionModel
Returns:
List containing the selected Intervals

getSelectedRelations

public java.util.List<IIntervalRelation> getSelectedRelations()
Retrieves the list of currently selected relations.

Specified by:
getSelectedRelations in interface TimeBarSelectionModel
Returns:
List containing the selected IIntervalRelations

setRowSelectionAllowed

public void setRowSelectionAllowed(boolean allowed)
Enable/Disable row selection.

Specified by:
setRowSelectionAllowed in interface TimeBarSelectionModel
Parameters:
allowed - row selection allowed when set to true

isRowSelectionAllowed

public boolean isRowSelectionAllowed()
Check allowance of row selections.

Specified by:
isRowSelectionAllowed in interface TimeBarSelectionModel
Returns:
true if row selections are allowed

setIntervalSelectionAllowed

public void setIntervalSelectionAllowed(boolean allowed)
Enable/disable interval selection.

Specified by:
setIntervalSelectionAllowed in interface TimeBarSelectionModel
Parameters:
allowed - interval selection allowed when set to true

isIntervalSelectionAllowed

public boolean isIntervalSelectionAllowed()
Check allowance of interval selections.

Specified by:
isIntervalSelectionAllowed in interface TimeBarSelectionModel
Returns:
true if interval selections are allowed

setRelationSelectionAllowed

public void setRelationSelectionAllowed(boolean allowed)
Enable/Disable relation selection.

Specified by:
setRelationSelectionAllowed in interface TimeBarSelectionModel
Parameters:
allowed - relation selection allowed when set to true

isRelationSelectionAllowed

public boolean isRelationSelectionAllowed()
Check allowance of relation selections.

Specified by:
isRelationSelectionAllowed in interface TimeBarSelectionModel
Returns:
true if relation selections are allowed

setMultipleSelectionAllowed

public void setMultipleSelectionAllowed(boolean allowed)
If multiple selction is not allowed only one row and one interval may be selected at one time.

Specified by:
setMultipleSelectionAllowed in interface TimeBarSelectionModel
Parameters:
allowed - true to signal multiple selections are allowed

getMultipleSelectionAllowed

public boolean getMultipleSelectionAllowed()
Retrieves the multiple selection allowance.

Specified by:
getMultipleSelectionAllowed in interface TimeBarSelectionModel
Returns:
true if multiple selections are allowed

clearSelection

public void clearSelection()
Clears all selections.

Specified by:
clearSelection in interface TimeBarSelectionModel

clearIntervalSelection

public void clearIntervalSelection()
Clears the selected intervals.

Specified by:
clearIntervalSelection in interface TimeBarSelectionModel

clearRowSelection

public void clearRowSelection()
Clears the selected rows.

Specified by:
clearRowSelection in interface TimeBarSelectionModel

clearRelationSelection

public void clearRelationSelection()
Clears the selected relations.

Specified by:
clearRelationSelection in interface TimeBarSelectionModel

setSelectedRow

public void setSelectedRow(TimeBarRow row)
Set the row selection to a given row.

Specified by:
setSelectedRow in interface TimeBarSelectionModel
Parameters:
row - row to be selected

addSelectedRow

public void addSelectedRow(TimeBarRow row)
Add a row to the collection of selected rows.

Specified by:
addSelectedRow in interface TimeBarSelectionModel
Parameters:
row - row to be selected

remSelectedRow

public void remSelectedRow(TimeBarRow row)
Remove a row from the collection of selected rows.

Specified by:
remSelectedRow in interface TimeBarSelectionModel
Parameters:
row - row to be removed from the selection

isSelected

public boolean isSelected(TimeBarRow row)
Check whether a given row is selected.

Specified by:
isSelected in interface TimeBarSelectionModel
Parameters:
row - row to check
Returns:
true if the given row is selected

setSelectedInterval

public void setSelectedInterval(de.jaret.util.date.Interval interval)
Set the interval as the oly selected interval.

Specified by:
setSelectedInterval in interface TimeBarSelectionModel
Parameters:
interval - interval that will be the only selected interval

addSelectedInterval

public void addSelectedInterval(de.jaret.util.date.Interval interval)
Add an interval to the selection.

Specified by:
addSelectedInterval in interface TimeBarSelectionModel
Parameters:
interval - interval to be added to the selection

remSelectedInterval

public void remSelectedInterval(de.jaret.util.date.Interval interval)
Remove an interval from the selection.

Specified by:
remSelectedInterval in interface TimeBarSelectionModel
Parameters:
interval - interval to remove from the selection

remSelectedIntervals

public void remSelectedIntervals(java.util.List<de.jaret.util.date.Interval> intervals)
Remove a list of intervals from the seletion.

Specified by:
remSelectedIntervals in interface TimeBarSelectionModel
Parameters:
intervals - list of intervals to remove from the selection

isSelected

public boolean isSelected(de.jaret.util.date.Interval interval)
Check whether an interval is in the selection.

Specified by:
isSelected in interface TimeBarSelectionModel
Parameters:
interval - interval to check
Returns:
true if the interval in qustion is in the selection

setSelectedRelation

public void setSelectedRelation(IIntervalRelation relation)
Set the relation as the oly selected relation.

Specified by:
setSelectedRelation in interface TimeBarSelectionModel
Parameters:
relation - relation that will be the only selected relation

addSelectedRelation

public void addSelectedRelation(IIntervalRelation relation)
Add an relation to the selection.

Specified by:
addSelectedRelation in interface TimeBarSelectionModel
Parameters:
relation - relation to be added to the selection

remSelectedRelation

public void remSelectedRelation(IIntervalRelation relation)
Remove an relation from the selection.

Specified by:
remSelectedRelation in interface TimeBarSelectionModel
Parameters:
relation - relation to remove from the selection

remSelectedRelations

public void remSelectedRelations(java.util.List<IIntervalRelation> relations)
Remove a list of relations from the seletion.

Specified by:
remSelectedRelations in interface TimeBarSelectionModel
Parameters:
relations - list of relations to remove from the selection

isSelected

public boolean isSelected(IIntervalRelation relation)
Check whether an inetrval is in the selection.

Specified by:
isSelected in interface TimeBarSelectionModel
Parameters:
relation - relation to check
Returns:
true if the relation in question is in the selection

addTimeBarSelectionListener

public void addTimeBarSelectionListener(TimeBarSelectionListener tbsl)
Add a TimeBarSelectionListener to be informed if the selection is altered.

Specified by:
addTimeBarSelectionListener in interface TimeBarSelectionModel
Parameters:
tbsl - the Listener to be added

remTimeBarSelectionListener

public void remTimeBarSelectionListener(TimeBarSelectionListener tbsl)
Remove a registered Listener.

Specified by:
remTimeBarSelectionListener in interface TimeBarSelectionModel
Parameters:
tbsl - the listener to be deregistered

fireSelectionChanged

protected void fireSelectionChanged()
Inform listeners about a general change of the selection.


fireElementAdded

protected void fireElementAdded(java.lang.Object element)
Inform listeners about the addition of a new element in the selection.

Parameters:
element - newly selected element

fireElementRemoved

protected void fireElementRemoved(java.lang.Object element)
Inform listeners about the removal of an element from the selection.

Parameters:
element - the removed element

getRowSelectionToggleMode

public boolean getRowSelectionToggleMode()
Retrieve the row selection toggle mode.

Specified by:
getRowSelectionToggleMode in interface TimeBarSelectionModel
Returns:
true for activated toggle mode

setRowSelectionToggleMode

public void setRowSelectionToggleMode(boolean activated)
Enable/dible row selection toggle mode (click toggles selection without modifier keys).

Specified by:
setRowSelectionToggleMode in interface TimeBarSelectionModel
Parameters:
activated - true for activated toggle mode


Copyright © 2012. All Rights Reserved.