Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

ShapeNode


A ShapeNode is an instance of the ShapeNode. This class is accessed through the GraphMLNode or the GraphMLGroupNode and allows to set various properties for the node Shape:
  • Border style
  • Label
  • Background color
  • Node geometry
  • Node type (rectangle, circle, etc...)
  • Node drop shadow
Some of these properties can directly be set or get through the node.

Getting the ShapeNode for a node

For a GraphMLNode, you can use the GraphMLNode.getShapeNode() method.

For a GraphMLGroupNode, there is one ShapeNode for each state (opened or closed). You can access the ShapeNode through one of the following methods:

Setting the ShapeNode properties

To set the size of a node, such that it will always be set to correctly enclose its label:
      GraphMLNode node = diagram.addNode();
      ShapeNode shapeNode = node.getShapeNode();
      shapeNode.setAutosized(true);
To set the color of a node:
      GraphMLNode node = diagram.addNode();
      ShapeNode shapeNode = node.getShapeNode();
      shapeNode.setFillColor("red");
To add a drop shadow to a node with a default black color and an offset of 3 on x and y:
      GraphMLNode node = diagram.addNode();
      ShapeNode shapeNode = node.getShapeNode();
      DropShadow dropShadow = new DropShadow(3, 3);
      shapeNode.setDropShadow(dropShadow);
Can also be directly set through the node:
      GraphMLNode node = diagram.addNode();
      DropShadow dropShadow = new DropShadow(3, 3);
      node.setDropShadow(dropShadow);

Categories: general | nodes

Copyright 2021 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence