ARoad0.Gui1
Class InternalFrame

java.lang.Object
  extended by ARoad0.Gui1.InternalFrame
All Implemented Interfaces:
MVC_View, Singleton

public class InternalFrame
extends java.lang.Object
implements Singleton, MVC_View

This class is responsible to built up and manage the internal frames in the desktop. It manages both the explorer frame, the ACS frames, the view frames, the diagram frames, the text frames, the 'All views' frames and the Structure frame. An internalFrame may have a null title if the number of frames is more than 20. It works with the InternalFrameModel class. It implements the singleton pattern.


Field Summary
static java.awt.Color BACKCOLOR
           
static java.awt.Color BACKCOLOR_2
           
static java.awt.Color BACKCOLOR_3
           
static java.awt.Color BACKCOLOR_4
           
static java.awt.Color BACKCOLOR_5
           
static java.awt.Color BACKCOLOR_6
           
static java.awt.Color BACKCOLOR_8
           
static java.awt.Color FORECOLOR
           
static java.awt.Color FORECOLOR_2
           
static java.awt.Color FORECOLOR_3
           
static java.awt.Color FORECOLOR_4
           
static java.awt.Color FORECOLOR_BLACK
           
private static IconPolice iconPolice__
           
private static int INITIAL_CAPACITY
           
private static InternalFrame instance__
          the only instance of this class, following the singleton pattern
private static InternalFrameModel model__
          the instance, following the MVC pattern, which manages the internal frames data
static java.awt.Color NON_EDITABLECOLOR
           
static java.awt.Color SOFTGREY
           
 
Constructor Summary
InternalFrame()
          only one private constructor
 
Method Summary
static InternalFrame getInstance()
          Only method to get an instance.
static void openBeamer(javax.swing.JComponent _pane)
          Opens the Beamer if it is closed, or updates the beamer if it is open.
static void openExplorer()
          Opens the Explorer if it is closed.
static void openSketcher(GraphicSketchView _pane)
          Opens the sketcher if it is closed, or no operation.
private static javax.swing.JInternalFrame prepareFrame(javax.swing.JInternalFrame _frame, javax.swing.JComponent _component)
          Creates a frame including a JComponent at the center, with a scroll pane, and with the standard icon police.
private static javax.swing.JInternalFrame prepareFrameWithoutScrolling(javax.swing.JInternalFrame _frame, javax.swing.JComponent _component)
          Creates a frame including a JComponent at the center, without any scroll pane, and with the standard icon police.
static javax.swing.JInternalFrame prepareInformationFrame(javax.swing.JInternalFrame _frame, int _width, int _height)
          Displays a frame with an information message.
private static javax.swing.JInternalFrame setFrameDisposition(javax.swing.JInternalFrame _frame)
          Sets the frame to the down right corner of the desktop, in a 400x400 square.
static javax.swing.JInternalFrame showACSTreeFrame(ImmutableName _name, javax.swing.JTree _tree, BaseObject _object)
          Creates and displays a frame including an ACS tree, with a frame listener which fires events to ActionCloseACS, and register _object as a base object.
static javax.swing.JInternalFrame showAllFullViewsFrame(javax.swing.JPanel _panel)
          Creates and displays a frame including a tabbed pane of all graphical views for the open full views, with a frame listener which fires events to ActionClose.
static javax.swing.JInternalFrame showAllNoThanViewsFrame(javax.swing.JPanel _panel)
          Creates and displays a frame including a tabbed pane of all graphical views for the open NoThan views, with a frame listener which fires events to ActionClose.
static javax.swing.JInternalFrame showArchitectureFrame(GraphicView _gview, ViewInBase _view)
          Creates and displays a frame including an unique view of the ACS architecture.
(package private) static void showBeamerFrame(javax.swing.JComponent _pane)
          Creates and displays the beamer panel for a base object.
static javax.swing.JInternalFrame showEmptyFrame(java.lang.String _message, javax.swing.JComponent _pane, int _width, int _height)
          Create and display the panel for a dialog without buttons, but just the ability to close the frame.
