ARoad0.gWork
Class ViewInBase_Facade

java.lang.Object
  extended by ARoad0.gWork.ViewInBase_Facade
All Implemented Interfaces:
Singleton

public class ViewInBase_Facade
extends java.lang.Object
implements Singleton

This class is the "facade" (GoF pattern) for all the operations about views that are called by Gui1, Gui2 and gDMak objects.


Field Summary
private static int INITIAL_CAPACITY
           
private static ViewInBase_Facade instance__
           
static java.util.List<ImmutableSource> L_SK_EP
          A static list reserved to populateSketchView().
static java.util.List<BaseObject> L_SK_RES
          A static list reserved to populateSketchView().
static java.lang.String NOTHAN_VIEW_INDICATOR
           
static RightsMediatorImpl SKETCH_MEDIATOR
          The RightsMediator for the sketch view.
static java.lang.String VIEW_FRAME_INDICATOR
           
 
Constructor Summary
private ViewInBase_Facade()
          only one private constructor
 
Method Summary
static void closeOpenView(ViewInBase _view)
          Closes any open view without save it.
static EPRViewInBase createEPRView(ImmutableName _name, java.util.Set _l_BaseObject)
          Creates a new view for EligibleParties and Resources, then registers and saves it.
static NoThanViewInBase createNoThanView(ImmutableName _name, java.util.Set _l_BaseObject)
          COMMENTS TO DO Creates a new view for EligibleParties and Resources, then registers and saves it.
static SketchViewInBase createSketchView(ImmutableName _name)
          Creates a new sketch view without registering nor saving it in the base.
static ViewInBase createView(ImmutableName _name, java.util.Map _m_BaseObjects)
          Creates a new classical view for BaseObjects, then save it.
static java.util.Map getAllStandardOpenViews()
           
static ViewInBase getArchitectureView()
           
static java.util.List getClosedViews()
          The 'Architecture' view is not returned in the list, to forbid its direct opening by the user.
static java.util.Set<ImmutableName> getElementsOfOneView(ImmutableName _name, boolean _acsNames)
          Get the elements of a closed or opened ViewInBase.
static ViewInBase_Facade getInstance()
          Only method to get an instance.
static java.util.Map getOpenFullViews()
          Do not return the Architecture view and the Sketch view.
static java.util.Map getOpenNoThanViews()
          Do not return the Architecture view and the Sketch view.
static boolean isNoThanViewName(ImmutableName _name)
          Check if the component name before the last component equals ''.
static boolean isOpenView(ImmutableName _name)
          getElementsOfOneView( ImmutableName _name, boolean _acsNames) throws BaseError
static boolean knowsView(ImmutableName _name)
           
static EPRViewInBase openOrCreateEPRView(ImmutableName _name, java.util.List _EPList, java.util.List _ResourceList)
          Gets the open EP-to-Resource view; opens the registered view if it is closed; creates it, if it is necessary.
static NoThanViewInBase openOrCreateNoThanView(ImmutableName _name, java.util.List _EPList)
          Gets the NoThan view; opens the registered view if it is closed; creates it, if it is necessary.
static ViewInBase openOrCreateView(ImmutableName _name, java.util.List _l_BaseObjects)
          Gets the BaseObjects view; open the registered view if it is closed; creates and saves it if necessary.
static java.util.Map populateSketchView(SketchViewInBase _view, BaseObject _center, java.lang.String _type)
          Detects the objects to put in a sketch view, around the center, and generates the DisplayableLinks which are applicable.
static void removeView(ImmutableName _name)
          Removes a view, and before, close and save it if it is open.
static void saveAllViews()
          No use.
static void saveAndCloseOpenView(ViewInBase _view)
          Closes any open view and save it.
static void saveView(ImmutableName _name)
          Saves the registered view on a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOTHAN_VIEW_INDICATOR

public static final java.lang.String NOTHAN_VIEW_INDICATOR
See Also:
Constant Field Values

VIEW_FRAME_INDICATOR

public static final java.lang.String VIEW_FRAME_INDICATOR
See Also:
Constant Field Values

instance__

private static ViewInBase_Facade instance__

INITIAL_CAPACITY

private static final int INITIAL_CAPACITY
See Also:
Constant Field Values

SKETCH_MEDIATOR

public static RightsMediatorImpl SKETCH_MEDIATOR
The RightsMediator for the sketch view. Setup by ActionOpenSketcher.openSketcher() and used by RightsFactory_Facade.detectSketchRights() that is a static method. This mediator is finalized by ViewModel.removeViewRightsMediator() that is called by an InternalFrame.openSketcher() inner class on the closing action.


