ARoad0.gBase
Class CFolderMemberImpl

java.lang.Object
  extended by ARoad0.gBase.CFolderMemberImpl
All Implemented Interfaces:
java.io.Serializable

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

This class is an embedded class responsible for modeling a folder member which is contained in a EPRViewInBase or in a VirtualFolder. An instance is used as a private attribute of a composite class instance (called the master instance) which delegates the processing of its membership to an instance of this class. The master class is a Basic or a VirtualFolder. When it is a VirtualFolder, it is only to handle the EPRViewInBases, and never the VirtualFolders.

This class implements some methods of its master, but this is not directly controlled by Java since this class does not implement the interface to avoid to be a public class. All variables are private to secure the white box inheritances from this class.

It is a javabean with the following bound properties:

- 'ImpliedOpenViews', 'VirtualFolders'.

The listeners are proper to this instance. Excepting for ViewInBase, they are outside gBase, transient (not serialized in this instance backup). They are called in any order. They receive only a copy of the new value, to protect the property. The exceptions from the listeners are not catched. This class is public to be overriden in the AcsAddons, and in this case, the subclass is only called by some classes in the same package.

See Also:
ViewInBase, VirtualFolder, Serialized Form

Field Summary
protected  java.beans.PropertyChangeSupport changeSupport_
          manages all the property change listeners
static CFolderMemberImpl EMPTY_INSTANCE
          A reusable empty instance for initialization, to avoid the use of 'new' for temporary values.
protected static int INCREMENT_CAPACITY
           
protected static int INITIAL_CAPACITY
          Protected variables
protected static int INITIAL_CAPACITY_2
           
protected  java.util.ArrayList<ViewInBase> l_OpenViews_
          list of open ViewInBase that contains this instance Created only when it is needed.
protected  java.util.ArrayList<VirtualFolder> l_VirtualFolders_
          list of VirtualFolder that contains this instance.
protected  ACSObject master_
           
protected static int PRIME
           
static java.io.ObjectStreamField[] serialPersistentFields
          variable for the JDK 2 serialization
private static long serialVersionUID
          private variables
 
Constructor Summary
CFolderMemberImpl()
          The basic constructor.
CFolderMemberImpl(ACSObject _master)
          Used by the master constructor.
 
Method Summary
protected  void addInVFolderList(VirtualFolder _folder)
          Registers the folder as containing the master.
protected  void addInViewList(ViewInBase _view)
          Registers the view as containing the master.
protected  void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
          Adds a listener for all the bound properties.
protected  void addPropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Adds a listener to the bean.
protected  CFolderMemberImpl cloneC(Basic _master)
          Clone for embedded class without registering the new object in the ACSs.
protected  CFolderMemberImpl copy(ACSObject _masterCopy)
          This method provides a copy of the instance with another name, without children copying because the copy order will not be always correct.
 boolean equals(java.lang.Object _obj)
           
protected  void finalize()
          This method removes the CFolderMember from the ACS lists, but there is no guaranee that the JVM calls this method before the end of the application.
protected  void finalizeForBase()
          Finalizes the CFolderMember.
protected  void finalizeFromDeserialization()
          This method finalizes all the virtual folders, since it is used after a deserialization.
protected  void firePropertyChange(java.lang.String _propertyName, java.lang.Object _oldValue, java.lang.Object _newValue)
          Fires an event to every registered listener, in any order.
protected  java.util.List<ViewInBase> getImpliedViews()
          Gets the open views containing the master.
 java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String _propertyName)
          Returns the change listeners for a property.
 long getSerialVersionUID()
           
protected  java.util.List<VirtualFolder> getVirtualFolders()
          Gets the virtual folders containing the master.
 int hashCode()
           
protected  boolean removeInVFolderList(VirtualFolder _folder)
          Unregisters the folder when it does not contain the master.
protected  boolean removeInViewList(ViewInBase _view)
          Unregisters the view when it does not contain the master.
protected  void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
          Removes a listener to the bean, for all the bound properties.
protected  void removePropertyChangeListener(java.lang.String _propertyName, java.beans.PropertyChangeListener _l)
          Removes a listener.
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_CAPACITY

protected static final int INITIAL_CAPACITY
Protected variables

See Also:
Constant Field Values

INITIAL_CAPACITY_2

protected static final int INITIAL_CAPACITY_2
See Also:
Constant Field Values

INCREMENT_CAPACITY

protected static final int INCREMENT_CAPACITY
See Also:
Constant Field Values

PRIME

protected static final int PRIME
See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
private variables

See Also:
Constant Field Values

master_

protected ACSObject master_

l_OpenViews_

protected transient java.util.ArrayList<ViewInBase> l_OpenViews_
list of open ViewInBase that contains this instance Created only when it is needed.


l_VirtualFolders_

protected java.util.ArrayList<VirtualFolder> l_VirtualFolders_
list of VirtualFolder that contains this instance. Created only when it is needed. Always null if the master is a VirtualFolderImpl.


EMPTY_INSTANCE

public static final CFolderMemberImpl EMPTY_INSTANCE
A reusable empty instance for initialization, to avoid the use of 'new' for temporary values. Caution: never change the state of the returned instance.


changeSupport_

protected transient java.beans.PropertyChangeSupport changeSupport_
manages all the property change listeners


serialPersistentFields

public static final java.io.ObjectStreamField[] serialPersistentFields
variable for the JDK 2 serialization

Constructor Detail

CFolderMemberImpl

public CFolderMemberImpl()
The basic constructor.


CFolderMemberImpl

