Appboard/old/custom flex widgets: Difference between revisions
imported>Mike.berman (created page) |
imported>Jason.nicholls No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:Custom Flex Widgets}} | |||
[[Category:AppBoard old]] | |||
AppBoard developers may have existing Flex components that need to be integrated into an AppBoard project. This section details the procedure for integrating Flex components. | AppBoard developers may have existing Flex components that need to be integrated into an AppBoard project. This section details the procedure for integrating Flex components. | ||
<videoflash>_AEoJtcKSag|600|300</videoflash> | |||
==Setting up a Development Environment== | ==Setting up a Development Environment== |
Latest revision as of 10:28, 17 July 2014
AppBoard developers may have existing Flex components that need to be integrated into an AppBoard project. This section details the procedure for integrating Flex components.
<videoflash>_AEoJtcKSag|600|300</videoflash>
Setting up a Development Environment
You will need the following tools and files:
- Latest version of Flash Builder 4, with the 4.0.0 SDK
- Do not use Flex SDK version 4.1.0, as it has some major defects
- Latest version of the AppBoard Turnkey Server (delivered as a zip file)
Perform the following to create your development environment:
- Unzip the AppBoard master zip file to any desired location on the server
- Unzip the "Appboard Turnkey Server" zip file that is inside the master zip file
- This is your "turnkey server".
- Start the turnkey server by running the Tomcat startup executable in [TURNKEY_HOME]/bin/
- Windows: startup.bat
- Unix: startup.sh
- Open Flash Builder 4
- Optionally create a new workspace named "Appboard"
- In Flash Builder 4, click "File" -> "Import" -> "Other" -> "General" -> "Existing Projects into Workspace" -> "Next"
- Click "Select archive file" and Browse for the "Appboard_VisualBuilder_SDK...zip" file
- Enable "Copy projects into workspace"
- Click Finish
- Right click on the "Appboard_VisualBuilder_SDK" project folder, and choose "Properties"
- Under "Flex Build Path", point the output folder to [TURNKEY_HOME]/webapps/enportal/visualizer-custom
- Check that the Output URL is proper, and ends with "visualizer-debug"
- Under "Flex Compiler" ensure that you are using "Flex SDK 4.0"
- Click OK
- Click "Project" -> "Clean" in the menu bar.
- Click "Debug" (icon) -> "Appboard_Builder"
Your browser should now launch and be running in a debug build of the Visual Builder interface.
Architecture of an Appboard Widget
Widgets are simply flex DisplayObject components that implement the com.edgetech.widget.IWidget interface. There are several example widgets included in the Appboard_VisualBuilder_SDK that you can use for reference. Start with com.edgetech.widget.FooWidget, as it is has only the most basic structure required.
Important Classes and Interfaces
The IWidget interface defines all of the necessary methods for an Appboard widget. See the IWidget.as source code for an explanation of each method.
As noted in IWidget, each widget must define a "ConfigurationUIClass". This class is simply an MXML that extends "WidgetConfigurationBase". The configuration UI is used when adding or editing a widget. See the "WidgetConfigurationBase.as" file for more information about its methods.
DataObjects
Appboard makes extensive use of the DataObject class as a means by which to transfer and store information on the Appboard server. The sever creates DataObjects to represent rows in a DataSource. The client creates DataObjects as a means of configuration storage. DataObjects are identified by their "MetaClass Name" and unique id. Use DataObject's "getMetaClass().name" method to obtain the "meta" class name of the DataObject. Use the "id" property to obtain the unique id.
Configuration DataObjects
Each widget is given one "Configuration DataObject". A configuration DataObject is a blank slate on which the configuration UI can store properties; such as strings, booleans, numbers and dates. The configuration DataObject is then used by the widget component to drive its behavior. Here are the types of items you can store on a configuration object.
- String, Number, Date, Int, Boolean
- Array of DataObjects
Here is an example of storing native types on a configuration DataObject.[php,N]
configuration.myStringProperty = "some string";
configuration.myCustomDate = new Date();
configuration.someNumber = 4;
configuration.booleanFlag = false;
To create a DataObject, use the DataModel singleton's "createDataObject" method. Example:[php,N]
var dataModel:DataModel = DataModel.getInstance();
var customDataObject:DataObject = dataModel.createDataObject("appboard.config.WidgetName.FooSomething");
configuration.customDataObjects = [customDataObject];
With the above code, the configuration would now have a property named "customDataObjects", which holds an array of one DataObject.
'Factory Modules'
When you are ready to load your custom widget on to your AppBoard server, simply edit the "CustomWidgetsFactoryModule.mxml" file. Use the documented "addClass" method to add a reference to your widget class.
'Debugging'
Click the "Debug" icon and choose "Appboard_Builder". This should launch the AppBoard Builder interface from the "visualizer-debug" directory. Your custom widget will be loaded via the factory module, and you will find your widget listed in the "Add Widget" dialog. You can use Flash Builder's debugger to create break points and variable watchers.