private static javax.swing.JInternalFrame showExplorerFrame(javax.swing.JTree _tree)
          Creates and displays an explorer frame including a tree, at the top left of the main window.
static javax.swing.JInternalFrame showStructureFrame(javax.swing.JPanel _panel, javax.swing.JTree _tree)
          Creates and displays the 'IS Structure' frame including a beamer-like panel and the IS trees, with a frame listener which fires events to ActionClose.
static javax.swing.JInternalFrame showTextFrame(javax.swing.JTextPane _text, java.lang.String _title, java.net.URI _uriIcon)
          Creates and displays a frame including a JTextPane.
static javax.swing.JInternalFrame showViewFrame(GraphicView _gview, BaseObject _object)
          Creates and displays a frame including a graphical view, with a frame listener which fires events to ActionCloseView, and registers _object as a base object.
(package private) static void updateBeamerObject(javax.swing.JComponent _pane)
          Updates the beamer panel for a base object.
static javax.swing.JInternalFrame updateTextFrame(javax.swing.JTextPane _text, javax.swing.JInternalFrame _frame)
          Creates and displays a frame including a text in html.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance__

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


model__

private static InternalFrameModel model__
the instance, following the MVC pattern, which manages the internal frames data


BACKCOLOR

public static final java.awt.Color BACKCOLOR

FORECOLOR

public static final java.awt.Color FORECOLOR

FORECOLOR_BLACK

public static final java.awt.Color FORECOLOR_BLACK

BACKCOLOR_2

public static final java.awt.Color BACKCOLOR_2

BACKCOLOR_3

public static final java.awt.Color BACKCOLOR_3

NON_EDITABLECOLOR

public static final java.awt.Color NON_EDITABLECOLOR

BACKCOLOR_8

public static final java.awt.Color BACKCOLOR_8

SOFTGREY

public static final java.awt.Color SOFTGREY

BACKCOLOR_4

public static final java.awt.Color BACKCOLOR_4

BACKCOLOR_5

public static final java.awt.Color BACKCOLOR_5

BACKCOLOR_6

public static final java.awt.Color BACKCOLOR_6

FORECOLOR_2

public static final java.awt.Color FORECOLOR_2

FORECOLOR_3

public static final java.awt.Color FORECOLOR_3

FORECOLOR_4

public static final java.awt.Color FORECOLOR_4

INITIAL_CAPACITY

private static final int INITIAL_CAPACITY
See Also:
Constant Field Values

iconPolice__

private static IconPolice iconPolice__
Constructor Detail

InternalFrame

public InternalFrame()
only one private constructor

Method Detail

getInstance

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

Returns:
the instance

showACSTreeFrame

public static javax.swing.JInternalFrame showACSTreeFrame(ImmutableName _name,
                                                          javax.swing.JTree _tree,
                                                          BaseObject _object)
                                                   throws ProcessError
Creates and displays a frame including an ACS tree, with a frame listener which fires events to ActionCloseACS, and register _object as a base object. The frame name is the last 4 components, if possible. Caution: it is so theorically possible to have 2 ACS frames having the same name, if the IS is complex with 2 ACS names being identical at their ends. Does not read the GUI configuration to apply the previous disposition. Error, with message to user, if the number of frames is superior to 20.

Parameters:
_name - of the object shown, with 2 components at least. Equal to the name of _object in the base.
_tree - to display
_object - is associated to the tree in the base. May be null.
Returns:
the JInternalFrame displayed in the desktop or a new JInternalFrame() (not displayed) if there are more than 20 open frames
Throws:
ProcessError - if _object is null.

showViewFrame

public static javax.swing.JInternalFrame showViewFrame(GraphicView _gview,
                                                       BaseObject _object)
                                                throws ProcessError
Creates and displays a frame including a graphical view, with a frame listener which fires events to ActionCloseView, and registers _object as a base object. Displays the NoThan view indicator in the frame title if necessary. Adds the 'See why' button. If there are hidden nodes in the view, adds the 'New Extended view' button. Error, with message to user, if the number of frames is superior to 20. Error when the extended view is opened if the number of view items is superior to 46. Calls InternalFrameUtilities.getViewFrameTitleFromViewName().

