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

public final class ArtDocument

  1. Object
  2. ArtDocument

An artwork: a canvas size and a tree of nodes.

Read one with ArtFormats.read, or build one in code. Render it with ArtRenderer, show it with ArtView, edit it with ArtModel and ArtEditor.

Constructors

public ArtDocument(double width, double height)Creates an empty document.

Methods

public double getWidth()Canvas width.
public double getHeight()Canvas height.
public void setSize(double width, double height)Resizes the canvas.
public GroupNode getRoot()The root group.
public void setRoot(GroupNode root)Replaces the root.
public String getTitle()The title, or null.
public void setTitle(String title)Sets the title.
public List<ImportNote> getNotes()What the reader that produced this document could not represent exactly.
public ArtDocument copy()A deep copy.
public ArtNode findById(String id)Finds a node by id anywhere in the tree.
public GroupNode parentOf(ArtNode node)The group that holds node, or null when it is the root or not in this document.
public Matrix toDocument(ArtNode node)The transform from node’s space to document space, or null when it is not here.

Inherited methods

Constructor details

ArtDocument

public ArtDocument(double width, double height)
Creates an empty document.

Parameters

width double
canvas width
height double
canvas height

Method details

getWidth

public double getWidth()
Canvas width.

getHeight

public double getHeight()
Canvas height.

setSize

public void setSize(double width, double height)
Resizes the canvas.

Parameters

width double
new width
height double
new height

getRoot

public GroupNode getRoot()
The root group.

setRoot

public void setRoot(GroupNode root)
Replaces the root.

Parameters

root GroupNode
the new root

getTitle

public String getTitle()
The title, or null.

setTitle

public void setTitle(String title)
Sets the title.

Parameters

title String
the title

getNotes

public List<ImportNote> getNotes()
What the reader that produced this document could not represent exactly.

copy

public ArtDocument copy()
A deep copy.

findById

public ArtNode findById(String id)
Finds a node by id anywhere in the tree.

Parameters

id String
the id

parentOf

public GroupNode parentOf(ArtNode node)
The group that holds node, or null when it is the root or not in this document.

Parameters

node ArtNode
the node

toDocument

public Matrix toDocument(ArtNode node)
The transform from node’s space to document space, or null when it is not here.

Parameters

node ArtNode
the node