lt.monarch.chart.view
Class DecoratedView<E extends AbstractPaintTags>

java.lang.Object
  extended by lt.monarch.chart.AbstractView<E>
      extended by lt.monarch.chart.view.CompositeView<E>
          extended by lt.monarch.chart.view.DecoratedView<E>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, StyleEditorEntity, View, ViewListener, ExpandableDecoration
Direct Known Subclasses:
LabeledChart

public class DecoratedView<E extends AbstractPaintTags>
extends CompositeView<E>
implements ExpandableDecoration

Decorates a chart with four optional views, arranged as in the java.awt.BorderLayout, but it also allows to specify the level of overlap. By default sub-views do not overlap and layout in a similar way to the java.awt.BorderLayout. If overlap is specified, side components overlap with the center component.

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
protected  Alignment bottomAlignment
           
protected  int bottomOverlap
           
protected  View bottomView
           
protected  Alignment leftAlignment
           
protected  int leftOverlap
           
protected  View leftView
           
protected  Alignment rightAlignment
           
protected  int rightOverlap
           
protected  View rightView
           
protected  Alignment topAlignment
           
protected  int topOverlap
           
protected  View topView
           
protected  View view
           
 
Fields inherited from class lt.monarch.chart.view.CompositeView
views
 
Fields inherited from class lt.monarch.chart.AbstractView
layoutInvalid, paintStyle, style
 
Constructor Summary
Constructor and Description
DecoratedView(View view)
          Creates a decorated view.
 
Method Summary
Modifier and Type Method and Description
 Alignment getBottomAlignment()
           
 View getBottomView()
           
 Alignment getLeftAlignment()
           
 View getLeftView()
           
 java.awt.Dimension getPreferredSize(AbstractGraphics g)
          Gets the preferred size of this view in the specified Graphics context.
 Alignment getRightAlignment()
           
 View getRightView()
           
 Alignment getTopAlignment()
           
 View getTopView()
           
protected  java.awt.Dimension getViewSize(AbstractGraphics g, View view)
           
 boolean isHorizontallyExpandable()
          Should return true if width of this view, when persisting in top or bottom position inside DecoratedView, should be expanded to maximum space available.
 boolean isVerticallyExpandable()
          Should return true if height of this view, when persisting in left or right position inside DecoratedView, should be expanded to maximum space available.
protected  void layout(AbstractGraphics g)
          Prepares the view by arranging all internal views and calculates required constants.
protected  Rectangle2D narrow(Rectangle2D bounds, java.awt.Dimension maxSize)
           
 void removeView(View v)
          Removes the view from this container.
 void setBottomView(View view)
          Adds a bottom view with no overlap.
 void setBottomView(View view, int overlap)
          Adds a bottom view.
 void setBottomView(View view, int overlap, Alignment alignment)
          Adds a bottom view.
 void setLeftView(View view)
          Adds a left view with no overlap.
 void setLeftView(View view, int overlap)
          Adds a left view.
 void setLeftView(View view, int overlap, Alignment alignment)
          Adds a left view.
 void setRightView(View view)
          Adds a right view with no overlap.
 void setRightView(View view, int overlap)
          Adds a right view.
 void setRightView(View view, int overlap, Alignment alignment)
          Adds a right view.
 void setTopView(View view)
          Adds a top view with no overlap.
 void setTopView(View view, int overlap)
          Adds a top view.
 void setTopView(View view, int overlap, Alignment alignment)
          Adds a top view.
 
Methods inherited from class lt.monarch.chart.view.CompositeView
addView, dispose, getContainingObjects, getGraphicsType, getViewCount, getViews, paint, setContainer, setView, validate, viewActivated, viewDeactivated, viewInvalidated
 
Methods inherited from class lt.monarch.chart.AbstractView
activate, addViewListener, clone, container, deactivate, finalize, getAlignmentX, getAlignmentY, getBounds, getChartObjectBounds, getContainer, getHeight, getMaximumSize, getMinimumSize, getPaintMode, getPaintStyle, getParent, getSize, getSize, getStyle, getStyle, getWidth, getX, getY, invalidate, isLayoutValid, removeViewListener, render, repaint, repaint, setAlignmentX, setAlignmentY, setBounds, setBounds, setLocation, setMaximumSize, setMinimumSize, setPaintMode, setPreferredSize, setSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

view

protected View view

topOverlap

protected int topOverlap

topView

protected View topView

topAlignment

protected Alignment topAlignment

bottomOverlap

protected int bottomOverlap

bottomView

protected View bottomView

bottomAlignment

protected Alignment bottomAlignment

leftOverlap

protected int leftOverlap

leftView

protected View leftView

leftAlignment

protected Alignment leftAlignment

rightOverlap

protected int rightOverlap

rightView

protected View rightView

rightAlignment

protected Alignment rightAlignment
Constructor Detail

DecoratedView

public DecoratedView(View view)
Creates a decorated view.

Parameters:
view - a sub-view, to be used as a center view.
Method Detail

setTopView

public void setTopView(View view)
Adds a top view with no overlap.

Parameters:
view - view to be added

setBottomView