L_SK_RES

public static java.util.List<BaseObject> L_SK_RES
A static list reserved to populateSketchView().


L_SK_EP

public static java.util.List<ImmutableSource> L_SK_EP
A static list reserved to populateSketchView().

Constructor Detail

ViewInBase_Facade

private ViewInBase_Facade()
only one private constructor

Method Detail

getInstance

public static ViewInBase_Facade getInstance()
Only method to get an instance.


knowsView

public static boolean knowsView(ImmutableName _name)
Parameters:
_name - of a view
Returns:
boolean true if _name is known as a view name. The view may be opened or closed.

isOpenView

public static boolean isOpenView(ImmutableName _name)
getElementsOfOneView( ImmutableName _name, boolean _acsNames) throws BaseError

Parameters:
_name - ImmutableName of a view
Returns:
boolean true if _name is known as a view name and the view is open.

getElementsOfOneView

public static java.util.Set<ImmutableName> getElementsOfOneView(ImmutableName _name,
                                                                boolean _acsNames)
                                                         throws BaseError
Get the elements of a closed or opened ViewInBase. Fire no event. A closed view is not opened by this method.

Parameters:
_name - of an opened or closed ViewInBase.
_acsNames - false to get the view elements names, true to get the names of the ACS which own the view elements
Returns:
the element names or the ACS names; if for ACS, it may contains a null item.
Throws:
BaseError - if the view is not known, the open view has not the same name, or ClassNotFoundException, IOException.

getClosedViews

public static java.util.List getClosedViews()
The 'Architecture' view is not returned in the list, to forbid its direct opening by the user.

Returns:
unmodifiable List of the closed view names. May be empty but not null.

isNoThanViewName

public static boolean isNoThanViewName(ImmutableName _name)
Check if the component name before the last component equals ''.

Parameters:
_name - of a ViewInBase
Returns:
true if it is NoThan view name, even if the view is unknown

getOpenFullViews

public static java.util.Map getOpenFullViews()
Do not return the Architecture view and the Sketch view. Call isNoThanViewName() to identity the full views.

Returns:
copy of the map of the non-null open Full views. Never null.

getOpenNoThanViews

public static java.util.Map getOpenNoThanViews()
Do not return the Architecture view and the Sketch view. Call isNoThanViewName() to identity the NoThan views.

Returns:
Map of the non-null open NoThan views. Never null.

getAllStandardOpenViews

public static java.util.Map getAllStandardOpenViews()
Returns:
unmodifiable Map of the Full and NoThan open views, but without the Architecture view and the Sketch view.

getArchitectureView

public static ViewInBase getArchitectureView()
Returns:
the 'Architecture' view if open, or null.

saveAllViews

public static void saveAllViews()
                         throws BaseError
No use. Saves all the registered views, even if they are empty. All open objects (views), but not the closed ones, are saved in some files (one per open object) in the default directory. The sketch view is never registered, then not processed there.

Throws:
BaseError - if an object is not open, objectName.lastComponent() is null, FileNotFoundException or IOException.

saveView

public static void saveView(ImmutableName _name)
Saves the registered view on a file. The sketch view is never registered, then not processed there.

Parameters:
_name - ImmutableName of the view to save

createView

public static ViewInBase createView(ImmutableName _name,
                                    java.util.Map _m_BaseObjects)
                             throws CreateError,
                                    BaseError
Creates a new classical view for BaseObjects, then save it. Called by ActionOpenArchitecture.openArchitecture().

Parameters:
_name - for the view to create. No test of null nor empty.
_m_BaseObjects - is the list of the BaseObjects in the view. May be null.
Returns:
the new ViewInBase
Throws:
CreateError - or BaseError if _name is already known in BaseManagerImpl, or if _l_BaseObject contains a null, no BaseObject, or empty-name object.
BaseError

openOrCreateView

public static ViewInBase openOrCreateView(ImmutableName _name,
                                          java.util.List _l_BaseObjects)
                                   throws DialogError
Gets the BaseObjects view; open the registered view if it is closed; creates and saves it if necessary. If the view exists, it may be a subclass of ViewInBase, but the created view is strictly a ViewInBaseImpl instance. The sketch view is never registered, then not processed there.

Parameters:
_name - ImmutableName for the view to create or open. No test of null nor empty.
_l_BaseObjects - is the list of the BaseObjects in the view. May be null.
Returns:
ViewInBase
Throws:
DialogError - to display to the user.

createEPRView

