org.jcreme.swing.workspace
Class WorkspaceFactory

java.lang.Object
  extended byorg.jcreme.swing.workspace.WorkspaceFactory

public abstract class WorkspaceFactory
extends java.lang.Object

This factory class enables to ensure that the identifiers chosen for workspaces are unique. It also provide a factory method to create workspaces and a method to retrieve previously built workspaces.

Version:
$Revision: 1.1 $
Author:
$Author: dbregeon $

Constructor Summary
WorkspaceFactory()
           
 
Method Summary
 void addWorkspaceFactoryListener(WorkspaceFactoryListener l)
           
protected abstract  Workspace build(java.lang.Object id)
          This is the factory method that will create the actual Workspace instances.
 Workspace buildWorkspace(java.lang.Object id)
          This method enables to build a Workspace with the given id.
protected  void fireWorkspaceAddedEvent(java.lang.Object id)
           
protected  void fireWorkspaceRemovedEvent(java.lang.Object id)
           
 Workspace getWorkspace(java.lang.Object id)
          This method gives access to existing Workspaces created by this factory.
 java.lang.Object[] getWorkspaceIdentifiers()
          This method provides a list of the identifiers used by Workspace in this factory.
 Workspace[] getWorkspaces()
          This method provides a list of the Workspaces available in this factory.
 void registerWorkspace(Workspace ws)
          This method enables to register a Workspace instance in this factory even if it was not created by it.
 void removeWorkspaceFactoryListener(WorkspaceFactoryListener l)
           
 void unregisterWorkspace(java.lang.Object id)
          This method enables to remove the Workspace identified by id from this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkspaceFactory

public WorkspaceFactory()
Method Detail

buildWorkspace

public Workspace buildWorkspace(java.lang.Object id)
                         throws java.lang.IllegalArgumentException
This method enables to build a Workspace with the given id.

Parameters:
id - the identifier for the new Workspace.
Returns:
the newly created Workspace.
Throws:
java.lang.IllegalArgumentException - if id is null or another Workspace already uses it.

build

protected abstract Workspace build(java.lang.Object id)
This is the factory method that will create the actual Workspace instances.

Parameters:
id - the identifier for the new Workspace.
Returns:
a newly created Workspace.

getWorkspace

public Workspace getWorkspace(java.lang.Object id)
This method gives access to existing Workspaces created by this factory.

Parameters:
id - the identifier of the Workspace to retrieve.
Returns:
the Workspace identified by id in this factory or null if no such Workspace exists in this factory.

getWorkspaces

public Workspace[] getWorkspaces()
This method provides a list of the Workspaces available in this factory.

Returns:
an array that contains all the Workspace instances in this factory.

getWorkspaceIdentifiers

public java.lang.Object[] getWorkspaceIdentifiers()
This method provides a list of the identifiers used by Workspace in this factory.

Returns:
an array that contains the identifiers of the Workspace instances in this factory.

unregisterWorkspace

public void unregisterWorkspace(java.lang.Object id)
This method enables to remove the Workspace identified by id from this factory.

Parameters:
id - the identifier of the Workspace to remove.

registerWorkspace

public void registerWorkspace(Workspace ws)
                       throws java.lang.IllegalArgumentException
This method enables to register a Workspace instance in this factory even if it was not created by it.

Parameters:
ws - the Workspace to register.
Throws:
java.lang.IllegalArgumentException - if ws is null, its id is null or a Workspace with the same id already exists.

addWorkspaceFactoryListener

public void addWorkspaceFactoryListener(WorkspaceFactoryListener l)
Parameters:
l -

removeWorkspaceFactoryListener

public void removeWorkspaceFactoryListener(WorkspaceFactoryListener l)
Parameters:
l -

fireWorkspaceAddedEvent

protected void fireWorkspaceAddedEvent(java.lang.Object id)

fireWorkspaceRemovedEvent

protected void fireWorkspaceRemovedEvent(java.lang.Object id)


Copyright 2006 null. All Rights Reserved.