public void setBottomView(View view)
Adds a bottom view with no overlap.

Parameters:
view - view to be added

setLeftView

public void setLeftView(View view)
Adds a left view with no overlap.

Parameters:
view - view to be added

setRightView

public void setRightView(View view)
Adds a right view with no overlap.

Parameters:
view - view to be added

setTopView

public void setTopView(View view,
                       int overlap)
Adds a top view. This sub-view overlaps with the center sub-view by the percentage specified.

Parameters:
view - view to be added
overlap - overlap coefficient. 0 results in no overlap, while 100 results in a complete overlap.

setBottomView

public void setBottomView(View view,
                          int overlap)
Adds a bottom view. This sub-view overlaps with the center sub-view by the percentage specified.

Parameters:
view - view to be added
overlap - overlap coefficient. 0 results in no overlap, while 100 results in a complete overlap.

setLeftView

public void setLeftView(View view,
                        int overlap)
Adds a left view. This sub-view overlaps with the center sub-view by the percentage specified.

Parameters:
view - view to be added
overlap - overlap coefficient. 0 results in no overlap, while 100 results in a complete overlap.

setRightView

public void setRightView(View view,
                         int overlap)
Adds a right view. This sub-view overlaps with the center sub-view by the percentage specified.

Parameters:
view - view to be added
overlap - overlap coefficient. 0 results in no overlap, while 100 results in a complete overlap.

setTopView

public void setTopView(View view,
                       int overlap,
                       Alignment alignment)
Adds a top view. This sub-view overlaps with the center sub-view by the percentage specified and with horizontal alignment.

Parameters:
view - view to be added
overlap - overlap coefficient. 0 results in no overlap, while 100 results in a complete overlap.
alignment - horizontal alignment it can be: CENTER, LEFT, RIGHT.

setBottomView

public void setBottomView(View view,
                          int overlap,
                          Alignment alignment)
Adds a bottom view. This sub-view overlaps with the center sub-view by the percentage specified and with horizontal alignment.

Parameters:
view - view to be added
overlap - overlap coefficient. 0 results in no overlap, while 100 results in a complete overlap.
alignment - horizontal alignment it can be: CENTER, LEFT, RIGHT.

setLeftView

public void setLeftView(View view,
                        int overlap,
                        Alignment alignment)
Adds a left view. This sub-view overlaps with the center sub-view by the percentage specified and with vertical alignment.

Parameters:
view - view to be added
overlap - overlap coefficient. 0 results in no overlap, while 100 results in a complete overlap.
alignment - vertical alignment it can be: CENTER, TOP, BOTTOM.

setRightView

public void setRightView(View view,
                         int overlap,
                         Alignment alignment)
Adds a right view. This sub-view overlaps with the center sub-view by the percentage specified and with vertical alignment.

Parameters:
view - view to be added
overlap - overlap coefficient. 0 results in no overlap, while 100 results in a complete overlap.
alignment - vertical alignment it can be: CENTER, TOP, BOTTOM.

removeView

public void removeView(View v)
Removes the view from this container.

Overrides:
removeView in class CompositeView<E extends AbstractPaintTags>
Parameters:
v - view to be added

getPreferredSize

public java.awt.Dimension getPreferredSize(AbstractGraphics g)
Description copied from class: AbstractView
Gets the preferred size of this view in the specified Graphics context.

Specified by:
getPreferredSize in interface View
Overrides:
getPreferredSize in class AbstractView<E extends AbstractPaintTags>
Parameters:
g - the Graphics context in which view will be painted
Returns:
a dimension object indicating this view's preferred size.

narrow

protected Rectangle2D narrow(Rectangle2D bounds,
                             java.awt.Dimension maxSize)

getViewSize

protected java.awt.Dimension getViewSize(AbstractGraphics g,
                                         View view)

layout

protected void layout(AbstractGraphics g)
Description copied from class: AbstractView
Prepares the view by arranging all internal views and calculates required constants.

Overrides:
layout in class AbstractView<E extends AbstractPaintTags>
Parameters:
g - graphics context

getTopView

public View getTopView()

getBottomView

public View getBottomView()

getLeftView

public View getLeftView()

getRightView

public View getRightView()

getTopAlignment

public Alignment getTopAlignment()

getBottomAlignment

public Alignment getBottomAlignment()

getLeftAlignment

public Alignment getLeftAlignment()

getRightAlignment

public Alignment getRightAlignment()

isHorizontallyExpandable

public boolean isHorizontallyExpandable()
Description copied from interface: ExpandableDecoration
Should return true if width of this view, when persisting in top or bottom position inside DecoratedView, should be expanded to maximum space available.

Specified by:
isHorizontallyExpandable in interface ExpandableDecoration
Returns:
true if view's width should be expanded to maximum, false other wise.

isVerticallyExpandable

public boolean isVerticallyExpandable()
Description copied from interface: ExpandableDecoration
Should return true if height of this view, when persisting in left or right position inside DecoratedView, should be expanded to maximum space available.

Specified by:
isVerticallyExpandable in interface ExpandableDecoration
Returns:
true if view's height should be expanded to maximum, false other wise.