From 6be58049f752e66b99f703e03174dc2e962aeb08 Mon Sep 17 00:00:00 2001 From: Simon Sarris Date: Wed, 5 Aug 2015 12:58:14 -0400 Subject: [PATCH] 1.5.5 --- api/index.html | 6 +- api/symbols/ActionTool.html | 2 +- api/symbols/Adornment.html | 2 +- api/symbols/AnimationManager.html | 2 +- api/symbols/Binding.html | 6 +- api/symbols/Brush.html | 2 +- api/symbols/ChangedEvent.html | 2 +- api/symbols/CircularEdge.html | 2 +- api/symbols/CircularLayout.html | 2 +- api/symbols/CircularVertex.html | 2 +- api/symbols/ClickCreatingTool.html | 2 +- api/symbols/ClickSelectingTool.html | 2 +- api/symbols/CommandHandler.html | 2 +- api/symbols/ContextMenuTool.html | 2 +- api/symbols/Diagram.html | 4 +- api/symbols/DiagramEvent.html | 2 +- api/symbols/DragSelectingTool.html | 2 +- api/symbols/DraggingTool.html | 2 +- api/symbols/ForceDirectedEdge.html | 2 +- api/symbols/ForceDirectedLayout.html | 2 +- api/symbols/ForceDirectedVertex.html | 2 +- api/symbols/Geometry.html | 12 +- api/symbols/GraphLinksModel.html | 2 +- api/symbols/GraphObject.html | 55 +- api/symbols/GridLayout.html | 2 +- api/symbols/Group.html | 2 +- api/symbols/InputEvent.html | 2 +- api/symbols/Iterable.html | 2 +- api/symbols/Iterator.html | 2 +- api/symbols/Layer.html | 2 +- api/symbols/LayeredDigraphEdge.html | 2 +- api/symbols/LayeredDigraphLayout.html | 2 +- api/symbols/LayeredDigraphVertex.html | 2 +- api/symbols/Layout.html | 2 +- api/symbols/LayoutEdge.html | 2 +- api/symbols/LayoutNetwork.html | 2 +- api/symbols/LayoutVertex.html | 2 +- api/symbols/Link.html | 2 +- api/symbols/LinkReshapingTool.html | 2 +- api/symbols/LinkingBaseTool.html | 2 +- api/symbols/LinkingTool.html | 2 +- api/symbols/List.html | 2 +- api/symbols/Map.html | 2 +- api/symbols/Margin.html | 2 +- api/symbols/Model.html | 2 +- api/symbols/Node.html | 2 +- api/symbols/Overview.html | 2 +- api/symbols/Palette.html | 2 +- api/symbols/Panel.html | 2 +- api/symbols/PanningTool.html | 2 +- api/symbols/Part.html | 2 +- api/symbols/PathFigure.html | 2 +- api/symbols/PathSegment.html | 2 +- api/symbols/Picture.html | 2 +- api/symbols/Placeholder.html | 2 +- api/symbols/Point.html | 2 +- api/symbols/Rect.html | 2 +- api/symbols/RelinkingTool.html | 2 +- api/symbols/ResizingTool.html | 2 +- api/symbols/RotatingTool.html | 2 +- api/symbols/RowColumnDefinition.html | 2 +- api/symbols/Set.html | 2 +- api/symbols/Shape.html | 8 +- api/symbols/Size.html | 2 +- api/symbols/Spot.html | 2 +- api/symbols/TextBlock.html | 2 +- api/symbols/TextEditingTool.html | 2 +- api/symbols/Tool.html | 2 +- api/symbols/ToolManager.html | 2 +- api/symbols/Transaction.html | 2 +- api/symbols/TreeEdge.html | 2 +- api/symbols/TreeLayout.html | 2 +- api/symbols/TreeModel.html | 2 +- api/symbols/TreeVertex.html | 2 +- api/symbols/UndoManager.html | 2 +- doc/changelog.html | 29 + doc/download.html | 2 +- extensions/Arrowheads.js | 109 + extensions/BPMN.html | 21 - extensions/BPMN.js | 1099 ++++---- extensions/BPMNClasses.js | 59 +- extensions/Buttons.js | 10 +- extensions/CheckBoxes.html | 215 ++ extensions/ScrollingTable.js | 6 +- extensions/goSamples.js | 1 + index.html | 18 +- intro/linkLabels.html | 3 + release/go-debug.js | 3582 +++++++++++++------------ release/go.js | 3407 +++++++++++------------ release/gojs.d.ts | 13 + samples/index.html | 1 + samples/minimalXML.html | 2 +- 92 files changed, 4584 insertions(+), 4222 deletions(-) create mode 100644 extensions/Arrowheads.js create mode 100644 extensions/CheckBoxes.html diff --git a/api/index.html b/api/index.html index ff00d98f6..c7a07ac40 100644 --- a/api/index.html +++ b/api/index.html @@ -970,7 +970,7 @@

Collection Classes

GoJS Class Index

@@ -985,7 +985,7 @@

GoJS Class Index

AnimationManager

AnimationManager handles animations in a Diagram. More... Each Diagram has one, Diagram.animationManager. Layouts, Group expansion and Tree expansion automatically start animations.

Animation is enabled by default, setting the isEnabled property to false will turn off animations for a Diagram.

When an animations begins it raises the "AnimationStarting" diagram event, upon completion it raises the "AnimationFinished" diagram event.

Animation will stop if a new transaction is started, if an undo or redo is called, if a layout is invalidated, or if a model is replaced. When an animation is stopped, the Diagram immediately finishes the animation and draws the final state. Animations can be stopped programatically with the method AnimationManager.stopAnimation.

-

Binding

A Binding describes how to automatically set a property on a GraphObject to a value of a property of data in the model. More... The target property name and the data source property name are strings. All name matching is case-sensitive.

Register bindings by calling GraphObject.bind with a new Binding. Existing bindings become read-only, and no new bindings may be added, when a template (a Part) is copied. Bindings will be shared by all copies of the template's GraphObjects.

For example, your node data might be like:

{ key: 23, say: "hello!" }

Your simple node template might be like:

  var template = new go.Node(go.Panel.Auto);
  // . . . define the rest of the Node's visual tree . . .
  var txt = new go.TextBlock();
  txt.bind(new go.Binding("text", "say"));
  template.add(txt);
  myDiagram.nodeTemplate = template;
Using GraphObject.make it might look like:
  var $ = go.GraphObject.make;
  myDiagram.nodeTemplate =
    $(go.Node, "Auto",
      . . .
      $(go.TextBlock, new go.Binding("text", "say"))
    )

The data binding causes the TextBlock.text property of the TextBlock to be set to the value of the data's "say" property. If the value of the "say" property of a particular data object is undefined, the binding is not evaluated: the target property is not set. If there is an error with the binding, you may see a message in the console log. For this reason you may want to explicitly set the initial value for a property when defining the GraphObject, since that value will remain as the default value if the Binding is not evaluated.

Sometimes the data value needs to be modified or converted in order to be used as the new value of a GraphObject property. The most common conversion functions are provided for you -- they convert a string to a geometric class: Point.parse, { @link Size.parse}, { @link Rect.parse}, Margin.parse, { @link Spot.parse}, and Geometry.parse. But you can easily define your own conversion function.

As an example of a conversion function, let's use a function that adds some text prefixing the data property value:

  new go.Binding("text", "say", function(v) { return "I say: " + v; })

By default bindings are Binding.OneWay. OneWay bindings are evaluated when the Panel.data property is set or when you call Panel.updateTargetBindings or Model.setDataProperty. OneWay bindings only transfer values from the source to the target.

TwoWay bindings are evaluated in the source-to-target direction just as OneWay bindings are evaluated. However when the GraphObject target property is set, the TwoWay bindings are evaluated in the target-to-source direction. There is no point in having a TwoWay binding on a GraphObject property that cannot be set. For efficiency, avoid TwoWay bindings on GraphObject properties that do not change value in your app.

You should not have a TwoWay binding on a node data object's key property. Unintentionally changing the node key value to be the same as another node data's key value may cause indeterminate behavior. Furthermore, changing a node data key without changing any references to that node using the key value will result in "dangling" references and inconsistent relationships. You can make that change safely by calling Model.setKeyForNodeData, but not via a data binding.

The target-to-source update can also go through a conversion function. The most common back-conversion functions are provided for you. They convert a geometric class to a string: Point.stringify, { @link Size.stringify}, { @link Rect.stringify}, Margin.stringify, { @link Spot.stringify}, and Geometry.stringify.

