org.odftoolkit.simple.style
Class GraphicProperties

java.lang.Object
  extended by org.odftoolkit.simple.style.GraphicProperties

public class GraphicProperties
extends Object

This class represents the graphic style settings. It provides methods to access borders and background styles. More functions will be added later.

This class is a corresponded high level class for element "style:graphic-properties". It provides methods to access the attributes and children of "style:graphic-properties".

Since:
0.5

Constructor Summary
protected GraphicProperties(StyleGraphicPropertiesElement properties)
          Create a paragraph style setting object, which has the association with an element "style:paragraph-properties".
 
Method Summary
 Border getBorder()
          Return the border setting for all four borders.
 Border getBottomBorder()
          Return the border setting for the bottom border.
static GraphicProperties getGraphicProperties(OdfStyleBase style)
          Return an instance of GraphicProperties
 StyleTypeDefinitions.FrameHorizontalPosition getHorizontalPosition()
          Return the horizontal position
 StyleTypeDefinitions.HorizontalRelative getHorizontalRelative()
          Return the horizontal relative
 Border getLeftBorder()
          Return the border setting for the left border.
static GraphicProperties getOrCreateGraphicProperties(OdfStyleBase style)
          Return an instance of GraphicProperties
 Border getRightBorder()
          Return the border setting for the right border.
 Border getTopBorder()
          Return the border setting for the top border.
 StyleTypeDefinitions.FrameVerticalPosition getVerticalPosition()
          Return the vertical position
 StyleTypeDefinitions.VerticalRelative getVerticalRelative()
          Return the vertical relative
 void setBorder(Border border)
          Set the border definition for all four borders.
 void setBorders(StyleTypeDefinitions.CellBordersType bordersType, Border border)
          Set the border style.
 void setBottomBorder(Border border)
          Set the border definition for the bottom border.
 void setFill(StyleTypeDefinitions.OdfDrawFill fillType, Color color)
          Set the fill style for a graphic object.
 void setHorizontalPosition(StyleTypeDefinitions.FrameHorizontalPosition horizontalPos)
          Set the horizontal position
 void setHorizontalRelative(StyleTypeDefinitions.HorizontalRelative relative)
          Set the horizontal relative
 void setLeftBorder(Border border)
          Set the border definition for the left border.
 void setRightBorder(Border border)
          Set the border definition for the right border.
 void setStroke(StyleTypeDefinitions.OdfDrawStroke stroke, Color color, String widthDesc, String dashStyleName)
          Set the style of stroke.
 void setStyleRunThrough(boolean isBackgroundObject)
          Set whether the content of a graphic object is displayed in the background or foreground.
 void setTopBorder(Border border)
          Set the border definition for the top border.
 void setVerticalPosition(StyleTypeDefinitions.FrameVerticalPosition verticalPos)
          Set the vertical position
 void setVerticalRelative(StyleTypeDefinitions.VerticalRelative relative)
          Set the vertical relative
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicProperties

protected GraphicProperties(StyleGraphicPropertiesElement properties)
Create a paragraph style setting object, which has the association with an element "style:paragraph-properties".

Parameters:
properties - - the element "style:paragraph-properties"
Method Detail

getOrCreateGraphicProperties

public static GraphicProperties getOrCreateGraphicProperties(OdfStyleBase style)
Return an instance of GraphicProperties

to represent the "style:graphic-properties" in a style element.

If there is no "style:graphic-properties" defined in the style element, a new "style:graphic-properties" element will be created.

Parameters:
style - - a style element
Returns:
an instance of GraphicProperties


getGraphicProperties

public static GraphicProperties getGraphicProperties(OdfStyleBase style)
Return an instance of GraphicProperties

to represent the "style:graphic-properties" in a style element.

If there is no "style:graphic-properties" defined in the style element, null will be returned.

Parameters:
style - - a style element
Returns:
an instance of GraphicProperties

;Null if there is no "style:graphic-properties" defined

setBorders

public void setBorders(StyleTypeDefinitions.CellBordersType bordersType,
                       Border border)
Set the border style.

The first parameter bordersType describes which borders you want to apply the style to, e.g. up border, bottom border, left border, right border, diagonal lines or four borders.

The border style information will be removed if the parameter bordersType is NONE.

Parameters:
bordersType - - the type of the borders
border - - the border style description

getBorder

public Border getBorder()
Return the border setting for all four borders.

Null will be returned if there is no border setting for all four borders.

Returns:
the border setting

getTopBorder

public Border getTopBorder()
Return the border setting for the top border.

Null will be returned if there is no border setting for the top border.

Returns:
the border setting

getLeftBorder

public Border getLeftBorder()
Return the border setting for the left border.

