Let me provide a specific example of why I want to do this. I'm
working on improving scripting support in Apache Pivot
(http://incubator.apache.org/pivot
). We want to make it easier to use scripting languages to build Pivot
applications.
UIs in Pivot are typically declared in markup, which we call WTKX
("Windowing ToolKit/XML)". Elements whose tag names begin with an
uppercase letter are considered classes and are instantiated by the
WTKX loader; XML namespaces are used to define the package names for
each class. For example, this WTKX defines an instance of
pivot.wtk.Window that has a pivot.wtk.FlowPane as its content; the
flow pane contains a single pivot.wtk.PushButton:
<Window title="Example Application"
xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
xmlns="pivot.wtk">
<content>
<FlowPane>
<PushButton wtkx:id="pushButton" buttonData="Click Me!"/>
</FlowPane>
</content>
</Window>
Often, we'll want to add scripted event listeners to components
declared this way. For example, I'd like to add a button press
listener to the push button as follows:
<Window title="Example Application"
xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
xmlns="pivot.wtk">
<content>
<FlowPane>
<PushButton wtkx:id="pushButton" buttonData="Click Me!">
<buttonPressListeners>
<wtkx:script language="javascript">
<![CDATA[
function buttonPressed(button) {
System.out.println("You clicked me!");
}
]]>
</wtkx:script>
</buttonPressListeners>
</PushButton>
</FlowPane>
</content>
</Window>
Though this example wouldn't really benefit from it, I'd like to
automatically import the packages declared by the XML namespaces into
the script block so the caller doesn't have to manually import them
again. Without the ability to do this, the script blocks will be a
little more verbose than I'd like.
G
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---