Parameters:
_gview - to display
_object - is the view associated to the frame in the base. Its name must have at least two components.
Returns:
the JInternalFrame displayed in the desktop. May be empty if there is more than 20 open frames in the desktop.
Throws:
ProcessError - if _object is null.

showBeamerFrame

static void showBeamerFrame(javax.swing.JComponent _pane)
Creates and displays the beamer panel for a base object. Called by openBeamer(). Gets the beamer frame previous disposition, from the GUI configuration file. No update of m_BaseObjectsInMainFrames__, because it does not include the beamer. Error, with message to user, if the number of frames is superior to 20.

Parameters:
_pane - to display, which is updated by the caller of this method. May be null. It is not used so far.

showAllFullViewsFrame

public static javax.swing.JInternalFrame showAllFullViewsFrame(javax.swing.JPanel _panel)
                                                        throws ProcessError
Creates and displays a frame including a tabbed pane of all graphical views for the open full views, with a frame listener which fires events to ActionClose. Error, with message to user, if the number of frames is superior to 20.

Parameters:
_panel - of a tabbed pane to display
Returns:
the JInternalFrame displayed in the desktop. May be empty.
Throws:
ProcessError - if _object is null.

showAllNoThanViewsFrame

public static javax.swing.JInternalFrame showAllNoThanViewsFrame(javax.swing.JPanel _panel)
                                                          throws ProcessError
Creates and displays a frame including a tabbed pane of all graphical views for the open NoThan views, with a frame listener which fires events to ActionClose. Error, with message to user, if the number of frames is superior to 20.

Parameters:
_panel - of a tabbed pane to display
Returns:
the JInternalFrame displayed in the desktop. May be empty.
Throws:
ProcessError - if _object is null.

showArchitectureFrame

public static javax.swing.JInternalFrame showArchitectureFrame(GraphicView _gview,
                                                               ViewInBase _view)
                                                        throws ProcessError
Creates and displays a frame including an unique view of the ACS architecture. Error, with message to user, if the number of frames is superior to 20.

Parameters:
_gview - to display
_view - is the view associated to the architecture in the base. Its name has only one component.
Returns:
the JInternalFrame displayed in the desktop. May be empty.
Throws:
ProcessError - if _object is null.

showStructureFrame

public static javax.swing.JInternalFrame showStructureFrame(javax.swing.JPanel _panel,
                                                            javax.swing.JTree _tree)
                                                     throws ProcessError
Creates and displays the 'IS Structure' frame including a beamer-like panel and the IS trees, with a frame listener which fires events to ActionClose. Error, with message to user, if the number of frames is superior to 20. Called by ActionopenGlobalStructure.openFrame().

Parameters:
_panel - to display, including a tabbed pane and a tree
_tree - of the global structure, set at the bottom of _panel
Returns:
the JInternalFrame displayed in the desktop. May be empty.
Throws:
ProcessError - if _object is null.

showEmptyFrame

public static javax.swing.JInternalFrame showEmptyFrame(java.lang.String _message,
                                                        javax.swing.JComponent _pane,
                                                        int _width,
                                                        int _height)
Create and display the panel for a dialog without buttons, but just the ability to close the frame. Called by ActionNewACSyst. Do not check the number of frames into the desktop.

Parameters:
_message - displayed at the top of the frame
_pane - to display, which is updated by the caller of this method. May be null.
_width - of the frame
_height - of the frame
Returns:
the frame

prepareInformationFrame

public static javax.swing.JInternalFrame prepareInformationFrame(javax.swing.JInternalFrame _frame,
                                                                 int _width,
                                                                 int _height)
Displays a frame with an information message. Puts the frame in the desktop, but does not set it visible. Called by ActionOpenAllFull/NoThanViews, ActionOpenGraphicView.

Parameters:
_frame - to display.
_width - of the frame
_height - of the frame
Returns:
the frame

updateBeamerObject

