Class View
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,EventListener,Dockable,DockingConstants,DockingListener,DockingMonitor
View class is slightly incompatible with JComponent.
Similar to JFC/Swing top-level containers, a View contains only a
content pane Container and a Titlebar. The content pane
should contain all the components displayed by the View. As a
convenience add and its variants, remove(Component) and
setLayout have been overridden to forward to the
contentPane as necessary. This means you can write:
view.add(child);And the child will be added to the contentPane. The content pane will always be non-null. Attempting to set it to null will cause the View to throw an exception. The default content pane will not have a layout manager set.
- Author:
- Christopher Butler, Karl Schaefer
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategyNested classes/interfaces inherited from interface org.flexdock.docking.event.DockingListener
DockingListener.Stub -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected Containerprotected booleanprotected ArrayListprotected ArrayListprotected HashSetprotected Titlebarstatic final StringFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface org.flexdock.docking.Dockable
DOCKABLE_INDICATORFields inherited from interface org.flexdock.docking.DockingConstants
ACTIVE_WINDOW, BOTTOM, CENTER, CENTER_REGION, CLOSE_ACTION, DEFAULT_PERSISTENCE_KEY, DOCKING_ID, EAST_REGION, HEAVYWEIGHT_DOCKABLES, HORIZONTAL, LEFT, MOUSE_PRESSED, NORTH_REGION, PERMANENT_FOCUS_OWNER, PIN_ACTION, REGION, RIGHT, SOUTH_REGION, TOP, UNINITIALIZED, UNINITIALIZED_RATIO, UNKNOWN_REGION, UNSPECIFIED_SIBLING_PREF, VERTICAL, WEST_REGIONFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidaddDockingListener(DockingListener listener) protected voidprotected Containerprotected LayoutManagerprotected TitlebarbooleanImplements the semantics for docking an externalDockableto thisDockableand returns abooleanindicating whether or not the docking operation was successful.booleanImplements the semantics for docking an externalDockableto the specified region of thisDockableand returns abooleanindicating whether or not the docking operation was successful.booleanImplements the semantics for docking an externalDockableto the specified region of thisDockablewith the specified layout ratio, returning abooleanindicating whether or not the docking operation was successful.voidFired when docking of aDockableis canceled during the operation.voidFired when docking of aDockablehas completed.voiddragStarted(DockingEvent evt) Fired when the dragging of aDockablehas begun.voiddropStarted(DockingEvent evt) Fired when the dropping of aDockablehas begun at the release of a drag-operation.getActionButton(String actionName) Returns the Component that is to be dragged and docked.Returns the DockingPort within which this Dockable is currently docked.Returns aDockablePropertySetinstance associated with thisDockable.Returns aListof theComponentsthat are event sources for drag operations.Returns aSetof theComponentsthat are used as frame drag sources.static ViewgetInstance(String viewId) intReturns aStringidentifier that is unique within a JVM instance, but persistent across JVM instances.protected StringgetSibling(String region) getTitle()protected ComponentbooleanisActionBlocked(String actionName) booleanisActive()booleanprotected booleanbooleanbooleanbooleanisTerritoryBlocked(Dockable dockable, String region) protected StringvoidvoidvoidremoveDockingListener(DockingListener listener) voidsetActionBlocked(String actionName, boolean blocked) voidsetActive(boolean b) voidsetActiveStateLocked(boolean b) voidSets the content pane for this view.protected voidsetContentPaneCheckingEnabled(boolean contentPaneCheckingEnabled) voidvoidvoidsetLayout(LayoutManager manager) Sets theLayoutManager.voidsetTabIcon(Icon icon) voidsetTabText(String tabText) voidsetTerritoryBlocked(String region, boolean blocked) voidvoidvoidsetTitlebar(Titlebar titlebar) voidvoidvoidupdateUI()Methods inherited from class javax.swing.JComponent
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, getUI, 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, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
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, getAccessibleContext, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.flexdock.docking.Dockable
addPropertyChangeListener, getClientProperty, putClientProperty, removePropertyChangeListener
-
Field Details
-
uiClassID
- See Also:
-
ACTION_TOGGLE_NEXT
- See Also:
-
ACTION_TOGGLE_PREVIOUS
- See Also:
-
titlepane
-
contentPane
-
contentPaneCheckingEnabled
protected boolean contentPaneCheckingEnabled -
dockingListeners
-
dragSources
-
frameDragSources
-
-
Constructor Details
-
View
-
View
-
View
-
-
Method Details
-
getInstance
-
createContentPane
-
createLayout
-
createTitlebar
-
getContentPane
-
getTitlebar
-
getDockingProperties
Description copied from interface:DockableReturns aDockablePropertySetinstance associated with thisDockable. Developers implementing theDockableinterface may or may not choose to provide their ownDockablePropertySetimplementation for use with this method. A default implementation is supplied by the framework and mostDockableimplementations, including all implementations provided by the framework, will return the defaultDockablePropertySetvia a call toorg.flexdock.docking.props.PropertyManager. Developers are encouraged to take advantage of this by callingPropertyManager.getDockablePropertySet(this).- Specified by:
getDockingPropertiesin interfaceDockable- Returns:
- the
DockablePropertySetassociated with thisDockableThis method may not return anullreference. - See Also:
-
getViewProperties
-
addAction
-
addAction
-
removeActions
public void removeActions() -
setIcon
-
setIcon
-
setContentPane
Sets the content pane for this view.- Parameters:
c- the container to use as the content pane.- Throws:
IllegalArgumentException- ifcisnullor ifcis thetitlepane.- See Also:
-
getPreferredTitlebarUIName
-
setTitlebar
-
getTitlePane
-
setTitle
-
setTitle
-
getTitle
-
updateUI
public void updateUI()- Overrides:
updateUIin classJComponent
-
getUIClassID
- Overrides:
getUIClassIDin classJComponent
-
addImpl
-
remove
-
getActionButton
-
getComponent
Description copied from interface:DockableReturns the Component that is to be dragged and docked. This may or may not be included in the list returned bygetDragSources().The framework performs indexing on the underlying
Component. Consequently, this method may not return anullreference.- Specified by:
getComponentin interfaceDockable- Returns:
- the component wrapped by this dockable.
-
getDragSources
Description copied from interface:DockableReturns aListof theComponentsthat are event sources for drag operations. The list may or may not include the Component returned bygetComponent().- Specified by:
getDragSourcesin interfaceDockable- Returns:
- a list containing the components that may be used to drag this dockable.
-
getFrameDragSources
Description copied from interface:DockableReturns aSetof theComponentsthat are used as frame drag sources. When aDockableis floated into an external frame, that frame may or may not have a titlebar for repositioning. The Components returned by this method will be setup with appropriate event listeners such that dragging them will serve to reposition the containing frame as if they were the frame titlebar. If a Component exists in both the Set returned by this method and the List returned bygetDragSources(), the "frame reposition" behavior will supercede any "drag-to-dock" behavior while the Dockable is in a floating state.- Specified by:
getFrameDragSourcesin interfaceDockable- Returns:
- a set containing the components that may be used to drag the frame this dockable resides in, if the dockable is floating.
-
getPersistentId
Description copied from interface:DockableReturns aStringidentifier that is unique within a JVM instance, but persistent across JVM instances. This is used for configuration mangement, allowing the JVM to recognize aDockableinstance within an application instance, persist the ID, and recall it in later application instances. The ID should be unique within an appliation instance so that there are no collisions with otherDockableinstances, but it should also be consistent from JVM to JVM so that the association between aDockableinstance and its ID can be remembered from session to session.The framework performs indexing on the persistent ID. Consequently, this method may not return a
nullreference.- Specified by:
getPersistentIdin interfaceDockable- Returns:
- the persistence id for this dockable. This id ensures that only one copy of a given dockable will exist.
-
isTerritoryBlocked
-
setTerritoryBlocked
-
getTabText
-
setTabText
-
getTabIcon
-
setTabIcon
-
dock
Description copied from interface:DockableImplements the semantics for docking an externalDockableto thisDockableand returns abooleanindicating whether or not the docking operation was successful.The framework already provides a default implementation for this method through
DockingManager.dock(Dockable dockable, Dockable parent). While users are free to provide their own implementation for this method, the recommended approach is to use the default implementation with the following line:return DockingManager.dock(dockable, this); -
getDockingPort
Description copied from interface:DockableReturns the DockingPort within which this Dockable is currently docked. If not currently docked, this method will return null.- Specified by:
getDockingPortin interfaceDockable- Returns:
- the docking port this dockable resides in, or
nullif the dockable is not currently docked (i.e. in the middle of a drag operation).
-
getSibling
-
getViewport
-
dock
Description copied from interface:DockableImplements the semantics for docking an externalDockableto the specified region of thisDockableand returns abooleanindicating whether or not the docking operation was successful. If the docking operation results in a split layout, this method should determine an appropriate ratio of available space to allot to the new siblingDockable.The framework already provides a default implementation for this method through
DockingManager.dock(Dockable dockable, Dockable parent, String region). While users are free to provide their own implementation for this method, the recommended approach is to use the default implementation with the following line:return DockingManager.dock(dockable, this, relativeRegion); -
dock
Description copied from interface:DockableImplements the semantics for docking an externalDockableto the specified region of thisDockablewith the specified layout ratio, returning abooleanindicating whether or not the docking operation was successful. If the docking operation results in a split layout, this method should use the specifiedratioto determine the amount of available space to allot to the new siblingDockable.The framework already provides a default implementation for this method through
DockingManager.dock(Dockable dockable, Dockable parent, String region, float proportion). While users are free to provide their own implementation for this method, the recommended approach is to use the default implementation with the following line:return DockingManager.dock(dockable, this, relativeRegion, ratio);- Specified by:
dockin interfaceDockable- Parameters:
dockable- theDockableto dock relative to thisDockablerelativeRegion- the docking region into which to dock the specifiedDockableratio- the proportion of available space in the resulting layout to allot to the new siblingDockable.- Returns:
trueif the docking operation was successful;falseotherwise.- See Also:
-
setActive
public void setActive(boolean b) -
isActive
public boolean isActive() -
setActiveStateLocked
public void setActiveStateLocked(boolean b) -
isActiveStateLocked
public boolean isActiveStateLocked() -
isMinimized
public boolean isMinimized() -
getMinimizedConstraint
public int getMinimizedConstraint() -
addDockingListener
- Specified by:
addDockingListenerin interfaceDockingMonitor
-
getDockingListeners
- Specified by:
getDockingListenersin interfaceDockingMonitor
-
removeDockingListener
- Specified by:
removeDockingListenerin interfaceDockingMonitor
-
dockingCanceled
Description copied from interface:DockingListenerFired when docking of aDockableis canceled during the operation.- Specified by:
dockingCanceledin interfaceDockingListener- Parameters:
evt- theDockingEventevent which provides the source Dockable, the old DockingPort and the new DockingPort
-
dockingComplete
Description copied from interface:DockingListenerFired when docking of aDockablehas completed.- Specified by:
dockingCompletein interfaceDockingListener- Parameters:
evt- theDockingEventevent which provides the source Dockable, the old DockingPort and the new DockingPort
-
dragStarted
Description copied from interface:DockingListenerFired when the dragging of aDockablehas begun.- Specified by:
dragStartedin interfaceDockingListener- Parameters:
evt- theDockingEventevent which provides the source Dockable, the old DockingPort and the new DockingPort
-
dropStarted
Description copied from interface:DockingListenerFired when the dropping of aDockablehas begun at the release of a drag-operation.- Specified by:
dropStartedin interfaceDockingListener- Parameters:
evt- theDockingEventevent which provides the source Dockable, the old DockingPort and the new DockingPort
-
undockingComplete
- Specified by:
undockingCompletein interfaceDockingListener
-
undockingStarted
- Specified by:
undockingStartedin interfaceDockingListener
-
setActionBlocked
-
isActionBlocked
-
isFloating
public boolean isFloating() -
paramString
- Overrides:
paramStringin classJComponent
-
isContentPaneCheckingEnabled
protected boolean isContentPaneCheckingEnabled()- Returns:
- the contentPaneCheckingEnabled
-
setContentPaneCheckingEnabled
protected void setContentPaneCheckingEnabled(boolean contentPaneCheckingEnabled) - Parameters:
contentPaneCheckingEnabled- the contentPaneCheckingEnabled to set
-
setLayout
Sets theLayoutManager. Overridden to conditionally forward the call to thecontentPane.
-