On 2007-07-11, at 08:42 EDT, Pierre Augier wrote:

This is interresting .. i have to understand the core mechanism of OL :) so i have few questions again :

1) Do you know where are theses core JS library (ex LzView) in the LPS server ? i didn't find them under /lps tree. 1bis) =>And who is doing the binding from LZX code to ECMA code ? i guess it's the OL compiler / servlet couple ?

WEB-INF/lps/lfc holds the core library sources. But they are not included in all distributions. The sources are also available through http://svn.openlaszlo.org/openlaszlo/branches/4.0/WEB-INF/lps/ lfc/

2) Which object framework is used by OL ? prototype.js ?

We have our own framework. Our compiler compiles an approximation of Javascript 2 to Javascript 1 and there is compiler runtime support in the core and compiler subdirectories of the LFC sources.

There are several blog entries that talk about our object framework, although some of them are a bit out of data as the framework has evolved a bit:

http://pt.withy.org/ptalk/archives/2006/02/classy_javascript.html
http://weblog.openlaszlo.org/archives/2006/02/class-based-oop-in- javascript-done-right/
http://pt.withy.org/ptalk/archives/2006/05/circles_and_arrows.html

another question about HCI design:
-3) Is it possible to have a MVC mechanism in OL ? I was thinking about declaring static my component in a sort of view, bind them in a JS library playing the role of the Controler, and then a model.

You might find this blog entry interesting:

http://osteele.com/archives/2003/08/rethinking-mvc

an example with a button that init and connect to a rtmp server (it's a draft) ---------------------------------------------------------------------- ---
<!-- the "view" myapp.lzx-->
<canvas>
<edittext id="edittextServerAddress" />
<button id="mybutton" >connect</button>

<script src="mycontroler.js">
...

<canvas/>
---------------------------------------------------------------------- ---
<!-- the "controler" mycontroler.js -->

//creating the model, ideally, the view would be created here too, but the view is the app entry point so i guess it have to be created first and then the view have to create the controller
var rtmpconn = new myrtmpconnection();

// binding view to controler

mybutton.onclick = function(button)
   {
           button.setAttribute('text','connecting ...');
           rtmpconn.setAttribute ... etc
           rtmpconn.myModelInitMethod(edittextServerAddress.text);
           rtmpconn.connect();
   }

// "controller classic" functions callable from "external"

function init(adress){

   ... code ...
   rtmpconn.myModelInitMethod(adress);
   ... code ...
}
---------------------------------------------------------------------- ---
<!-- the model "mymodel.lzx" -->
<library>

   <class name="myrtmpconnection" extends="rtmpconnection">

        <attribute name="myModelVar" />
<method name="myModelInitMethod" args="adress"=> (code) </ method>
   </class>

</library>

... hope that is clear ... the idea is to have a "real" agent MVC model ... but that's maybe a bad/wrong way ?

thanks a lot

Pierre


Henry Minsky a écrit :
I should add that there is a certain magic translation of core class names from LZX to Javascript that is happening, so <view> actually corresponds to the real class named LzView, same for most of the core classes that are user visible. The magic happens via the static var declaration in a class called "tagname":

class LzView extends LzNode {
static var tagname = 'view';
..


As Tucker said, if you redefine a core class like that, you do so at your own risk,
all sorts of things will probably break.

On 7/10/07, *P T Withington* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Welcome to dynamic languages.  Yes, it is allowed.  If you really
wanted to, you could replace the core classes too. And, yes, it will
    probably cause a problem if you do.

In general, Javascript emphasizes flexibility over safety. IMO, Java
    leans the other way.

    On 2007-07-10, at 13:29 EDT, Pierre Augier wrote:

    > I all !!
    >
> i 'am asking if it's possible to override core class by inclusion
    >
    > i mean something like this :
    > ----------------------------------------------------
    >
    > #file /mypath/view.lzx
    >
    > <class name="view">
    >
    > // my own view class
    >
    > </class>
    >
    >
    > and later...
    >
    > #file /myotherpath/myapp.lzx
    >
    > <include href="/mypath/view.lzx"/>
    >
    > <canvas>
    >
    > <!-- use of the overrided class -->
    >    <view name="lalala" />
    >
    > </canvas>
    >
    > ----------------------------------------------------
    >
> I've tried with "view" and "text" as class name ==> does
    > not work (compilation error)
> then i've tried with "menu" or "button" ==> it
    > work althought i get a warning message in debug console
    >
    > i guess it's because view and text are in the LFC, but menu and
    > button are component ...
    >
    > but my question is:
    >
    > except for LFC that sems impossible to override, for the other
    > class, is this allowed ?? will cause problem ???
    >
    >
    > thanks
    >
    > Pierre
    >
    >




--
Henry Minsky
Software Architect
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>




Reply via email to