bibliothek.gui.dock.station.screen.window
Class DefaultScreenDockWindowBorder

java.lang.Object
  extended by bibliothek.gui.dock.station.screen.window.DefaultScreenDockWindowBorder
All Implemented Interfaces:
ScreenDockWindowBorder, Border

@ColorCodes(value={"station.screen.border","station.screen.border.line","station.screen.border.line.highlight.inner","station.screen.border.line.highlight.outer","station.screen.border.line.shadow.inner","station.screen.border.line.shadow.outer","station.screen.border.highlight.inner","station.screen.border.highlight.outer","station.screen.border.shadow.inner","station.screen.border.shadow.outer","station.screen.border.hover","station.screen.border.highlight.inner.hover","station.screen.border.highlight.outer.hover","station.screen.border.shadow.inner.hover","station.screen.border.shadow.outer.hover","station.screen.border.selected","station.screen.border.highlight.inner.selected","station.screen.border.highlight.outer.selected","station.screen.border.shadow.inner.selected","station.screen.border.shadow.outer.selected"})
public class DefaultScreenDockWindowBorder
extends Object
implements ScreenDockWindowBorder

This border can be used by ScreenDockWindows to paint a border. The border itself offers methods to paint indications whether the user currently moves or presses the mouse over it. The states however have to be set by window itself.

Author:
Benjamin Sigg

Nested Class Summary
protected  class DefaultScreenDockWindowBorder.BorderColor
          A DockColor representing a color used by this border.
 
Nested classes/interfaces inherited from interface bibliothek.gui.dock.station.screen.window.ScreenDockWindowBorder
ScreenDockWindowBorder.Position
 
Field Summary
protected  DefaultScreenDockWindowBorder.BorderColor color
           
protected  DefaultScreenDockWindowBorder.BorderColor colorHighlightInner
           
protected  DefaultScreenDockWindowBorder.BorderColor colorHighlightInnerHover
           
protected  DefaultScreenDockWindowBorder.BorderColor colorHighlightInnerSelected
           
protected  DefaultScreenDockWindowBorder.BorderColor colorHighlightOuter
           
protected  DefaultScreenDockWindowBorder.BorderColor colorHighlightOuterHover
           
protected  DefaultScreenDockWindowBorder.BorderColor colorHighlightOuterSelected
           
protected  DefaultScreenDockWindowBorder.BorderColor colorHover
           
protected  DefaultScreenDockWindowBorder.BorderColor colorLine
           
protected  DefaultScreenDockWindowBorder.BorderColor colorLineHighlightInner
           
protected  DefaultScreenDockWindowBorder.BorderColor colorLineHighlightOuter
           
protected  DefaultScreenDockWindowBorder.BorderColor colorLineShadowInner
           
protected  DefaultScreenDockWindowBorder.BorderColor colorLineShadowOuter
           
protected  DefaultScreenDockWindowBorder.BorderColor colorSelected
           
protected  DefaultScreenDockWindowBorder.BorderColor colorShadowInner
           
protected  DefaultScreenDockWindowBorder.BorderColor colorShadowInnerHover
           
protected  DefaultScreenDockWindowBorder.BorderColor colorShadowInnerSelected
           
protected  DefaultScreenDockWindowBorder.BorderColor colorShadowOuter
           
protected  DefaultScreenDockWindowBorder.BorderColor colorShadowOuterHover
           
protected  DefaultScreenDockWindowBorder.BorderColor colorShadowOuterSelected
           
static ScreenDockWindowBorderFactory FACTORY
          A factory creating new DefaultScreenDockWindowBorders.
 
Constructor Summary
DefaultScreenDockWindowBorder(ScreenDockWindow window, JComponent target)
          Creates a new border
 
Method Summary
protected  Color defaultModify(Color color, boolean inner, boolean shadow)
          Creates colors for parts of this border based on some basic color.
 Insets getBorderInsets(Component c)
           
 DockController getController()
          Gets the DockController which is currently associated with this border
 int getCornerSize()
          Gets the size of the corners in pixels.
protected  Color getHoverColor(Component c)
          Gets the base color used for painting a region under the mouse
protected  Color getHoverColor(Component c, boolean inner, boolean shadow)
          Gets a color to paint some part of this border that is under the mouse.
protected  Color getLine(Component c)
          Gets the color that should be used for painting a line.
