org.oddjob.swing
Class OddjobPanel

java.lang.Object
  extended by org.oddjob.framework.BaseComponent
      extended by org.oddjob.framework.SimpleService
          extended by org.oddjob.swing.OddjobPanel
All Implemented Interfaces:
Serializable, Runnable, ArooaContextAware, ArooaSessionAware, ServiceProvider, Services, PropertyChangeNotifier, Iconic, LogEnabled, Resetable, Stateful, Stoppable, Structural

public class OddjobPanel
extends SimpleService
implements ServiceProvider, Services, Serializable, Stoppable, Structural

Provide a simple panel with buttons on, that run Oddjob jobs.

See Also:
Serialized Form
Author:
rob
Since:
1.3

Field Summary
protected  ChildHelper<Object> childHelper
           
 
Fields inherited from class org.oddjob.framework.SimpleService
stateHandler
 
Fields inherited from class org.oddjob.framework.BaseComponent
iconHelper
 
Constructor Summary
OddjobPanel()
          Constructor.
 
Method Summary
 void addStructuralListener(StructuralListener listener)
          Add a listener.
protected  JComponent createPanel()
           
 int getColumns()
           
 ScreenPresence getScreen()
           
 Object getService(String serviceName)
          Provide the service for the given name.
 Services getServices()
          Provider the services.
protected  void onStart()
           
protected  void onStop()
          Allow sub classes to do something on stop.
 void removeStructuralListener(StructuralListener listener)
          Remove a listener.
 String serviceNameFor(Class<?> theClass, String flavour)
          If these services can provide a service of the given class then a name that identifies the service is provided.
 void setColumns(int cols)
           
 void setExecutorService(ExecutorService executorService)
          Set the ExecutorService.
 void setJobs(int index, Runnable child)
          Add a child.
 
Methods inherited from class org.oddjob.framework.SimpleService
fireDestroyedState, getName, getStateChanger, hardReset, logger, loggerName, onDestroy, run, setName, softReset, stateHandler, stop, toString
 
Methods inherited from class org.oddjob.framework.BaseComponent
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, save, setArooaContext, setArooaSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.oddjob.Stoppable
stop
 
Methods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
 

Field Detail

childHelper

protected transient ChildHelper<Object> childHelper
Constructor Detail

OddjobPanel

public OddjobPanel()
Constructor.

Method Detail

setExecutorService

@Inject
public void setExecutorService(ExecutorService executorService)
Set the ExecutorService.

Property: executorService

Description: The ExecutorService to use. This will be automatically set by Oddjob.

Required: No.

Parameters:
child - A child

createPanel

protected JComponent createPanel()

onStart

protected void onStart()
                throws Throwable
Specified by:
onStart in class SimpleService
Throws:
Exception
Throwable

onStop

protected void onStop()
               throws FailedToStopException
Description copied from class: SimpleService
Allow sub classes to do something on stop.

Overrides:
onStop in class SimpleService
Throws:
FailedToStopException

addStructuralListener

public void addStructuralListener(StructuralListener listener)
Add a listener. The listener will immediately receive add notifications for all existing children.

Specified by:
addStructuralListener in interface Structural
Parameters:
listener - The listener.

removeStructuralListener

public void removeStructuralListener(StructuralListener listener)
Remove a listener.

Specified by:
removeStructuralListener in interface Structural
Parameters:
listener - The listener.

setJobs

public void setJobs(int index,
                    Runnable child)
Add a child.

Property: jobs

Description: The child jobs.

Required: No, but pointless if missing.

Parameters:
child - A child

getServices

public Services getServices()
Description copied from interface: ServiceProvider
Provider the services.

Specified by:
getServices in interface ServiceProvider
Returns:
The services. May be null.

getService

public Object getService(String serviceName)
                  throws IllegalArgumentException
Description copied from interface: Services
Provide the service for the given name.

Specified by:
getService in interface Services
Returns:
A service for the name.
Throws:
IllegalArgumentException - If no service for the name can be provided.

serviceNameFor

public String serviceNameFor(Class<?> theClass,
                             String flavour)
Description copied from interface: Services
If these services can provide a service of the given class then a name that identifies the service is provided.

Specified by:
serviceNameFor in interface Services
Parameters:
theClass - The type of service.
flavour - An optional flavour. May be null.
Returns:
A service name, or null if none can be provided.

getColumns

public int getColumns()

setColumns

public void setColumns(int cols)

getScreen

public ScreenPresence getScreen()