User: andreas 
  Date: 00/10/14 09:16:52

  Added:       examples/plain.pane/src/com/madplanet/plainPane
                        FileManagerFactoryImpl.java FileManagerImpl.java
  Log:
  Add two new examples taken from Andreas Schaefer's
  HowTo page.
  The plain.pane is just shows how to bring a simple pane
  up and running and the simple component shows how
  to use XMLBeans to create a Bean component.
  
  Revision  Changes    Path
  1.1                  
ejx/examples/plain.pane/src/com/madplanet/plainPane/FileManagerFactoryImpl.java
  
  Index: FileManagerFactoryImpl.java
  ===================================================================
  /*
   * jBoss, the OpenSource EJB server
   *
   * Distributable under GPL license.
   * See terms of license at gnu.org.
   */
  package com.madplanet.plainPane;
  
  import java.io.File;
  import javax.swing.filechooser.FileFilter;
  
  import com.dreambean.ejx.FileManager;
  import com.dreambean.ejx.FileManagerFactory;
  
  /**
  * FileManagerFactory implemenation which allows EJX
  * plugin to select an existing file or create one in the
  * given directory.
  * <BR>
  * The purpose of this class is to deliver a file filter to
  * select a file and to create a file manage implemenation
  * when the file is selected or a directory to put the new
  * file into.
  *      
  * @author <A href="mailto:[EMAIL PROTECTED]">Andreas "Mad" Schaefer</A>
  * @version $Revision: 1.1 $
  **/
  public class FileManagerFactoryImpl
        extends FileFilter
        implements FileManagerFactory
  {
        // Public --------------------------------------------------------
        
        // FileFilter implementation -------------------------------------
        public boolean accept(File f)
        {
                return f.getName().equals( "plane.pane.xml" ) || f.isDirectory();
        }
        
        public String getDescription() { 
                return toString(); 
        }
  
        // FileManagerFactory implementation -----------------------------
        public FileManager createFileManager() {
                return new FileManagerImpl( this );
        }
        
        public FileFilter getFileFilter() {
                return this;
        }
        
        public String toString() {
                return "Plane Pane XML";
        }
  }
  
  
  
  1.1                  
ejx/examples/plain.pane/src/com/madplanet/plainPane/FileManagerImpl.java
  
  Index: FileManagerImpl.java
  ===================================================================
  /*
   * jBoss, the OpenSource EJB server
   *
   * Distributable under GPL license.
   * See terms of license at gnu.org.
   */
  package com.madplanet.plainPane;
  
  import java.awt.BorderLayout;
  import java.awt.Component;
  import java.beans.beancontext.BeanContextServicesSupport;
  import java.io.File;
  import javax.swing.JPanel;
  import javax.swing.JLabel;
  
  import com.dreambean.ejx.FileManager;
  import com.dreambean.ejx.FileManagerFactory;
  
  /**
  * FileManager handles the load and save of a given file
  * and create a new GUI component to display in EJX
  * when EJX is asking for.
  *      
  * @author <A href="mailto:[EMAIL PROTECTED]">Andreas "Mad" Schaefer</A>
  * @version $Revision: 1.1 $
  **/
  public class FileManagerImpl
        extends BeanContextServicesSupport
        implements FileManager
  {
        // Attributes ----------------------------------------------------
        /** The factory which created this instance **/
        private FileManagerFactory mFactory;
        
        // Constructors --------------------------------------------------
        /**
        * Creates this file manager and store the Factory created
        * this instance
        *
        * @param pCaller                                        File Manager Factory 
created this instance
        **/
        FileManagerImpl( FileManagerFactory pCaller ) {
                mFactory = pCaller;
        }
        
        // Public --------------------------------------------------------
        
        // FileManager implementation ---------------------
        public boolean isChanged() {
                return true;
        }
        
        public void createNew() {
        }
        
        public void load( File file )
                throws Exception
        {
        }
        
        public void save( File f )
                throws Exception
        {
        }
        
        public File getFile() {
                return null;
        }
        
        public void setFile( File pFile ) {
        }
        
        public FileManagerFactory getFactory() {
                return mFactory;
        }
        
        public Component getComponent() {
                JPanel lPane = new JPanel( new BorderLayout() );
        
                lPane.add(
                        new JLabel( "<HTML><BODY><H1>Hello World</H1><H2>Next 
Step</H2></BODY></HTML>" ), 
                        BorderLayout.CENTER
                );
        
                return lPane;
        }
  }
  
  
  

Reply via email to