User: andreas
Date: 00/10/14 22:26:55
Added: examples/plain.pane/src/com/madplanet/plainPane
ResourceManagerFactoryImpl.java
ResourceManagerImpl.java
Removed: examples/plain.pane/src/com/madplanet/plainPane
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/plain.pane/src/com/madplanet/plainPane/ResourceManagerFactoryImpl.java
Index: ResourceManagerFactoryImpl.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 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 Resource or create one in the
* given directory.
* <BR>
* The purpose of this class is to deliver a file filter to
* select a Resource and to create a Resource manage implemenation
* when the Resource is selected or a directory to put the new
* Resource 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( "plane.pane.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 "Plane Pane";
}
}
1.1
ejx/examples/plain.pane/src/com/madplanet/plainPane/ResourceManagerImpl.java
Index: ResourceManagerImpl.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.net.URL;
import javax.swing.JPanel;
import javax.swing.JLabel;
import com.dreambean.ejx.ResourceManager;
import com.dreambean.ejx.ResourceManagerFactory;
/**
* ResourceManager handles the load and save of a given Resource
* 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 Resource manager and store the Factory created
* this instance
*
* @param pCaller Resource 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() {
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;
}
}