You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2002/09/25 19:54:57 UTC

cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing SwingTagLibrary.java

jstrachan    2002/09/25 10:54:57

  Modified:    jelly/src/test/org/apache/commons/jelly/swing example.jelly
               jelly/src/java/org/apache/commons/jelly/tags/swing
                        SwingTagLibrary.java
  Added:       jelly/src/test/org/apache/commons/jelly/swing run.jelly
                        about.jelly
  Log:
  Patch to demonstrate the use of dialogs in JellySwing.
  
  The new demo 
  
  	maven demo:swing
  
  now has an about dialog box as well as a Jelly script runner. This lets you leave the Swing UI running and then you can fire off any Jelly script you wish using a file dialog.
  While the program is running you can keep re-evaluating Jelly scripts.
  This makes a large benefit for edit-compile-run cycles. So as you edit Jelly scripts you can just click run to run them. No need to wait for the JVM and Maven to startup
  
  Revision  Changes    Path
  1.8       +14 -3     jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/swing/example.jelly
  
  Index: example.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/swing/example.jelly,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- example.jelly	25 Sep 2002 16:26:16 -0000	1.7
  +++ example.jelly	25 Sep 2002 17:54:57 -0000	1.8
  @@ -42,10 +42,21 @@
             </action>
           </menuItem>
         </menu>
  +      <menu text="Run">
  +        <menuItem>
  +          <action name="Run a Jelly script">
  +          	<log:info>about to open the Jelly script runner...</log:info>
  +          	<j:include uri="run.jelly"/>
  +          </action>
  +        </menuItem>
  +      </menu>
         <menu text="Help">
  -				<font family="Verdana" size="14"/>
  -
  -        <menuItem text="About"/>
  +        <menuItem>
  +          <action name="About">
  +          	<log:info>about to display the about dialog...</log:info>
  +          	<j:include uri="about.jelly"/>
  +          </action>
  +        </menuItem>
         </menu>
       </menuBar>
       
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/swing/run.jelly
  
  Index: run.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly 
  	xmlns:j="jelly:core" 
  	xmlns="jelly:swing" 
  	xmlns:log="jelly:log">
  
  	<!-- default working directory to swing examples -->		
  	<j:if test="${empty working.dir}">
  		<j:set var="working.dir" value="src/test/org/apache/commons/jelly/swing"/>
  	</j:if>
  		
  	<fileChooser var="chooser" description="Jelly files" currentDirectory="${working.dir}"/>
  	
  	${chooser.showDialog(frame, 'Choose Jelly file')}
  
  	<j:set var="file" value="${chooser.selectedFile}"/>
  	
  	<j:if test="${file != null}">
  		<log:info>about to run ${file}</log:info>	
  		<j:include uri="${file.toURL().toString()}"/>
  	</j:if>
  	
  </j:jelly>
  
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/swing/about.jelly
  
  Index: about.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly 
  	xmlns:j="jelly:core" 
  	xmlns="jelly:swing" 
  	xmlns:log="jelly:log">
  
  	<j:set var="text">
  This is an example of the kind of Rich User Interface you can create
  using JellySwing.
  
  The whole user interface can be specified using XML which can then be
  executed using Jelly.
  
  There is support for all the main Swing controls as well as custom controls.
  Configure your views using XML techniques such as XSLT or Jelly, then 
  plug in your own models or create new models dynamically using Jelly.		
  	</j:set>
  	
  	<optionPane var="optionPane" message="${text}"/>
  	
  	<j:set var="dialog" value="${optionPane.createDialog(frame, 'About JellySwing')}"/>
  	${dialog.show()}
  	
  </j:jelly>
  
  
  
  
  
  
  1.9       +2 -1      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/SwingTagLibrary.java
  
  Index: SwingTagLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/SwingTagLibrary.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SwingTagLibrary.java	25 Sep 2002 16:26:15 -0000	1.8
  +++ SwingTagLibrary.java	25 Sep 2002 17:54:57 -0000	1.9
  @@ -177,7 +177,8 @@
   					// can the element control it's children ?
   					// but children should also be able to be any component (as Swing comps. are all container)
           registerBeanFactory( "desktopPane", JDesktopPane.class );
  -        registerBeanFactory( "dialog", JDesktopPane.class );
  +        registerBeanFactory( "dialog", JDialog.class );
  +        registerBeanFactory( "fileChooser", JFileChooser.class );
           registerBeanFactory( "frame", JFrame.class );
           registerBeanFactory( "internalFrame", JInternalFrame.class );
           registerBeanFactory( "label", JLabel.class );
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>