Null will be returned if there is no border setting for the left border.

Returns:
the border setting

getRightBorder

public Border getRightBorder()
Return the border setting for the right border.

Null will be returned if there is no border setting for the right border.

Returns:
the border setting

getBottomBorder

public Border getBottomBorder()
Return the border setting for the bottom border.

Null will be returned if there is no border setting for the bottom border.

Returns:
the border setting

setBottomBorder

public void setBottomBorder(Border border)
Set the border definition for the bottom border.

If the parameter border is null, the border definition for the bottom border will be removed.

If the line type in the border definition is NONE, the border definition for the bottom border will be removed.

Parameters:
border - - the border setting

setTopBorder

public void setTopBorder(Border border)
Set the border definition for the top border.

If the parameter border is null, the border definition for the top border will be removed.

If the line type in the border definition is NONE, the border definition for the top border will be removed.

Parameters:
border - - the border setting

setLeftBorder

public void setLeftBorder(Border border)
Set the border definition for the left border.

If the parameter border is null, the border definition for the left border will be removed.

If the line type in the border definition is NONE, the border definition for the left border will be removed.

Parameters:
border - - the border setting

setRightBorder

public void setRightBorder(Border border)
Set the border definition for the right border.

If the parameter border is null, the border definition for the right border will be removed.

If the line type in the border definition is NONE, the border definition for the right border will be removed.

Parameters:
border - - the border setting

setBorder

public void setBorder(Border border)
Set the border definition for all four borders.

If the parameter border is null, the border definition for all four borders will be removed.

If the line type in the border definition is NONE, the border definition for all four borders will be removed.

Parameters:
border - - the border setting

setStroke

public void setStroke(StyleTypeDefinitions.OdfDrawStroke stroke,
                      Color color,
                      String widthDesc,
                      String dashStyleName)
Set the style of stroke.

There are three types of stroke: none, solid and dash.

If the stroke is NONE, there is no stroke around the frame.

If the stroke is SOLID, there is solid line around the frame. color and width need to be specified.

If the stroke is DASH, there is dash line around the frame. color, width and the style name of dash line need to be specified.

Parameters:
stroke - the stroke type
color - the color of the stroke
widthDesc - the width description of the stroke, e.g. "0.01in"
dashStyleName - the dash style name
See Also:
StyleTypeDefinitions.OdfDrawStroke

setFill

public void setFill(StyleTypeDefinitions.OdfDrawFill fillType,
                    Color color)
Set the fill style for a graphic object.

This method supports 2 types of fill: none and solid.

If the fill type is NONE, the object is no filled at all.

If the fill type is SOLID, the drawing object is filled with the color specified by the second parameter.

Parameters:
fillType - the fill style type
color - the specified color

setStyleRunThrough

public void setStyleRunThrough(boolean isBackgroundObject)
Set whether the content of a graphic object is displayed in the background or foreground. If it's displayed in the background, the content wouldn't be selected or moved.

Parameters:
isBackgroundObject - If true, the graphic object is displayed in the background.
Since:
0.5.5

setHorizontalPosition

public void setHorizontalPosition(StyleTypeDefinitions.FrameHorizontalPosition horizontalPos)
Set the horizontal position

Parameters:
horizontalPos - the horizontal position
Since:
0.5.5

setHorizontalRelative

public void setHorizontalRelative(StyleTypeDefinitions.HorizontalRelative relative)
Set the horizontal relative

Parameters:
relative - the horizontal relative
Since:
0.5.5

setVerticalRelative

public void setVerticalRelative(StyleTypeDefinitions.VerticalRelative relative)
Set the vertical relative

Parameters:
relative - the vertical relative
Since:
0.5.5

setVerticalPosition

public void setVerticalPosition(StyleTypeDefinitions.FrameVerticalPosition verticalPos)
Set the vertical position

Parameters:
verticalPos - the vertical position
Since:
0.5.5

getHorizontalPosition

public StyleTypeDefinitions.FrameHorizontalPosition getHorizontalPosition()
Return the horizontal position

Returns:
the horizontal position
Since:
0.5.5

getVerticalPosition

public StyleTypeDefinitions.FrameVerticalPosition getVerticalPosition()
Return the vertical position

Returns:
the vertical position
Since:
0.5.5

getVerticalRelative

public StyleTypeDefinitions.VerticalRelative getVerticalRelative()
Return the vertical relative

Returns:
the vertical relative
Since:
0.5.5

getHorizontalRelative

public StyleTypeDefinitions.HorizontalRelative getHorizontalRelative()
Return the horizontal relative

Returns:
the horizontal relative
Since:
0.5.5


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.