public class IlvPanelView extends JPanel implements IlvDocumentView
IlvDocumentView
interface
for a JPanel
.
IlvDocumentView
interface.
IlvPanelView
as the
view of the document, which contains the Swing component. The
initializeView(ilog.views.appframe.docview.IlvDocument)
method of the panel view is in charge of
initializing the enclosed component with the data of the
associated document.
Take the example of an application that has defined a
table model for its business model, called BusinessTableModel
,
and a JTable
inheriting class for editing this model, called
BusinessTable
. A document and document view can be defined
to encapsulate those classes in the Perforce JViews Application Framework architecture,
without Application Framework being intrusive in business classes.
The document may be defined as follows:
public class BusinessDocument extends IlvAbstractFileDocument { ... public getBusinessTableModel() {...} ... }and the document view:
public class BusinessPanelView extends IlvPanelView { BusinessTable businessTable; public BusinessPanelView() { setLayout(new BorderLayout()); this.businessTable = new BusinessTable(); add(businessTable, BorderLayout.CENTER); } ... public void initializeView(IlvDocument document) { if (document != null) { businessTable.setModel( ((BusinessDocument)document).getBusinessTableModel()); } } ... }
This approach is used for the IlvTextView
,
IlvTreeView
, and
IlvExplorerView
classes.
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SETTINGS_NAME
Default attribute name for selecting the settings element that provides
the settings of the panel view.
|
static String |
DEFAULT_SETTINGS_TYPE
Type of settings element providing the settings for the panel views.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ACTIVE_PROPERTY, ACTIVE_VIEW_NAME, APPLICATION_PROPERTY, CLOSABLE_PROPERTY, CLOSING_VIEW_MSG, DOCUMENT_PROPERTY, SETTINGS_ELEMENT_PROPERTY, STATIC_VIEW_PROPERTY, VIEW_CONTAINER_PROPERTY
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Modifier | Constructor and Description |
---|---|
|
IlvPanelView()
Constructs a new
IlvPanelView . |
protected |
IlvPanelView(String settingsType,
String defaultSettingsName)
Constructs a panel view that reads its settings from a settings element
with the specified
settingsType . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e)
Invoked when receiving action events.
|
void |
addActionHandler(ActionHandler actionHandler)
Adds the specified
actionHandler to the list of action handlers of
the view. |
boolean |
close()
Closes the view by closing its container.
|
IlvApplication |
getApplication()
Returns the application of the view.
|
IlvDocument |
getDocument()
Returns the document associated with the view.
|
Object |
getProperty(String key)
Returns the client property of the panel with the specified key.
|
IlvSettings |
getSettings()
Returns the settings the panel view reads its settings from.
|
IlvSettingsElement |
getSettingsElement()
Returns the settings element that provides the settings for this
panel view.
|
String |
getSettingsName()
Returns the name that identifies the panel view within the settings.
|
IlvSettingsQuery |
getSettingsQuery()
Returns the query that selects the settings element that provides
the settings for this panel view.
|
String |
getSettingsType()
Returns the type of the settings element that provides the settings
for this panel view.
|
IlvViewContainer |
getViewContainer()
Returns the view container that owns the view.
|
void |
initializeView(IlvDocument document)
Initializes the panel view with the specified document.
|
boolean |
isProcessingAction(String command)
Determines whether the panel view is able to process the action
with the specified
command key in its
actionPerformed(java.awt.event.ActionEvent) method. |
boolean |
isStaticView()
Determines whether this view has been registered as a static view or has
been dynamically created for a specific document.
|
protected void |
readSettings(IlvSettingsElement settingsElement)
Reads the settings of the panel view.
|
void |
receiveMessage(MessageEvent event)
Invoked when receiving a message event.
|
protected void |
registerMappings(IlvMessageMapper mapper)
This method is called to register the mappings between action events and
the panel view methods.
|
boolean |
removeActionHandler(ActionHandler actionHandler)
Removes the specified
actionHandler from the list of action
handlers managed by this view. |
void |
setApplication(IlvApplication application)
Sets the application of the view.
|
void |
setDocument(IlvDocument document)
Sets the document associated with the view.
|
Object |
setProperty(String key,
Object value)
Sets one of the client properties of this panel using the associated key.
|
void |
setSettings(IlvSettings settings)
Sets the settings the panel view reads its settings from.
|
void |
setSettingsElement(IlvSettingsElement element)
Forces the settings of the panel view to be read and written from the
specified settings element.
|
void |
setSettingsName(String name)
Sets the name that identifies the panel view within the settings.
|
void |
setSettingsQuery(IlvSettingsQuery query)
Sets the query that selects the settings element that provides the settings
for this panel view.
|
void |
setViewContainer(IlvViewContainer container)
Sets the view container of the view.
|
boolean |
updateAction(Action action)
Invoked by the application to update the state of the specified
action . |
void |
viewClosed()
Invoked after the view is closed.
|
void |
viewClosing()
Invoked before the view closes.
|
protected void |
writeSettings(IlvSettingsElement settingsElement)
Writes the settings of the panel view.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, removePropertyChangeListener
public static final String DEFAULT_SETTINGS_TYPE
public static final String DEFAULT_SETTINGS_NAME
protected IlvPanelView(String settingsType, String defaultSettingsName)
settingsType
.settingsType
- The type of the settings element providing the settings
for the panel view.defaultSettingsName
- The default name used to select the settings
element that provide the settings for this panel view.getSettingsType()
,
getSettingsName()
public IlvPanelView()
IlvPanelView
. This method delegates
the initialization of the panel to the constructor
IlvPanelView(String, String)
, with the settings constants
DEFAULT_SETTINGS_TYPE
and DEFAULT_SETTINGS_NAME
given
as the parameters.public void initializeView(IlvDocument document)
DOCUMENT_PROPERTY
of the view.initializeView
in interface IlvDocumentView
document
- The document to initialize the content of the view with.public void viewClosing()
viewClosing
in interface IlvDocumentView
viewClosed()
public void viewClosed()
viewClosed
in interface IlvDocumentView
viewClosing()
public IlvDocument getDocument()
getDocument
in interface IlvDocumentView
setDocument(ilog.views.appframe.docview.IlvDocument)
,
IlvDocumentView.DOCUMENT_PROPERTY
public void setDocument(IlvDocument document)
document
- The document of the view.getDocument()
,
IlvDocumentView.DOCUMENT_PROPERTY
public IlvViewContainer getViewContainer()
getViewContainer
in interface IlvDocumentView
setViewContainer(ilog.views.appframe.docview.IlvViewContainer)
,
IlvDocumentView.VIEW_CONTAINER_PROPERTY
public void setViewContainer(IlvViewContainer container)
container
- The new view container of the view.getViewContainer()
,
IlvDocumentView.VIEW_CONTAINER_PROPERTY
public boolean isStaticView()
IlvDocumentView.STATIC_VIEW_PROPERTY
property of the view.true
if this view is a static view; false
otherwise.IlvDocumentView.STATIC_VIEW_PROPERTY
public boolean close()
true
if the container could be closed;
false
otherwise.public IlvApplication getApplication()
getApplication
in interface IlvDocumentView
setApplication(ilog.views.appframe.IlvApplication)
,
IlvDocumentView.APPLICATION_PROPERTY
public void setApplication(IlvApplication application)
application
- The application of the view.getApplication()
,
IlvDocumentView.APPLICATION_PROPERTY
public void addActionHandler(ActionHandler actionHandler)
actionHandler
to the list of action handlers of
the view.actionHandler
- The new action handler to add.removeActionHandler(ilog.views.appframe.event.ActionHandler)
public boolean removeActionHandler(ActionHandler actionHandler)
actionHandler
from the list of action
handlers managed by this view.true
if the action handler was previously added;
false
otherwise.addActionHandler(ilog.views.appframe.event.ActionHandler)
protected void registerMappings(IlvMessageMapper mapper)
mapper
- The message mapper to register mappings to.IlvMessageMapper.registerActionMethod(java.lang.String, java.lang.String)
,
IlvMessageMapper.registerActionStateMethod(java.lang.String, java.lang.String)
public void receiveMessage(MessageEvent event)
receiveMessage
in interface MessageListener
event
- The message event.MessageEvent
public boolean isProcessingAction(String command)
command
key in its
actionPerformed(java.awt.event.ActionEvent)
method.isProcessingAction
in interface ActionHandler
command
- The command key of the action.true
if the action listener performs the specified
action; false
otherwise.public boolean updateAction(Action action)
action
.updateAction
in interface ActionHandler
action
- The action to update.true
if the action handler has updated the state
of the action; false
otherwise.public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
e
- The action event.public Object setProperty(String key, Object value)
PropertyChangeEvent
will be sent to
property change listeners.setProperty
in interface IlvPropertyManager
key
- The non-null
property key.value
- An Object
value. If it is equal to
null
, the property with the specified key will be removed.getProperty(java.lang.String)
,
JComponent.putClientProperty(java.lang.Object, java.lang.Object)
public Object getProperty(String key)
getProperty
in interface IlvPropertyManager
key
- The non-null
property key.null
if the specified property was not found.setProperty(java.lang.String, java.lang.Object)
,
JComponent.getClientProperty(java.lang.Object)
public IlvSettings getSettings()
setSettings(ilog.views.appframe.settings.IlvSettings)
public void setSettings(IlvSettings settings)
settings
- The settings of the panel view.getSettings()
public String getSettingsName()
name
attribute of the
settings element that provides the settings for the associated object.
If no name has been specified using the method setSettingsName(java.lang.String)
,
null
will be returned.setSettingsName(java.lang.String)
,
getSettingsElement()
,
getSettingsQuery()
public void setSettingsName(String name)
name
- The new settings name.getSettingsName()
public String getSettingsType()
null
if no settings type
has been specified.getSettingsElement()
public void setSettingsQuery(IlvSettingsQuery query)
query
- The new settings query.getSettingsQuery()
public IlvSettingsQuery getSettingsQuery()
If a query has been specified with the method setSettingsQuery(ilog.views.appframe.settings.IlvSettingsQuery)
,
it will be returned. Otherwise, a query is built for selecting a settings
root element with the type returned by getSettingsType()
and the
value of the name
attribute equal to the name returned
by getSettingsName()
. If getSettingsName()
returns
null
, the query will select the first root element it finds
with the settings type given by the method getSettingsType()
.
setSettingsQuery(ilog.views.appframe.settings.IlvSettingsQuery)
,
getSettingsName()
,
getSettingsType()
public void setSettingsElement(IlvSettingsElement element)
getSettings()
with the query getSettingsQuery()
.element
- The settings element that provides the settings for the
panel view.getSettingsElement()
public IlvSettingsElement getSettingsElement()
setSettingsElement(ilog.views.appframe.settings.IlvSettingsElement)
method, it will be returned. Otherwise,
the settings element is selected from the settings given by the
getSettings()
method with the query returned by
getSettingsQuery()
.null
if no settings
element could be found.setSettingsElement(ilog.views.appframe.settings.IlvSettingsElement)
,
getSettingsQuery()
protected void readSettings(IlvSettingsElement settingsElement)
settingsElement
- The root settings element that contains the
settings for this panel view.protected void writeSettings(IlvSettingsElement settingsElement)
settingsElement
- The root settings element to write the settings to.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.