org.odftoolkit.simple.draw
Class Control

java.lang.Object
  extended by org.odftoolkit.simple.Component
      extended by org.odftoolkit.simple.draw.Control

public class Control
extends Component

This class represents control object, a shape that is linked to a control inside an form. It provides methods to get/set control properties, content, and styles.

Since:
0.8

Constructor Summary
Control(DrawControlElement element)
           
 
Method Summary
 OdfElement getContainerElement()
          Get the container element which contains this control.
static Control getInstanceof(DrawControlElement element)
          Get an instance of control according to a DrawControlElement.
 DrawControlElement getOdfElement()
          Get the instance of DrawControlElement which represents this control.
 FrameRectangle getRectangle()
          Return the rectangle used by this control
 ControlStyleHandler getStyleHandler()
          Return the style handler for this control
static Control newDrawControl(ControlContainer container)
          Create an instance of control and and append it at the end of a container element.
 boolean remove()
          Remove the shape control from the container.
 void setAchorType(StyleTypeDefinitions.AnchorType achorType)
          Set how a form control is bound to a text document.
 void setControl(String formControlId)
          Set a control within a form that is linked to this control shape by its ID.
 void setFormatString(String formatStr, String type)
          Set the format string of the input control.
 void setRectangle(FrameRectangle rectangle)
          Set the rectangle used by this control
 
Methods inherited from class org.odftoolkit.simple.Component
getComponentByElement, getOwnerDocument, registerComponent, unregisterComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Control

public Control(DrawControlElement element)
Method Detail

getContainerElement

public OdfElement getContainerElement()
Get the container element which contains this control.

Returns:
the container element.

getOdfElement

public DrawControlElement getOdfElement()
Get the instance of DrawControlElement which represents this control.

Specified by:
getOdfElement in class Component
Returns:
the instance of DrawControlElement

newDrawControl

public static Control newDrawControl(ControlContainer container)
Create an instance of control and and append it at the end of a container element.

Parameters:
container - - the container element
Returns:
a control instance

getInstanceof

public static Control getInstanceof(DrawControlElement element)
Get an instance of control according to a DrawControlElement.

Parameters:
element - - an instance of DrawControlElement
Returns:
an instance of DrawControlElement

remove

public boolean remove()
Remove the shape control from the container.

The resource is removed if it's only used by this object.

Returns:
true if the shape control is successfully removed; false if otherwise.

getStyleHandler

public ControlStyleHandler getStyleHandler()
Return the style handler for this control

Returns:
the style handler

setControl

public void setControl(String formControlId)
Set a control within a form that is linked to this control shape by its ID.

Parameters:
formControlId - - id of a form control

setAchorType

public void setAchorType(StyleTypeDefinitions.AnchorType achorType)
Set how a form control is bound to a text document. Default position relative and alignment will be set.

If the document is not text document, nothing will happen.

Parameters:
achorType - - the point at which a form control is bound to a text document

setRectangle

public void setRectangle(FrameRectangle rectangle)
Set the rectangle used by this control

Parameters:
rectangle - - the rectangle used by this control

getRectangle

public FrameRectangle getRectangle()
Return the rectangle used by this control

Returns:
- the rectangle used by this control

setFormatString

public void setFormatString(String formatStr,
                            String type)
Set the format string of the input control.

This function only works for date, time and percentage, otherwise an IllegalArgumentException will be thrown.

For value type percentage, the formatStr must follow the encoding rule of java.text.DecimalFormat. For value type date and time, the formatStr must follow the encoding rule of java.text.SimpleDateFormat.

Parameters:
formatStr - -the input need be formatted as this specified format string.
type - - the type that need to be set
Throws:
IllegalArgumentException - if formatStr is null or the value type is supported.
See Also:
SimpleDateFormat, DecimalFormat


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