Styling
To ensure a similar experience between browsers, operating systems, and other environment factors we have included a default font into Infinit.e. Because of the way widgets are dynamically loaded modules, if you want to take advantage of the global font widgets must include the css stylesheet we use to style all font. If you use the eclipse plugin or predefined project in the getting started section, these are created for you and included in your widget automatically. If you choose not to use the Infinit.e font you are more than welcome to unreference the stylesheet and go with your own approach. The stylesheet included with your project is just an example and is not uploaded with your project when it is being submitted, so do not make changes to that stylesheet as they will not be reflected when uploaded your widget to the main Infinit.e application.
The stylesheet we have included styles all spark components and a selection of common MX components. If you include a MX component that we have not styled in our stylesheet, you have the option to add a style to your widget individually. If using the eclipse plugin or predefined project there is a commented out example in the <fx:Style> tag of adding the font to a mx:Text component. an example is also shown here:
Code Block | ||
---|---|---|
| ||
<fx:Style>
mx|Text
{
font-family: infiniteNonCFFFont;
}
</fx:Style> |
Widget Saving - Community vs User Options
Typically a widget will save any options that it wants on reloading during a onSaveWidgetOptions call. Any json object passed to the widget framework on that call will be returned when the widget is loaded via onLoadWidgetOptions in a WidgetSaveObject. The WidgetSaveObject has 2 interesting fields, userSave and communitySave. The userSave object is the standard object that was saved during a onSaveWidgetOptions call and should be used for any save options that are unique to an individual user; for example their current zoom level and centerpoint on map widget or the graph type on a statistics widget.
...
title | Widget Saving Example |
---|
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Code Block | ||
---|---|---|
| ||
public function onLoadWidgetOptions( widgetOptions:WidgetSaveObject ):void
{
if ( widgetOptions != null )
{
//this holds a users last map
if ( widgetOptions.userSave != null )
{
//...code from above here
}
if ( widgetOptions.communitySave != null )
{
//Any shares you have access to with type widgetSave will be provided here
//Here we will be given a map of community ids to shares e.g. { "commid12345": {"key1":"value1"}, "commid67890":{"anotherkey",["blue","green","red"]}}
for ( var commid:String in widgetOptions.communitySave )
{
//this is the object saved in the share for community <commid>
//Now you can do what you want with it (we printed it out)
var community_save_object = widgetOptions.communitySave[commid];
for ( var key:String in community_save_object )
{
trace("CommId: " + commid + " key: " + key + " value: " + community_save_object[key]);
}
}
}
}
} |
Widget Drag and Drop
A generic drag and drop interface is implemented for sending document, entities, and associations between widgets. To accept these things a widget only needs to implement an event handler for the widgetDrop event on WidgetModule
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
The WidgetDropEvent object holds 3 anonymous arrays: entities,associations,documents, any/all of these may have data in them.
...
...
...
...
...
...
Panel |
---|
Related Documentation: |