|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectARoad0.Gui1.BeamerManager
public class BeamerManager
This important class displays and updates the properties of any base object in matched tabbed panes. It manages customizable CRUD (create/read/update/delete) panels from the entities both from the generic gBase package, from any ACS addon gBase, and from some virtual entities the gDMak package handles. For this purpose, it is responsible for managing the ARoad0.gBaseInterface.BaseObject property editors and their layout. It works both for the beamer, the ACSFactoryImpl frame, the structure frame, the 'All full views' and 'All NoThan views' frames (see ActionOpenAllFullViews and ActionOpenAllNoThanViews).
Each property to display for a base object is analyzed in the static method updateBeamerPane(), that gets the right beamer pane, that is always a JPanel so far, and initialize it with all the panels associated to the properties of the displayed object. For this, it uses the BeanDescriptor of each property class. Group the property editors with the same panel group name in the same group panel. To display the tabbed panes in the order (1, 2, 3), the first set (one or several) of properties has to be from the pane 1, then the following property has to be from the pane 2, and it works even if another pane 1 property is at the end of the properties array.
The first method to call on a BeamerManager instance is updateBeamerPane(), which returns a JComponent to use as an argument for the method InternalFrame.openBeamer(). The single instance listens all the closing actions from the base object shown in the beamer. It handles a list for back and forward operations, up to 30 updatings.
For the 'allViews' window, the setJTabbedPane() method is called by ActionOpenAllFullViews and ActionOpenAllNoThanViews to populate a JPanel with the GraphicViewPropertyEditors, from property descriptors which are dynamically constructed by ActionOpenUserV.getViewPropertyDescriptor(). This is the same way for ActionNewACSyst.createUserDefinedACSrights() to define the properties of a new ACS.
Field Summary | |
---|---|
private static int |
BACK_SIZE_LIMIT
The maximal size of the back list. |
private static javax.swing.JButton |
backButton__
Three buttons in the tool bar |
protected static javax.swing.ImageIcon |
backButtonIcon__
|
static int |
BEAMER_FONT_SIZE
General font size |
private static javax.swing.JComponent |
beamerPane__
Pane of the beamer; this component is a JPanel with a BorderLayout. |
static java.awt.Font |
boldButtonFont
Bold font. |
static java.awt.Font |
boldUpFont
Bold font with BEAMER_FONT_SIZE as size |
static int |
BUTTON_FONT_SIZE
Font size for buttons |
private static javax.swing.JPanel |
CENTER_JPANEL
Center panel in the beamer |
private static javax.swing.JTabbedPane |
CENTER_JTABBEDPANE
Center tabbed pane in the beamer |
private static javax.swing.JComponent |
centerPanel__
Central panel in beamerPane__; may be a JPanel or a JTabbedPane. |
private static javax.swing.JButton |
deleteButton__
|
private static javax.swing.JButton |
forwardButton__
|
protected static javax.swing.ImageIcon |
forwardButtonIcon__
|
private static BeamerManager |
INSTANCE
|
static java.awt.Font |
italicFont
Italic font |
private static java.util.List |
L_BACK_BASEOBJECTS
List of the backing base objects displayed in the beamer. |
private static java.util.List |
L_FORWARD_BASEOBJECTS
List of the forwarding base objects displayed in the beamer. |
static int |
LARGE_TEXT_FONT_SIZE
Font size for large texts at 12 |
private static java.util.Map |
m_currentPropertyEditors__
Current CommonPropertyEditors in the beamer. |
private static BaseObject |
objectInBeamer__
Object displayed in the beamer |
private static BeanInfoPattern |
objectInBeamerBeanInfo__
BeanInfo of the object displayed in the beamer |
private static BaseBeanManager |
objectInBeamerManager__
Base object manager which fire propertyChangeEvent when objectInBeamer__ is deleted (not when it changes; these changes are listened by the property editors) |
private static ImmutableName |
objectInBeamerName__
Name of the object displayed in the beamer |
static java.awt.Font |
plainButtonFont
Plain font for button titles with BUTTON_FONT_SIZE as size |
static java.awt.Font |
plainFont
Plain font. |
private static java.lang.String |
previousTabbedPaneTitle__
The title of the current pane selected in the JTabbedPane |
static java.awt.Font |
smallBoldUpFont
Bold font with VIEW_FONT_SIZE as size |
private static javax.swing.JToolBar |
TOOLBAR
The tool bar |
private static boolean |
updateFromButtons__
This boolean is true when a click on the back or forward button provides a new selection in the explorer, and then updates the beamer. |
static int |
VIEW_FONT_SIZE
General font size |
Constructor Summary | |
---|---|
private |
BeamerManager()
With this private constructor, the compiler won't generate a default public constructor. |
Method Summary | |
---|---|
private static CommonPropertyEditor |
addPropertyEditor(BaseObject _objectInBeamer,
java.beans.PropertyDescriptor _descriptor,
java.awt.Container _component,
boolean _largerContainer)
Adds the property custom editor to a container, through PropertyEditor.getCustomEditor(). |
private static void |
finalizeForUser()
Finalizes the static variables of the beamer when it is closing, but reinitializes the panels in the beamer and the buttons in the toolbar. |
private static void |
finalizePropertyEditors()
Clears the center panel and removes it in the beamer. |
static java.lang.Class<?> |
getACSAllowedType(ACSObject _object,
java.lang.Class<?> _type)
Detect the subtype which is allowed by the acs, if there are some restrictions. |
static boolean |
getACSboolean(ACS _acs,
java.lang.String _method)
Gets the ACS configuration through the call of a boolean method. |
(package private) static BaseObject |
getBaseObject(ImmutableName _name,
java.lang.Class _type)
This is wrapper of ACS_Facade.getEorBaseObject() to get a StringRight while there is an on-going entering of the properties for an ACSFactory. |
static javax.swing.JComponent |
getBeamerPane()
The method to obtain the beamer pane, which may be a JPanel or a JTabbedPane. |
static java.lang.Class<?> |
getElementaryPropertyType(java.beans.PropertyDescriptor _propertyDescriptor)
Detect the type for a property type from a property descriptor, since the returned value by getPropertyType() may be an elementary BaseObject, or an array, a map or collection of BaseObjects, Strings or booleans. |
(package private) static boolean |
getForbidsForArchitecture(BaseObject _source,
java.beans.PropertyDescriptor _propertyDescriptor,
java.lang.String _buttonType)
Unused - this method forbids the display of the 'Select' and 'Remove' buttons for the members of the 'Architecture' view, and forbids the 'ConnectedACS' property. |
static BeamerManager |
getInstance()
The single method to obtain the unique instance of BeamerManager. |
private static boolean |
getNotDisplayThisProperty(BaseObject _objectInPane,
java.beans.PropertyDescriptor _propertyDescriptor)
Detects the need to not display a property in the beamer, following the ACS policy about its allowed properties and tabbed panes, and also some more general requirements about metarights. |
private static java.lang.String[] |
getOrderedNames(BaseObject _objectInPane,
java.beans.PropertyDescriptor[] _l_descriptors,
java.lang.String _name)
Read the names for the panel and tabbed pane groups. |
private static java.beans.PropertyDescriptor[] |
getOrderedPropertyDescriptors(BaseObject _objectInPane,
java.beans.PropertyDescriptor[] _l_descriptors,
java.lang.String[] _l_orderedName)
Return the indexes of the property descriptors in the right order, where the first property to display in the first tabbed pane is at the index 0. |
static void |
initializeDeleteButton()
The method to obtain the initialization of the delete button, before any use of setDeleteButton(). |
private static void |
initializeObjectClosing(BaseObject _objectInBeamer)
Analyzes the BeanInfo of the displayed object to set the event handling when the object is closing or deleting, and to set objectInBeamerManager__. |
private static javax.swing.JPanel |
initializeViewTabComponent(javax.swing.JTabbedPane _pane,
java.lang.String _title,
TabClosingHandler _caller)
Sets the component to put in the tab title, with a JLabel and a JButton to close the tab. |
void |
propertyChange(java.beans.PropertyChangeEvent _evt)
Set an empty beamer when an event is fired by the closing JInternalFrame of the beamer (event 'beamerClosing'), or by an Action class when an ACS or a view is closing (event 'objectClosing'), or by the BaseBeanManager of the displayed object when this object is closed or deleted. |
private static java.util.Map |
readDescriptorIndexesForPanelNames(java.beans.PropertyDescriptor[] _l_descriptors)
For each panel group name, return the indexes of the descriptors which are associated to. |
private static java.util.Map |
readDescriptorIndexesForTabbedNames(BaseObject _objectInPane,
java.beans.PropertyDescriptor[] _l_descriptors)
For each tabbed panel name, return the indexes for the descriptors which are associated to. |
private static void |
reinitializePanes(java.beans.BeanInfo _info,
BaseObject _objectInBeamer)
Analyzes the BeanInfo to set the internal static variables beamerPane__ and centerPanel__ (new JTabbedPane or new JPanel). |
private static void |
setBFButtons()
Updates the back and forward buttons states. |
private static void |
setDeleteButton(java.beans.BeanDescriptor _beanDescriptor)
Set the delete button if it is required in the bean descriptor. |
static void |
setJPanel(BaseObject _objectInBeamer,
java.beans.PropertyDescriptor[] _l_propertyDescriptor,
javax.swing.JPanel _result,
java.util.Map _m_currentPropertyEditors)
Set centerPanel__ when it is a JPanel. |
static void |
setJTabbedPane(BaseObject _objectInPane,
java.beans.PropertyDescriptor[] _l_propertyDescriptor,
javax.swing.JTabbedPane _result,
java.util.Map _m_currentPropertyEditors,
java.lang.Object _handler)
Set the properties of a BaseObject in a JTabbedPane, based on the property descriptors and for a given JTabbedPane. |
javax.swing.JComponent |
updateBeamerPane(BaseObject _objectInBeamer)
This is the only method to call just after getInstance() to set the right beamer pane, that is always a JPanel so far, and to initialize it with all the panels associated to the properties of the base object to display. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int BACK_SIZE_LIMIT
private static final java.util.List L_BACK_BASEOBJECTS
private static final java.util.List L_FORWARD_BASEOBJECTS
private static final javax.swing.JTabbedPane CENTER_JTABBEDPANE
private static final javax.swing.JPanel CENTER_JPANEL
private static final javax.swing.JToolBar TOOLBAR
public static final int VIEW_FONT_SIZE
public static final int BEAMER_FONT_SIZE
public static final int BUTTON_FONT_SIZE
public static final int LARGE_TEXT_FONT_SIZE
public static final java.awt.Font italicFont
public static final java.awt.Font plainFont
public static final java.awt.Font boldUpFont
public static final java.awt.Font plainButtonFont
public static final java.awt.Font smallBoldUpFont
public static final java.awt.Font boldButtonFont
private static javax.swing.JButton backButton__
private static javax.swing.JButton forwardButton__
private static javax.swing.JButton deleteButton__
protected static javax.swing.ImageIcon backButtonIcon__
protected static javax.swing.ImageIcon forwardButtonIcon__
private static boolean updateFromButtons__
private static javax.swing.JComponent beamerPane__
private static javax.swing.JComponent centerPanel__
private static BaseObject objectInBeamer__
private static ImmutableName objectInBeamerName__
private static BaseBeanManager objectInBeamerManager__
private static BeanInfoPattern objectInBeamerBeanInfo__
private static java.util.Map m_currentPropertyEditors__
private static java.lang.String previousTabbedPaneTitle__
private static final BeamerManager INSTANCE
Constructor Detail |
---|
private BeamerManager()
Method Detail |
---|
public static BeamerManager getInstance()
public static void initializeDeleteButton()
public static javax.swing.JComponent getBeamerPane()
public javax.swing.JComponent updateBeamerPane(BaseObject _objectInBeamer) throws ProcessError
_objectInBeamer
- is the object to display in the beamer
ProcessError
- in initializeObjectClosing()
if BeanInfo.getBaseBeanManagerGetMethod() returns a wrong methodpublic void propertyChange(java.beans.PropertyChangeEvent _evt)
propertyChange
in interface java.beans.PropertyChangeListener
public static void setJPanel(BaseObject _objectInBeamer, java.beans.PropertyDescriptor[] _l_propertyDescriptor, javax.swing.JPanel _result, java.util.Map _m_currentPropertyEditors) throws ProcessError
_objectInBeamer
- to display in the beamer_l_propertyDescriptor
- is array of the BeanInfo property descriptors_result
- is the tabbed pane where the property editors are added_m_currentPropertyEditors
- is the map of the current property editors
ProcessError
- if a CommonPropertyEditor throws an exception
in addPropertyEditor()public static void setJTabbedPane(BaseObject _objectInPane, java.beans.PropertyDescriptor[] _l_propertyDescriptor, javax.swing.JTabbedPane _result, java.util.Map _m_currentPropertyEditors, java.lang.Object _handler) throws ProcessError
Calls getOrderedNames(), getOrderedPropertyDescriptors() and addPropertyEditor(). When called by reinitializePanes(), reads previousTabbedPaneTitle__ without updating, to select the same pane if possible. Add a closing button on each pane when it is called by a TabClosingHandler.
Called by reinitializePanes() to sets centerPanel__, by ActionNewACSyst to define the ACS properties, by ActionOpenAllFullViews, ActionOpenGlobalStructure, ActionOpenAllNoThanViews and ActionOpenGraphicView to display the views.
_objectInPane
- to display in the tabbed pane. Used
if it is an ACSObject or an ACS. May be null otherwise._l_propertyDescriptor
- is an array of the BeanInfo property descriptors.
For a GraphicViewPropertEditor, most of the values are not used._result
- is the tabbed pane where the property editors are added_m_currentPropertyEditors
- is the map to update with the property editors.
Used only to finalize them._handler
- may be null. Have to be null for the calls from this class.
If it is a TabClosingHandler as ActionClose, the tab closing is initialized.
Noop otherwise.
ProcessError
- if a CommonPropertyEditor throws an exception
in addPropertyEditor()public static java.lang.Class<?> getElementaryPropertyType(java.beans.PropertyDescriptor _propertyDescriptor)
_propertyDescriptor
- is the descriptor of the property
public static java.lang.Class<?> getACSAllowedType(ACSObject _object, java.lang.Class<?> _type)
_object
- is the object with _type as type_type
- is the general type of _object
public static boolean getACSboolean(ACS _acs, java.lang.String _method)
_acs
- of the object to display_method
- is the name of an ACS method which returns a boolean
static boolean getForbidsForArchitecture(BaseObject _source, java.beans.PropertyDescriptor _propertyDescriptor, java.lang.String _buttonType)
_source
- is the object to display in the property editor_propertyDescriptor
- is one property descriptor from the BeanInfo class_buttonType
- is the property value for checking the right to display
the button
static BaseObject getBaseObject(ImmutableName _name, java.lang.Class _type)
_name
- name of the BaseObject_type
- class of the BaseObject or array class. It is ridden only if _type
is an instance of StringRight or an array of StringRight. Never null.
private static void setBFButtons()
private static void reinitializePanes(java.beans.BeanInfo _info, BaseObject _objectInBeamer) throws ProcessError
_info
- bean info for the object to put in the beamer_objectInBeamer
- is the object to display in the beamer
ProcessError
- if a CommonPropertyEditor throws an exception
in addPropertyEditor()private static void setDeleteButton(java.beans.BeanDescriptor _beanDescriptor)
_beanDescriptor
- private static java.lang.String[] getOrderedNames(BaseObject _objectInPane, java.beans.PropertyDescriptor[] _l_descriptors, java.lang.String _name)
_objectInPane
- to display in the tabbed pane_l_descriptors
- from a BeanInfo_name
- of the property, like "tabbedPaneName" and "panelGroupName"
private static java.util.Map readDescriptorIndexesForPanelNames(java.beans.PropertyDescriptor[] _l_descriptors)
_l_descriptors
- array of descriptors from a BeanInfo, where some values may be null.
private static java.util.Map readDescriptorIndexesForTabbedNames(BaseObject _objectInPane, java.beans.PropertyDescriptor[] _l_descriptors)
_objectInPane
- to display in the tabbed pane. May be null._l_descriptors
- array of descriptors from a BeanInfo
private static java.beans.PropertyDescriptor[] getOrderedPropertyDescriptors(BaseObject _objectInPane, java.beans.PropertyDescriptor[] _l_descriptors, java.lang.String[] _l_orderedName)
_objectInPane
- to display in the tabbed pane_l_descriptors
- is an array of descriptors from a BeanInfo_l_orderedName
- is an array of the names for the tabbed panes
private static CommonPropertyEditor addPropertyEditor(BaseObject _objectInBeamer, java.beans.PropertyDescriptor _descriptor, java.awt.Container _component, boolean _largerContainer) throws ProcessError
_objectInBeamer
- is the object to display in the beamer_descriptor
- of a _objectInBeamer property_component
- which has to handle the property editor_largerContainer
- is true to have a larger returned container.
Used only when the property is boolean, and adds an empty label
with a size get from CommonPropertyEditor.EMPTY_FIELD_DIMENSION.
ProcessError
- if a CommonPropertyEditor throws an exceptionprivate static boolean getNotDisplayThisProperty(BaseObject _objectInPane, java.beans.PropertyDescriptor _propertyDescriptor)
_objectInPane
- to display in the tabbed pane. May be null._propertyDescriptor
- is a property descriptor from a BeanInfo
private static void initializeObjectClosing(BaseObject _objectInBeamer) throws ProcessError
_objectInBeamer
- is the object to display in the beamer
ProcessError
- if BeanInfo.getBaseBeanManagerGetMethod()
returns a wrong methodBeanInfoPattern
private static javax.swing.JPanel initializeViewTabComponent(javax.swing.JTabbedPane _pane, java.lang.String _title, TabClosingHandler _caller)
_pane
- is the JTabbedPane where a new tab has been added_title
- is the current title of the tab_caller
- is the caller of the setJTabbedPane method (ActionClose indeed)
TabClosingHandler
private static void finalizePropertyEditors()
private static void finalizeForUser()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |