Base for all Mockup, ControlCollection, Links, and all Control and derived objects.
Return the type of object as a string i.e. 'Mockup', 'ControlCollection', 'Control' etc
Usage
if ( theObject.objectType == 'Control' ) { ... }
Returns parent of the object, or null if no parent.
Usage
var a = theObject.parent;
Create a new control.
Inherits: object Base
Parameters
Returns: object Control
Usage
var b = require('mockupsnode');
var alert = new b.Control('Alert');
alert.button1 = 'Yay';
Get the control type.
Usage
if ( mockup.controls[0].controlType == 'Alert' ) { ... }
Get/set the custom data
Get/set the custom id
Get/set the height. Must be >= -1. -1 indicates that the control is displayed at its default size.
Get/set the id
Lock/unlock the control
Get the measured height. This is the default height of the control.
Get the measured width. This is the default width of the control.
Get/set the width. Must be >= -1. -1 indicates that the control is displayed at its default size.
Get/set the x position. Must be >= 0
Get/set the y position. Must be >= 0
Get the z-order. Change z-order of a control using the ControlCollection move functions.
Create a new Accordion control.
Inherits: object Control
Returns: object ControlAccordion
Usage
var b = require('mockupsnode');
var accordion = new b.ControlAccordion();
Get the href - auto-populated when settings links.
Get the Links object
Get the map - auto-populated when settings links.
Get/set the selected index.
Show/hide the vertical scrollbar.
Get/set text
Get/set the position of the scrollbar, should be a number between 0 and 100.
Create a new ButtonBar control.
Inherits: object Control
Returns: object ControlButtonBar
Usage
var b = require('mockupsnode');
var alert = new b.ControlButtonBar();
Get/set bold mode
Get/set the text font size
Get the hrefs - auto-populated when settings links.
Get/set italic mode
Get the Links object
Get the map - auto-populated when settings links.
Get/set the selected index, starting from 0
Get/set the text
Get/set underline mode
Returned from the controls property of a Mockup and a ControlGroup
Inherits: object Base
Returns: object ControlCollection
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
console.log('There are %d top level controls in this collection', mockup.controls.length);
// visit all controls
mockup.controls.visitControls(function(c) { console.log(c.controlType); }, true );
Parameters
Returns: number index of the added control
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
var alert = new b.ControlAlert();
var index = mockup.controls.add(alert);
Parameters
Returns: object Control the control at the index, or undefined if an invalid index
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
var control1 = mockup.controls.at(1);
var control2 = mockup.controls[2];
Parameters
Returns: boolean True/false
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
assert(mockup.controls.contains(mockup.controls[0]));
Parameters
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
mockup.controls.forEach(function(c,i)
{
console.log('Control: %s, id path = %s, z = %d', c.controlType, getControlIdPath(c), c.z);
}, true);
function getControlIdPath(c)
{
var path = c.id;
c = c.parent.parent; // skip the parent collection
while ( e instanceof b.Control )
{
path = c.id + ':' + path;
c = c.parent.parent;
}
return path;
}
Get the number of controls in this collection.
Parameters
Returns: number The new position of the control, or undefined if failed.
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
mockup.controls.moveAfter(mockup.controls[0], mockup.controls[3]);
Parameters
Returns: number The new position of the control, or undefined if failed.
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
mockup.controls.moveBackward(mockup.controls[2]);
Parameters
Returns: number The new position of the control, or undefined if failed.
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
mockup.controls.moveBefore(mockup.controls[0], mockup.controls[3]);
Parameters
Returns: number The new position of the control, or undefined if failed.
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
mockup.controls.moveForward(mockup.controls[2]);
Parameters
Returns: number The new position of the control, or undefined if failed.
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
mockup.controls.moveToBottom(mockup.controls[2]);
Parameters
Returns: number The new position of the control, or undefined if failed.
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
mockup.controls.moveToTop(mockup.controls[2]);
Parameters
or
Returns: object Control the removed control, or null/exception if failed.
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
mockup.controls.remove(0);
Create a new Group control.
Inherits: object Control
Returns: object ControlGroup
Usage
var b = require('mockupsnode');
var alert = new b.ControlGroup();
Get the ControlCollection
Create a new StickyNote control.
Inherits: object Control
Returns: object ControlStickyNote
Usage
var b = require('mockupsnode');
var alert = new b.ControlStickyNote();
Get/set the background color
Get/set bold mode
Get/set the text font size
Get/set italic mode
Get/set the text
Get/set the text alignment. Choose from Enums.HorizontalTextAlignment
Get/set underline mode
Create a new VerticalRule control.
Inherits: object Control
Returns: object ControlVerticalRule
Usage
var b = require('mockupsnode');
var alert = new b.ControlVerticalRule();
Get/set the line color
Get/set the line opacity. Must be between 0 and 1
Create a new VerticalScrollBar control.
Inherits: object Control
Returns: object ControlVerticalScrollBar
Usage
var b = require('mockupsnode');
var alert = new b.ControlVerticalScrollBar();
Get/set the scrollbar position. Must be between 0 and 100
Create a new VolumeSlider control.
Inherits: object Control
Returns: object ControlVolumeSlider
Usage
var b = require('mockupsnode');
var alert = new b.ControlVolumeSlider();
Create a new Webcam control.
Inherits: object Control
Returns: object ControlWebcam
Usage
var b = require('mockupsnode');
var alert = new b.ControlWebcam();
Returned from the 'links' property of various Control based objects. Set the links of a Control
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
var button = b.controls[0];
// set link at position 0 for a single link @Control
button.links.set('a.bmml');
// set link at position 1 for a multi link @Control
button.links.set('a.bmml',1);
Parameters
Returns: string Link at the specified index
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
var link1 = mockup.controls[0].links.at(1);
var link2 = mockup.controls[0].links[2];
Parameters
Returns: string The removed link
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
mockup.controls[0].links.remove(0);
Parameters
Usage
var b = require('mockupsnode');
var mockup = b.openMockup('/tmp/mockup.bmml');
var accordion = mockup.controls[0];
accordion.links.set('1.bmml',2);
Create a new Mockup.
Inherits: object Base
Returns: object Mockup
Usage
var b = require('mockupsnode');
var mockup = new b.Mockup();
mockup.skin = 'wireframe';
Returns the top level ControlCollection object
Get/set the measured height in pixels. Should generally not be set directly
Get/set the measured width in pixels. Should generally not be set directly
Get/set the height in pixels. Should generally not be set directly
Get/set the width in pixels. Should generally not be set directly
Save the mockup
Parameters
Usage
var b = require('mockupsnode');
var mockup1 = b.openMockup('/tmp/mockup.bmml');
....
// Save back to original file
mockup1.saveMockup();
// Save as new file
mockup1.saveMockup('/tmp/mockupnew.bmml');
Get/set the mockup version. Should generally be left as default value.
Top level object returned from requires. Provides various helper functions.
Create an empty mockup object. Can also create a new mockup via 'new'.
Returns: object Mockup
Open an existing mockup file. Only file paths are currently supported
Parameters
Returns: object Mockup
Usage
// Open a mockup from a local file
var b = require('mockupsnode');
var mockup = b.openMockup('c:\\temp\\mockup.bmml');
console.log('Width' + mockup.width + ', height: ' + mockup.height);
Set the license via a key
Parameters
Usage
// Open a mockup from a local file
var b = require('mockupsnode');
b.setLicense('<KEY HERE>');