It is common to want to update some data properties based on changes to the diagram. For example, as the user changes the Part.location by dragging a Node, you can automatically keep the node's model data in sync using a TwoWay binding.

  new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify)
The call to Binding.makeTwoWay changes the Binding.mode to be Binding.TwoWay and specifies the Binding.backConverter function to be the Point.stringify static function.

Because the Binding is on the whole node (template), the target object is the whole Node and the target property is "location". The value of data.loc will be a string representation of the Node.location value.

The target of a Binding is always a property of a GraphObject. The source of a Binding is normally a property of a data object in the model. But it is also possible to have the source of a Binding be another GraphObject that is in the same Part. You just have to make sure that object has a unique GraphObject.name or is the Part itself. The source property on the GraphObject has to be settable, and the Part must have a value for Panel.data.

As a common kind of example of data binding between two properties of GraphObjects, consider this Binding on a Shape which changes the color of the Shape.stroke depending on whether the Node is selected (Part.isSelected):

  new go.Binding("stroke", "isSelected", function(s) { return s ? "dodgerblue" : "gray"; }).ofObject()
Note the call to Binding.ofObject, which tells the Binding that it should use as the source a GraphObject with a particular name. However that name argument is optional -- supplying no name (or supplying an empty string) will cause the binding to operate with the root GraphObject. In this case that would be the Node itself. Now with this binding whenever the value of Part.isSelected changes, this Shape's stroke changes color. The conversion function is what changes the boolean "isSelected" value to a brush color specifier.

The binding functionality also has more advanced features for less common situations. The source property name may be an empty string, to convert the object as a whole. Conversion functions may take a second argument that takes the object that is bound. For source-to-target conversions, the second argument will be the GraphObject whose property is bound. For target-to-source conversions, the second argument will be the source data object.

Here's an example of a two-way data-binding using two custom conversion functions working with two separate data properties. First we define the two conversion functions.

  function toLocation(data, node) {
    return new go.Point(data.x, data.y);
  };
  function fromLocation(loc, data) {
    data.x = loc.x;
    data.y = loc.y;
  };

Then to data-bind the default template's Part.location property to two separate data properties, "x" and "y":

  new go.Binding("location", "", toLocation).makeTwoWay(fromLocation)

An empty string argument for the sourceprop parameter indicates that the whole data object should be passed to the toLocation function, rather than the value of some property of that data. The return value is used as the new value for the Part.location property. In almost all cases the second argument is not used. For efficiency reasons you should try to avoid using an empty source property name.

The binding works normally for the source-to-target direction. But when the target property is modified it is the source property that is set with the (back-)converted property value from the target object. Because in this example the source property name is the empty string, and because one cannot replace the whole source data object, any return value from the conversion function is ignored. Instead the conversion function has to modify the data object directly, as this example fromLocation function does.

+

Binding

A Binding describes how to automatically set a property on a GraphObject to a value of a property of data in the model. More... The target property name and the data source property name are strings. All name matching is case-sensitive.

Register bindings by calling GraphObject.bind with a new Binding. Existing bindings become read-only, and no new bindings may be added, when a template (a Part) is copied. Bindings will be shared by all copies of the template's GraphObjects.

For example, your node data might be like:

{ key: 23, say: "hello!" }

Your simple node template might be like:

  var template = new go.Node(go.Panel.Auto);
  // . . . define the rest of the Node's visual tree . . .
  var txt = new go.TextBlock();
  txt.bind(new go.Binding("text", "say"));
  template.add(txt);
  myDiagram.nodeTemplate = template;
Using GraphObject.make it might look like:
  var $ = go.GraphObject.make;
  myDiagram.nodeTemplate =
    $(go.Node, "Auto",
      . . .
      $(go.TextBlock, new go.Binding("text", "say"))
    )

The data binding causes the TextBlock.text property of the TextBlock to be set to the value of the data's "say" property. If the value of the "say" property of a particular data object is undefined, the binding is not evaluated: the target property is not set. If there is an error with the binding, you may see a message in the console log. For this reason you may want to explicitly set the initial value for a property when defining the GraphObject, since that value will remain as the default value if the Binding is not evaluated.

Sometimes the data value needs to be modified or converted in order to be used as the new value of a GraphObject property. The most common conversion functions are provided for you -- they convert a string to a geometric class: Point.parse, Size.parse, Rect.parse, Margin.parse, Spot.parse, and Geometry.parse. But you can easily define your own conversion function.

As an example of a conversion function, let's use a function that adds some text prefixing the data property value:

  new go.Binding("text", "say", function(v) { return "I say: " + v; })

By default bindings are Binding.OneWay. OneWay bindings are evaluated when the Panel.data property is set or when you call Panel.updateTargetBindings or Model.setDataProperty. OneWay bindings only transfer values from the source to the target.

TwoWay bindings are evaluated in the source-to-target direction just as OneWay bindings are evaluated. However when the GraphObject target property is set, the TwoWay bindings are evaluated in the target-to-source direction. There is no point in having a TwoWay binding on a GraphObject property that cannot be set. For efficiency, avoid TwoWay bindings on GraphObject properties that do not change value in your app.

You should not have a TwoWay binding on a node data object's key property. Unintentionally changing the node key value to be the same as another node data's key value may cause indeterminate behavior. Furthermore, changing a node data key without changing any references to that node using the key value will result in "dangling" references and inconsistent relationships. You can make that change safely by calling Model.setKeyForNodeData, but not via a data binding.

The target-to-source update can also go through a conversion function. The most common back-conversion functions are provided for you. They convert a geometric class to a string: Point.stringify, Size.stringify, Rect.stringify, Margin.stringify, Spot.stringify, and Geometry.stringify.

It is common to want to update some data properties based on changes to the diagram. For example, as the user changes the Part.location by dragging a Node, you can automatically keep the node's model data in sync using a TwoWay binding.

  new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify)
The call to Binding.makeTwoWay changes the Binding.mode to be Binding.TwoWay and specifies the Binding.backConverter function to be the Point.stringify static function.

Because the Binding is on the whole node (template), the target object is the whole Node and the target property is "location". The value of data.loc will be a string representation of the Node.location value.

The target of a Binding is always a property of a GraphObject. The source of a Binding is normally a property of a data object in the model. But it is also possible to have the source of a Binding be another GraphObject that is in the same Part. You just have to make sure that object has a unique GraphObject.name or is the Part itself. The source property on the GraphObject has to be settable, and the Part must have a value for Panel.data.

As a common kind of example of data binding between two properties of GraphObjects, consider this Binding on a Shape which changes the color of the Shape.stroke depending on whether the Node is selected (Part.isSelected):

  new go.Binding("stroke", "isSelected", function(s) { return s ? "dodgerblue" : "gray"; }).ofObject()
Note the call to Binding.ofObject, which tells the Binding that it should use as the source a GraphObject with a particular name. However that name argument is optional -- supplying no name (or supplying an empty string) will cause the binding to operate with the root GraphObject. In this case that would be the Node itself. Now with this binding whenever the value of Part.isSelected changes, this Shape's stroke changes color. The conversion function is what changes the boolean "isSelected" value to a brush color specifier.

The binding functionality also has more advanced features for less common situations. The source property name may be an empty string, to convert the object as a whole. Conversion functions may take a second argument that takes the object that is bound. For source-to-target conversions, the second argument will be the GraphObject whose property is bound. For target-to-source conversions, the second argument will be the source data object.

Here's an example of a two-way data-binding using two custom conversion functions working with two separate data properties. First we define the two conversion functions.

  function toLocation(data, node) {
    return new go.Point(data.x, data.y);
  };
  function fromLocation(loc, data) {
    data.x = loc.x;
    data.y = loc.y;
  };

Then to data-bind the default template's Part.location property to two separate data properties, "x" and "y":

  new go.Binding("location", "", toLocation).makeTwoWay(fromLocation)

An empty string argument for the sourceprop parameter indicates that the whole data object should be passed to the toLocation function, rather than the value of some property of that data. The return value is used as the new value for the Part.location property. In almost all cases the second argument is not used. For efficiency reasons you should try to avoid using an empty source property name.

The binding works normally for the source-to-target direction. But when the target property is modified it is the source property that is set with the (back-)converted property value from the target object. Because in this example the source property name is the empty string, and because one cannot replace the whole source data object, any return value from the conversion function is ignored. Instead the conversion function has to modify the data object directly, as this example fromLocation function does.

Brush

A Brush holds color information and describes how to draw the inside of a Shape or the stroke of a shape or a TextBlock or the background of any GraphObject. More...

