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

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

public class DefaultTimeBarViewState
extends java.lang.Object
implements ITimeBarViewState

The default implementation of a ITimeBarViewState.

Version:
$Id: DefaultTimeBarViewState.java 800 2008-12-27 22:27:33Z kliem $
Author:
kliem

Field Summary
protected  int _defaultHeight
          the default height for rows.
protected  TimeBarViewerDelegate _delegate
          delegate this viewstate is assigned to.
protected  java.util.Map<TimeBarRow,java.lang.Boolean> _drawOverlapping
          map holding the individual overlapping properties for rows.
protected  java.util.Map<TimeBarRow,java.lang.Integer> _heights
          map holding the heights.
protected  IRowHeightStrategy _rowHeightStrategy
          strategy for calculatng row heights.
protected  java.util.List<ITimeBarViewStateListener> _tbvsListeners
          vies state listeners.
protected  boolean _useVariableRowHeights
          true if variable row heights should be used, false if fixed heights should be used.
 
Constructor Summary
DefaultTimeBarViewState(TimeBarViewerDelegate delegate)
          Consruct the default view state for a specific delegate.
 
Method Summary
 void addTimeBarViewStateListener(ITimeBarViewStateListener listener)
          Add a listener to be informed about row height/width changes.
 void fireRowHeightChanged(TimeBarRow row, int height)
          Inform the listeners about the new height of a row.
 void fireViewStateChanged()
          Inform listeners about a massive change in the view state.
 int getDefaultRowHeight()
          Retrieve the default row height.
 boolean getDrawOverlapping(TimeBarRow row)
          Check whether the intervals in a certain row should be drawn overlapping.
 int getRowHeight(TimeBarRow row)
          Retrieve the height of the given row.
 IRowHeightStrategy getRowHeightStrategy()
          Retrieve the row height strategy if set.
 boolean getUseVariableRowHeights()
          Retrieve whether to use variable row heights/widths.
 void removeTimeBarViewStateListener(ITimeBarViewStateListener listener)
          Remove a viewstate listener.
 void setDefaultRowHeight(int height)
          Set the default height for all rows.
 void setDrawOverlapping(TimeBarRow row, boolean drawOverlapping)
          Set for a single row whether the intervals should be drawn overlapping (overwriting the global setting done in the viewer/delegate).
 void setRowHeight(TimeBarRow row, int height)
          Set the height for a specific row.
 void setRowHeightStrategy(IRowHeightStrategy rowHeightStrategy)
          Set a strategy for height calculation.
 void setUseVariableRowHeights(boolean useVariableRowHeights)
          Set whether to use variable row heights/widths.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_tbvsListeners

protected java.util.List<ITimeBarViewStateListener> _tbvsListeners
vies state listeners.


_heights

protected java.util.Map<TimeBarRow,java.lang.Integer> _heights
map holding the heights.


_drawOverlapping

protected java.util.Map<TimeBarRow,java.lang.Boolean> _drawOverlapping
map holding the individual overlapping properties for rows.


_useVariableRowHeights

protected boolean _useVariableRowHeights
true if variable row heights should be used, false if fixed heights should be used.


_defaultHeight

protected int _defaultHeight
the default height for rows.


_rowHeightStrategy

protected IRowHeightStrategy _rowHeightStrategy
strategy for calculatng row heights.


_delegate

protected TimeBarViewerDelegate _delegate
delegate this viewstate is assigned to.

Constructor Detail

DefaultTimeBarViewState

public DefaultTimeBarViewState(TimeBarViewerDelegate delegate)
Consruct the default view state for a specific delegate.

Parameters:
delegate - the delegate
Method Detail

getRowHeight

public int getRowHeight(TimeBarRow row)
Retrieve the height of the given row.

Specified by:
getRowHeight in interface ITimeBarViewState
Parameters:
row - row to receive the height for
Returns:
the height of the row

setRowHeight

public void setRowHeight(TimeBarRow row,
                         int height)
Set the height for a specific row.

Specified by:
setRowHeight in interface ITimeBarViewState
Parameters:
row - row to set the height for
height - the height of the row

setRowHeightStrategy

public void setRowHeightStrategy(IRowHeightStrategy rowHeightStrategy)
Set a strategy for height calculation.

Specified by:
setRowHeightStrategy in interface ITimeBarViewState
Parameters:
rowHeightStrategy - the strategy for calculation or null to remove a strategy

getRowHeightStrategy

public IRowHeightStrategy getRowHeightStrategy()
Retrieve the row height strategy if set.

Specified by:
getRowHeightStrategy in interface ITimeBarViewState
Returns:
the strategy or null

fireRowHeightChanged

public void fireRowHeightChanged(TimeBarRow row,
                                 int height)
Inform the listeners about the new height of a row.

Parameters:
row - row
height - new height

fireViewStateChanged

public void fireViewStateChanged()
Inform listeners about a massive change in the view state.


removeTimeBarViewStateListener

public void removeTimeBarViewStateListener(ITimeBarViewStateListener listener)
Remove a viewstate listener.

Specified by:
removeTimeBarViewStateListener in interface ITimeBarViewState
Parameters:
listener - listener to be removed

addTimeBarViewStateListener

public void addTimeBarViewStateListener(ITimeBarViewStateListener listener)
Add a listener to be informed about row height/width changes.

Specified by:
addTimeBarViewStateListener in interface ITimeBarViewState
Parameters:
listener - listener to be informed

setDefaultRowHeight

public void setDefaultRowHeight(int height)
Set the default height for all rows. This height will also be used, if variable heights are not used.

Specified by:
setDefaultRowHeight in interface ITimeBarViewState
Parameters:
height - height

getDefaultRowHeight

public int getDefaultRowHeight()
Retrieve the default row height.

Specified by:
getDefaultRowHeight in interface ITimeBarViewState
Returns:
the default row height

getUseVariableRowHeights

public boolean getUseVariableRowHeights()
Retrieve whether to use variable row heights/widths.

Specified by:
getUseVariableRowHeights in interface ITimeBarViewState
Returns:
true if variable row heights/width should be used

setUseVariableRowHeights

public void setUseVariableRowHeights(boolean useVariableRowHeights)
Set whether to use variable row heights/widths.

Specified by:
setUseVariableRowHeights in interface ITimeBarViewState
Parameters:
useVariableRowHeights - true to use variable row heights/widths. This will have an impact no some performance aspects in the timebar viewer.

getDrawOverlapping

public boolean getDrawOverlapping(TimeBarRow row)
Check whether the intervals in a certain row should be drawn overlapping. If no value had been set, the global value from the delegate is returned.

Specified by:
getDrawOverlapping in interface ITimeBarViewState
Parameters:
row - row to look for
Returns:
true if the intervals shoukd be drawn overlapping

setDrawOverlapping

public void setDrawOverlapping(TimeBarRow row,
                               boolean drawOverlapping)
Set for a single row whether the intervals should be drawn overlapping (overwriting the global setting done in the viewer/delegate).

Specified by:
setDrawOverlapping in interface ITimeBarViewState
Parameters:
row - the row to set the property for
drawOverlapping - true for overlapping drawing


Copyright © 2012. All Rights Reserved.