Constructor
new BoxBase(parentopt)
BoxBase constructor
Name | Type | Attributes | Description |
---|---|---|---|
parent | module:boxes/BoxBase. | <optional> | Another BoxBase object used to determine the value of properties not |
- Source
Members
alternativeColor :string
The color used to draw text when a cell is in alternative
state.
- string
- Source
backColor :string
The background color
- string
- Source
bgGradient :module:AWT.Gradient
The background gradient. Default is null
.
- Source
borderColor :string
The color of the border.
- string
- Source
borderStroke :module:AWT.Stroke
The stroke used to draw the border.
- Source
defaultValues :object
Default values
- object
- Source
dontFill :boolean
Wheter the cell's background should be painted or not. This property has no effect on
hosted components.
- boolean
- Source
dynFontSize :number
The current font size of this BoxBase. Can be dynamically adjusted when drawing.
- number
- Source
font :module:AWT.Font
Font size can be dynamically reduced to fit the available space if any element using thisBoxBase
requests it. When this happen, this field contains the real font currently used
to draw text.
- Source
inactiveColor :string
The color used to draw text when a cell is in inactive
state.
- string
- Source
markerStroke :module:AWT.Stroke
The stroke used to draw a border around marked cells.
- Source
parent :module:boxes/BoxBase.BoxBase
The parent BoxBase object
- Source
resetFontCounter :number
Counts the number of times the dynFontSize
has been reset. This is useful to avoid excessive
recursive loops searching the optimal font size.
- number
- Source
shadow :boolean
Whether the text should have a shadow or not
- boolean
- Source
shadowColor :string
The color used to draw a shadow below regular text.
- string
- Source
textColor :string
The color used to write text.
- string
- Source
textMargin :number
The margin to respect between text elements and the limits of the cell or other elements.
- number
- Source
transparent :boolean
Whether the cell's background (and its hosted component, if any) should be transparent
- boolean
- Source
Methods
get(property) → {any}
Gets the value of the specified property, scanning down to parents and prototype if not defined.
Name | Type | Description |
---|---|---|
property | string | The property to retrieve |
- Source
- The object or value associated to this property
- Type:
- any
getAttributes() → {object}
Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.
- Source
- The resulting object, with minimal attrributes
- Type:
- object
getCSS(cssopt, inactiveopt, inverseopt, alternativeopt) → {object}
Gets the properties defined in this BoxBase as a collection of CSS attributes
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
css | object | <optional> | An optional set of initial CSS properties | |
inactive | boolean | <optional> | false | When |
inverse | boolean | <optional> | false | When |
alternative | boolean | <optional> | false | When |
- Source
- Type:
- object
getOwn(property) → {any}
Gets the value of the specified property, scanning down to parents if not defined, and returning
always an own property (not from prototype)
Name | Type | Description |
---|---|---|
property | string | The property to retrieve |
- Source
- The object or value associated to this property
- Type:
- any
prepareText(ctx, text, maxWidth, maxHeight) → {Array.<object>}
This utility method computes the width and height of text lines rendered on an HTML
canvas element, reducing the font size of the BoxBase as needed when they exceed the maximum
width and/or height.
Name | Type | Description |
---|---|---|
ctx | external:CanvasRenderingContext2D | The canvas rendering context used to draw the text. |
text | string | The text to drawn. |
maxWidth | number | Maximum width |
maxHeight | number | Maximum height |
- Source
- An array of objects representing lines of text. Each object has a
text
member with the text displayed in the line, and asize
member with the linemodule:AWT.Dimension
- Type:
- Array.<object>
set(property, value)
Sets the value of a specific property.
Name | Type | Description |
---|---|---|
property | string | The property name. |
value | any | Depends on the type of property |
- Source
setAttributes(data) → {module:boxes/BoxBase.BoxBase}
Reads the properties of this BoxBase from a data object
Name | Type | Description |
---|---|---|
data | object | The data object to be parsed |
- Source
setProperties($xml)
Loads the BoxBase settings from a specific JQuery XML element
Name | Type | Description |
---|---|---|
$xml | external:jQuery | The XML element to parse |
- Source