Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

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:

<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. 

Widget Saving Example
//Here is an example of creating an anonymous object (tempWidgetOptions)
//and setting some fields to save the zoom and centerpoint of a map widget 
//This method will be polled every few minutes
public function onSaveWidgetOptions():Object
{
      var tempWidgetOptions:Object = new Object();
      tempWidgetOptions[ "centerLat" ] = _map.center.lat;
      tempWidgetOptions[ "centerLng" ] = _map.center.lng;
      tempWidgetOptions[ "zoomLevel" ] = _map.zoom;
      return tempWidgetOptions;
}

//The next time a widget is opened it will be sent the anonymous object
//that was last saved from onSaveWidgetOptions
//that object can be used to restore previous states
public function onLoadWidgetOptions( widgetOptions:WidgetSaveObject ):void
{               
    if ( widgetOptions != null )
    {
        //this holds a users last map 
        if ( widgetOptions.userSave != null )
        {
              this.widgetOptions = widgetOptions.userSave;
              //widgetOptions contains fields centerLat,centerLng,zoomLevel from our last save
        }
	}
}



The communitySave object is used for giving a widget specific saved data for a given community, for example giving an intelligence community KML specific to a region of interest for a map widget or using a certain color scheme specific to business operations for a statistics widget.  The communitySave objects can only be set external to a widget in http://infinite.ikanow.com/fileUploader.jsp  To make a communitySave in the fileUploader just upload a json file with a community selected, any json available to a user when a widgetLoads will be passed into the WidgetSaveObject.communitySave when onLoadWidgetOptions is called from then on.


  • No labels