User: andreas
Date: 00/10/14 22:26:57
Added: examples/simple.component/src/com/madplanet/simpleComponent
ResourceManagerFactoryImpl.java
ResourceManagerImpl.java
Removed: examples/simple.component/src/com/madplanet/simpleComponent
FileManagerFactoryImpl.java FileManagerImpl.java
Log:
Replaced FileManager and FileManagerFactory by the new
ResourceManager and ResourceManagerFactory supporting
URL instead of just files.
ATTENTION:
- At the moment you can still only use files to open and store
Data because of unresolved issues (FilterFilter and JFile-
Chooser)
- These changes are NOT PORTED to jBoss CVS module
Revision Changes Path
1.1
ejx/examples/simple.component/src/com/madplanet/simpleComponent/ResourceManagerFactoryImpl.java
Index: ResourceManagerFactoryImpl.java
===================================================================
/*
* jBoss, the OpenSource EJB server
*
* Distributable under GPL license.
* See terms of license at gnu.org.
*/
package com.madplanet.simpleComponent;
import java.io.File;
import java.net.URL;
import javax.swing.filechooser.FileFilter;
import com.dreambean.ejx.ResourceManager;
import com.dreambean.ejx.ResourceManagerFactory;
/**
* ResourceManagerFactory 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 ResourceManagerFactoryImpl
extends FileFilter
implements ResourceManagerFactory
{
// Public --------------------------------------------------------
// FileFilter implementation -------------------------------------
public boolean accept(File f)
{
return f.getName().equals( "simple.component.xml" ) || f.isDirectory();
}
public String getDescription() {
return toString();
}
// ResourceManagerFactory implementation -----------------------------
public ResourceManager createResourceManager() {
return new ResourceManagerImpl( this );
}
public FileFilter getFileFilter() {
return this;
}
public String toString() {
return "Simple Component";
}
}
1.1
ejx/examples/simple.component/src/com/madplanet/simpleComponent/ResourceManagerImpl.java
Index: ResourceManagerImpl.java
===================================================================
/*
* jBoss, the OpenSource EJB server
*
* Distributable under GPL license.
* See terms of license at gnu.org.
*/
package com.madplanet.simpleComponent;
import java.awt.BorderLayout;
import java.awt.Component;
import java.beans.beancontext.BeanContextServicesSupport;
import java.net.URL;
import com.dreambean.ejx.ResourceManager;
import com.dreambean.ejx.ResourceManagerFactory;
/**
* ResourceManager 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 ResourceManagerImpl
extends BeanContextServicesSupport
implements ResourceManager
{
// Attributes ----------------------------------------------------
/** The factory which created this instance **/
private ResourceManagerFactory mFactory;
// Constructors --------------------------------------------------
/**
* Creates this file manager and store the Factory created
* this instance
*
* @param pCaller File Manager Factory
created this instance
**/
ResourceManagerImpl( ResourceManagerFactory pCaller ) {
mFactory = pCaller;
}
// Public --------------------------------------------------------
// ResourceManager implementation ------------------------------------
public boolean isChanged() {
return true;
}
public void createNew() {
}
public void load( URL pResource )
throws Exception
{
}
public void save( URL pResource )
throws Exception
{
}
public URL getResource() {
return null;
}
public void setResource( URL pResource ) {
}
public ResourceManagerFactory getFactory() {
return mFactory;
}
public Component getComponent() {
// Create the Property Container and return its GUI component
return new MainPane().getComponent();
}
}