A Brush must not be modified once it has been assigned to a GraphObject, such as the Shape.fill or TextBlock.stroke or GraphObject.background. However, a Brush may be shared by multiple GraphObjects.

@@ -1101,7 +1101,7 @@

GoJS Class Index

Set

An unordered iterable collection that cannot contain two instances of the same kind of value. More... It optionally enforces the type of elements that may be added to the Set.

An example usage:

  var set = new go.Set("string");  // make a set of strings
  set.add("orange");
  set.add("apple");
  set.add("orange");
  // now set.count === 2
  // and set.contains("orange") === true
  // and set.contains("banana") === false

You can iterate over the items in a Set:

  var it = aSet.iterator;
  while (it.next()) {
    . . . it.value . . .
  }
Or:
  aSet.each(function(val) {
      . . . val . . .
    });

Although not precisely implementing the features of the EcmaScript 6 Set class, this GoJS Set class has synonyms for the following methods and property:

  • add(val): #add
  • delete(val): #remove
  • has(val): #contains
  • clear(): clear
  • size: #count
The constructor does not take an optional Iterable argument, but you can get the same effect by: new go.Set().addAll(iterable)
-

Shape

A Shape is a GraphObject that shows a geometric figure. More... The Geometry determines what is drawn; the properties #fill and #stroke (and other stroke properties) determine how it is drawn.

There are generally two types of shapes: Those that use a custom Geometry by setting Shape.geometry, and those that receive an automatically generated Geometry using the value of #figure, #toArrow, or #fromArrow. An explicitly set Geometry always supersedes the figure and arrowhead properties.

Some created Shapes:

var $ = go.GraphObject.make;  // for conciseness in defining GraphObjects

// A shape with the figure set to RoundedRectangle:
$(go.Shape, { figure: "RoundedRectangle", fill: "lightgreen" })
// Alternatively:
$(go.Shape, "RoundedRectangle", { fill: "lightgreen" })

// A shape with a custom geometry, using geometryString:
$(go.Shape,
    { geometry: go.Geometry.parse("M120 0 L80 80 0 50z") })

// A shape with a custom geometry, using geometryString:
$(go.Shape,
   { geometryString: "F M120 0 L80 80 0 50z",
     fill: "lightgreen" })

// A common link template, using two shapes,
// the first for the link path and the second for the arrowhead
myDiagram.linkTemplate =
  $(go.Link,
    // The first shape in a link is special, its geometry is set by the Link's routing,
    // so it does not need a geometry or figure set manually
    $(go.Shape,
      { strokeWidth: 2, stroke: 'gray' }),
    $(go.Shape,
      { toArrow: "Standard", fill: 'gray', stroke: null })
  );

You can see more custom geometry examples and read about geometryString on the Geometry Path Strings Introduction page.

When automatically generating a Shape Geometry, the value of #toArrow takes precedence, then #fromArrow, then #figure. If the value of #toArrow or #fromArrow is "None" then it is ignored, and the "None" value of #figure is identical to "Rectangle".

All of the predefined figures are shown in the Shapes sample. You can define your own named figures by calling the static function Shape.defineFigureGenerator. Get a Map of named figures by calling the static function Shape.getFigureGenerators.

All of the predefined arrowheads are shown in the Arrowheads sample. You can define your own named arrowheads by calling the static function Shape.defineArrowheadGeometry. Get a Map of named arrowheads by calling the static function Shape.getArrowheadGeometries.

The Shape properties #parameter1, and #parameter2 determine details of the construction of some #figure geometries. Specifically, they often set the #spot1, #spot2 for the Shape. These spots determine the "inner area" of an Auto panel when a Shape is the main object. See the Auto Panels section of the Panels Introduction page for more details.

Shapes use their geometric bounds when determining hit testing, but use rectangular bounds when participating in (panel) layouts.

+

Shape

A Shape is a GraphObject that shows a geometric figure. More... The Geometry determines what is drawn; the properties #fill and #stroke (and other stroke properties) determine how it is drawn.

There are generally two types of shapes: Those that use a custom Geometry by setting Shape.geometry, and those that receive an automatically generated Geometry using the value of #figure, #toArrow, or #fromArrow. An explicitly set Geometry always supersedes the figure and arrowhead properties.

Some created Shapes:

var $ = go.GraphObject.make;  // for conciseness in defining GraphObjects

// A shape with the figure set to RoundedRectangle:
$(go.Shape, { figure: "RoundedRectangle", fill: "lightgreen" })
// Alternatively:
$(go.Shape, "RoundedRectangle", { fill: "lightgreen" })

// A shape with a custom geometry, using geometryString:
$(go.Shape,
    { geometry: go.Geometry.parse("M120 0 L80 80 0 50z") })

// A shape with a custom geometry, using geometryString:
$(go.Shape,
   { geometryString: "F M120 0 L80 80 0 50z",
     fill: "lightgreen" })

// A common link template, using two shapes,
// the first for the link path and the second for the arrowhead
myDiagram.linkTemplate =
  $(go.Link,
    // The first shape in a link is special, its geometry is set by the Link's routing,
    // so it does not need a geometry or figure set manually
    $(go.Shape,
      { strokeWidth: 2, stroke: 'gray' }),
    $(go.Shape,
      { toArrow: "Standard", fill: 'gray', stroke: null })
  );

You can see more custom geometry examples and read about geometryString on the Geometry Path Strings Introduction page.

When automatically generating a Shape Geometry, the value of #toArrow takes precedence, then #fromArrow, then #figure. If the value of #toArrow or #fromArrow is "None" then it is ignored, and the "None" value of #figure is identical to "Rectangle".

All of the predefined figures are shown in the Shapes sample. You can define your own named figures by calling the static function Shape.defineFigureGenerator. Get a Map of named figures by calling the static function Shape.getFigureGenerators.

All of the predefined arrowheads are shown in the Arrowheads sample. You can define your own named arrowheads by calling the static function Shape.defineArrowheadGeometry. Get a Map of named arrowheads by calling the static function Shape.getArrowheadGeometries.

You can see a copy of all of the built-in arrowhead definitions in this file: Arrowheads.js.

The Shape properties #parameter1, and #parameter2 determine details of the construction of some #figure geometries. Specifically, they often set the #spot1, #spot2 for the Shape. These spots determine the "inner area" of an Auto panel when a Shape is the main object. See the Auto Panels section of the Panels Introduction page for more details.

Shapes use their geometric bounds when determining hit testing, but use rectangular bounds when participating in (panel) layouts.

Size

A Size describes a width and a height in two-dimensional coordinates. More... The width and height must both be non-negative.

Use the static functions Size.parse and Size.stringify to convert to and from a standard string representation that is independent of the current locale.

When an instance of this class is the value of a property of a GraphObject class or Diagram or CommandHandler or a Tool class, you should treat the object as if it were frozen or read-only -- you cannot modify its properties. This allows the property to return a value without allocating a new instance. If you need to do your own calculations with the value, call #copy to make a new instance with the same values that you can modify.

Many methods modify the object's properties and then return a reference to "this" object. The only instance method to allocate a new object is the #copy method. The static Size.parse method also allocates a new object.

The "Debug" implementation of this class is significantly slower than the "Release" implementation, mostly due to additional error checking.

You cannot inherit from this class.

diff --git a/api/symbols/ActionTool.html b/api/symbols/ActionTool.html index 11ae89985..c169f8af3 100644 --- a/api/symbols/ActionTool.html +++ b/api/symbols/ActionTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Adornment.html b/api/symbols/Adornment.html index e67dc03ab..09819f35c 100644 --- a/api/symbols/Adornment.html +++ b/api/symbols/Adornment.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/AnimationManager.html b/api/symbols/AnimationManager.html index f1e879c99..3c823d78b 100644 --- a/api/symbols/AnimationManager.html +++ b/api/symbols/AnimationManager.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Binding.html b/api/symbols/Binding.html index 00a9c28d4..439a38412 100644 --- a/api/symbols/Binding.html +++ b/api/symbols/Binding.html @@ -974,7 +974,7 @@

Collection Classes

@@ -989,7 +989,7 @@

- A Binding describes how to automatically set a property on a GraphObject to a value of a property of data in the model. The target property name and the data source property name are strings. All name matching is case-sensitive.

Register bindings by calling GraphObject.bind with a new Binding. Existing bindings become read-only, and no new bindings may be added, when a template (a Part) is copied. Bindings will be shared by all copies of the template's GraphObjects.

For example, your node data might be like:

{ key: 23, say: "hello!" }

Your simple node template might be like:

  var template = new go.Node(go.Panel.Auto);
  // . . . define the rest of the Node's visual tree . . .
  var txt = new go.TextBlock();
  txt.bind(new go.Binding("text", "say"));
  template.add(txt);
  myDiagram.nodeTemplate = template;