public CFolderMemberImpl(ACSObject _master)
                  throws CreateError
Used by the master constructor.

Parameters:
_master - master of this embedded class
Throws:
CreateError - the master is null
Method Detail

copy

protected CFolderMemberImpl copy(ACSObject _masterCopy)
                          throws CreateError
This method provides a copy of the instance with another name, without children copying because the copy order will not be always correct.

Parameters:
_masterCopy - is the master of the new copy
Returns:
copy as CFolderMemberImpl instance
Throws:
CreateError - of the constructor with the same parameters.

getImpliedViews

protected java.util.List<ViewInBase> getImpliedViews()
Gets the open views containing the master.

Returns:
List of ViewInBase. May be empty, but never null.

getVirtualFolders

protected java.util.List<VirtualFolder> getVirtualFolders()
Gets the virtual folders containing the master.

Returns:
List of VirtualFolders. May be empty, but never null.

addInViewList

protected void addInViewList(ViewInBase _view)
Registers the view as containing the master. Fires 'ImpliedOpenViews' event.


removeInViewList

protected boolean removeInViewList(ViewInBase _view)
Unregisters the view when it does not contain the master. Fires 'ImpliedOpenViews' event.

Returns:
false if the view is unknown or the instance is finalized

addInVFolderList

protected void addInVFolderList(VirtualFolder _folder)
                         throws CreateError
Registers the folder as containing the master. Fires 'VirtualFolders' event.

Throws:
CreateError - if the ACS or the master does not manage the virtual folders.

removeInVFolderList

protected boolean removeInVFolderList(VirtualFolder _folder)
                               throws CreateError
Unregisters the folder when it does not contain the master. Called by VirtualFolderImpl.removeEorBaseObject(), sometimes from the method finalizeForBase() of this instance. Fires the 'VirtualFolders' event.

Parameters:
_folder - to remove. May be finalized, e. g. with a null baseError_.
Returns:
false if the folder is unknown, if the instance or the argument is finalized
Throws:
CreateError - if the ACS or the master does not manage the virtual folders.

addPropertyChangeListener

protected void addPropertyChangeListener(java.beans.PropertyChangeListener _l)
Adds a listener for all the bound properties.

Parameters:
_l - PropertyChangeListener to add

addPropertyChangeListener

protected void addPropertyChangeListener(java.lang.String _propertyName,
                                         java.beans.PropertyChangeListener _l)
Adds a listener to the bean. Used for all the bound properties: 'ImpliedOpenViews', 'VirtualFolders'.

Parameters:
_propertyName - String is the name of the property
_l - PropertyChangeListener to add

removePropertyChangeListener

protected void removePropertyChangeListener(java.beans.PropertyChangeListener _l)
Removes a listener to the bean, for all the bound properties.

Parameters:
_l - PropertyChangeListener to remove

removePropertyChangeListener

protected void removePropertyChangeListener(java.lang.String _propertyName,
                                            java.beans.PropertyChangeListener _l)
Removes a listener. Used for all the bound properties: 'ImpliedOpenViews', 'VirtualFolders'.

Parameters:
_propertyName - String is the name of the property
_l - PropertyChangeListener to remove

getPropertyChangeListeners

public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String _propertyName)
Returns the change listeners for a property. Used by the AcsAddons.

Parameters:
_propertyName - name of the listened property.
Returns:
the change listeners. May be null.

finalizeForBase

protected void finalizeForBase()
                        throws UpDateError
Finalizes the CFolderMember. Removes the master in the virtual folders. HAVE TO BE USED before deleting the CFolderMember instance.

Throws:
UpDateError - if VirtualFolder.removeEorBaseObject() throws an exception

finalizeFromDeserialization

protected void finalizeFromDeserialization()
This method finalizes all the virtual folders, since it is used after a deserialization. There, they have been deserialized but are not 'true' objects of the base. No action on the open views, always empty. The instance is NOT removed as a listener, since there is no listener. The internal maps are set to null, but not the private bound properties sets. Does not call finalizeForBase(). Called for EPRViewInBaseImpl only.


cloneC

protected CFolderMemberImpl cloneC(Basic _master)
Clone for embedded class without registering the new object in the ACSs. Caution: don't use any modifying method that may altere the integrity of the base. The list are cloned without deep copy. The external object references are not cloned (see "Eor" in get method). The links between the EOR and the new instance are not set, but the lists of OER are cloned (viewInBase, virtualFolder) so it is possible to get these active objects.

Returns:
cloned object with _master as the master
Throws:
java.lang.CloneNotSupportedException

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode derived from the master nick name and the open views

equals

public boolean equals(java.lang.Object _obj)
Overrides:
equals in class java.lang.Object
Parameters:
_obj - Object
Returns:
true if _obj is a CFolderMemberImpl instance (or an instance of an extended class) equals to the current one

getSerialVersionUID

public long getSerialVersionUID()
Returns:
long: serial version UID for serialization of the instance

firePropertyChange

protected void firePropertyChange(java.lang.String _propertyName,
                                  java.lang.Object _oldValue,
                                  java.lang.Object _newValue)
Fires an event to every registered listener, in any order. For the properties: 'ImpliedOpenViews', 'VirtualFolders'.

Parameters:
_propertyName - name of the changing property
_oldValue - of the property
_newValue - of the property. No operation if equal to _oldValue and not null.

finalize

protected void finalize()
                 throws java.lang.Throwable
This method removes the CFolderMember from the ACS lists, but there is no guaranee that the JVM calls this method before the end of the application.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable