[fusion-users] Problems with starting a new application.

Tómas Guðmundsson tomas at snertill.is
Tue May 13 11:46:30 EDT 2008


Hey all,

I just found out how to solve my own problem. So I would like 
to share it with the list. Maybe if it is not documented it 
can be revised or copied to the documentation. Please correct
me if I'm wrong. Note: This is not the way you should do it 
through MapGuide, but programmatically with files on a disc.

To add your own widget to a current fusion application you have
to follow these steps.
1) Create a WidgetInfo xml of your widget (i.e. MyWidget.xml).
   This must contain all the information about the Widget, please
   refer to other widgets like About.xml on what information is 
   needed. Take a look at TaskPane.xml if you need to pass on 
   parameters to your widget.

2) Create a JavaScript implementation of your widget called
   the same name as the WidgetInfo file, in our case (MyWidget.js)
   This must also follow the "fusion-way" of things so take a 
   look at common things between javascript files like Class.Create()
   MyWidget.prototype { ... initialize() ... execute(function() { }) ... }

3) Now you must modify the ApplicationDefinition.xml. For the first
   part you must add a reference to your widget into some container, 
   be it a toolbar, taskpane or context menus, some where it must be 
   shown. Now, you must also define the Widget with xml in the same
   file. Just take a look at further down in the file how it's done.
   There you can just copy paste the xml from the widgetinfo file but
   bear in mind you must change the tag <WidgetInfo> to <Widget xsi...>
   Also, the <Name> tag must be added as well. 

Tip: You must make sure that in the Name tag, class created in the javascript
and preferably for having things not become messy, use the same name for everything.
In this case MyWidget. 

Hope this helps new developers trying to create a new fusion application.

Rgds
Tomas.
-----Original Message-----
From: fusion-users-bounces at lists.osgeo.org [mailto:fusion-users-bounces at lists.osgeo.org] On Behalf Of Tómas Guðmundsson
Sent: 13. maí 2008 13:57
To: Paul Spencer
Cc: fusion-users at lists.osgeo.org
Subject: RE: [fusion-users] Problems with starting a new application.

Paul,

Thank you very much for this. This totally helped me out.

As I will be continuing the development for Snertill in Iceland
I hope this can be a place to find answers to my and other
peoples problems. 

To programmatically add a widget. Besides having a Widget.js and 
Widget.xml in the widgets/ and widgetinfo/ folders, what else is 
needed so that Fusion will recognize it?

Thanks very much for your time guys.
Tomas

-----Original Message-----
From: Paul Spencer [mailto:pspencer at dmsolutions.ca] 
Sent: 13. maí 2008 13:39
To: Tómas Guðmundsson
Cc: Kenneth Skovhede, GEOGRAF A/S; fusion-users at lists.osgeo.org
Subject: Re: [fusion-users] Problems with starting a new application.

Tómas,

If you do not specify ApplicationDefinition= in the url to a template,  
Fusion will assume that you have a file called  
ApplicationDefinition.xml in the same place as your template and will  
automatically attempt to load it.  If you do specify  
ApplicationDefinition= then it will look to see if the path starts  
with either Library:// or Session:// - if it does then it will contact  
the mapguide server to load the ApplicationDefinition, otherwise it  
will assume you have pointed it to another file and will attempt to  
load it using HTTP.

You may have more than one MapGroup in your ApplicationDefinition.   
Each one has an ID.  The ID is used to match with a MapWidget tag  
inside a WidgetSet.  It is perfectly valid to have two (or more)  
WidgetSet tags each having a MapWidget tag that points to a different  
MapGroup.  You will find that if you change the ID in the MapGroup,  
you will need to search for the MapWidget tag and update it to match.

Hope this helps!

Cheers

Paul

On 13-May-08, at 9:01 AM, Tómas Guðmundsson wrote:

