ARoad0.Gui1
Class InternalFrameModel

java.lang.Object
  extended by ARoad0.Gui1.InternalFrameModel
All Implemented Interfaces:
MVC_Model, Singleton

public class InternalFrameModel
extends java.lang.Object
implements Singleton, MVC_Model

This class is responsible to manage the internal frames data and the trees data, following the MVC pattern. This includes Explorer, Beamer, Sketcher, IS structure, Architecture, ACS main frames and varied view frames. It has maps of the base objects and the GraphicViews displayed in main frames.


Field Summary
private static javax.swing.JInternalFrame activeFrame__
           
private static javax.swing.JInternalFrame beamer__
           
private static javax.swing.JComponent beamerPane__
           
static javax.swing.JInternalFrame EMPTY_FRAME
           
private static javax.swing.JInternalFrame explorer__
           
private static javax.swing.JTree explorerTree__
           
private static javax.swing.JInternalFrame FullViewsframe__
           
private static int INITIAL_CAPACITY
           
private static InternalFrameModel instance__
          the only instance of this class, following the singleton pattern
private static java.util.List l_onGoingClosingOnBaseObjects__
          dynamic list of names for the base objects for which ActionClose is closing the main frame.
private static java.util.Map m_BaseObjectsInMainFrames__
          current base objects displayed in dedicated main frames ; getName() gets the key do not include the object displayed in the beamer.
private static java.util.Map m_JComponentsOfBaseObjects__
          current JComponents (JTree, JPanel) displayed in dedicated main frames or JTabbedPanes, and associated to base objects.
private static java.util.Map m_MainFramesOfBaseObjects__
          current main frames associated to base objects ; the object name is the key does not include the beamer nor the 'EPR views' frame.
private static javax.swing.JInternalFrame NoThanViewsframe__
           
private static javax.swing.JInternalFrame sketcher__
           
private static GraphicSketchView sketcherPane__
           
private static javax.swing.JInternalFrame structureframe__
           
private static javax.swing.JTree structureTree__
           
private static boolean withBeamer__
           
private static boolean withExplorer__
           
private static boolean withSketcher__
           
 
Constructor Summary
InternalFrameModel()
          only one private constructor
 
Method Summary
static void addBaseObjectJComponent(BaseObject _object, javax.swing.JComponent _component)
          Updates m_JComponentsOfBaseObjects__.
(package private) static void addMainFrameBaseObject(BaseObject _object, javax.swing.JInternalFrame _frame, javax.swing.JComponent _component)
          Updates m_BaseObjectsInMainFrames__, m_MainFramesOfBaseObjects__ and m_JComponentsOfBaseObjects__ with a lock on them.
static void addOnGoingClosingFromActionClass(ImmutableName _name)
          Update the dynamic list of names for the base objects which ActionCloseXXX is closing.
static javax.swing.JInternalFrame getActiveFrame()
          Get the frame which is active in the desktop.
static javax.swing.JInternalFrame getAllFullViewsFrame()
          Get the 'All full views' frame, if it exists.
static javax.swing.JInternalFrame getAllNoThanViewsFrame()
          Gets the 'All NoThan views' frame, if it exists.
static java.util.Map getBaseObjectsInMainFrames()
          Gets the objects in the base that are associated to main internal frame(s).
static javax.swing.JInternalFrame getBeamer()
          Gets the beamer.
static javax.swing.JComponent getBeamerPane()
          Get the pane in the beamer.
static javax.swing.JInternalFrame getExplorer()
          Gets the explorer.
static InternalFrameModel getInstance()
          Only method to get an instance.
static java.util.Map getJComponentsOfBaseObjects()
          Gets the JComponent (JTree, JPanel or GraphicView) that is associated to the base object in its main frame or tab in 'All view' tabbed pane.
static java.util.Map getMainFramesOfBaseObjects()
          Gets the main frames associated to the base objects.
(package private) static java.util.List getOnGoingClosingFromActionClass()
          Gets the list of names for the base objects that ActionClose is closing.
static javax.swing.JInternalFrame getOpenedSeeWhyFrame(ImmutableName _viewName)
          Gets the 'See why' frame of a view, if it is opened.
static javax.swing.JInternalFrame getSketcher()
          Gets the sketcher.
static GraphicSketchView getSketcherPane()
          Gets the sketch view in the sketcher.
static javax.swing.JInternalFrame getStructureFrame()
          Gets the 'IS structure' frame, if it exists.
