>-----Original Message-----
>From: Bob Buffone [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, August 29, 2006 11:55 AM
>To: [email protected]
>Subject: Application Creation
>
>Hello Again,
>
>Application Creation in this email refers to the process of creating a
Xap Application in the HTML code.
>
>Currently there are several ways of doing this but in general it looks
as follows.
>
><script>
> function onload(){
> var session = Xap.createSession( "../../", "index.xal",
other variables );
> }
></script>
>
>1.) Currently the application initialization process for XAP consists
of the Xap.createSession function. This function is responsible for
creating an initial application within the HTML. If developers want to
create multiple applications they can use the Xap.defineSession
function. The naming of these methods seems unintuitive and tied to
server based terms. People may not be using server sessions. If users
want to embed multiple application in a single HTML page to create a
Mashup there isn't a way
>
"Session" and "application" seem to be used equivalently; it's probably
a good idea to use the latter, though I've never confused these client
sessions with a server session. I think we can embed multiple
applications in a page, currently: the dateAndColorPickers example has
two Xap sessions defined (one in tags, the other in JS) and then
created.
Using "application" will be impossible in light of 5.) below if we use
"application" for something containing many sessions. "Xaplet"?
>2.) Both defineSession and createSession can take a variable list of
arguments that are not configurable in the XapConfig.xml file.
Do you want to define defaults in a config file?
>3.) It is also not possible to create a Xap session with out a UI.
This makes it difficult for developers to use just xModify against the
HTML DOM in their application.
_Something_ has to be served. Why can't the developer create
head/bodiless HTML that just encloses everything in a <script/> tag?
>
>4.) Two different methods for creating and defining application,
createSession(), defineSession().
>
The sessions are actually created in "Xap.createAllPredefinedSessions".
This first scans the page to
see if there are any sessions defined there in tags, and adds any such
to the list of sessions to create. (That
list can already have elements in it as a result of calling
"Xap.defineSession()" from within an html <script/> tag.)
I can easily see our getting rid of a separate "Xap.createSession()"
because
1.) ...it doesn't do very much---basically just wraps around
creating and starting a new ClientSession instance
and
2.) ...it shouldn't be called from outside of Xap---if it could
be made private....
I still like the idea that all the sessions for the page are predefined
and then created; it's a good place to check for conflicts.
>5.) There isn't a top level Application object that developers
interface with to perform global Application related functions.
>
This is good; the object could also be a router between sessions.
>Suggestions to fix issues:
>
>1.) Have just one Xap.createApplication function that will under the
covers be responsible for creating the session information.
>2.) Xap.createApplication will take an object that allows users to
specify just the parameters they want to configure. For Example:
>
>var config = {
> startPage: "index.xal",
> context: "../../",
> scanPage: true
> ...
>
>Xap.createApplication(config); // This will tie tightly my
recommendation for change the configuration. All property names of the
config object above exactly match the property names of the Xap
configuration file.
I thinkl it should still be possible for people to define a session in a
tag; someone laying out a page can then lay out html elements using the
tool of their choice, and then insert the Xap sessions.
>
>3.) Make the startPage and scanPage parameters optional. This will
create an application that can be easily used with an UI less
application or application that is using the xModify functionality
against the HTML dom.
>
This is a minor issue, I think: scanPage() looks at the document DOM;
if there are no tags with Xap's non-standard attributes, it does
nothing---if they have been put there, then the designer will want them
to be used.
>4.) Create an application object (Xap.application.Application) that
handles more of the global data structures such as configuration,
session creation and possible ease of use functionality for connecting
HTML actions to Xap event handling.
>
>
>End result of the changes would be as follows.
><script>
> function onload(){
> var config = {
> startPage: "index.xal",
> context: "../../",
> scanPage: true
> }
> var application = Xap.createApplication(config);
> }
></script>
>
>Bob (Buffone)