commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: [Jelly] Running Jelly:SWT's withouth creating a new shell?
Date Fri, 31 Jan 2003 13:56:53 GMT
Hey Dag

From: "Dag Liodden" <>
> Hi all!
> I'm working on a JMX-console for JBoss and am looking into using Jelly:Swt
> for scripting custom configurators for each MBean.


> The simple scripting that
> Jelly allows for SWT right now is really enough for the basic
> layouts/operations that need to be done with the MBeans. However, I'm not
> familiar with Jelly and I'm wondering how to execute a Jelly:Swt script
> does not create a new shell (in Swing - Frame). In other words, I'd just
> like to know how to set a parent (shell) tag -outside- of a script and
> execute it. I have a main app with a gui and just want to place
> script-generated composites (in Swing - Panel) inside that gui. It would
> also be nice to get a ref of the generated object back to my main app. :)
> Any ideas? (this is probably a non-swt-specific :)
> If you answer, pleas cc me as I'm not on the list yet. :)

This was an oversight - I've just patched the SWT tags in CVS so that a
parent (shell or Container) can now be specified in an attribute.


<tree parent="${someShell}">

There's a demo of this working - if you cd to jelly/jelly-tags/swt and with
a recent CVS HEAD of Maven type

    maven demo

You should get an SWT screen which you can click on the 'parent demo' button
on the toolbar which runs the parentDemo.jelly script.

If you want to export any widget at any point in the hierarchy as a variable
so that you can use it either from Java code or pass it into some bean or
method, just use the var attribute.

<table var="myTable">

then in Jelly code you could do something like...

    <j:useBean var="foo" class="com.acme.MyHelperBean" table="${myTable}"/>

which would invoke the setTable() method of the MyHelperBean.

or in normal Java code

    JellyContext context = new JellyContext()
    Object table = context.getVariable( "myTable" );

On a closing note, it'd be easy to extend JellySWT to add some richer JFace
widgets too, so the JFace abstraction for content providers, label producers
and such like could be used. While we're on the subjet, Van's recent
articles on SWT and JFace are worth a read...


Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

View raw message