static javax.swing.JTree getTreeInExplorer()
          Get the tree in the explorer.
static javax.swing.JTree getTreeInStructure()
          Gets the tree in the IS structure.
static void removeBaseObjectJComponent(ImmutableName _name)
          Updates m_JComponentsOfBaseObjects__.
(package private) static void removeMainFrameBaseObject(ImmutableName _name)
          Updates m_BaseObjectsInMainFrames__, m_MainFramesOfBaseObjects__ and m_JComponentsOfBaseObjects__ with a lock on them.
(package private) static void removeOnGoingClosingFromActionClass(ImmutableName _name)
          Removes a name for the base objects which are closing.
(package private) static void setActiveFrame(javax.swing.JInternalFrame _frame)
          Sets the frame which is active in the desktop.
static void setAllFullViewsFrame(javax.swing.JInternalFrame _frame)
          Sets the 'All full views' frame.
static void setAllNoThanViewsFrame(javax.swing.JInternalFrame _frame)
          Sets the 'All NoThan views' frame.
(package private) static void setBeamer(javax.swing.JInternalFrame _frame, javax.swing.JComponent _pane, boolean _withBeamer)
          Set the beamer.
(package private) static void setExplorer(javax.swing.JInternalFrame _frame, javax.swing.JTree _tree, boolean _withExplorer)
          Set the explorer.
(package private) static void setSketcher(javax.swing.JInternalFrame _frame, GraphicSketchView _pane, boolean _withSketcher)
          Set the sketcher.
static void setStructureFrame(javax.swing.JInternalFrame _frame, javax.swing.JTree _tree)
          Sets the 'IS structure' frame.
static boolean withAllFullViews()
          True if the 'All full views' frame is displayed in the main window.
static boolean withAllNoThanViews()
          True if the 'All NoThan views' frame is displayed in the main window.
static boolean withArchitecture()
          True if the 'Architecture' frame is displayed in the main window.
static boolean withBeamer()
          True if the beamer is displayed in the main window.
static boolean withExplorer()
          True if the explorer is displayed in the main window.
static boolean withSketcher()
          True if the sketcher is displayed in the main window.
static boolean withStructure()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance__

private static InternalFrameModel instance__
the only instance of this class, following the singleton pattern


INITIAL_CAPACITY

private static final int INITIAL_CAPACITY
See Also:
Constant Field Values

m_BaseObjectsInMainFrames__

private static java.util.Map m_BaseObjectsInMainFrames__
current base objects displayed in dedicated main frames ; getName() gets the key do not include the object displayed in the beamer.


m_MainFramesOfBaseObjects__

private static java.util.Map m_MainFramesOfBaseObjects__
current main frames associated to base objects ; the object name is the key does not include the beamer nor the 'EPR views' frame.


m_JComponentsOfBaseObjects__

private static java.util.Map m_JComponentsOfBaseObjects__
current JComponents (JTree, JPanel) displayed in dedicated main frames or JTabbedPanes, and associated to base objects. getName() gets the key from the base object. do not include the object displayed in the beamer. contain JPanels in 'EPR views' JTabbedPane tabs.


l_onGoingClosingOnBaseObjects__

private static java.util.List l_onGoingClosingOnBaseObjects__
dynamic list of names for the base objects for which ActionClose is closing the main frame. The closing has not to produce the call of the relevant ActionClose class. Used by an inner class in InternalFrameUtilities and by gDMak.ActionClose.


EMPTY_FRAME

public static final javax.swing.JInternalFrame EMPTY_FRAME

activeFrame__

private static javax.swing.JInternalFrame activeFrame__

explorer__

private static javax.swing.JInternalFrame explorer__

explorerTree__

private static javax.swing.JTree explorerTree__

withExplorer__

private static boolean withExplorer__

beamer__

private static javax.swing.JInternalFrame beamer__

beamerPane__

private static javax.swing.JComponent beamerPane__

withBeamer__

private static boolean withBeamer__

FullViewsframe__

private static javax.swing.JInternalFrame FullViewsframe__

NoThanViewsframe__

private static javax.swing.JInternalFrame NoThanViewsframe__

structureframe__

private static javax.swing.JInternalFrame structureframe__

structureTree__

private static javax.swing.JTree structureTree__

sketcher__

private static javax.swing.JInternalFrame sketcher__

sketcherPane__

private static GraphicSketchView sketcherPane__

withSketcher__

private static boolean withSketcher__
Constructor Detail

