Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public abstract class SlideElement

  1. Object
  2. 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 idThe id, unique within the presentation.
public final String nameA name for people and screen readers, or null.
public final float xThe box’s left edge in points.
public final float yThe box’s top edge in points.
public final float widthThe box’s width in points, at least 0.
public final float heightThe box’s height in points, at least 0.
public final float rotationClockwise rotation in degrees about the box’s centre.
public final boolean flipHTrue when mirrored left to right.
public final boolean flipVTrue 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 id
The id, unique within the presentation.

name

public final String name
A name for people and screen readers, or null.

x

public final float x
The box’s left edge in points.

y

public final float y
The box’s top edge in points.

width

public final float width
The box’s width in points, at least 0.

height

public final float height
The box’s height in points, at least 0.

rotation

public final float rotation
Clockwise rotation in degrees about the box’s centre.

flipH

public final boolean flipH
True when mirrored left to right.

flipV

public final boolean flipV
True 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

id String
the id, not empty
name String
a name, or null
x float
left edge in points
y float
top edge
width float
width
height float
height
rotation float
degrees clockwise
flipH boolean
mirrored horizontally
flipV boolean
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

x float
left edge
y float
top edge
width float
width
height float
height
rotation float
degrees clockwise
flipH boolean
mirrored horizontally
flipV boolean
mirrored vertically

Returns

the changed element

withId

public abstract SlideElement withId(String value)
This element with another id, for copies.

Parameters

value String
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

nx float
left edge
ny float
top edge
nw float
width
nh float
height

Returns

the element

withRotation

public SlideElement withRotation(float degrees)
This element rotated to an angle.

Parameters

degrees float
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

px float
x
py float
y

Returns

true when inside

sameFrame

protected final boolean sameFrame(SlideElement e)
True when the base fields equal another element’s.

Parameters

e SlideElement
the other

Returns

true when equal

frameHash

protected final int frameHash()
A hash of the base fields.

Returns

the hash