protected  Color getLine(Component c, boolean inner, boolean shadow)
          Gets the color that should be used for painting a line.
 int getMoveSize()
          Gets the size of the area at the top that can be grabbed in pixels.
protected  Color getNormalColor(Component c)
          Gets a color to paint some part of this border.
protected  Color getNormalColor(Component c, boolean inner, boolean shadow)
          Gets a color to paint some part of this.
protected  Color getSelectedColor(Component c)
          Gets a color to paint some part of this border that is under the pressed mouse.
protected  Color getSelectedColor(Component c, boolean inner, boolean shadow)
          Gets a color to paint some part of this border that is under the pressed mouse.
 boolean isBorderOpaque()
           
 boolean isDrawDividers()
          Tells whether dividing lines are painted
 void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
           
 void setController(DockController controller)
          Sets the DockController which should be monitored for receiving colors.
 void setCornerSize(int cornerSize)
          Sets the size of the corners in pixels.
 void setDrawDividers(boolean drawDividers)
          Sets whether dividing lines are to be painted or not
 void setMouseOver(ScreenDockWindowBorder.Position mouseOver)
          Sets where the mouse is currently hovering.
 void setMousePressed(ScreenDockWindowBorder.Position mousePressed)
          Sets where the mouse is currently pressed.
 void setMoveSize(int moveSize)
          Sets the size of the area at the top that can be grabbed and used to move the window.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACTORY

public static final ScreenDockWindowBorderFactory FACTORY
A factory creating new DefaultScreenDockWindowBorders.


colorLine

protected final DefaultScreenDockWindowBorder.BorderColor colorLine

colorLineHighlightInner

protected final DefaultScreenDockWindowBorder.BorderColor colorLineHighlightInner

colorLineHighlightOuter

protected final DefaultScreenDockWindowBorder.BorderColor colorLineHighlightOuter

colorLineShadowInner

protected final DefaultScreenDockWindowBorder.BorderColor colorLineShadowInner

colorLineShadowOuter

protected final DefaultScreenDockWindowBorder.BorderColor colorLineShadowOuter

color

protected final DefaultScreenDockWindowBorder.BorderColor color

colorHighlightInner

protected final DefaultScreenDockWindowBorder.BorderColor colorHighlightInner

colorHighlightOuter

protected final DefaultScreenDockWindowBorder.BorderColor colorHighlightOuter

colorShadowInner

protected final DefaultScreenDockWindowBorder.BorderColor colorShadowInner

colorShadowOuter

protected final DefaultScreenDockWindowBorder.BorderColor colorShadowOuter

colorHover

protected final DefaultScreenDockWindowBorder.BorderColor colorHover

colorHighlightInnerHover

protected final DefaultScreenDockWindowBorder.BorderColor colorHighlightInnerHover

colorHighlightOuterHover

protected final DefaultScreenDockWindowBorder.BorderColor colorHighlightOuterHover

colorShadowInnerHover

protected final DefaultScreenDockWindowBorder.BorderColor colorShadowInnerHover

colorShadowOuterHover

protected final DefaultScreenDockWindowBorder.BorderColor colorShadowOuterHover

colorSelected

protected final DefaultScreenDockWindowBorder.BorderColor colorSelected

colorHighlightInnerSelected

protected final DefaultScreenDockWindowBorder.BorderColor colorHighlightInnerSelected

colorHighlightOuterSelected

protected final DefaultScreenDockWindowBorder.BorderColor colorHighlightOuterSelected

colorShadowInnerSelected

protected final DefaultScreenDockWindowBorder.BorderColor colorShadowInnerSelected

colorShadowOuterSelected

protected final DefaultScreenDockWindowBorder.BorderColor colorShadowOuterSelected
Constructor Detail

DefaultScreenDockWindowBorder

public DefaultScreenDockWindowBorder(ScreenDockWindow window,
                                     JComponent target)
Creates a new border

Parameters:
window - the window for which this border is used
target - the component which is painted by this
Method Detail

setController

public void setController(DockController controller)
Description copied from interface: ScreenDockWindowBorder
Sets the DockController which should be monitored for receiving colors.

Specified by:
setController in interface ScreenDockWindowBorder
Parameters:
controller - the new controller, can be null

getController

public DockController getController()
Gets the DockController which is currently associated with this border

Returns:
the controller, may be null

setCornerSize

