Q: How can I make the border of a table node thick and red?
A: Use node.setStroke() and tableNode.setStrokeThickness(). They are both inherited from DiagramItem, so you can use them with any type of node.
Q: How can I change the font for all diagram items?
A: You should do this using a style:
var defaultStyle = new Style(); defaultStyle.setFontName("Verdana"); diagram.setStyle(defaultStyle);
Q: How can I wrap text inside nodes?
A: Text inside ShapeNode-s is wrapped by default. If you have nonbreaking text that you need to wrap, you must set the enableStyledText property to true and it will wrap the text on char by char basis:
var shapeNode1 = diagram.getFactory().createShapeNode(new Rect(0, 0, 30, 25)); shapeNode1.setText("Hello from ShapeNode 1!"); shapeNode1.setEnableStyledText(true);Another option is to call ShapeNode.resizeToFitText(). That would guarantee that no word will be cut and the node’s dimensions will accommodate their text.
Q: I would like to place text with hyperlinks inside my tables.
A: In order to do this you should enable styled text for the node:
startNode.setEnableStyledText (true); startNode.setText("This is <a href="http://site.org">.....</a>");Then you can use some HTML-like formatting tags for your text. A list with currently supported text is available here.
Q: How can I handle hyperlinks from text inside my nodes?
A: You can handle the hyperlinkClicked event if you have several links in a node:
// node is a ShapeNode instance node.setText("test <a href ='http://mindfusion.eu'>link</a> test and another <a href=”http://clientsarea.eu”>diagram test</a>"); node.setEnableStyledText(true); //... // attach an event listener to the hyperlinkClicked event diagram.addEventListener(Events.hyperlinkClicked, onHyperlinkClicked); function onHyperlinkClicked(sender, args) { window.open(args.getHyperlink()); }If you want your node to represent a single hyperlink that opens when the node is clicked you can store the hyperlink and handle the nodeClicked event:
//... this.setHyperLink(""); //... function onNodeClicked(sender, args) { // ... window.open(args.getNode().getHyperLink()); }