InternalFrameModel

public InternalFrameModel()
only one private constructor

Method Detail

getInstance

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

Returns:
InternalFrameModel

withExplorer

public static boolean withExplorer()
True if the explorer is displayed in the main window. It is always true after the first ACS opening.

Returns:
boolean

getExplorer

public static javax.swing.JInternalFrame getExplorer()
Gets the explorer.

Returns:
JInternalFrame explorer displayed in the desktop

getTreeInExplorer

public static javax.swing.JTree getTreeInExplorer()
Get the tree in the explorer.

Returns:
JTree tree of open objects displayed in the desktop explorer. Never null.

withBeamer

public static boolean withBeamer()
True if the beamer is displayed in the main window.

Returns:
boolean

getBeamer

public static javax.swing.JInternalFrame getBeamer()
Gets the beamer.

Returns:
the beamer displayed in the desktop. May be empty.

getBeamerPane

public static javax.swing.JComponent getBeamerPane()
Get the pane in the beamer.

Returns:
the pane displayed in the beamer. May be null, a JPanel or a JTabbedPane.

withSketcher

public static boolean withSketcher()
True if the sketcher is displayed in the main window.

Returns:
boolean

getSketcher

public static javax.swing.JInternalFrame getSketcher()
Gets the sketcher.

Returns:
the sketcher displayed in the desktop. May be empty.

getSketcherPane

public static GraphicSketchView getSketcherPane()
Gets the sketch view in the sketcher.

Returns:
the pane displayed in the sketcher. May be null.

getAllFullViewsFrame

public static javax.swing.JInternalFrame getAllFullViewsFrame()
Get the 'All full views' frame, if it exists.

Returns:
the 'All full views' frame. May be null.

setAllFullViewsFrame

public static void setAllFullViewsFrame(javax.swing.JInternalFrame _frame)
Sets the 'All full views' frame.

Parameters:
_frame - the 'All full views' frame. May be null.

withAllFullViews

public static boolean withAllFullViews()
True if the 'All full views' frame is displayed in the main window.

Returns:
boolean

getAllNoThanViewsFrame

public static javax.swing.JInternalFrame getAllNoThanViewsFrame()
Gets the 'All NoThan views' frame, if it exists.

Returns:
the 'All NoThan views' frame. May be null.

setAllNoThanViewsFrame

public static void setAllNoThanViewsFrame(javax.swing.JInternalFrame _frame)
Sets the 'All NoThan views' frame.

Parameters:
_frame - the 'All NoThan views' frame. May be null.

withAllNoThanViews

public static boolean withAllNoThanViews()
True if the 'All NoThan views' frame is displayed in the main window.

Returns:
boolean

getStructureFrame

public static javax.swing.JInternalFrame getStructureFrame()
Gets the 'IS structure' frame, if it exists.

Returns:
the frame. May be null.

getTreeInStructure

public static javax.swing.JTree getTreeInStructure()
Gets the tree in the IS structure.

Returns:
JTree of open or closed objects displayed in the IS structure. Never null.

setStructureFrame

public static void setStructureFrame(javax.swing.JInternalFrame _frame,
                                     javax.swing.JTree _tree)
Sets the 'IS structure' frame.

Parameters:
_frame - the frame. May be null.
_tree - the global structure tree. Never null.

withStructure

public static boolean withStructure()
Returns:
true if the 'IS structure' frame is displayed in the main window

withArchitecture

public static boolean withArchitecture()
True if the 'Architecture' frame is displayed in the main window. May be false with an 'Architecture' node in the explorer, which is tested through ViewInBase_Facade.getArchitectureView() null or not.

Returns:
boolean

getBaseObjectsInMainFrames

public static java.util.Map getBaseObjectsInMainFrames()
Gets the objects in the base that are associated to main internal frame(s). The object name is the map key. The object viewed in the beamer is not in this map.

Returns:
unmodifiableMap of base objects displayed in the main window

getMainFramesOfBaseObjects

public static java.util.Map getMainFramesOfBaseObjects()
Gets the main frames associated to the base objects. The object name is the map key. The beamer, the explorer, the Sketcher are never in this map. The Architecture view is included.

Returns:
unmodifiableMap of frames displayed in the main window

getJComponentsOfBaseObjects

public static java.util.Map getJComponentsOfBaseObjects()
Gets the JComponent (JTree, JPanel or GraphicView) that is associated to the base object in its main frame or tab in 'All view' tabbed pane. No JComponent if the base object is a view opened in the GUI whithout main frame ou tab.

