Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
langjavascript
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--

The MIT License
Copyright (c) 2011 IKANOW llc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

-->
<mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009"
		   xmlns:s="library://ns.adobe.com/flex/spark"
		   xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute"
		   implements="com.ikanow.infinit.e.widget.library.widget.IWidget" creationComplete="init(event){dispatchEvent(new Event("Done Loading"));}">
	<s:HGroup width="100%" height="100%">
		<s:List id="titleList" width="50%" height="100%" dataProvider="{titleArrayList}" />
		<s:List id="entityList" width="50%" height="100%" dataProvider="{entityArrayList}" />
	</s:HGroup>
    <fx:Style source="../com/ikanow/infinit/e/assets/styles/infiniteDefaultStyle.css" />
    <fx:Style>
		@namespace s "library://ns.adobe.com/flex/spark";
		@namespace mx "library://ns.adobe.com/flex/mx";
		/* If you need to override a style in our stylesheet, or add another
		style that we did not support you can do so here, an example has been commented out
		Please see documentation about over-riding MX component styles to display fonts
		*/
		/*
		mx|Text
		{
			font-family: infiniteNonCFFFont;
		}
		*/
	</fx:Style>
	<fx:Script>
		<![CDATA[
			import com.ikanow.infinit.e.widget.library.data.IWidgetContext;
			import com.ikanow.infinit.e.widget.library.widget.IWidget;

			import mx.collections.ArrayCollection;

			private var _context:IWidgetContext;
			[Bindable] private var titleArrayList:ArrayCollection = new ArrayCollection();
			[Bindable] private var entityArrayList:ArrayCollection = new ArrayCollection();

			/**
			 * MethodIWidget firedinterface whento modulereceive isdata doneobject loading.  Sends(IWidgetContext).
			 * messageStore tothe parentiwidgetcontext lettingso itwe knowcan thatreceieve moduledata islater.
			 */
ready to receive data.
			 */
			private function init(event:Event			public function onInit(context:IWidgetContext):void
			{
				var events:Event_context = new Event("Done Loading")context;
				dispatchEvent(events);
			}

			/**
			 * IWidget interface tothat receivefires datawhen object (IWidgetContext)a new query is done.
			 * Store We can access the data from the query iwidgetcontextby using soour
we			 can* receieveiwidgetcontext data laterobject _context.getQueryResults().
			 */
			public function onInitonReceiveNewQuery(context:IWidgetContext):void
			{
				_context = contexttitleArrayList.removeAll();
			}

			/**
	entityArrayList.removeAll();
				var *queryResults:ArrayCollection IWidget= interface that fires when a new query is done. _context.getQuery_AllResults().getTopDocuments();
				for each (var doc:Object in queryResults )
			 * We can access the data from the query by using our
			 * iwidgetcontext object _context.getQueryResults().	{
					titleArrayList.addItem(doc.title);
			 */
			publicfor functioneach onReceiveNewQuery():void
			{
 var entity:Object in doc.entities )
					titleArrayList.removeAll();{
						entityArrayList.removeAlladdItem(entity.disambiguous_name);
					var queryResults:ArrayCollection =  _context.getQueryResults().getResults();}
				}
			}

			/**
				for each (var doc:Object in queryResults )
				{
					titleArrayList.addItem(doc.title);
					for each ( var entity:Object in doc.entities )
					{
						entityArrayList.addItem(entity.disambiguous_name);
					}
				}
			}

			/**
			 * IWidget interface that fires when a new filter is done (including from ourself)
			 * We can access the data fromt he filter by using our
			 * iwidgetcontext object _context.getFilterResults().
			 */
			public function onReceiveNewFilter():void
			{
				var filterResults:ArrayCollection = _context.getFilterResults().getResults();
* IWidget interface that fires when a new filter is done (including from ourself)
			 * We can access the data fromt he filter by using our
			 * iwidgetcontext object _context.getFilterResults().
			 */
			public function onReceiveNewFilter():void
			{
				var filterResults:ArrayCollection = _context.getQuery_FilteredResults().getTopDocuments();
                                // Eg duplicate code from onReceiveNewQuery
			}

			/**
			 * function to rescale the module when the parent container is being resized
			 *
			 * @param newHeight The new height the component needs to be set to
			 * @param newWidth The new width the component needs to be set to be set to
			 */
			public function onParentResize(newHeight:Number,newWidth:Number):void
			{
				this.height = newHeight;
				this.width = newWidth;
			}
			/**
			 * Stubbed out/unusued callbacks:
			 */
			public function supportedExportFormats():ArrayCollection
			{
				return null;
			}
			public function onGenerateExportData(filename:String, format:String):ByteArray
			{
				return null;
			}
			public function onGeneratePDF(printPDF:PDF, title:String):PDF
			{
				return null;
			}
*/
			public function reScale(newHeight:Number,newWidth:NumberonSaveWidgetOptions():voidObject
			{
				this.height = newHeightreturn null;
			}
			this.width = newWidth;public function onLoadWidgetOptions(widgetOptions:Object):void
			{
			}

		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
</mx:Module>