Using GraphObject.make it might look like:
  var $ = go.GraphObject.make;
  myDiagram.nodeTemplate =
    $(go.Node, "Auto",
      . . .
      $(go.TextBlock, new go.Binding("text", "say"))
    )

The data binding causes the TextBlock.text property of the TextBlock to be set to the value of the data's "say" property. If the value of the "say" property of a particular data object is undefined, the binding is not evaluated: the target property is not set. If there is an error with the binding, you may see a message in the console log. For this reason you may want to explicitly set the initial value for a property when defining the GraphObject, since that value will remain as the default value if the Binding is not evaluated.

Sometimes the data value needs to be modified or converted in order to be used as the new value of a GraphObject property. The most common conversion functions are provided for you -- they convert a string to a geometric class: Point.parse, { @link Size.parse}, { @link Rect.parse}, Margin.parse, { @link Spot.parse}, and Geometry.parse. But you can easily define your own conversion function.

As an example of a conversion function, let's use a function that adds some text prefixing the data property value:

  new go.Binding("text", "say", function(v) { return "I say: " + v; })

By default bindings are Binding.OneWay. OneWay bindings are evaluated when the Panel.data property is set or when you call Panel.updateTargetBindings or Model.setDataProperty. OneWay bindings only transfer values from the source to the target.

TwoWay bindings are evaluated in the source-to-target direction just as OneWay bindings are evaluated. However when the GraphObject target property is set, the TwoWay bindings are evaluated in the target-to-source direction. There is no point in having a TwoWay binding on a GraphObject property that cannot be set. For efficiency, avoid TwoWay bindings on GraphObject properties that do not change value in your app.

You should not have a TwoWay binding on a node data object's key property. Unintentionally changing the node key value to be the same as another node data's key value may cause indeterminate behavior. Furthermore, changing a node data key without changing any references to that node using the key value will result in "dangling" references and inconsistent relationships. You can make that change safely by calling Model.setKeyForNodeData, but not via a data binding.

The target-to-source update can also go through a conversion function. The most common back-conversion functions are provided for you. They convert a geometric class to a string: Point.stringify, { @link Size.stringify}, { @link Rect.stringify}, Margin.stringify, { @link Spot.stringify}, and Geometry.stringify.

It is common to want to update some data properties based on changes to the diagram. For example, as the user changes the Part.location by dragging a Node, you can automatically keep the node's model data in sync using a TwoWay binding.

  new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify)
The call to Binding.makeTwoWay changes the Binding.mode to be Binding.TwoWay and specifies the Binding.backConverter function to be the Point.stringify static function.

Because the Binding is on the whole node (template), the target object is the whole Node and the target property is "location". The value of data.loc will be a string representation of the Node.location value.

The target of a Binding is always a property of a GraphObject. The source of a Binding is normally a property of a data object in the model. But it is also possible to have the source of a Binding be another GraphObject that is in the same Part. You just have to make sure that object has a unique GraphObject.name or is the Part itself. The source property on the GraphObject has to be settable, and the Part must have a value for Panel.data.

As a common kind of example of data binding between two properties of GraphObjects, consider this Binding on a Shape which changes the color of the Shape.stroke depending on whether the Node is selected (Part.isSelected):

  new go.Binding("stroke", "isSelected", function(s) { return s ? "dodgerblue" : "gray"; }).ofObject()
Note the call to Binding.ofObject, which tells the Binding that it should use as the source a GraphObject with a particular name. However that name argument is optional -- supplying no name (or supplying an empty string) will cause the binding to operate with the root GraphObject. In this case that would be the Node itself. Now with this binding whenever the value of Part.isSelected changes, this Shape's stroke changes color. The conversion function is what changes the boolean "isSelected" value to a brush color specifier.

The binding functionality also has more advanced features for less common situations. The source property name may be an empty string, to convert the object as a whole. Conversion functions may take a second argument that takes the object that is bound. For source-to-target conversions, the second argument will be the GraphObject whose property is bound. For target-to-source conversions, the second argument will be the source data object.

Here's an example of a two-way data-binding using two custom conversion functions working with two separate data properties. First we define the two conversion functions.

  function toLocation(data, node) {
    return new go.Point(data.x, data.y);
  };
  function fromLocation(loc, data) {
    data.x = loc.x;
    data.y = loc.y;
  };

Then to data-bind the default template's Part.location property to two separate data properties, "x" and "y":

  new go.Binding("location", "", toLocation).makeTwoWay(fromLocation)

An empty string argument for the sourceprop parameter indicates that the whole data object should be passed to the toLocation function, rather than the value of some property of that data. The return value is used as the new value for the Part.location property. In almost all cases the second argument is not used. For efficiency reasons you should try to avoid using an empty source property name.

The binding works normally for the source-to-target direction. But when the target property is modified it is the source property that is set with the (back-)converted property value from the target object. Because in this example the source property name is the empty string, and because one cannot replace the whole source data object, any return value from the conversion function is ignored. Instead the conversion function has to modify the data object directly, as this example fromLocation function does. + A Binding describes how to automatically set a property on a GraphObject to a value of a property of data in the model. The target property name and the data source property name are strings. All name matching is case-sensitive.

Register bindings by calling GraphObject.bind with a new Binding. Existing bindings become read-only, and no new bindings may be added, when a template (a Part) is copied. Bindings will be shared by all copies of the template's GraphObjects.

For example, your node data might be like:

{ key: 23, say: "hello!" }

Your simple node template might be like:

  var template = new go.Node(go.Panel.Auto);
  // . . . define the rest of the Node's visual tree . . .
  var txt = new go.TextBlock();
  txt.bind(new go.Binding("text", "say"));
  template.add(txt);
  myDiagram.nodeTemplate = template;
Using GraphObject.make it might look like:
  var $ = go.GraphObject.make;
  myDiagram.nodeTemplate =
    $(go.Node, "Auto",
      . . .
      $(go.TextBlock, new go.Binding("text", "say"))
    )

The data binding causes the TextBlock.text property of the TextBlock to be set to the value of the data's "say" property. If the value of the "say" property of a particular data object is undefined, the binding is not evaluated: the target property is not set. If there is an error with the binding, you may see a message in the console log. For this reason you may want to explicitly set the initial value for a property when defining the GraphObject, since that value will remain as the default value if the Binding is not evaluated.

Sometimes the data value needs to be modified or converted in order to be used as the new value of a GraphObject property. The most common conversion functions are provided for you -- they convert a string to a geometric class: Point.parse, Size.parse, Rect.parse, Margin.parse, Spot.parse, and Geometry.parse. But you can easily define your own conversion function.

As an example of a conversion function, let's use a function that adds some text prefixing the data property value:

  new go.Binding("text", "say", function(v) { return "I say: " + v; })

By default bindings are Binding.OneWay. OneWay bindings are evaluated when the Panel.data property is set or when you call Panel.updateTargetBindings or Model.setDataProperty. OneWay bindings only transfer values from the source to the target.

TwoWay bindings are evaluated in the source-to-target direction just as OneWay bindings are evaluated. However when the GraphObject target property is set, the TwoWay bindings are evaluated in the target-to-source direction. There is no point in having a TwoWay binding on a GraphObject property that cannot be set. For efficiency, avoid TwoWay bindings on GraphObject properties that do not change value in your app.

You should not have a TwoWay binding on a node data object's key property. Unintentionally changing the node key value to be the same as another node data's key value may cause indeterminate behavior. Furthermore, changing a node data key without changing any references to that node using the key value will result in "dangling" references and inconsistent relationships. You can make that change safely by calling Model.setKeyForNodeData, but not via a data binding.

The target-to-source update can also go through a conversion function. The most common back-conversion functions are provided for you. They convert a geometric class to a string: Point.stringify, Size.stringify, Rect.stringify, Margin.stringify, Spot.stringify, and Geometry.stringify.

It is common to want to update some data properties based on changes to the diagram. For example, as the user changes the Part.location by dragging a Node, you can automatically keep the node's model data in sync using a TwoWay binding.

  new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify)
The call to Binding.makeTwoWay changes the Binding.mode to be Binding.TwoWay and specifies the Binding.backConverter function to be the Point.stringify static function.

Because the Binding is on the whole node (template), the target object is the whole Node and the target property is "location". The value of data.loc will be a string representation of the Node.location value.

