Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public abstract class SlideElement
- Object
- SlideElement
Known subtypesChartElement, DiagramElement, GroupElement, PictureElement, ShapeElement, TableElement
Something placed on a slide: a shape, a picture, a table, a chart, a diagram or a group of
them. Every element has an id unique in its presentation, a box in points from the slide’s
top left corner, and a rotation about the box’s centre. Elements are immutable; the
with... methods answer changed copies.Fields
public final String id | The id, unique within the presentation. |
public final String name | A name for people and screen readers, or null. |
public final float x | The box’s left edge in points. |
public final float y | The box’s top edge in points. |
public final float width | The box’s width in points, at least 0. |
public final float height | The box’s height in points, at least 0. |
public final float rotation | Clockwise rotation in degrees about the box’s centre. |
public final boolean flipH | True when mirrored left to right. |
public final boolean flipV | True when mirrored top to bottom. |
Constructors
protected SlideElement(String id, String name, float x, float y, float width, float height, float rotation, boolean flipH, boolean flipV) | Base constructor. |
Methods
public abstract SlideElement withTransform(float x, float y, float width, float height, float rotation, boolean flipH, boolean flipV) | This element moved, resized, rotated or flipped. |
public abstract SlideElement withId(String value) | This element with another id, for copies. |
public SlideElement withBounds(float nx, float ny, float nw, float nh) | This element moved and resized, keeping its rotation and flips. |
public SlideElement withRotation(float degrees) | This element rotated to an angle. |
public String plainText() | The text of the element for search, outlines and screen readers. |
public boolean contains(float px, float py) | True when the point, in slide points, is inside the element’s rotated box. |
protected final boolean sameFrame(SlideElement e) | True when the base fields equal another element’s. |
protected final int frameHash() | A hash of the base fields. |
Inherited methods
Field details
id
public final String idThe id, unique within the presentation.
name
public final String nameA name for people and screen readers, or null.
x
public final float xThe box’s left edge in points.
y
public final float yThe box’s top edge in points.
width
public final float widthThe box’s width in points, at least 0.
height
public final float heightThe box’s height in points, at least 0.
rotation
public final float rotationClockwise rotation in degrees about the box’s centre.
flipH
public final boolean flipHTrue when mirrored left to right.
flipV
public final boolean flipVTrue when mirrored top to bottom.
Constructor details
SlideElement
protected SlideElement(String id, String name, float x, float y, float width, float height, float rotation, boolean flipH, boolean flipV)Base constructor.
Parameters
idString- the id, not empty
nameString- a name, or null
xfloat- left edge in points
yfloat- top edge
widthfloat- width
heightfloat- height
rotationfloat- degrees clockwise
flipHboolean- mirrored horizontally
flipVboolean- mirrored vertically
Method details
withTransform
public abstract SlideElement withTransform(float x, float y, float width, float height, float rotation, boolean flipH, boolean flipV)This element moved, resized, rotated or flipped.
Parameters
xfloat- left edge
yfloat- top edge
widthfloat- width
heightfloat- height
rotationfloat- degrees clockwise
flipHboolean- mirrored horizontally
flipVboolean- mirrored vertically
Returns
the changed element
withId
public abstract SlideElement withId(String value)This element with another id, for copies.
Parameters
valueString- the id
Returns
the element
withBounds
public SlideElement withBounds(float nx, float ny, float nw, float nh)This element moved and resized, keeping its rotation and flips.
Parameters
nxfloat- left edge
nyfloat- top edge
nwfloat- width
nhfloat- height
Returns
the element
withRotation
public SlideElement withRotation(float degrees)This element rotated to an angle.
Parameters
degreesfloat- clockwise
Returns
the element
plainText
public String plainText()The text of the element for search, outlines and screen readers.
Returns
the text, empty when there is none
contains
public boolean contains(float px, float py)True when the point, in slide points, is inside the element’s rotated box.
Parameters
pxfloat- x
pyfloat- y
Returns
true when inside
sameFrame
protected final boolean sameFrame(SlideElement e)True when the base fields equal another element’s.
Parameters
eSlideElement- the other
Returns
true when equal
frameHash
protected final int frameHash()A hash of the base fields.
Returns
the hash