net.sf.nachocalendar.components

Class HeaderPanel


public class HeaderPanel
extends JComponent

Panel used to render headers and week numbers.
Author:
Ignacio Merani

Constructor Summary

HeaderPanel(HeaderRenderer renderer)
Creates a new instance of HeaderPanel.

Method Summary

Dimension
getPreferredSize()
If the preferredSize has been set to a non-null value just returns it.
HeaderRenderer
getRenderer()
Getter for property renderer.
Object
getValue()
Getter for property value.
boolean
isAntiAliased()
boolean
isHeader()
Getter for property header.
boolean
isWorking()
Getter for property working.
void
paint(Graphics g)
Invoked by Swing to draw components.
void
setAntiAliased(boolean antiAliased)
void
setHeader(boolean header)
Setter for property header.
void
setRenderer(HeaderRenderer renderer)
Setter for property renderer.
void
setValue(Object value)
Setter for property value.
void
setWorking(boolean working)
Setter for property working.

Constructor Details

HeaderPanel

public HeaderPanel(HeaderRenderer renderer)
Creates a new instance of HeaderPanel.
Parameters:
renderer - renderer to be used

Method Details

getPreferredSize

public Dimension getPreferredSize()
If the preferredSize has been set to a non-null value just returns it. If the UI delegate's getPreferredSize method returns a non null value then return that; otherwise defer to the component's layout manager.
Returns:
the value of the preferredSize property

getRenderer

public HeaderRenderer getRenderer()
Getter for property renderer.
Returns:
Value of property renderer.

getValue

public Object getValue()
Getter for property value.
Returns:
Value of property value.

isAntiAliased

public boolean isAntiAliased()
Returns:
Returns the antiAliased.

isHeader

public boolean isHeader()
Getter for property header.
Returns:
Value of property header.

isWorking

public boolean isWorking()
Getter for property working.
Returns:
Value of property working.

paint

public void paint(Graphics g)
Invoked by Swing to draw components. Applications should not invoke paint directly, but should instead use the repaint method to schedule the component for redrawing.

This method actually delegates the work of painting to three protected methods: paintComponent, paintBorder, and paintChildren. They're called in the order listed to ensure that children appear on top of component itself. Generally speaking, the component and its children should not paint in the insets area allocated to the border. Subclasses can just override this method, as always. A subclass that just wants to specialize the UI (look and feel) delegate's paint method should just override paintComponent.

Parameters:
g - the Graphics context in which to paint

setAntiAliased

public void setAntiAliased(boolean antiAliased)
Parameters:
antiAliased - The antiAliased to set.

setHeader

public void setHeader(boolean header)
Setter for property header.
Parameters:
header - New value of property header.

setRenderer

public void setRenderer(HeaderRenderer renderer)
Setter for property renderer.
Parameters:
renderer - New value of property renderer.

setValue

public void setValue(Object value)
Setter for property value.
Parameters:
value - New value of property value.

setWorking

public void setWorking(boolean working)
Setter for property working.
Parameters:
working - New value of property working.