> Yes, that does help me, thank you very much.
> However I did find a way to make Fusion read my  
> ApplicationDefinition.xml
> (by leaving no extra URL parameters like ApplicationDefinition)  
> however, I
> do not understand how and why. When I modify the MapGroup in the
> ApplicationDefinition, that if I change the id from sheboygan  
> something else,
> It doesn't work. But if use another map resource and keep the  
> Sheboygan id for
> the mapgroup it works perfectly ? Is this a bug within fusion and  
> should it be
> reported or is there a setting defining a map with ID='sheboygan'  
> somewhere
> I don't know about ?
> Rgds
> tomas
>
> From: Kenneth Skovhede, GEOGRAF A/S [mailto:ks at geograf.dk]
> Sent: 13. maí 2008 13:04
> To: Tómas Guðmundsson
> Subject: Re: [fusion-users] Problems with starting a new application.
>
> I'm not all up to date on Fusion, so I might be wrong.
> Fusion can either use a standalone ApplicationDefinition.xml, or  
> read the equvalent xml from the MapGuide server.
> When you use Studio, it modifies the xml in the MapGuide server.
> Normally, Fusion will load the xml from the MapGuide server, rather  
> than from a file.
> You cannot load xml into MapGuide via. Studio, but you can save a  
> copy of the Xml to your disc, and manually insert it into the server.
>
> Does that help you?
>
>
> Regards, Kenneth Skovhede, GEOGRAF A/S
>
>
> Tómas Guðmundsson skrev:
> Hello all.
>
> I wanted to ask this list if they can help me understand something  
> more about fusion. If there is some more documentation than on the  
> osgeo webpage I would be verey happy if someone could point me to  
> that resource. I'm hoping somebody on this list can answer several  
> aspects I have not yet wrapped my head around. I am using Mapguide  
> Server and Studio Enterprise 2009 and the Fusion that came bundled  
> with that CD. All my modifications and testing took place in the  
> folder mapguide2009/fusion/templates/mapguide/newtemplate/ where  
> newtemplate was indeed just a copy of another template which I  
> modified so I wouldn't overwrite the original copy.
>
> ApplicationDefinition.xml. To what ApplicationDefinition does fusion  
> listen to or parse? I modified the one in the same directory, to  
> hopefully include my mapdefinition but nothing happens. It still  
> went with the default Sheboygan sample data or when it didn't do  
> that it told me (via firebug) that mapGroup has no properties in  
> Map.js. Maybe I'm referencing it wrong? Where can I find the  
> MapDefinition for a weblayout or a map I have ? Also, when I removed  
> a whole section of let's say, ContextMenu, nothing changed. Even  
> with the right map (now given as a paramter in the URL) the same  
> default ContextMenu popped up.
>
>
> I know there are several ways to add your own stuff to the fusion  
> application, but as a programmer I want to everything by hand.  When  
> I add something with a point and click via Mapguide Studio it  
> sometimes works but I would like to know the best way, and in what  
> order I should add the xml definition of a widget, the javascript  
> implementation of that widget, and then the xml snippet inside the  
> applicationdefinition? (Which as point a) made, did not work for me  
> when I changed the ApplicationDefinition).
>
>
> How do I get fusion to execute my code? I tried with my own widgets  
> or components and just the simple javascript command "alert('I say,  
> Hello Fusion!');" does not seem to execute in my own widgets. Other  
> widgets modified, like in the most simple one, About widget. Just  
> before I would open the about window, I entered that line and  
> nothing happened. A colleague of mine told me to move it up 4 lines,  
> on line 67 in About.js, which seems totally random to me but hey, I  
> got my About button to say Hello Fusion so it worked.
>
> So these are my main points of not understanding how Fusion works,  
> so I would appreciate it greatly if somebody could help me  
> understand these points.
>
> Regards,
> Tomas, Programmer for
> Snertill, Iceland.
>
>
>
>
> _______________________________________________
> 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


__________________________________________

    Paul Spencer
    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


More information about the fusion-users mailing list