public static EPRViewInBase createEPRView(ImmutableName _name,
                                          java.util.Set _l_BaseObject)
                                   throws CreateError,
                                          BaseError
Creates a new view for EligibleParties and Resources, then registers and saves it.

Parameters:
_name - for the view to create. No test of null nor empty.
_l_BaseObject - is the list of the BaseObjects in the view. May be null.
Returns:
the new EPRViewInBase
Throws:
BaseError - or CreateError if _name is already known in BaseManagerImpl, or if _l_BaseObject contains a null, no BaseObject, or empty-name object, or if it contains an object that is not an eligible party nor a resource.
CreateError

createNoThanView

public static NoThanViewInBase createNoThanView(ImmutableName _name,
                                                java.util.Set _l_BaseObject)
                                         throws BaseError,
                                                CreateError
COMMENTS TO DO Creates a new view for EligibleParties and Resources, then registers and saves it.

Parameters:
_name - for the view to create. No test of null nor empty.
_l_BaseObject - is the list of the BaseObjects in the view. May be null.
Returns:
the new EPRViewInBase
Throws:
BaseError - or CreateError if _name is already known in BaseManagerImpl, or if _l_BaseObject contains a null, no BaseObject, or empty-name object, or if it contains an object that is not an eligible party nor a resource.
CreateError

openOrCreateEPRView

public static EPRViewInBase openOrCreateEPRView(ImmutableName _name,
                                                java.util.List _EPList,
                                                java.util.List _ResourceList)
                                         throws DialogError
Gets the open EP-to-Resource view; opens the registered view if it is closed; creates it, if it is necessary. _EPList and _ResourceList may contain redondant elements. The sketch view is never registered, then not processed there.

Parameters:
_name - ImmutableName for the view to create or open. No test of null nor empty.
_EPList - List of the eligible parties in the view. may be null.
_ResourceList - List of the resources in the view. may be null.
Returns:
EPRViewInBase
Throws:
DialogError - to display to the user.

openOrCreateNoThanView

public static NoThanViewInBase openOrCreateNoThanView(ImmutableName _name,
                                                      java.util.List _EPList)
                                               throws DialogError
Gets the NoThan view; opens the registered view if it is closed; creates it, if it is necessary. The sketch view is never registered, then not processed there.

Parameters:
_name - ImmutableName for the view to create or open. No test of null nor empty.
_EPList - List of the eligible parties in the view. may be null.
Returns:
the view
Throws:
DialogError - to display to the user.

createSketchView

public static SketchViewInBase createSketchView(ImmutableName _name)
                                         throws BaseError,
                                                CreateError
Creates a new sketch view without registering nor saving it in the base. The sketch view does not listen the view elements or the base changes.

Parameters:
_name - for the view to create. No test of null nor empty.
Returns:
the new SketchViewInBase
Throws:
BaseError - or CreateError if _l_BaseObject contains a null, no BaseObject, or empty-name object, or if it contains an object that is not an eligible party nor a resource.
CreateError

populateSketchView

public static java.util.Map populateSketchView(SketchViewInBase _view,
                                               BaseObject _center,
                                               java.lang.String _type)
Detects the objects to put in a sketch view, around the center, and generates the DisplayableLinks which are applicable. The sketch view does not listen the view elements or the base changes. Called by ActionOpenSketcher.openSelection() for every change to do in the sketcher, so it is designed to be fast. Works in the main thread. Calls RightsFactory_Facade.detectSketchRights().

Parameters:
_view - is the empty sketch view to populate. Never null.
_center - is the center of the sketch view. Never null.
_type - is the _center type, which is "actor", "resource", "ec_resource" "groupid", "userid", "virtualfolder"
Returns:
the map of the DisplayableLinkImpls for this view after the adding of the relevant elements in _view. Null if the view size is 22 or more.

saveAndCloseOpenView

public static void saveAndCloseOpenView(ViewInBase _view)
Closes any open view and save it.

Parameters:
_view - ViewInBase to close

closeOpenView

public static void closeOpenView(ViewInBase _view)
                          throws BaseError
Closes any open view without save it. This method is not used for the automatic closings, for example while an ACS is closed and if it contains some nodes of the view.

Parameters:
_view - ViewInBase to close
Throws:
BaseError - if _view is not open, ViewName.lastComponent() is null, or FileNotFoundException, IOException.

removeView

public static void removeView(ImmutableName _name)
                       throws BaseError
Removes a view, and before, close and save it if it is open.

Parameters:
_name - ViewInBase to remove from the base
Throws:
BaseError - if the view is unknown, ViewName.lastComponent() is null, or FileNotFoundException, IOException.