The target of a Binding is always a property of a GraphObject. The source of a Binding is normally a property of a data object in the model. But it is also possible to have the source of a Binding be another GraphObject that is in the same Part. You just have to make sure that object has a unique GraphObject.name or is the Part itself. The source property on the GraphObject has to be settable, and the Part must have a value for Panel.data.

As a common kind of example of data binding between two properties of GraphObjects, consider this Binding on a Shape which changes the color of the Shape.stroke depending on whether the Node is selected (Part.isSelected):

  new go.Binding("stroke", "isSelected", function(s) { return s ? "dodgerblue" : "gray"; }).ofObject()
Note the call to Binding.ofObject, which tells the Binding that it should use as the source a GraphObject with a particular name. However that name argument is optional -- supplying no name (or supplying an empty string) will cause the binding to operate with the root GraphObject. In this case that would be the Node itself. Now with this binding whenever the value of Part.isSelected changes, this Shape's stroke changes color. The conversion function is what changes the boolean "isSelected" value to a brush color specifier.

The binding functionality also has more advanced features for less common situations. The source property name may be an empty string, to convert the object as a whole. Conversion functions may take a second argument that takes the object that is bound. For source-to-target conversions, the second argument will be the GraphObject whose property is bound. For target-to-source conversions, the second argument will be the source data object.

Here's an example of a two-way data-binding using two custom conversion functions working with two separate data properties. First we define the two conversion functions.

  function toLocation(data, node) {
    return new go.Point(data.x, data.y);
  };
  function fromLocation(loc, data) {
    data.x = loc.x;
    data.y = loc.y;
  };

Then to data-bind the default template's Part.location property to two separate data properties, "x" and "y":

  new go.Binding("location", "", toLocation).makeTwoWay(fromLocation)

An empty string argument for the sourceprop parameter indicates that the whole data object should be passed to the toLocation function, rather than the value of some property of that data. The return value is used as the new value for the Part.location property. In almost all cases the second argument is not used. For efficiency reasons you should try to avoid using an empty source property name.

The binding works normally for the source-to-target direction. But when the target property is modified it is the source property that is set with the (back-)converted property value from the target object. Because in this example the source property name is the empty string, and because one cannot replace the whole source data object, any return value from the conversion function is ignored. Instead the conversion function has to modify the data object directly, as this example fromLocation function does.

@@ -1282,7 +1282,7 @@

Method Summary -
This static function can be used to create a function that parses a string into an enumerated value, given the class that the enumeration values are defined on and a default value if the string cannot be parsed successfully. More...

The normal usage is to pass the result of this function as the conversion function of a Binding.

