[fusion-users] Widget Functions.
Alan Boudreault
aboudreault at mapgears.com
Wed May 14 10:43:00 EDT 2008
Just to be sure....... Put the Fusion.require('widgets/myWidgets.js');
line before the Class.Create statement, and it will work. (not in the
initialize method).
Regards,
Alan
Alan Boudreault wrote:
> quire method in your sneRefreshMap definition file.
> ie: Fusion.require(widgets/myRequiredWidget.js');
>
> This will avoid to add extra unuseful information in the
> ApplicationDefinition.xml.
>
> Regards,
> Alan
>
> Tómas Guðmundsson wrote:
>> I tried what you guys said. Here is the block I added. Note my widget
>> is called sneBlockUI.
>>
>> ApplicationDefinition.xml:
>> <!-- ******************************************
>> * Trying to load extra javascripts
>> * with xml here. Required by fusion.
>> **********************************************-->
>> <Container xsi:type="UiItemContainerType">
>> <Name>sneBlockUI</Name>
>> <Type>Block UI</Type>
>> <Item xsi:type="WidgetItemType">
>> <Function>Widget</Function>
>> <Widget>sneBlockUI</Widget> </Item> </Container>
>> index.html:
>> <div id="sneBlockUI"></div>
>>
>> Do I need to add the widget (xml) definition for sneBlockUI as well ?
>>
>> -----Original Message-----
>> From: fusion-users-bounces at lists.osgeo.org
>> [mailto:fusion-users-bounces at lists.osgeo.org] On Behalf Of Mike Adair
>> Sent: 14. maí 2008 13:52
>> To: Alan Boudreault
>> Cc: fusion-users at lists.osgeo.org
>> Subject: Re: [fusion-users] Widget Functions.
>>
>> Also, widgets must be associated with a DOM element to be
>> instantiated. This can be either through a <Container><Item>
>> element, or simply through a <div id='widgetName'> element in the
>> page (I think this works). You can try putting a breakpoint in the
>> widget constructor to see if it ever gets instantiated.
>>
>> Mike
>>
>> Alan Boudreault wrote:
>>
>>> Where is defined you class sneBlockUI ? Can you check with firebug
>>> if the file you defined this class is well loaded ? Fusion does'nt
>>> load all the "TheWidget.js" files by default, only those that are
>>> required. (Those defined in the ApplicationDefinition.xml)
>>>
>>> Regards,
>>> Alan
>>>
>>> Tómas Guðmundsson wrote:
>>>
>>>> Yeah,
>>>>
>>>> Here are the errors I get via firebug.
>>>> Fusion.Widget.sneBlockUI is not a constructor
>>>> - this.blocker = new Fusion.Widget.sneBlockUI(); ---
>>>> sneRefreshMap.js (line 8)
>>>> blockUI is not defined
>>>> - blockUI(); --- sneRefreshMap.js (line 16)
>>>>
>>>> What I am aiming for is this blocking of the ui while the map is
>>>> rendering so maybe I should just modify the Map.js ?
>>>> However here is the code.
>>>>
>>>> Fusion.Widget.sneRefreshMap = Class.create();
>>>> Fusion.Widget.sneRefreshMap.prototype = {
>>>> initialize : function(widgetTag) {
>>>> //console.log('RefreshMap.initialize');
>>>> Object.inheritFrom(this, Fusion.Widget.prototype,
>>>> [widgetTag, true]);
>>>> Object.inheritFrom(this, Fusion.Tool.ButtonBase.prototype,
>>>> []);
>>>> this.dialog = null;
>>>> this.blocker = new Fusion.Widget.sneBlockUI();
>>>> },
>>>>
>>>> /**
>>>> * execute function.
>>>> */
>>>> execute : function() {
>>>> var map = this.getMap();
>>>> blockUI();
>>>> map.redraw(); },
>>>> blockUI : function() {
>>>> if (!this.dialog) {
>>>> var size = Element.getPageDimensions();
>>>> var o = {
>>>> title: OpenLayers.String.translate('Loading'),
>>>> id: 'Loading',
>>>> imageBaseUrl: this.imageBaseUrl,
>>>> width: 150,
>>>> height: 85,
>>>> resizeable: false,
>>>> top: (size.height-200)/2,
>>>> left: (size.width-320)/2,
>>>> };
>>>> this.dialog = new Jx.Dialog(o);
>>>> }
>>>>
>>>> this.dialog.open(); }
>>>> };
>>>>
>>>> -----Original Message-----
>>>> From: Paul Spencer [mailto:pspencer at dmsolutions.ca] Sent: 14. maí
>>>> 2008 11:25
>>>> To: Tómas Guðmundsson
>>>> Cc: fusion-users at lists.osgeo.org
>>>> Subject: Re: [fusion-users] Widget Functions.
>>>>
>>>> I'm not sure about the first error, can you send code for us to
>>>> look at?
>>>>
>>>> For the second, try:
>>>>
>>>> var myObject = new Fusion.Widget.MyNewWidget();
>>>>
>>>> Paul
>>>>
>>>> On 14-May-08, at 5:57 AM, Tómas Guðmundsson wrote:
>>>>
>>>>
>>>>
>>>>> Hi all.
>>>>>
>>>>> I have been wondering about a very strange "bug" but then again
>>>>> this might be something that you don't notice until you've told
>>>>> everybody about it and feel like a complete idiot.
>>>>>
>>>>> I'm trying to create a code that extends the refresh widget by
>>>>> opening up a ui-blocking page like the Print widget does.
>>>>> However, if I just use the pure code from Print.js, like
>>>>> copy/paste. Firebug gives me an error that the function can not
>>>>> be found. Totally cryptic to me. It is defined exactly like the
>>>>> Print.js widget, do I need to define my functions somewhere else ?
>>>>>
>>>>> Also, if I have created a seperate widget that I want to use just
>>>>> like a new class in a conventional programming, like so.
>>>>>
>>>>> var myObject = new MyNewWidget();
>>>>>
>>>>> Do I need to call Fusion.Class or something ?
>>>>>
>>>>> Thanks
>>>>> Tomas
>>>>> _______________________________________________
>>>>> fusion-users mailing list
>>>>> fusion-users at lists.osgeo.org
>>>>> http://lists.osgeo.org/mailman/listinfo/fusion-users
>>>>>
>>>> __________________________________________
>>>>
>>>> Paul SpencerTómas Guðmundsson <tomas at snertill.is>
>>>> Chief Technology Officer
>>>> DM Solutions Group Inc
>>>> http://www.dmsolutions.ca/
>>>>
>>>> _______________________________________________
>>>> fusion-users mailing list
>>>> fusion-users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/fusion-users
>>>>
>>>
>> _______________________________________________
>> fusion-users mailing list
>> fusion-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/fusion-users
>>
>
>
--
Alan Boudreault
Mapgears
http://www.mapgears.com
More information about the fusion-users
mailing list