jET
1.0alpha4


org.jet.sce
Class Scenery

java.lang.Object
  |
  +--org.jet.sce.Scenery
All Implemented Interfaces:
java.io.Serializable

public class Scenery
extends java.lang.Object
implements java.io.Serializable

The scenery is the class where data for editor is stored. It has two lists containing tracks and switches. In addition scenery may have custom properties, and description.

See Also:
Serialized Form

Nested Class Summary
 class Scenery.NamesIndices
          The indices for track and switch names, implementing a list data model to speed up searching for track names.
 
Field Summary
 java.util.Vector elements
          List containing scenery elements.
protected  javax.swing.event.EventListenerList listenerList
          Event listener list.
 java.util.Vector switches
          List containing switches.
 
Constructor Summary
Scenery()
           
 
Method Summary
 void addSceneryChangeListener(SceneryChangeListener listener)
          Adds a scenery listener to this document for notification of any changes.
 void addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
          Adds an undo listener for notification of any changes.
 void dump(java.io.PrintStream psOut)
          Dumps debugging info.
protected  void fireSceneryChange(SceneryEvent sce)
          Fires scenery change event to all registered scenery listeners.
 java.lang.String getDescription()
          Gets scenery description.
 java.util.EventListener[] getListeners(java.lang.Class listenerType)
          Returns an array of registered foo listeners on this scenery.
 java.lang.Object getProperty(java.lang.Object key)
          Gets a property with key key.
 SceneryChangeListener[] getSceneryChangeListeners()
          Returns an array of all registered scenery listeners on this document.
 java.util.Dictionary getSceneryProperties()
          Scenery may contain some properties.
 javax.swing.ListModel getTrackNames()
          Returns data model for list of track and switch names.
 javax.swing.event.UndoableEditListener[] getUndoableEditListeners()
          Returns an array of all registered undo listeners on this document.
 void insert(java.lang.Object[] obj)
           
 void putProperty(java.lang.Object key, java.lang.Object value)
          Sets property for the scenery.
 void readLock()
          Acquires a lock to begin reading from the scenery.
 void readUnlock()
          Does a read unlock.
 void remove(java.lang.Object[] obj)
           
 void removeSceneryChangeListener(SceneryChangeListener listener)
          Removes a scenery listener.
 void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
          Removes an undo listener.
 void setDescription(java.lang.String content)
          Sets scenery description.
 void setSceneryProperties(java.util.Dictionary x)
          Scenery may contain some properties.
protected  void writeLock()
          Acquires a scenery lock for writing.
protected  void writeUnlock()
          Releases a write lock previously obtained via writeLock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenerList

protected javax.swing.event.EventListenerList listenerList
Event listener list.


elements

public java.util.Vector elements
List containing scenery elements.


switches

public java.util.Vector switches
List containing switches.

Constructor Detail

Scenery

public Scenery()
Method Detail

insert

public void insert(java.lang.Object[] obj)

remove

public void remove(java.lang.Object[] obj)

getTrackNames

public javax.swing.ListModel getTrackNames()
Returns data model for list of track and switch names.


setDescription

public void setDescription(java.lang.String content)
Sets scenery description.

Scenery description describes scenery and it is usefull to include some user data.

Parameters:
content - The description.

getDescription

public java.lang.String getDescription()
Gets scenery description.

Scenery description describes scenery and it is usefull to include some user data.

Returns:
The description.

addSceneryChangeListener

public void addSceneryChangeListener(SceneryChangeListener listener)
Adds a scenery listener to this document for notification of any changes.

Parameters:
listener - The scenery listener to add.
See Also:
addSceneryChangeListener(org.jet.sce.SceneryChangeListener)

removeSceneryChangeListener

public void removeSceneryChangeListener(SceneryChangeListener listener)
Removes a scenery listener.

Parameters:
listener - The scenery listener to remove.
See Also:
removeSceneryChangeListener(org.jet.sce.SceneryChangeListener)

getSceneryChangeListeners

public SceneryChangeListener[] getSceneryChangeListeners()
Returns an array of all registered scenery listeners on this document.

Returns:
All of registered scenery listeners on this document.
See Also:
addSceneryChangeListener(org.jet.sce.SceneryChangeListener), removeSceneryChangeListener(org.jet.sce.SceneryChangeListener)

addUndoableEditListener

public void addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Adds an undo listener for notification of any changes.

Parameters:
listener - The undo listener to add.
See Also:
addUndoableEditListener(javax.swing.event.UndoableEditListener)

getUndoableEditListeners

public javax.swing.event.UndoableEditListener[] getUndoableEditListeners()
Returns an array of all registered undo listeners on this document.

Returns:
All undo listeners in array.
See Also:
addUndoableEditListener(javax.swing.event.UndoableEditListener), removeUndoableEditListener(javax.swing.event.UndoableEditListener)

removeUndoableEditListener

public void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Removes an undo listener.

Parameters:
listener - The undo listener to remove.
See Also:
removeUndoableEditListener(javax.swing.event.UndoableEditListener)

getListeners

public java.util.EventListener[] getListeners(java.lang.Class listenerType)
Returns an array of registered foo listeners on this scenery. for example you may query a scenery with the following code:
SceneryChangeListener[] mls = 
         (SceneryChangeListener[])(d.getListeners(SceneryChangeListener.class));

Returns:
The array of listener of specified class.
Throws:
java.lang.ClassCastException - If listenerType dosen't specify a class or interface that implements java.util.EventListener.
See Also:
getSceneryChangeListeners(), getUndoableEditListeners()

fireSceneryChange

protected void fireSceneryChange(SceneryEvent sce)
Fires scenery change event to all registered scenery listeners.

Parameters:
sce - Scenery event to fire.

getSceneryProperties

public java.util.Dictionary getSceneryProperties()
Scenery may contain some properties. This method retrives it all.

Returns:
The scenery properties.
See Also:
setSceneryProperties(java.util.Dictionary)

setSceneryProperties

public void setSceneryProperties(java.util.Dictionary x)
Scenery may contain some properties. This method replaces scenery properties with new one.

Parameters:
x - New properties.
See Also:
getSceneryProperties()

getProperty

public final java.lang.Object getProperty(java.lang.Object key)
Gets a property with key key.

Parameters:
key - A property key.
Returns:
Value of property.
See Also:
putProperty(java.lang.Object, java.lang.Object)

putProperty

public final void putProperty(java.lang.Object key,
                              java.lang.Object value)
Sets property for the scenery. It allows to remove property specified by a key, when value is null.

Parameters:
key - A property key.
value - A property value. If null property will be removed.
See Also:
getProperty(java.lang.Object)

writeLock

protected final void writeLock()
Acquires a scenery lock for writing.

Throws:
java.lang.IllegalStateException - Thrown on illegal lock attempt.
See Also:
writeUnlock()

writeUnlock

protected final void writeUnlock()
Releases a write lock previously obtained via writeLock.

See Also:
writeLock()

readLock

public final void readLock()
Acquires a lock to begin reading from the scenery. There can be multiple readers at the same time.

See Also:
readUnlock()

readUnlock

public final void readUnlock()
Does a read unlock.

See Also:
readLock()

dump

public void dump(java.io.PrintStream psOut)
Dumps debugging info.

Parameters:
psOut - Print stream to output.

jET
1.0alpha4