linktemplate.bind(new go.Binding('routing', 'dataPropName', go.Binding.parseEnum(go.Link, go.Link.Normal)));
This binding will try to parse the string that is the value of the bound data's "dataPropName" property. If it is a legitimate enumerated value defined on the Link class, the conversion function will return that value. If the bound data's "dataPropName" property is not present or has an unrecognized value, the Link.routing property gets the default value, { @link Link#Normal}. +
This static function can be used to create a function that parses a string into an enumerated value, given the class that the enumeration values are defined on and a default value if the string cannot be parsed successfully. More...

The normal usage is to pass the result of this function as the conversion function of a Binding.

linktemplate.bind(new go.Binding('routing', 'dataPropName', go.Binding.parseEnum(go.Link, go.Link.Normal)));
This binding will try to parse the string that is the value of the bound data's "dataPropName" property. If it is a legitimate enumerated value defined on the Link class, the conversion function will return that value. If the bound data's "dataPropName" property is not present or has an unrecognized value, the Link.routing property gets the default value, Link.Normal.
diff --git a/api/symbols/Brush.html b/api/symbols/Brush.html index f62c7dd75..dfe43a525 100644 --- a/api/symbols/Brush.html +++ b/api/symbols/Brush.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/ChangedEvent.html b/api/symbols/ChangedEvent.html index 2761cfa87..28cd4d9ec 100644 --- a/api/symbols/ChangedEvent.html +++ b/api/symbols/ChangedEvent.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/CircularEdge.html b/api/symbols/CircularEdge.html index 1f1b83236..2541cff4e 100644 --- a/api/symbols/CircularEdge.html +++ b/api/symbols/CircularEdge.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/CircularLayout.html b/api/symbols/CircularLayout.html index d18fb313b..d4ed5a72b 100644 --- a/api/symbols/CircularLayout.html +++ b/api/symbols/CircularLayout.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/CircularVertex.html b/api/symbols/CircularVertex.html index fdd634774..18ac88f91 100644 --- a/api/symbols/CircularVertex.html +++ b/api/symbols/CircularVertex.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/ClickCreatingTool.html b/api/symbols/ClickCreatingTool.html index e59885082..e8d41bfe8 100644 --- a/api/symbols/ClickCreatingTool.html +++ b/api/symbols/ClickCreatingTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/ClickSelectingTool.html b/api/symbols/ClickSelectingTool.html index 84e2583a8..fd7c17dfc 100644 --- a/api/symbols/ClickSelectingTool.html +++ b/api/symbols/ClickSelectingTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/CommandHandler.html b/api/symbols/CommandHandler.html index a60b8345c..bc1ca0be4 100644 --- a/api/symbols/CommandHandler.html +++ b/api/symbols/CommandHandler.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/ContextMenuTool.html b/api/symbols/ContextMenuTool.html index 3ace9f197..e830c566a 100644 --- a/api/symbols/ContextMenuTool.html +++ b/api/symbols/ContextMenuTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Diagram.html b/api/symbols/Diagram.html index 0eeb688fe..52fa62882 100644 --- a/api/symbols/Diagram.html +++ b/api/symbols/Diagram.html @@ -974,7 +974,7 @@

Collection Classes

@@ -1976,7 +1976,7 @@

Properties Summary -
Gets or sets the initialAutoScale of the Diagram. More... The only accepted values are listed as constant properties of Diagram, such as Diagram.None, { @link Diagram#Uniform}, or Diagram.UniformToFill. Setting this will change the Diagram's Diagram.scale and Diagram.position, if appropriate.

If you want to always automatically scale the Diagram, use autoScale instead. If you want to set the scale to a value on initialization (for instance every time the model is replaced), use initialScale.

The default value is Diagram.None -- the scale and position are not automatically adjusted according to the area covered by the document.

Note that depending on the values of maxScale and minScale, the actual value for scale might be limited. +

Gets or sets the initialAutoScale of the Diagram. More... The only accepted values are listed as constant properties of Diagram, such as Diagram.None, Diagram.Uniform, or Diagram.UniformToFill. Setting this will change the Diagram's Diagram.scale and Diagram.position, if appropriate.

If you want to always automatically scale the Diagram, use autoScale instead. If you want to set the scale to a value on initialization (for instance every time the model is replaced), use initialScale.

The default value is Diagram.None -- the scale and position are not automatically adjusted according to the area covered by the document.

Note that depending on the values of maxScale and minScale, the actual value for scale might be limited.

diff --git a/api/symbols/DiagramEvent.html b/api/symbols/DiagramEvent.html index dede7a4b1..00328053c 100644 --- a/api/symbols/DiagramEvent.html +++ b/api/symbols/DiagramEvent.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/DragSelectingTool.html b/api/symbols/DragSelectingTool.html index e96891637..c48a720de 100644 --- a/api/symbols/DragSelectingTool.html +++ b/api/symbols/DragSelectingTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/DraggingTool.html b/api/symbols/DraggingTool.html index da025656b..0623c3366 100644 --- a/api/symbols/DraggingTool.html +++ b/api/symbols/DraggingTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/ForceDirectedEdge.html b/api/symbols/ForceDirectedEdge.html index b6835e25e..25e3b590f 100644 --- a/api/symbols/ForceDirectedEdge.html +++ b/api/symbols/ForceDirectedEdge.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/ForceDirectedLayout.html b/api/symbols/ForceDirectedLayout.html index 1037910a6..a20265490 100644 --- a/api/symbols/ForceDirectedLayout.html +++ b/api/symbols/ForceDirectedLayout.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/ForceDirectedVertex.html b/api/symbols/ForceDirectedVertex.html index e51bb0c88..574c0a526 100644 --- a/api/symbols/ForceDirectedVertex.html +++ b/api/symbols/ForceDirectedVertex.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Geometry.html b/api/symbols/Geometry.html index fdf2b265d..33a7a854d 100644 --- a/api/symbols/Geometry.html +++ b/api/symbols/Geometry.html @@ -974,7 +974,7 @@

Collection Classes

@@ -1081,7 +1081,7 @@

Properties Summary -
Gets or sets the Shape.geometryStretch value the Shape should use by default. More... The default value is GraphObject.Fill. Some figure generators return a Geometry with this property set to GraphObject.Uniform, in order to preserve its aspect ratio when used by a Shape. +
Gets or sets the Shape.geometryStretch value the Shape should use by default when the Shape.geometryStretch value is GraphObject.None. More... The default value is GraphObject.Fill. Some figure generators return a Geometry with this property set to GraphObject.Uniform, in order to preserve its aspect ratio when used by a Shape that may have different sizes.
@@ -1153,7 +1153,7 @@

Properties Summary -
Gets or sets the spot to use when the Shape.spot1 value is Spot.Default. More... The default value is Spot.TopLeft. +
Gets or sets the spot an "Auto" Panel will use for the top-left corner of any panel content when the Shape.spot1 value is Spot.Default. More... The default value is Spot.TopLeft, at the top-left point of the bounds of the Shape.
@@ -1171,7 +1171,7 @@

Properties Summary -
Gets or sets the spot to use when the Shape.spot2 value is Spot.Default. More... The default value is Spot.BottomRight. +
Gets or sets the spot an "Auto" Panel will use for the bottom-right corner of any panel content when the Shape.spot2 value is Spot.Default. More... The default value is Spot.BottomRight, at the bottom-right point of the bounds of the Shape.
@@ -1530,7 +1530,7 @@

Method Summary -
Rotates the Geometry in place by a given angle, with optional x and y values to rotate the geometry about. More... If no x and y value are giving, (0, 0) is used as the rotation point. +
Rotates the Geometry in place by a given angle, with optional x and y values to rotate the geometry about. More... If no x and y value are given, (0, 0) is used as the rotation point.
@@ -1583,7 +1583,7 @@

Method Summary -
Scales the Geometry in place by a given (x, y) scale factor More... +
Scales the Geometry in place by a given (x, y) scale factor. More...

If you want to flip a Geometry horizontally, call geo.scale(-1, 1). If you want to flip a Geometry vertically, call geo.scale(1, -1).

diff --git a/api/symbols/GraphLinksModel.html b/api/symbols/GraphLinksModel.html index 62ca6f2ec..9376e25e0 100644 --- a/api/symbols/GraphLinksModel.html +++ b/api/symbols/GraphLinksModel.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/GraphObject.html b/api/symbols/GraphObject.html index 69da15fed..1bc4cc977 100644 --- a/api/symbols/GraphObject.html +++ b/api/symbols/GraphObject.html @@ -974,7 +974,7 @@

Collection Classes

@@ -3312,6 +3312,59 @@

Method Summary + +

+ + + + +
+ <static> + {*}
+ + +
+ GraphObject.takeBuilderArgument(args, defval, pred) + + 1.5 + +
+ + +
This static function returns the first argument from the arguments array passed to a GraphObject.defineBuilder function by GraphObject.make. More... By default this requires the first argument to be a string, but you can provide a predicate to determine whether the argument is suitable. + + +
+
Parameters:
+ +
+ {Array} args + +
+
the arguments Array passed to the builder function; this may be modified if an acceptable argument is found and returned
+ +
+ {*=} defval + +
+
the default value to return if the argument is optional and not present as the first argument; otherwise throw an error when the argument is not there
+ +
+ {function(*):boolean|null=} pred + +
+
a predicate to determine the acceptability of the argument; the default predicate checks whether the argument is a string
+ +
+ + +
+
Returns:
+ +
{*}
+ +
+
diff --git a/api/symbols/GridLayout.html b/api/symbols/GridLayout.html index 3cec6c288..45b6eb40d 100644 --- a/api/symbols/GridLayout.html +++ b/api/symbols/GridLayout.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Group.html b/api/symbols/Group.html index c68961f05..f1f7925c7 100644 --- a/api/symbols/Group.html +++ b/api/symbols/Group.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/InputEvent.html b/api/symbols/InputEvent.html index aaf01ce8d..73babdfc6 100644 --- a/api/symbols/InputEvent.html +++ b/api/symbols/InputEvent.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Iterable.html b/api/symbols/Iterable.html index fe75273c4..204d591dc 100644 --- a/api/symbols/Iterable.html +++ b/api/symbols/Iterable.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Iterator.html b/api/symbols/Iterator.html index 3a475e4bf..bbc665d76 100644 --- a/api/symbols/Iterator.html +++ b/api/symbols/Iterator.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Layer.html b/api/symbols/Layer.html index fcd8a37c6..1a0892b3e 100644 --- a/api/symbols/Layer.html +++ b/api/symbols/Layer.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/LayeredDigraphEdge.html b/api/symbols/LayeredDigraphEdge.html index 169e2c564..8025d98d8 100644 --- a/api/symbols/LayeredDigraphEdge.html +++ b/api/symbols/LayeredDigraphEdge.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/LayeredDigraphLayout.html b/api/symbols/LayeredDigraphLayout.html index 4f0ac963e..e2696c940 100644 --- a/api/symbols/LayeredDigraphLayout.html +++ b/api/symbols/LayeredDigraphLayout.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/LayeredDigraphVertex.html b/api/symbols/LayeredDigraphVertex.html index b6b6537c0..1f42d2e41 100644 --- a/api/symbols/LayeredDigraphVertex.html +++ b/api/symbols/LayeredDigraphVertex.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Layout.html b/api/symbols/Layout.html index fda5f8113..250f7f9e4 100644 --- a/api/symbols/Layout.html +++ b/api/symbols/Layout.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/LayoutEdge.html b/api/symbols/LayoutEdge.html index 4c427461e..b51ae5206 100644 --- a/api/symbols/LayoutEdge.html +++ b/api/symbols/LayoutEdge.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/LayoutNetwork.html b/api/symbols/LayoutNetwork.html index 6602e916e..3a00e6f51 100644 --- a/api/symbols/LayoutNetwork.html +++ b/api/symbols/LayoutNetwork.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/LayoutVertex.html b/api/symbols/LayoutVertex.html index 69b9d5d27..96c6d67d7 100644 --- a/api/symbols/LayoutVertex.html +++ b/api/symbols/LayoutVertex.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Link.html b/api/symbols/Link.html index 14d39c351..619c2f7bb 100644 --- a/api/symbols/Link.html +++ b/api/symbols/Link.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/LinkReshapingTool.html b/api/symbols/LinkReshapingTool.html index a470ba300..8578e2331 100644 --- a/api/symbols/LinkReshapingTool.html +++ b/api/symbols/LinkReshapingTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/LinkingBaseTool.html b/api/symbols/LinkingBaseTool.html index 05c5c404b..25b1e83fe 100644 --- a/api/symbols/LinkingBaseTool.html +++ b/api/symbols/LinkingBaseTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/LinkingTool.html b/api/symbols/LinkingTool.html index d538151a6..dd56534ce 100644 --- a/api/symbols/LinkingTool.html +++ b/api/symbols/LinkingTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/List.html b/api/symbols/List.html index 232a72327..542c47c77 100644 --- a/api/symbols/List.html +++ b/api/symbols/List.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Map.html b/api/symbols/Map.html index bcf818c90..bad5c7406 100644 --- a/api/symbols/Map.html +++ b/api/symbols/Map.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Margin.html b/api/symbols/Margin.html index b57510ea5..366d37f7d 100644 --- a/api/symbols/Margin.html +++ b/api/symbols/Margin.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Model.html b/api/symbols/Model.html index a31e97248..1f1500323 100644 --- a/api/symbols/Model.html +++ b/api/symbols/Model.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Node.html b/api/symbols/Node.html index c28016920..a4cfd43bc 100644 --- a/api/symbols/Node.html +++ b/api/symbols/Node.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Overview.html b/api/symbols/Overview.html index 585badd40..9dd1b66d4 100644 --- a/api/symbols/Overview.html +++ b/api/symbols/Overview.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Palette.html b/api/symbols/Palette.html index d9a745fc0..d6b801ea1 100644 --- a/api/symbols/Palette.html +++ b/api/symbols/Palette.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Panel.html b/api/symbols/Panel.html index 36310337b..736d2fd35 100644 --- a/api/symbols/Panel.html +++ b/api/symbols/Panel.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/PanningTool.html b/api/symbols/PanningTool.html index 3b3591347..65086e252 100644 --- a/api/symbols/PanningTool.html +++ b/api/symbols/PanningTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Part.html b/api/symbols/Part.html index b080e13f0..b169b200e 100644 --- a/api/symbols/Part.html +++ b/api/symbols/Part.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/PathFigure.html b/api/symbols/PathFigure.html index 37b5a64d6..3da045150 100644 --- a/api/symbols/PathFigure.html +++ b/api/symbols/PathFigure.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/PathSegment.html b/api/symbols/PathSegment.html index efa79609a..7c69679a7 100644 --- a/api/symbols/PathSegment.html +++ b/api/symbols/PathSegment.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Picture.html b/api/symbols/Picture.html index ced14194b..9c5850277 100644 --- a/api/symbols/Picture.html +++ b/api/symbols/Picture.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Placeholder.html b/api/symbols/Placeholder.html index 1b0b8f63e..6f5064a6c 100644 --- a/api/symbols/Placeholder.html +++ b/api/symbols/Placeholder.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Point.html b/api/symbols/Point.html index df2b6f847..4d77ed547 100644 --- a/api/symbols/Point.html +++ b/api/symbols/Point.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Rect.html b/api/symbols/Rect.html index 770fa8e95..be71a7790 100644 --- a/api/symbols/Rect.html +++ b/api/symbols/Rect.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/RelinkingTool.html b/api/symbols/RelinkingTool.html index db643c84a..646dbae00 100644 --- a/api/symbols/RelinkingTool.html +++ b/api/symbols/RelinkingTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/ResizingTool.html b/api/symbols/ResizingTool.html index 1c1beacc2..9d48a9474 100644 --- a/api/symbols/ResizingTool.html +++ b/api/symbols/ResizingTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/RotatingTool.html b/api/symbols/RotatingTool.html index 4650817fc..dfbd77c17 100644 --- a/api/symbols/RotatingTool.html +++ b/api/symbols/RotatingTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/RowColumnDefinition.html b/api/symbols/RowColumnDefinition.html index 536fb450f..e881a2c47 100644 --- a/api/symbols/RowColumnDefinition.html +++ b/api/symbols/RowColumnDefinition.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Set.html b/api/symbols/Set.html index eed8c8934..14d2f300f 100644 --- a/api/symbols/Set.html +++ b/api/symbols/Set.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Shape.html b/api/symbols/Shape.html index 777e65ff1..d60002a04 100644 --- a/api/symbols/Shape.html +++ b/api/symbols/Shape.html @@ -974,7 +974,7 @@

Collection Classes

@@ -991,7 +991,7 @@

GraphObject. - A Shape is a GraphObject that shows a geometric figure. The Geometry determines what is drawn; the properties fill and stroke (and other stroke properties) determine how it is drawn.

There are generally two types of shapes: Those that use a custom Geometry by setting Shape.geometry, and those that receive an automatically generated Geometry using the value of figure, toArrow, or fromArrow. An explicitly set Geometry always supersedes the figure and arrowhead properties.

Some created Shapes:

var $ = go.GraphObject.make;  // for conciseness in defining GraphObjects

// A shape with the figure set to RoundedRectangle:
$(go.Shape, { figure: "RoundedRectangle", fill: "lightgreen" })
// Alternatively:
$(go.Shape, "RoundedRectangle", { fill: "lightgreen" })

// A shape with a custom geometry, using geometryString:
$(go.Shape,
    { geometry: go.Geometry.parse("M120 0 L80 80 0 50z") })

// A shape with a custom geometry, using geometryString:
$(go.Shape,
   { geometryString: "F M120 0 L80 80 0 50z",
     fill: "lightgreen" })

// A common link template, using two shapes,
// the first for the link path and the second for the arrowhead
myDiagram.linkTemplate =
  $(go.Link,
    // The first shape in a link is special, its geometry is set by the Link's routing,
    // so it does not need a geometry or figure set manually
    $(go.Shape,
      { strokeWidth: 2, stroke: 'gray' }),
    $(go.Shape,
      { toArrow: "Standard", fill: 'gray', stroke: null })
  );

You can see more custom geometry examples and read about geometryString on the Geometry Path Strings Introduction page.

When automatically generating a Shape Geometry, the value of toArrow takes precedence, then fromArrow, then figure. If the value of toArrow or fromArrow is "None" then it is ignored, and the "None" value of figure is identical to "Rectangle".

All of the predefined figures are shown in the Shapes sample. You can define your own named figures by calling the static function Shape.defineFigureGenerator. Get a Map of named figures by calling the static function Shape.getFigureGenerators.

All of the predefined arrowheads are shown in the Arrowheads sample. You can define your own named arrowheads by calling the static function Shape.defineArrowheadGeometry. Get a Map of named arrowheads by calling the static function Shape.getArrowheadGeometries.

The Shape properties parameter1, and parameter2 determine details of the construction of some figure geometries. Specifically, they often set the spot1, spot2 for the Shape. These spots determine the "inner area" of an Auto panel when a Shape is the main object. See the Auto Panels section of the Panels Introduction page for more details.

Shapes use their geometric bounds when determining hit testing, but use rectangular bounds when participating in (panel) layouts. + A Shape is a GraphObject that shows a geometric figure. The Geometry determines what is drawn; the properties fill and stroke (and other stroke properties) determine how it is drawn.

There are generally two types of shapes: Those that use a custom Geometry by setting Shape.geometry, and those that receive an automatically generated Geometry using the value of figure, toArrow, or fromArrow. An explicitly set Geometry always supersedes the figure and arrowhead properties.

Some created Shapes:

var $ = go.GraphObject.make;  // for conciseness in defining GraphObjects

// A shape with the figure set to RoundedRectangle:
$(go.Shape, { figure: "RoundedRectangle", fill: "lightgreen" })
// Alternatively:
$(go.Shape, "RoundedRectangle", { fill: "lightgreen" })

// A shape with a custom geometry, using geometryString:
$(go.Shape,
    { geometry: go.Geometry.parse("M120 0 L80 80 0 50z") })

// A shape with a custom geometry, using geometryString:
$(go.Shape,
   { geometryString: "F M120 0 L80 80 0 50z",
     fill: "lightgreen" })

// A common link template, using two shapes,
// the first for the link path and the second for the arrowhead
myDiagram.linkTemplate =
  $(go.Link,
    // The first shape in a link is special, its geometry is set by the Link's routing,
    // so it does not need a geometry or figure set manually
    $(go.Shape,
      { strokeWidth: 2, stroke: 'gray' }),
    $(go.Shape,
      { toArrow: "Standard", fill: 'gray', stroke: null })
  );

You can see more custom geometry examples and read about geometryString on the Geometry Path Strings Introduction page.

When automatically generating a Shape Geometry, the value of toArrow takes precedence, then fromArrow, then figure. If the value of toArrow or fromArrow is "None" then it is ignored, and the "None" value of figure is identical to "Rectangle".

All of the predefined figures are shown in the Shapes sample. You can define your own named figures by calling the static function Shape.defineFigureGenerator. Get a Map of named figures by calling the static function Shape.getFigureGenerators.

All of the predefined arrowheads are shown in the Arrowheads sample. You can define your own named arrowheads by calling the static function Shape.defineArrowheadGeometry. Get a Map of named arrowheads by calling the static function Shape.getArrowheadGeometries.

You can see a copy of all of the built-in arrowhead definitions in this file: Arrowheads.js.

The Shape properties parameter1, and parameter2 determine details of the construction of some figure geometries. Specifically, they often set the spot1, spot2 for the Shape. These spots determine the "inner area" of an Auto panel when a Shape is the main object. See the Auto Panels section of the Panels Introduction page for more details.

Shapes use their geometric bounds when determining hit testing, but use rectangular bounds when participating in (panel) layouts.

@@ -1088,7 +1088,7 @@

Properties Summary -
Gets or sets the name of the kind of arrowhead that this shape should take when this shape is an element of a Link. More... Value must be a string.

The default is "None", which means that this Shape is not an arrowhead, causing it to be the default Shape, a large filled Rectangle. If you want to have an arrowhead Shape but sometimes not show an arrowhead, you can set or bind the GraphObject.visible property, or you can set or bind this "toArrow" property to be the empty string. The arrowhead named "" will display as nothing.

The name can be any case but will always be canonicalized when set. For instance, setting "opentriangle" will set the value of the arrowhead to "OpenTriangle". All of the predefined arrowheads are shown in the Arrowheads sample.

Setting this property may also set the GraphObject.segmentIndex, GraphObject.segmentOrientation, and GraphObject.alignmentFocus properties. This shape should be an element of a Link.

At most one of the following three properties may be set to a non-"None" value at the same time on the same shape: figure, toArrow, fromArrow.

You can define your own named arrowheads by calling the static function Shape.defineArrowheadGeometry. +

Gets or sets the name of the kind of arrowhead that this shape should take when this shape is an element of a Link. More... Value must be a string.

The default is "None", which means that this Shape is not an arrowhead, causing it to be the default Shape, a large filled Rectangle. If you want to have an arrowhead Shape but sometimes not show an arrowhead, you can set or bind the GraphObject.visible property, or you can set or bind this "toArrow" property to be the empty string. The arrowhead named "" will display as nothing.

The name can be any case but will always be canonicalized when set. For instance, setting "opentriangle" will set the value of the arrowhead to "OpenTriangle". All of the predefined arrowheads are shown in the Arrowheads sample.

Setting this property may also set the GraphObject.segmentIndex, GraphObject.segmentOrientation, and GraphObject.alignmentFocus properties. This shape should be an element of a Link.

At most one of the following three properties may be set to a non-"None" value at the same time on the same shape: figure, toArrow, fromArrow.

You can define your own named arrowheads by calling the static function Shape.defineArrowheadGeometry.

You can see a copy of all of the built-in arrowhead definitions in this file: Arrowheads.js.

@@ -1427,7 +1427,7 @@

Properties Summary -
Gets or sets the name of the kind of arrowhead that this shape should take when this shape is an element of a Link. More... Value must be a string.

The default is "None", which means that this Shape is not an arrowhead, causing it to be the default Shape, a large filled Rectangle. If you want to have an arrowhead Shape but sometimes not show an arrowhead, you can set or bind the GraphObject.visible property, or you can set or bind this "toArrow" property to be the empty string. The arrowhead named "" will display as nothing.

The name can be any case but will always be canonicalized when set. For instance, setting "opentriangle" will set the value of the arrowhead to "OpenTriangle". All of the predefined arrowheads are shown in the Arrowheads sample.

Setting this property may also set the GraphObject.segmentIndex, GraphObject.segmentOrientation, and GraphObject.alignmentFocus properties. This shape should be an element of a Link.

At most one of the following three properties may be set to a non-"None" value at the same time on the same shape: figure, toArrow, fromArrow.

You can define your own named arrowheads by calling the static function Shape.defineArrowheadGeometry. +

Gets or sets the name of the kind of arrowhead that this shape should take when this shape is an element of a Link. More... Value must be a string.

The default is "None", which means that this Shape is not an arrowhead, causing it to be the default Shape, a large filled Rectangle. If you want to have an arrowhead Shape but sometimes not show an arrowhead, you can set or bind the GraphObject.visible property, or you can set or bind this "toArrow" property to be the empty string. The arrowhead named "" will display as nothing.

The name can be any case but will always be canonicalized when set. For instance, setting "opentriangle" will set the value of the arrowhead to "OpenTriangle". All of the predefined arrowheads are shown in the Arrowheads sample.

Setting this property may also set the GraphObject.segmentIndex, GraphObject.segmentOrientation, and GraphObject.alignmentFocus properties. This shape should be an element of a Link.

At most one of the following three properties may be set to a non-"None" value at the same time on the same shape: figure, toArrow, fromArrow.

You can define your own named arrowheads by calling the static function Shape.defineArrowheadGeometry.

You can see a copy of all of the built-in arrowhead definitions in this file: Arrowheads.js.

diff --git a/api/symbols/Size.html b/api/symbols/Size.html index 7ba9fc1b7..d3f9d9e4b 100644 --- a/api/symbols/Size.html +++ b/api/symbols/Size.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Spot.html b/api/symbols/Spot.html index a9e3540ef..2a094c480 100644 --- a/api/symbols/Spot.html +++ b/api/symbols/Spot.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/TextBlock.html b/api/symbols/TextBlock.html index 963c0404a..3e7b86dc6 100644 --- a/api/symbols/TextBlock.html +++ b/api/symbols/TextBlock.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/TextEditingTool.html b/api/symbols/TextEditingTool.html index b8246f3b5..ec246de45 100644 --- a/api/symbols/TextEditingTool.html +++ b/api/symbols/TextEditingTool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Tool.html b/api/symbols/Tool.html index 95920c517..9771b3e28 100644 --- a/api/symbols/Tool.html +++ b/api/symbols/Tool.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/ToolManager.html b/api/symbols/ToolManager.html index 802f299f9..4cf9559de 100644 --- a/api/symbols/ToolManager.html +++ b/api/symbols/ToolManager.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/Transaction.html b/api/symbols/Transaction.html index 1983863fd..da357389e 100644 --- a/api/symbols/Transaction.html +++ b/api/symbols/Transaction.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/TreeEdge.html b/api/symbols/TreeEdge.html index 6daeef054..9eec83a14 100644 --- a/api/symbols/TreeEdge.html +++ b/api/symbols/TreeEdge.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/TreeLayout.html b/api/symbols/TreeLayout.html index 5a7d0c386..af8079aa1 100644 --- a/api/symbols/TreeLayout.html +++ b/api/symbols/TreeLayout.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/TreeModel.html b/api/symbols/TreeModel.html index a0fe241bd..b4d4d7351 100644 --- a/api/symbols/TreeModel.html +++ b/api/symbols/TreeModel.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/TreeVertex.html b/api/symbols/TreeVertex.html index 0057d2715..83e8df63c 100644 --- a/api/symbols/TreeVertex.html +++ b/api/symbols/TreeVertex.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/api/symbols/UndoManager.html b/api/symbols/UndoManager.html index 61c42f505..7f8b03159 100644 --- a/api/symbols/UndoManager.html +++ b/api/symbols/UndoManager.html @@ -974,7 +974,7 @@

Collection Classes

diff --git a/doc/changelog.html b/doc/changelog.html index 8c666c848..97fad3bf3 100644 --- a/doc/changelog.html +++ b/doc/changelog.html @@ -53,6 +53,32 @@

GoJS® Change Log

} +

Changes for 1.5.5

+
    +
  • + Added the CheckBoxes sample, + demonstrating how to define a "check box" and how to customize them. +
  • +
  • + Added the static method GraphObject.takeBuilderArgument, for use by GraphObject.defineBuilder functions + for more easily retrieving builder arguments from the arguments passed to GraphObject.make. +
  • +
  • + Added the definitions of the predefined arrowheads to the Arrowheads.js file in the Extensions directory. + The predefined arrowheads are still predefined, so you will not need to load this file in order to have those definitions. + This file provides information about how each arrowhead is defined, so that you can customize them or copy-and-adapt them. +
  • +
  • + Fixed TextBlock.isStrikethrough to work with all values of TextBlock.textAlign. +
  • +
  • + Adding a Part is now undoable if its layer has changed without notifying the undo manager, such as with a "layerName":"isSelected" binding. +
  • +
  • + Fixed Geometry.scale and Geometry.rotate of PathSegments that are arcs. +
  • +
+

Changes for 1.5.4

Changes for 1.5.3

diff --git a/doc/download.html b/doc/download.html index e94b1cfd8..233a7c7e9 100644 --- a/doc/download.html +++ b/doc/download.html @@ -2,7 +2,7 @@ -GoJS® Diagramming Components for JavaScript and HTML, by Northwoods Software® +GoJS® Download + + + + + +
+

Simple uses of CheckBoxes, using CheckBoxButtons

+
+ +
+ + \ No newline at end of file diff --git a/extensions/ScrollingTable.js b/extensions/ScrollingTable.js index 7cbdd3f17..e9bcea7a5 100644 --- a/extensions/ScrollingTable.js +++ b/extensions/ScrollingTable.js @@ -56,11 +56,7 @@ go.GraphObject.defineBuilder("AutoRepeatButton", function(args) { // Note that if you have more than one of these in a Part, // you'll want to make sure each one has a unique name. go.GraphObject.defineBuilder("ScrollingTable", function(args) { - var tablename = "TABLE"; - if (typeof args[1] === 'string') { - tablename = args[1]; // the name of the button - args.splice(1, 1); // remove this name from the arguments to be processed by GraphObject.make - } + var tablename = go.GraphObject.takeBuilderArgument(args, "TABLE"); // an internal helper function for actually performing a scrolling operation function incrTableIndex(obj, i) { diff --git a/extensions/goSamples.js b/extensions/goSamples.js index 8f0079072..9b2382b99 100644 --- a/extensions/goSamples.js +++ b/extensions/goSamples.js @@ -155,6 +155,7 @@ var myMenu = '\
  • Port Shifting
  • \
  • Column Resizing
  • \
    \ +
  • CheckBoxes
  • \
  • Scrolling Table
  • \
  • Simulating Input
  • \
    \ diff --git a/index.html b/index.html index aa8e13a69..ae1648e04 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ - GoJS® Diagramming Components for JavaScript and HTML, by Northwoods Software® + GoJS® Diagramming for JavaScript and HTML, by Northwoods Software®