static void updateBeamerObject(javax.swing.JComponent _pane)
Updates the beamer panel for a base object. Called by openBeamer(). No update of m_BaseObjectsInMainFrames__, because it does not include the beamer.

Parameters:
_pane - to display, which is updated by the caller of this method.

openBeamer

public static void openBeamer(javax.swing.JComponent _pane)
Opens the Beamer if it is closed, or updates the beamer if it is open. Called by ActionOpenBeamer.

Parameters:
_pane - to display, which is updated by the caller of this method. May be null.

openExplorer

public static void openExplorer()
Opens the Explorer if it is closed. Throw an InternalError if there is a null ACS in the base.


openSketcher

public static void openSketcher(GraphicSketchView _pane)
Opens the sketcher if it is closed, or no operation. The frame title contains 'Sketcher'. Called by ActionOpenSketcher. Gets the previous sketcher frame disposition, from the GUI configuration file. Calls ViewModel.removeViewRightsMediator() at the frame closing, to finalize the sketch view mediator. No updating of m_BaseObjectsInMainFrames__, because it does not include the sketcher. Error, with message to user, if the number of frames is superior to 20.

Parameters:
_pane - to display, which is a non-null GraphicSketchView.

showTextFrame

public static javax.swing.JInternalFrame showTextFrame(javax.swing.JTextPane _text,
                                                       java.lang.String _title,
                                                       java.net.URI _uriIcon)
Creates and displays a frame including a JTextPane. No updating of m_BaseObjectsInMainFrames__, because it does not include the text frames. Called by showViewFrame() and ActionOpenGraphicView.restoreMainAndSeeWhyFrames() in the event dispatch thread.

Parameters:
_text - to display, possibly with image(s)
_title - of the frame
_uriIcon - URI of the image to use as frame icon
Returns:
JInternalFrame displayed in the desktop

updateTextFrame

public static javax.swing.JInternalFrame updateTextFrame(javax.swing.JTextPane _text,
                                                         javax.swing.JInternalFrame _frame)
Creates and displays a frame including a text in html. No updating of m_BaseObjectsInMainFrames__, because it does not include the text frames. Called by GraphicViewBaseListenerImpl.changeFrameView(), updateFrameViewRights() in the Event Dispatching Thread, since this is NOT a thread-safe method.

Parameters:
_text - to display, possibly with image(s)
_frame - to update
Returns:
_frame

prepareFrameWithoutScrolling

private static javax.swing.JInternalFrame prepareFrameWithoutScrolling(javax.swing.JInternalFrame _frame,
                                                                       javax.swing.JComponent _component)
                                                                throws DialogError
Creates a frame including a JComponent at the center, without any scroll pane, and with the standard icon police. Error and message to the user, if the number of frames is greater than 20.

Parameters:
_frame - JInternalFrame to process.
_component - JComponent to display
Returns:
JInternalFrame to display in the desktop
Throws:
DialogError - if there is more than 20 open frames.

prepareFrame

private static javax.swing.JInternalFrame prepareFrame(javax.swing.JInternalFrame _frame,
                                                       javax.swing.JComponent _component)
                                                throws DialogError
Creates a frame including a JComponent at the center, with a scroll pane, and with the standard icon police. Set the font frame. Error and message to the user, if the number of frames is greater than 20.

Parameters:
_frame - JInternalFrame to process.
_component - JComponent to display
Returns:
JInternalFrame to display in the desktop
Throws:
DialogError - if there is more than 20 open frames.

showExplorerFrame

private static javax.swing.JInternalFrame showExplorerFrame(javax.swing.JTree _tree)
Creates and displays an explorer frame including a tree, at the top left of the main window. ActionOpenBeamer and ActionOpenSketcher are listeners of all selection changes.

Parameters:
_tree - to display
Returns:
the Explorer displayed in the desktop

setFrameDisposition

private static javax.swing.JInternalFrame setFrameDisposition(javax.swing.JInternalFrame _frame)
Sets the frame to the down right corner of the desktop, in a 400x400 square.

Parameters:
_frame - JInternalFrame to handle
Returns:
_frame