The object name is the map key. The object shown in the beamer is not in this map.

Returns:
unmodifiableMap of JComponents displayed in the main frames

getOnGoingClosingFromActionClass

static java.util.List getOnGoingClosingFromActionClass()
Gets the list of names for the base objects that ActionClose is closing.

Returns:
unmodifiableList

getOpenedSeeWhyFrame

public static javax.swing.JInternalFrame getOpenedSeeWhyFrame(ImmutableName _viewName)
Gets the 'See why' frame of a view, if it is opened. Used by ActionSave.

Parameters:
_viewName - is a view name for a view placed in a main frame or not, with an open 'See why' frame or not. Never null.
Returns:
the 'See why' frame or null

getActiveFrame

public static javax.swing.JInternalFrame getActiveFrame()
Get the frame which is active in the desktop. Used by ActionXXX.

Returns:
JInternalFrame which is currently active

setBeamer

static void setBeamer(javax.swing.JInternalFrame _frame,
                      javax.swing.JComponent _pane,
                      boolean _withBeamer)
Set the beamer.

Parameters:
_frame - is the beamer. Has to be equals to new JInternalFrame if _withBeamer is false. Never null.
_pane - is the JComponent in the beamer. Has to be equals to a new JComponent if _withBeamer is false. May be null.
_withBeamer - has to be false if the beamer is closed.

setExplorer

static void setExplorer(javax.swing.JInternalFrame _frame,
                        javax.swing.JTree _tree,
                        boolean _withExplorer)
Set the explorer.

Parameters:
_frame - is the explorer. Has to be equals to new JInternalFrame if _withExplorer is false.
_tree - is the JTree in the explorer. Never null. Has to be equals to new JTree if _withExplorer is false.
_withExplorer - has to be false if the explorer is closed.

setSketcher

static void setSketcher(javax.swing.JInternalFrame _frame,
                        GraphicSketchView _pane,
                        boolean _withSketcher)
Set the sketcher.

Parameters:
_frame - is the sketcher. Has to be equals to new JInternalFrame if _withSketcher is false. Never null.
_pane - is the sketch view in the sketcher. This method sets the internal value to null if _withSketcher is false.
_withSketcher - has to be false if the sketcher is closed.

addOnGoingClosingFromActionClass

public static void addOnGoingClosingFromActionClass(ImmutableName _name)
Update the dynamic list of names for the base objects which ActionCloseXXX is closing. Used by gDMak.ActionCloseUtilities.

Parameters:
_name - ImmutableName of the base object which is closing

addMainFrameBaseObject

static void addMainFrameBaseObject(BaseObject _object,
                                   javax.swing.JInternalFrame _frame,
                                   javax.swing.JComponent _component)
Updates m_BaseObjectsInMainFrames__, m_MainFramesOfBaseObjects__ and m_JComponentsOfBaseObjects__ with a lock on them. Used by InternalFrame.

Parameters:
_object - to declare
_frame - main frame associated to _object
_component - is the JTree, JPanel or the GraphicView associated to the ACS or to the view

removeMainFrameBaseObject

static void removeMainFrameBaseObject(ImmutableName _name)
Updates m_BaseObjectsInMainFrames__, m_MainFramesOfBaseObjects__ and m_JComponentsOfBaseObjects__ with a lock on them. Used by InternalFrameUtilities.

Parameters:
_name - of the object to remove

addBaseObjectJComponent

public static void addBaseObjectJComponent(BaseObject _object,
                                           javax.swing.JComponent _component)
Updates m_JComponentsOfBaseObjects__. Used by addMainFrameBaseObject().

Parameters:
_object - to declare
_component - is the JTree, JPanel or GraphicView associated to _object

removeBaseObjectJComponent

public static void removeBaseObjectJComponent(ImmutableName _name)
Updates m_JComponentsOfBaseObjects__. Called by ActionClose.closeOneEPRviewsTab().

Parameters:
_name - of the BaseObject to remove

removeOnGoingClosingFromActionClass

static void removeOnGoingClosingFromActionClass(ImmutableName _name)
Removes a name for the base objects which are closing.

Parameters:
_name - to remove

setActiveFrame

static void setActiveFrame(javax.swing.JInternalFrame _frame)
Sets the frame which is active in the desktop.

Parameters:
_frame - which is currently active. May be EMPTY_FRAME.