Package com.codename1.graph


package com.codename1.graph

Graphs as data: nodes, the edges between them, the groups they belong to, and the arrangements that place them. What a com.codename1.ui.graph.NodeGraph shows.

Nothing here draws, and everything runs without a component, on a server too.

  • GraphModel is the graph. DefaultGraphModel keeps one in memory and accepts edits, each checked by a ConnectionValidator.
  • A GraphNode is a box in world units. Give it GraphPorts for a node editor, where edges join an output to an input of the same type; leave it without for a diagram, where edges join nodes.
  • A GraphGroup is a box drawn around its members, and can collapse.
  • com.codename1.graph.arrange places the nodes automatically.

The classes are not thread safe: use a model from one thread, which for a model shown by a component is the EDT.

  • Class
    Description
    The listener list, the lookups and the refusals every read-only model shares.
    Decides whether an edge may be made.
    An editable graph kept in memory.
    Told when the nodes, edges or groups of a GraphModel change.
    A connection from one node to another, optionally from a port to a port.
    A labeled box drawn around the nodes whose group id names it, such as the services of one subsystem.
    The nodes, edges and groups a com.codename1.ui.graph.NodeGraph shows.
    A box in a graph: a position and a size in world units, a label, and optionally ports and a group.
    A place on a GraphNode where edges attach, as in a node editor.