commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons/jelly/jelly-tags/jface/src/test/org/apache/commons/jelly/tags/jface JFaceDemo.jelly
Date Wed, 26 Feb 2003 09:23:29 GMT
jstrachan    2003/02/26 01:23:28

  Added:       jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface
                        ApplicationWindowTag.java
                        DoubleClickListenerTag.java JFaceTagLibrary.java
                        MenuManagerTag.java ViewerTag.java
                        SelectionChangedListenerTag.java ActionTag.java
                        ContributionItemTag.java package.html
               jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/impl
                        ApplicationWindowImpl.java
               jelly/jelly-tags/jface/src/test/org/apache/commons/jelly/tags/jface
                        JFaceDemo.jelly
  Log:
  Applied patches supplied by Christiaan ten Klooster
  
  Revision  Changes    Path
  1.1                  jakarta-commons/jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/ApplicationWindowTag.java
  
  Index: ApplicationWindowTag.java
  ===================================================================
  /*
   * /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swt/SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   * 1.1
   * 2002/12/18 15:27:49
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   */
  package org.apache.commons.jelly.tags.jface;
  
  import java.util.Map;
  
  import org.apache.commons.jelly.JellyTagException;
  import org.apache.commons.jelly.MissingAttributeException;
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.jelly.tags.core.UseBeanTag;
  import org.apache.commons.jelly.tags.jface.impl.ApplicationWindowImpl;
  import org.eclipse.jface.window.Window;
  import org.eclipse.swt.SWT;
  import org.eclipse.swt.widgets.Shell;
  
  /**
   * This tag creates an JFace ApplicationWindow
   *  
   * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster</a>
   */
  public class ApplicationWindowTag extends UseBeanTag {
  
      private Shell parent;
      private int style = SWT.NULL;
  
      /**
       * @param widgetClass
       */
      public ApplicationWindowTag(Class tagClass) {
          super(tagClass);
      }
  
      /* 
       * @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
       */
      public void doTag(XMLOutput output)
          throws MissingAttributeException, JellyTagException {
          Map attributes = getAttributes();
          Object parent = attributes.remove("parent");
          if (parent != null) {
              if (parent instanceof Shell) {
                  this.parent = (Shell) parent;
              } else {
                  throw new JellyTagException(
                      "The parent attribute is not a Shell, it is of type: "
                          + parent.getClass().getName()
                          + " value: "
                          + parent);
              }
          }
          super.doTag(output);
      }
  
      /* 
       * @see org.apache.commons.jelly.tags.core.UseBeanTag#newInstance(java.lang.Class, java.util.Map, org.apache.commons.jelly.XMLOutput)
       */
      protected Object newInstance(
          Class theClass,
          Map attributes,
          XMLOutput output)
          throws JellyTagException {
  
          return new ApplicationWindowImpl(parent);
      }
  
  
      /**
       * @return the visible window, if there is one.
       */
      public Window getWindow() {
          Object bean = getBean();
          if (bean instanceof Window) {
              return (Window) bean;
          }
          return null;
      }
      
  }
  
  
  
  1.1                  jakarta-commons/jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/DoubleClickListenerTag.java
  
  Index: DoubleClickListenerTag.java
  ===================================================================
  /*
   * /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swt/SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   * 1.1
   * 2002/12/18 15:27:49
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   */
  package org.apache.commons.jelly.tags.jface;
  
  import org.apache.commons.jelly.JellyTagException;
  import org.apache.commons.jelly.MissingAttributeException;
  import org.apache.commons.jelly.TagSupport;
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.eclipse.jface.viewers.DoubleClickEvent;
  import org.eclipse.jface.viewers.IDoubleClickListener;
  import org.eclipse.jface.viewers.StructuredViewer;
  import org.eclipse.jface.viewers.Viewer;
  
  /**
   * This tag adds a listener for double-clicks in this viewer.
   * 
   * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster</a> 
   */
  public class DoubleClickListenerTag
      extends TagSupport
      implements IDoubleClickListener {
  
      /** The Log to which logging calls will be made. */
      private static final Log log = LogFactory.getLog(DoubleClickListenerTag.class);
  
      private String var = "event";
      private XMLOutput output;
  
      /* 
       * @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
       */
      public void doTag(XMLOutput output)
          throws MissingAttributeException, JellyTagException {
          if (var == null) {
              throw new MissingAttributeException("var");
          }
  
          StructuredViewer viewer = getParentViewer();
          if (viewer == null) {
              throw new JellyTagException("This tag must be nested within a viewer tag");
          }
  
          viewer.addDoubleClickListener(this);
          this.output = output;
      }
  
      public StructuredViewer getParentViewer() {
          ViewerTag tag = (ViewerTag) findAncestorWithClass(ViewerTag.class);
          if (tag != null) {
              Viewer viewer = tag.getViewer();
              if (viewer instanceof StructuredViewer) {
                  return (StructuredViewer) viewer;
              }
          }
          return null;
      }
  
      /**
       * @return String
       */
      public String getVar() {
          return var;
      }
  
      /**
       * Sets the var.
       * @param var The var to set
       */
      public void setVar(String var) {
          this.var = var;
      }
  
      //  Listener interface
      //-------------------------------------------------------------------------
      /* 
       * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
       */
      public void doubleClick(DoubleClickEvent event) {
          try {
              context.setVariable(var, event);
              invokeBody(output);
          } catch (Exception e) {
              log.error(
                  "Caught exception: " + e + " while processing event: " + event,
                  e);
          }
      }
  
  }
  
  
  
  1.1                  jakarta-commons/jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/JFaceTagLibrary.java
  
  Index: JFaceTagLibrary.java
  ===================================================================
  /*
   * /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swt/SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   * 1.1
   * 2002/12/18 15:27:49
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   */
  package org.apache.commons.jelly.tags.jface;
  
  import org.apache.commons.jelly.JellyException;
  import org.apache.commons.jelly.Tag;
  import org.apache.commons.jelly.impl.TagFactory;
  import org.apache.commons.jelly.tags.swt.SwtTagLibrary;
  import org.eclipse.jface.action.Separator;
  import org.eclipse.jface.window.ApplicationWindow;
  import org.eclipse.jface.viewers.CheckboxTreeViewer;
  import org.eclipse.jface.viewers.TableTreeViewer;
  import org.eclipse.jface.viewers.TableViewer;
  import org.eclipse.jface.viewers.TreeViewer;
  import org.eclipse.swt.SWT;
  import org.xml.sax.Attributes;
  
  /**
   * A Jelly custom tag library that creates JFace user interfaces
   * This taglib extends the SWT tag lib
   *  
   * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster</a>
   */
  public class JFaceTagLibrary extends SwtTagLibrary {
  
      public JFaceTagLibrary() {
  
          // Viewer tags
          registerViewerTag("tableViewer", TableViewer.class);
          registerViewerTag("tableTreeViewer", TableTreeViewer.class);
          registerViewerTag("treeViewer", TreeViewer.class);
          registerViewerTag("checkboxTreeViewer", CheckboxTreeViewer.class);
  
          // Event tags
          registerTag("doubleClickListener", DoubleClickListenerTag.class);
          registerTag(
              "selectionChangedListener",
              SelectionChangedListenerTag.class);
  
          // Window tags
          registerWindowTag("applicationWindow", ApplicationWindow.class);
  
          // ContributionManager tags
          registerMenuManager("menuManager", MenuManagerTag.class);
  
          // Action tags
          registerActionTag("action", ActionTag.class);
  
          // ContributionItem tags
          registerContributionItemTag("separator", Separator.class);
      }
  
      /**
       * Register a widget tag for the given name
       *
       * @param name
       * @param widgetClass
       */
      protected void registerViewerTag(String name, Class widgetClass) {
          registerViewerTag(name, widgetClass, SWT.NULL);
      }
  
      /**
       * Register a widget tag for the given name
       *      
       * @param name
       * @param widgetClass
       * @param style
       */
      protected void registerViewerTag(
          String name,
          final Class theclass,
          final int style) {
          registerTagFactory(name, new TagFactory() {
              /**
               * @see org.apache.commons.jelly.impl.TagFactory#createTag(java.lang.String, org.xml.sax.Attributes)
               */
              public Tag createTag(String name, Attributes attributes)
                  throws JellyException {
                  return new ViewerTag(theclass, style);
              }
          });
      }
  
      /**
       * @param string
       * @param class1
       */
      private void registerMenuManager(String name, final Class theClass) {
          registerTagFactory(name, new TagFactory() {
              /**
               * @see org.apache.commons.jelly.impl.TagFactory#createTag(java.lang.String, org.xml.sax.Attributes)
               */
              public Tag createTag(String name, Attributes attributes)
                  throws JellyException {
                  return new MenuManagerTag();
              }
          });
      }
  
      /**
       * Register a widget tag for the given name
       *      
       * @param widgetClass
       * @param style
       */
      protected void registerWindowTag(String name, final Class theClass) {
          registerTagFactory(name, new TagFactory() {
              /**
               * @see org.apache.commons.jelly.impl.TagFactory#createTag(java.lang.String, org.xml.sax.Attributes)
               */
              public Tag createTag(String name, Attributes attributes)
                  throws JellyException {
                  return new ApplicationWindowTag(theClass);
              }
          });
      }
  
      /**
       * Register a widget tag for the given name
       */
      protected void registerActionTag(String name, final Class theClass) {
          registerTagFactory(name, new TagFactory() {
              /**
               * @see org.apache.commons.jelly.impl.TagFactory#createTag(java.lang.String, org.xml.sax.Attributes)
               */
              public Tag createTag(String name, Attributes attributes)
                  throws JellyException {
                  return new ActionTag(theClass);
              }
          });
      }
  
      /**
         * Register a widget tag for the given name
         */
      protected void registerContributionItemTag(
          String name,
          final Class theClass) {
          registerTagFactory(name, new TagFactory() {
              /**
               * @see org.apache.commons.jelly.impl.TagFactory#createTag(java.lang.String, org.xml.sax.Attributes)
               */
              public Tag createTag(String name, Attributes attributes)
                  throws JellyException {
                  return new ContributionItemTag(theClass);
              }
          });
      }
  }
  
  
  
  1.1                  jakarta-commons/jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/MenuManagerTag.java
  
  Index: MenuManagerTag.java
  ===================================================================
  /*
   * /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swt/SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   * 1.1
   * 2002/12/18 15:27:49
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   */
   package org.apache.commons.jelly.tags.jface;
  
  import java.util.Map;
  
  import org.apache.commons.jelly.JellyTagException;
  import org.apache.commons.jelly.MissingAttributeException;
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.jelly.tags.core.UseBeanTag;
  import org.eclipse.jface.action.MenuManager;
  import org.eclipse.jface.window.ApplicationWindow;
  import org.eclipse.jface.window.Window;
  
  /**
   * This tag creates an JFace MenuManager
   * 
   * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster</a> 
   */
  public class MenuManagerTag extends UseBeanTag {
  
      private String text;
      private MenuManager mm;
      
      /**
       * @return the parent window which this widget will be added to.
       */
      public Window getParentWindow() {
  
          ApplicationWindowTag tag =
              (ApplicationWindowTag) findAncestorWithClass(ApplicationWindowTag
                  .class);
          if (tag != null) {
              return tag.getWindow();
          }
  
          return null;
      }
  
      /* (non-Javadoc)
       * @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
       */
      public void doTag(XMLOutput output)
          throws MissingAttributeException, JellyTagException {
  
          Map attributes = getAttributes();
          text = attributes.remove("text").toString();
  
          if (text == null)
              throw new MissingAttributeException("text attribute is missing");
  
          mm = new MenuManager(text);
  
          ApplicationWindow window = (ApplicationWindow) getParentWindow();
          if (window != null) {
              window.getMenuBarManager().add(mm);
          }
  
          // invoke by body just in case some nested tag configures me
          invokeBody(output);
      }
  
      /**
       * @return MenuManager
       */
      public MenuManager getMenuManager() {
          return mm;
      }
  
  }
  
  
  
  1.1                  jakarta-commons/jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/ViewerTag.java
  
  Index: ViewerTag.java
  ===================================================================
  /*
   * /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swt/SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   * 1.1
   * 2002/12/18 15:27:49
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   */
  package org.apache.commons.jelly.tags.jface;
  
  import java.util.Map;
  
  import org.apache.commons.jelly.JellyTagException;
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.jelly.tags.swt.WidgetTag;
  import org.eclipse.jface.viewers.Viewer;
  import org.eclipse.swt.SWT;
  import org.eclipse.swt.widgets.Composite;
  import org.eclipse.swt.widgets.Widget;
  
  /**
   * This tag creates an JFace Viewer
   *  
   * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster</a>
   */
  public class ViewerTag extends WidgetTag {
  
      private Composite parent;
      private int style = SWT.NULL;
  
      /**
       * @param widgetClass
       */
      public ViewerTag(Class widgetClass) {
          super(widgetClass);
      }
  
      /**
       * @param widgetClass
       * @param style
       */
      public ViewerTag(Class widgetClass, int style) {
          super(widgetClass);
          this.style = style;
      }
  
      /* 
       * @see org.apache.commons.jelly.tags.core.UseBeanTag#newInstance(java.lang.Class, java.util.Map, org.apache.commons.jelly.XMLOutput)
       */
      protected Object newInstance(
          Class theClass,
          Map attributes,
          XMLOutput output)
          throws JellyTagException {
  
          int style = getStyle(attributes);
  
          // now lets call the constructor with the parent
          Widget parent = getParentWidget();
          Viewer viewer = (Viewer) createWidget(theClass, parent, style);
  
          return viewer;
      }
      
      /**
       * @return the visible viewer, if there is one.
       */
      public Viewer getViewer() {
          Object bean = getBean();
          if (bean instanceof Viewer) {
              return (Viewer) bean;
          }
          return null;
      }
  
  }
  
  
  
  1.1                  jakarta-commons/jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/SelectionChangedListenerTag.java
  
  Index: SelectionChangedListenerTag.java
  ===================================================================
  /*
   * /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swt/SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   * 1.1
   * 2002/12/18 15:27:49
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   */
  package org.apache.commons.jelly.tags.jface;
  
  import org.apache.commons.jelly.JellyTagException;
  import org.apache.commons.jelly.MissingAttributeException;
  import org.apache.commons.jelly.TagSupport;
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.eclipse.jface.viewers.ISelectionChangedListener;
  import org.eclipse.jface.viewers.SelectionChangedEvent;
  import org.eclipse.jface.viewers.Viewer;
  
  /**
   * This tag adds a listener for selection changes in this viewer.
   * 
   * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster</a> 
   */
  public class SelectionChangedListenerTag
      extends TagSupport
      implements ISelectionChangedListener {
  
      /** The Log to which logging calls will be made. */
      private static final Log log =
          LogFactory.getLog(SelectionChangedListenerTag.class);
  
      private String var = "event";
      private XMLOutput output;
  
      /* 
       * @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
       */
      public void doTag(XMLOutput output)
          throws MissingAttributeException, JellyTagException {
          if (var == null) {
              throw new MissingAttributeException("var");
          }
  
          Viewer viewer = getParentViewer();
          if (viewer == null) {
              throw new JellyTagException("This tag must be nested within a viewer tag");
          }
  
          viewer.addSelectionChangedListener(this);
          this.output = output;
      }
  
      public Viewer getParentViewer() {
          ViewerTag tag = (ViewerTag) findAncestorWithClass(ViewerTag.class);
          if (tag != null) {
              return tag.getViewer();
          }
          return null;
      }
  
      /**
       * @return String
       */
      public String getVar() {
          return var;
      }
  
      /**
       * Sets the var.
       * @param var The var to set
       */
      public void setVar(String var) {
          this.var = var;
      }
  
      //  Listener interface
      //-------------------------------------------------------------------------
  
      /* 
       * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
       */
      public void selectionChanged(SelectionChangedEvent event) {
          try {
              context.setVariable(var, event);
              invokeBody(output);
          } catch (Exception e) {
              log.error(
                  "Caught exception: " + e + " while processing event: " + event,
                  e);
          }
      }
  
  }
  
  
  
  1.1                  jakarta-commons/jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/ActionTag.java
  
  Index: ActionTag.java
  ===================================================================
  /*
   * /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swt/SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   * 1.1
   * 2002/12/18 15:27:49
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   */
  package org.apache.commons.jelly.tags.jface;
  
  import java.util.Map;
  
  import org.apache.commons.jelly.JellyTagException;
  import org.apache.commons.jelly.MissingAttributeException;
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.jelly.tags.core.UseBeanTag;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.eclipse.jface.action.Action;
  import org.eclipse.jface.action.IContributionManager;
  import org.eclipse.swt.widgets.Event;
  
  /**
   * This tag creates an JFace Action
   * 
   * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster</a> 
   */
  public class ActionTag extends UseBeanTag {
  
      /**
       *  Implementing Action class
       */
      class ActionImpl extends Action {
          public void runWithEvent(Event event) {
              try {
                  context.setVariable(var, event);
                  invokeBody(output);
              } catch (Exception e) {
                  log.error(
                      "Caught exception: "
                          + e
                          + " while processing event: "
                          + event,
                      e);
              }
          }
      }
  
      /** The Log to which logging calls will be made. */
      private static final Log log = LogFactory.getLog(ActionTag.class);
      private XMLOutput output;
      private String var = "event";
      
      /**
       * @param arg0
       */
      public ActionTag(Class arg0) {
          super(arg0);
      }
  
      /**
       * @return IContributionManager
       */
      protected IContributionManager getParentContributionManager() {
          MenuManagerTag tag =
              (MenuManagerTag) findAncestorWithClass(MenuManagerTag.class);
          if (tag != null) {
              return tag.getMenuManager();
          }
          return null;
      }
  
      /**
        * @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
        */
      public void doTag(XMLOutput output)
          throws MissingAttributeException, JellyTagException {
  
          Map attributes = getAttributes();
  		
          Action action = new ActionImpl();
          setBeanProperties(action, attributes);
  
          IContributionManager cm = getParentContributionManager();
          if (cm != null) {
              cm.add(action);
          }
  
          this.output = output;
      }
  
  }
  
  
  1.1                  jakarta-commons/jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/ContributionItemTag.java
  
  Index: ContributionItemTag.java
  ===================================================================
  /*
   * /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swt/SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   * 1.1
   * 2002/12/18 15:27:49
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   */
  package org.apache.commons.jelly.tags.jface;
  
  import org.apache.commons.jelly.JellyTagException;
  import org.apache.commons.jelly.MissingAttributeException;
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.jelly.tags.core.UseBeanTag;
  import org.eclipse.jface.action.ContributionItem;
  import org.eclipse.jface.action.IContributionManager;
  
  /**
   * This tag creates an JFace ContributionItem
   * 
   * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster</a> 
   */
  public class ContributionItemTag extends UseBeanTag {
  
      public ContributionItemTag(Class arg0) {
          super(arg0);
      }
  
      /**
        * @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
        */
      public void doTag(XMLOutput output)
          throws MissingAttributeException, JellyTagException {
  
          super.doTag(output);
  
          Object bean = getBean();
          if (bean != null && bean instanceof ContributionItem) {
              IContributionManager cm = getParentContributionManager();
              if (cm != null) {
                  cm.add((ContributionItem) bean);
              }
          }
  
      }
  
      /**
       * @return IContributionManager
       */
      protected IContributionManager getParentContributionManager() {
          MenuManagerTag tag =
              (MenuManagerTag) findAncestorWithClass(MenuManagerTag.class);
          if (tag != null) {
              return tag.getMenuManager();
          }
          return null;
      }
  
  }
  
  
  
  1.1                  jakarta-commons/jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/package.html
  
  Index: package.html
  ===================================================================
  <html>
  <head>
  </head>
  <body>
  
    <p>
    	The JellyJFace Library is a Jelly Library for creating Rich User Interfaces 
    	using SWT and JFace via XML markup (a Jelly script).
    	JellyJFace is an eextension of JellySWT to add support for the JFace framework.
    </p>
    
  </body>
  </html>
  
  
  
  1.1                  jakarta-commons/jelly/jelly-tags/jface/src/java/org/apache/commons/jelly/tags/jface/impl/ApplicationWindowImpl.java
  
  Index: ApplicationWindowImpl.java
  ===================================================================
  /*
   * /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swt/SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   * 1.1
   * 2002/12/18 15:27:49
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * SwtTagLibrary.java,v 1.1 2002/12/18 15:27:49 jstrachan Exp
   */
  package org.apache.commons.jelly.tags.jface.impl;
  
  import org.eclipse.jface.window.ApplicationWindow;
  import org.eclipse.swt.SWT;
  import org.eclipse.swt.widgets.Control;
  import org.eclipse.swt.widgets.Shell;
  
  /**
   * This is the default implementation for a ApplicationWindowTag
   * 
   * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster</a> 
   */
  public class ApplicationWindowImpl extends ApplicationWindow {
  
      /**
       * @param shell
       */
      public ApplicationWindowImpl(Shell parentShell) {
  
          super(parentShell);
  
          // default at all
          addMenuBar();
          addStatusLine();
          addToolBar(SWT.NULL);
  
          setBlockOnOpen(true);
  
          // create window 
          create();
      }
  
      /* 
       * override to make public
       * @see org.eclipse.jface.window.Window#getContents()
       */
      public Control getContents() {
          return super.getContents();
      }
  
  }
  
  
  
  
  1.1                  jakarta-commons/jelly/jelly-tags/jface/src/test/org/apache/commons/jelly/tags/jface/JFaceDemo.jelly
  
  Index: JFaceDemo.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns="jelly:swt" xmlns:log="jelly:log">
  
    <applicationWindow var="mainapp">
  
  	<menuManager text="File">
  			<action text="Test">
  					<log:error> Very Nice !!!</log:error>
  			</action>
  			<separator />
  			<action text="Check me" checked="true" />
  	</menuManager>
  		
  	<menuManager text="Edit">
  			<action text="Say Hi Statusbar">
  				  ${mainapp.setStatus('Hello ...')} 
  			</action>
  	</menuManager>
  	
  <!--	
  	<fillLayout type="vertical"/>	
  -->
  
  	<label text="A big red label 1" background="204, 0, 0"/>
  	<label text="I can barelly read this ;-(" foreground="#f2f2f2" />
  	<label text="It sure looks like the dutch flag ;-)" foreground="#ffffff" background="0, 0, 153" />		
  	
    </applicationWindow>
  
    ${mainapp.MenuBarManager.updateAll(true)} 
    ${mainapp.open()}
  
  
  </j:jelly>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message