public void setCornerSize(int cornerSize)
Description copied from interface: ScreenDockWindowBorder
Sets the size of the corners in pixels. If the mouse is in a corner, then the window can be resized in two dimensions.

Specified by:
setCornerSize in interface ScreenDockWindowBorder
Parameters:
cornerSize - the size in pixels, at least 0

getCornerSize

public int getCornerSize()
Gets the size of the corners in pixels.

Returns:
the size in pixels

setMoveSize

public void setMoveSize(int moveSize)
Sets the size of the area at the top that can be grabbed and used to move the window.

Specified by:
setMoveSize in interface ScreenDockWindowBorder
Parameters:
moveSize - the size, at least 0

getMoveSize

public int getMoveSize()
Gets the size of the area at the top that can be grabbed in pixels.

Returns:
the size in pixels

setDrawDividers

public void setDrawDividers(boolean drawDividers)
Sets whether dividing lines are to be painted or not

Parameters:
drawDividers - true if lines should be painted

isDrawDividers

public boolean isDrawDividers()
Tells whether dividing lines are painted

Returns:
true if lines are painted

setMouseOver

public void setMouseOver(ScreenDockWindowBorder.Position mouseOver)
Description copied from interface: ScreenDockWindowBorder
Sets where the mouse is currently hovering.

Specified by:
setMouseOver in interface ScreenDockWindowBorder
Parameters:
mouseOver - the position, null equals ScreenDockWindowBorder.Position.NOTHING

setMousePressed

public void setMousePressed(ScreenDockWindowBorder.Position mousePressed)
Description copied from interface: ScreenDockWindowBorder
Sets where the mouse is currently pressed.

Specified by:
setMousePressed in interface ScreenDockWindowBorder
Parameters:
mousePressed - the position, null equals ScreenDockWindowBorder.Position.NOTHING

getBorderInsets

public Insets getBorderInsets(Component c)
Specified by:
getBorderInsets in interface Border

isBorderOpaque

public boolean isBorderOpaque()
Specified by:
isBorderOpaque in interface Border

paintBorder

public void paintBorder(Component c,
                        Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
Specified by:
paintBorder in interface Border

getLine

protected Color getLine(Component c)
Gets the color that should be used for painting a line.

Parameters:
c - the component for which the line is painted
Returns:
the color, not null

getLine

protected Color getLine(Component c,
                        boolean inner,
                        boolean shadow)
Gets the color that should be used for painting a line.

Parameters:
c - the component for which the line is painted
inner - whether the inner or the outer rectangle is painted
shadow - whether the shadow or the highlight part is painted
Returns:
the color, not null

getHoverColor

protected Color getHoverColor(Component c)
Gets the base color used for painting a region under the mouse

Parameters:
c - the component for which the border is painted
Returns:
the color, not null

getHoverColor

protected Color getHoverColor(Component c,
                              boolean inner,
                              boolean shadow)
Gets a color to paint some part of this border that is under the mouse.

Parameters:
c - the component for which the border is painted
inner - whether the inner or the outer rectangle is painted
shadow - whether the shadow or the highlight part is painted
Returns:
the color, not null

getSelectedColor

protected Color getSelectedColor(Component c)
Gets a color to paint some part of this border that is under the pressed mouse.

Parameters:
c - the component for which the border is painted
Returns:
the color, not null

getSelectedColor

protected Color getSelectedColor(Component c,
                                 boolean inner,
                                 boolean shadow)
Gets a color to paint some part of this border that is under the pressed mouse.

Parameters:
c - the component for which the border is painted
inner - whether the inner or the outer rectangle is painted
shadow - whether the shadow or the highlight part is painted
Returns:
the color, not null

getNormalColor

protected Color getNormalColor(Component c)
Gets a color to paint some part of this border.

Parameters:
c - the component for which the border is painted
Returns:
the color, not null

getNormalColor

protected Color getNormalColor(Component c,
                               boolean inner,
                               boolean shadow)
Gets a color to paint some part of this.

Parameters:
c - the component for which the border is painted
inner - whether the inner or the outer rectangle is painted
shadow - whether the shadow or the highlight part is painted
Returns:
the color, not null

defaultModify

protected Color defaultModify(Color color,
                              boolean inner,
                              boolean shadow)
Creates colors for parts of this border based on some basic color.

Parameters:
color - the basic color
inner - whether the inner or the outer rectangle is painted
shadow - whether the shadow or the highlight part is painted
Returns:
the modified color