Hello, I followed this discussion because I like the subject. Generating
code. I have my own
ideas about the subject and would appreciate your opinion. I read about a
XML parser written
in JavaScript. Then I thought about the combination Widgets and XML. We
could define and
document the widget in XML, create a editor to modify the widgets
properties, show the result
in a seperate frame and use the parser (8kb) to create a kind of javascript
DOM at runtime, also storing
references to widgets instances within that DOM.
A little example :

<html>
<head>
<title>fam.meenhorst.nl</title>
<script language="JavaScript" src="./shared/js/dynapi.js"></script>
<script language="Javascript">
DynAPI.setLibraryPath('./shared/js/lib/');
DynAPI.include('dynapi.api.*');
DynAPI.include('dynapi.util.thread');
DynAPI.include('dynapi.util.pathanim');
DynAPI.include('dynapi.util.cookies');
DynAPI.include('dynapi.gui.loadpanel');
DynAPI.include('dynapi.gui.viewport');
DynAPI.include('dynapi.gui.label');
DynAPI.include('dynapi.gui.dynimage');
DynAPI.include('dynxml.xml.*');
DynAPI.include('widget.gui.*');
</script>
<script language="JavaScript" src="./shared/js/dom.js"></script>
<script language="Javascript">
DynAPI.onLoad = function() {

   DynAPI.cookies.readCookie('theme');
   selectedTheme = DynAPI.cookies.readCookie('theme');
   if (!selectedTheme) selectedTheme='default';

   domDesktop=dom.getAttrib(dom.getRef('/DynDOM/desktop'));
   domDesktopItems=dom.getAttrib(dom.getRef('/DynDOM/desktop/items'));
   domTheme=dom.getRef('/DynDOM/themes/' + selectedTheme);
   domStart=dom.getRef('/DynDOM/startmenu');
   domFav=dom.getRef('/DynDOM/favorites');

   // precatch theme images
   for (elem in domTheme.contents) {
      for (attr in domTheme.contents[elem].attributes) {
      var val = domTheme.contents[elem].attributes[attr];
      if ( val.indexOf('.gif')!=0 || val.indexOf('.jpg')!=0)
DynImage.getImage(val);
   }

 generate widget instances using the getAttrib and getRef functions


I attached the parser and the discribed two functions.



 -----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Pascal
Sent: Monday, January 22, 2001 4:54 PM
To: [EMAIL PROTECTED]
Subject: RE: [Dynapi-Dev] Oversight (Code generation)


Yep, that's basically all.. the only thing do is create a recursive function
of some sort, that walks thru all layers and child layers, and also generate
the correct addChild() calls, and all EventListeners (can be done using the
eventlisteners array).

The only problem still remaining is the fetching of real javascript variable
names... not sure if these are part of the DOM somewhere.. For a wysiwyg
editor it wouldn't be a problem, you could generate your own variable
names.. but for existing code you would have to use the real variable names
to not screw up existing code.

I also want these modules not extending the DynLayer or other DynAPI
objects, but rather have there own functions to handle these things..

cya,
Pascal Bestebroer ([EMAIL PROTECTED])
Software ontwikkelaar
Oberon Informatiesystemen b.v.
http://www.oibv.com
-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]Namens Michael Pemberton
Verzonden: maandag 22 januari 2001 16:38
Aan: [EMAIL PROTECTED]
Onderwerp: Re: [Dynapi-Dev] Oversight (Code generation)


I was mucking around with this last night.  the attached file is one method
of doing it.
Just include the attached file and call layerName.generateCode() this should
return a copy of the initialisation command for the layer.
Pascal wrote:
Some secondary values are callable, but certain arrays will give problems
(I'm trying to fix that).
I'm not sure if I can retrieve variable names (anyone with an idea on that
one?) But I am planning on creating an extra module like Oversight, which
reads the DynAPI tree of objects (dynapi.document and all child layers) and
regenarets correct code for it.. This would be the first step for wysiwyg
editing.. simple attach dragevent listeners to every layer on screen so that
they can be placed, call the code-generator and you have your wysiwyg editor
Also another idea I'm having is including a better object watcher to
Oversight.. like the one found in Delph, Visual basic ,etc.. a window
showing all properties and values, make them editable and you have easy
access to every object, making the Dump Object obsolete.
cya,
Pascal Bestebroer ([EMAIL PROTECTED])
Software ontwikkelaar
Oberon Informatiesystemen b.v.
http://www.oibv.com
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]Namens Richard Bennett
> Verzonden: maandag 22 januari 2001 0:42
> Aan: [EMAIL PROTECTED]
> Onderwerp: Re: [Dynapi-Dev] Oversight
>
>
> Hi,
> This was another amazing job, both of you, I'll add it to
> every example on
> my site with the next release,
> and have it called from a link instead of my DynAPIDiagnose.
> A few points:
>     you probably know dumping the secondary values from the hyperlinks
> doesn't work yet.
>     Is it possible to get a clickable list of the objects on
> the page by the
> name they were defined by, like this:
>
>     Available objects on this page:
>     * MyLayer
>             *MyChildLayer
>
>     * SkinWindow1
>             *myPushPanel1
>                     *myLoadPanel1
>     etc.
>     oh, and you could add printing, and...
>
> Cheers,
> Richard Bennett
>
> [EMAIL PROTECTED]
> www.richardinfo.com
> (Everything running on, and ported to the 19/12/2000 snapshot
> of DynAPI2)
>
>
> ----- Original Message -----
> From: "Pascal Bestebroer" <[EMAIL PROTECTED]>
> To: "Dev" <[EMAIL PROTECTED]>
> Sent: Sunday, January 21, 2001 2:58 PM
> Subject: [Dynapi-Dev] Oversight
>
>
> > Played "abit" with Martin Ström 's console code, and got
> some nice ideas
> on
> > how to enhance it.
> > See the attached result.
> >
> > Unzip this package into a sub directory of your DynAPI code
> (eg. into the
> > src/ directory), and add the following two lines to your
> code for some
> great
> > debuggin tools:
> >
> > DynAPI.include('oversight.js','../src/oversight')
> >
> > and then in the DynAPI.onLoad, add the first line:
> >
> > Oversight.run('../src/oversight')
> >
> > where the '../src/oversight' is the path of your Oversight
> root folder.
> >
> > I haven't done much on errorhandling yet so be carefull,
> but currently you
> > have the
> > following tools:
> >
> > * Add watch
> >   Adds a property to the watcher.. the watcher will then
> display the value
> > of that property.
> >   For example, try adding a watch for myLayer.x  and make the layer
> > dragable..
> >
> > * Delete watch
> >   Deletes the property or variable from the watcher list..
> no real need
> for
> > this, every property
> >   will have a DEL link in the watcher window, to remove
> it.. saves typing
> >
> > * Dump object
> >   Dumps the specified object and it's properties/methods..
> also creating
> > dynamic hyperlinks for
> >   all child objects.
> >
> > * Show value
> >   Displays the value of the specified variable or property
> (not watching,
> > just printin it once)
> >
> > * Execute code
> >   Will execute any code you type in it.. Basically this
> allows you to
> create
> > DynLayer, move existing
> >   DynLayers/widgets, etc,etc,etc.
> >
> > I want to enhance the Execute code, so that it displays a
> memo field so in
> > which you can type more lines
> > at once.. making it a runtime editor.
> >
> > I think that when we create more of these types of tools, that the
> > DynBuilder as described by Henrik is actually possible as a
> Webapplication.
> >
> > I've only tested this stuff on IE5 and NS4.. and works
> under both browsers
> > perfectly.
> > Let me know of any ideas, comments, flames, rock throwing, etc..
> >
> > cya,
> >
> > Pascal Bestebroer
> > [EMAIL PROTECTED]
> > http://www.dynamic-core.net
> >
>
>
> _______________________________________________
> Dynapi-Dev mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-dev
>
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-dev
--
Michael Pemberton
[EMAIL PROTECTED]
ICQ: 12107010

dom.js

dynxml.js

xparse.js

dynapi.js

Reply via email to