On Thursday, February 27, 2003, at 12:36 PM, Raymond Irving wrote:

--- Benoit Marchant <[EMAIL PROTECTED]> wrote:
Mac OS X 10.2.4, Dual processor G4 1Ghz:


http://www24.brinkster.com/dyntools/next/examples/

speedtest.templatedesigner-basic.html
Gecko/20021120 Netscape/7.01 : 500 layers in 1407
milliseconds
IE 5.2.2: 500 layers in 1826 milliseconds
Safari: 500 layers in 3927 milliseconds

Did you compare the values without using
templatedesigner? Is TemplateDesigner faster?

No I didn't, I didn't install the examples on my machine.

http://www24.brinkster.com/dyntools/next/examples/
speedtest.templatedesigner-deep_nest.html
Safari: doesn't work ??

Any ideas why? Too many nested layers?

It's funny you used a dictionary to pass the
arguments !

Yes I did :)

The TemplateDesigner.add() function should never be
used in a loop. If we were to use a dictionary object
for DynLayer then we would have a problem it DynLayer
was used inside a loop.

Wouldn't it make more sense to use a class on the
divs to have them all
look the same ? That would work for all properties
but the innerHTML ?

That's true, but once the page loads you'll not have
the option of change the class property, correct? In
other words if we were to use the TemplateDesigner to
generate a <style> sheet and write it out using
document.write(), how will we be able to modify the
properties of the <style> sheet after the page loads?
Will it be possible to do so in ns4,ie6,etc?

I've been playing with <div> in Netscape 4 so that I can use some static html accross many browsers, as in dynapi 1, that's what was used even for NS4. The key to have stuff working in NS4 is to use #div_id or .ClassName in a <style> </style> in the page or linked through a css file. Any <div style=""> is fatal to NS4 !

So in the example I was just working on, an html page with the divs in it, where I initialize dynlayers using it, I changed a #div_id to .className, added the class= className to the div definition, and it worked like a charm. I moved one of the layer, no issue.
I believe that whatever you use to configure a div, whether it's style="", a #div_id or a class definition, once the div is instanciated in the dom tree of the browser, you can change any property of each div individually.

In NS4 you can read class values by doing:
document.classes.className.all.top
But can't change the vlaue, well you can but it doesn't seem to have any effect

And in more modern browsers, it's possible to change the class values, there's an example at

http://developer.apple.com/internet/javascript/styles.html

with a nice script that encapsulate my browsers differences.

So tell me if I'm wrong, but your TemplateDesigner is not meant to change the properties of all the generated layers that used it, right ? So if that's true, then the class could be used.

Now if we wanted to do that, then a Template object (so a real object compared to the current dictionary) could keep track of all the dynlayers that use it.
So at creation, the template output a .className, and all dynlayers's divs refers to that class.
At modification, if you want to change one dynlayer, use regular apis.
If you want to change all layers using the same template, then call a method on the template, and the template will iterate on all the layers and individually change the same property to the same value.

Call it a DynClass, or DynCSSClass and we got a very nice stuff !!! What do you think ?


Otherwise, it's a good idea to automate things. How
would that work if
you wanted to automate in the same way the creation
of a widget that
needs extra arguments. I think we should find a
clean way to make that
possible, it's in the same line as the getInline
issue for subclasses
of dynlayers.

The quickest solution that most developers use is to
overwrite the function. Do you have any ideas that
will have an impact on performance?

One idea I had was to use a PropertyBag object:

function myObject(x,y,pBag){
//some code here
}

var pbag=PropertyBag.getBag();
pbag.color="yellow";
pbag.size=2;
myObject(10,10,pbag);

The PropertyBag object still impacts performance as
the bag would have to be flush every time.


I was wondering if we could just javascript tricks like function.call

//From the Netscape doc:
You can use call to chain constructors for an object, similar to Java. In the following example, the constructor for the product object is defined with two parameters, name and value. Another object, prod_dept, initializes its unique variable (dept) and calls the constructor for product in its constructor to initialize the other variables.

function product(name, value){
this.name = name;
if(value > 1000)
this.value = 999;
else
this.value = value;
}

function prod_dept(name, value, dept){
this.dept = dept;
product.call(this, name, value);
}

prod_dept.prototype = new product();

// since 5 is less than 100 value is set
cheese = new prod_dept("feta", 5, "food");

// since 5000 is above 1000, value will be 999
car = new prod_dept("honda", 5000, "auto");

In dynapi, we don't use call, and I don't understand why ?
Nonetheless, ideally you should be able to do

MyWidget inherit from DynLayer
function MyWidget(html,x,y,w,h,color,top, Bottom) {...}
and
myNewWidget = MyWidget.getInline(p,id, html,x,y,w,h,color,top, Bottom);

DynLayer
.getInline = function(p,id, html,x,y,w,h,color,top, Bottom)

//instead of var dlyr = new DynLayer();
//something like dlyr = new (can you get MyWidget dynamically there ? calling prototype or something?)(arguments minus p and id)
}

That should work as long as each constructor of each subclass respect and re declare the arguments of it's super class. Otherwise it gets harder to know what to pass, or we could do this:

DynLayer.getInline = function(p,id, className, constructorArguments) {

eval("var dlyr = new "+ className+"("+ constructorArguments+")");
}
If there's a way to get classname with javascript language features, that would be even better.


Benoit

--
Raymond Irving

Benoit

Download updates here:


http://www24.brinkster.com/dyntools/next/dynapi3x.zip
Specs:
----------
Window XP
IE 6, Opera V7 build 2577, Phoenix 0.4
800Mhz 512MB RAM

Please test these findings and please give a
response.
Should I implement these designs or not?

PS. Template Designer current does not work with
ns4.
NS4 support will be added shortly

--
Raymond Irving


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]


http://www.mail-archive.com/[EMAIL PROTECTED]/



__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[EMAIL PROTECTED]/

Reply via email to