Class BaseContainer
- All Implemented Interfaces:
IContainer,HoverListener,ItemChangeListener,ImageObserver,MenuContainer,Serializable,EventListener
- Direct Known Subclasses:
MapContainer
A container holds a world-coordinate viewport and a z-stack of
Layers. Each layer holds a collection of AItems.
Layer architecture
This container defines three standard layers:- Connections (protected; drawn first / bottom)
- Content (default user layer; typical items go here)
- Annotations (protected; drawn last / top)
Important implementation note
Layer's constructor auto-registers the new layer with the container
via IContainer.addLayer(Layer). During this container's constructor,
the protected layer fields are not yet assigned when the first
addLayer calls occur.
Therefore, after constructing the layers we explicitly remove the protected
layers from _layers and re-add the default user layer if needed.
This guarantees that:
_layerscontains only user layers- protected layers are still drawn and hit-tested in their fixed positions
Visibility and locking
Container-wide operations that involve user interaction (hit testing, selection, deletion, enclosed selection) respect:Layer.isVisible()— invisible layers are ignored for hit testing and enclosureLayer.isLocked()— locked layers are treated as non-interactive and ignored
Tool handler extensibility
Subclasses that need a specialisedBaseToolHandler should override
createToolHandler() rather than overriding setToolBar(edu.cnu.mdi.graphics.toolbar.AToolBar).
This keeps the base class free of instanceof checks against specific
subclasses.
File drag-and-drop
Drop support is no longer installed here. It is managed centrally by
BaseView.enableFileDrop(), which attaches a single
FileDropHandler to the canvas component (this
object), the scroll-pane viewport (when present), and the view frame itself.
Subclasses of BaseView activate drop support with one call:
enableFileDrop(myFileFilter); // in the BaseView subclass constructor
- See Also:
-
Nested Class Summary
Nested 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.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IDrawableOptional drawable invoked after all z layers are drawn.protected LayerAnnotation layer (protected; always drawn last).protected IDrawableOptional drawable invoked before user layers are drawn.protected LayerConnection layer (protected; always drawn first).protected LayerDefault user content layer (drawn between connection and annotation layers).protected Rectangle2D.DoubleDefault/original world system.protected final FeedbackControlFeedback control for mouse-over feedback providers.protected FeedbackPaneOptional feedback (mouse-over) pane.The user-managed z-layers (does NOT include protected layers).protected Rectangle2D.DoublePrevious world system (used to undo last zoom).protected AToolBarOptional toolbar for this container.protected BaseViewThe view that holds this container (may be null for viewless container).protected Rectangle2D.DoubleWorld coordinate viewport.protected HoverInfoWindowLazily-created popup window used for hover messages.protected AffineTransformTransform local(screen) → world.protected BaseToolHandlerTool handler for this container.protected AffineTransformTransform world → local(screen).Fields 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 edu.cnu.mdi.container.IContainer
FIXED_ZOOM_FACTORFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionBaseContainer(Rectangle2D.Double worldSystem) Construct a container with the given initial world system. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a z layer for containing items rendered on this container..booleanCheck whether at least one item on any item list is selected.doubleGet the approximate zoom factor based on the current and default world systems.voidClip graphics context to container bounds.protected BaseToolHandlerFactory method that creates theBaseToolHandlerappropriate for this container.voidDelete all selected items, across all item lists.voidfeedbackTrigger(MouseEvent mouseEvent, boolean dragging) Convenience method to update the location string in the toolbar.Get all layers in draw order (bottom -> top), including protected layers.Get all layers in hit-test order (top -> bottom), including protected layers.Get the annotation layer for this container.Get the underlying JComponentGet the connection layer for this container.Get the default user content layer.getEnclosedItems(Rectangle rect) Obtain a collection of all enclosed items across all lists.Return the object that controls the container's feedback.Get the optional feedback pane.Lazily creates the hover popup window.getImage()Get the background image.getItemAtPoint(Point pp) Find an item, if any, at the point.getItemsAtPoint(Point lp) Find all items, if any, at the point.getLayerByName(String name) Gets an z layer by name.protected Point2D.DoubleConvert the mouse event location to a world point.Get all selected items, across all item lists.Get this container's tool bar interface.getView()Get the view (internal frame) that holds this container.Get the current world system.voidhoverDown(HoverEvent he) Called when a hover event ends.voidhoverUp(HoverEvent he) Called when a hover event starts.booleanisProtectedLayer(Layer layer) Determine whether a layer is one of the protected layers.voiditemChanged(Layer layer, AItem item, ItemChangeType type) Responds to item change events fired by layers owned by this container.voidlocalToWorld(Point pp, Point2D.Double wp) This converts a screen or pixel point to a world point.voidlocalToWorld(Polygon polygon, WorldPolygon worldPolygon) This converts a screen or local polygon to a world polygon.voidThis converts a screen or local rectangle to a world rectangle.protected voidonFilesDropped(List<File> files) Called when files are dropped onto this container's canvas.voidOverride paint command.voidpan(int dh, int dv) Pan the container.voidReleases hover resources held by this container.voidBegin preparations for a zoom.voidRecenter the container at the point of a click.voidrefresh()Refresh the container.voidresetWorldSystem(Rectangle2D.Double worldSystem) Reset the world system to a new value.voidRestore the default world.voidThis is called when we have completed a rubber banding.voidscale(double scaleFactor) Convenience routine to scale the container.voidselectAllItems(boolean select) Select or deselect all items, across all item lists.protected voidCompute transforms for world to local and local to world conversion.voidsetAfterDraw(IDrawable afterDraw) Set the after-draw drawable for this container.voidsetBeforeDraw(IDrawable beforeDraw) Set the before-draw drawable.voidsetDirty(boolean dirty) Convenience method for setting the dirty flag for all items on all item lists.voidsetFeedbackPane(FeedbackPane feedbackPane) Sets the feedback pane.voidsetToolBar(AToolBar toolBar) Set this container's tool bar.voidCheck and set the toolbar state (e.g., button enable/disable)voidAssociate this container with its hosting view.voidSet the world system (does not cause redraw)voidshareModel(BaseContainer sContainer) Share the model with another container (used for magnification windows).voidUndo that last zoom.voidupdateStatusText(Point pp, Point2D.Double wp) Update the toolbar status text with the current mouse location.voidworldToLocal(Point pp, double wx, double wy) This converts a world point to a screen or pixel point.voidworldToLocal(Point pp, Point2D.Double wp) This converts a world point to a screen or pixel point.voidworldToLocal(Polygon polygon, WorldPolygon worldPolygon) This converts a world polygon to a screen or pixel polygon.voidThis converts a world rectangle to a screen or pixel rectangle.voidzoom(double xmin, double xmax, double ymin, double ymax) Zooms to the specified area.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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUIMethods inherited from class java.awt.Container
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, 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, transferFocusUpCycle
-
Field Details
-
_layers
The user-managed z-layers (does NOT include protected layers).Ordering convention: index 0 is back (drawn earlier), last index is front.
-
_toolBar
Optional toolbar for this container. -
_feedbackPane
Optional feedback (mouse-over) pane. -
_afterDraw
Optional drawable invoked after all z layers are drawn. -
_beforeDraw
Optional drawable invoked before user layers are drawn. -
_view
The view that holds this container (may be null for viewless container). -
_worldSystem
World coordinate viewport. -
_defaultWorldSystem
Default/original world system. -
_previousWorldSystem
Previous world system (used to undo last zoom). -
hoverWindow
Lazily-created popup window used for hover messages. -
_defaultLayer
Default user content layer (drawn between connection and annotation layers). Most developer-created items go here by default. -
_annotationLayer
Annotation layer (protected; always drawn last). -
_connectionLayer
Connection layer (protected; always drawn first). -
_feedbackControl
Feedback control for mouse-over feedback providers. -
localToWorld
Transform local(screen) → world. -
worldToLocal
Transform world → local(screen). -
toolHandler
Tool handler for this container.
-
-
Constructor Details
-
BaseContainer
Construct a container with the given initial world system.- Parameters:
worldSystem- the default world coordinate viewport; must not benull
-
-
Method Details
-
setView
Associate this container with its hosting view.File drag-and-drop wiring is not done here; it is the responsibility of the view itself via
Set the container's view.BaseView.enableFileDrop(java.util.function.Predicate). This keeps all drop-surface management in one place and avoids the container needing to know about the transfer layer.- Specified by:
setViewin interfaceIContainer- Parameters:
view- the view to set.
-
getDefaultLayer
Get the default user content layer.- Specified by:
getDefaultLayerin interfaceIContainer- Returns:
- the default user content layer (never null after construction)
-
isProtectedLayer
Determine whether a layer is one of the protected layers.- Parameters:
layer- layer to test- Returns:
- true if layer is the connection or annotation layer
-
getAllLayers
Get all layers in draw order (bottom -> top), including protected layers.Order:
- Connections
- User layers
- Annotations
- Returns:
- immutable snapshot list in draw order (never null)
-
getAllLayersForHitTesting
Get all layers in hit-test order (top -> bottom), including protected layers.Order:
- Annotations
- User layers (top -> bottom)
- Connections
- Returns:
- immutable snapshot list in hit-test order (never null)
-
clipBounds
Clip graphics context to container bounds.- Parameters:
g- graphics context
-
approximateZoomFactor
public double approximateZoomFactor()Get the approximate zoom factor based on the current and default world systems.- Specified by:
approximateZoomFactorin interfaceIContainer- Returns:
- the approximate zoom factor. Numbers greater than 1 mean zoomed in; less than 1 mean zoomed out.
-
paintComponent
Override paint command. Draw all layers.Rendering order:
- background
- connection layer
- before-draw
- user layers
- after-draw
- annotation layer
- Overrides:
paintComponentin classJComponent- Parameters:
g- graphics context
-
addLayer
Add a z layer for containing items rendered on this container..- Specified by:
addLayerin interfaceIContainer- Parameters:
layer- the layer to add.
-
getAnnotationLayer
Get the annotation layer for this container.- Specified by:
getAnnotationLayerin interfaceIContainer- Returns:
- the annotation layer for this container. All drawing tools draw on the annotation layer, which is kept on top.
-
getConnectionLayer
Get the connection layer for this container.- Specified by:
getConnectionLayerin interfaceIContainer- Returns:
- the connection layer for this container. Connection items are drawn on first, i.e. connections are under other items.
-
getLayerByName
Gets an z layer by name. Do not use for the annotation layer or connection layer-- for that use getAnnotationLayer() or getConnectionLayer().- Specified by:
getLayerByNamein interfaceIContainer- Parameters:
name- the name of the layer.- Returns:
- the z layer, or
null.
-
localToWorld
This converts a screen or pixel point to a world point.- Specified by:
localToWorldin interfaceIContainer- Parameters:
pp- contains the local (screen-pixel) point.wp- will hold the resultant world point.
-
worldToLocal
This converts a world point to a screen or pixel point.- Specified by:
worldToLocalin interfaceIContainer- Parameters:
pp- will hold the resultant local (screen-pixel) point.wp- contains world point.
-
worldToLocal
This converts a world rectangle to a screen or pixel rectangle.- Specified by:
worldToLocalin interfaceIContainer- Parameters:
r- will hold the resultant local (screen-pixel) rectangle.wr- contains the world rectangle.
-
localToWorld
This converts a screen or local rectangle to a world rectangle.- Specified by:
localToWorldin interfaceIContainer- Parameters:
r- contains the local (screen-pixel) rectangle.wr- will hold the resultant world rectangle.
-
worldToLocal
This converts a world point to a screen or pixel point.- Specified by:
worldToLocalin interfaceIContainer- Parameters:
pp- will hold the resultant local (screen-pixel) point.wx- the world x coordinate.wy- the world y coordinate.
-
pan
public void pan(int dh, int dv) Pan the container.- Specified by:
panin interfaceIContainer- Parameters:
dh- the horizontal step in pixels.dv- the vertical step in pixels.
-
recenter
Recenter the container at the point of a click.- Specified by:
recenterin interfaceIContainer- Parameters:
pp- the point in question. It will be the new center.
-
prepareToZoom
public void prepareToZoom()Begin preparations for a zoom.- Specified by:
prepareToZoomin interfaceIContainer
-
restoreDefaultWorld
public void restoreDefaultWorld()Restore the default world. This gets us back to the original zoom level.- Specified by:
restoreDefaultWorldin interfaceIContainer
-
resetWorldSystem
Reset the world system to a new value. Resets the default and previous world systems as well.- Specified by:
resetWorldSystemin interfaceIContainer- Parameters:
worldSystem- the new world system.
-
refresh
public void refresh()Refresh the container.- Specified by:
refreshin interfaceIContainer
-
scale
public void scale(double scaleFactor) Convenience routine to scale the container.- Specified by:
scalein interfaceIContainer- Parameters:
scaleFactor- the scale factor.
-
undoLastZoom
public void undoLastZoom()Undo that last zoom.- Specified by:
undoLastZoomin interfaceIContainer
-
rubberBanded
This is called when we have completed a rubber banding. pane.- Specified by:
rubberBandedin interfaceIContainer- Parameters:
b- The rubber band bounds.
-
setDirty
public void setDirty(boolean dirty) Convenience method for setting the dirty flag for all items on all item lists.- Specified by:
setDirtyin interfaceIContainer- Parameters:
dirty- the new value of the dirty flag.
-
getItemAtPoint
Find an item, if any, at the point.Includes protected layers and respects visibility/locking.
- Specified by:
getItemAtPointin interfaceIContainer- Parameters:
pp- The pixel point in question.- Returns:
- the topmost satisfying item, or null.
-
getEnclosedItems
Obtain a collection of all enclosed items across all lists.Includes protected layers and respects visibility/locking.
- Specified by:
getEnclosedItemsin interfaceIContainer- Parameters:
rect- the rectangle in question.- Returns:
- all items on all item lists enclosed by the rectangle.
-
getItemsAtPoint
Find all items, if any, at the point.Includes protected layers and returns items in top -> bottom order.
- Specified by:
getItemsAtPointin interfaceIContainer- Parameters:
lp- the pixel point in question.- Returns:
- all items across all item lists that contain the given point. It may
be an empty vector, but it won't be
null.
-
anySelectedItems
public boolean anySelectedItems()Check whether at least one item on any item list is selected.Includes protected layers. Does not require visibility, so selections on hidden layers still count (if your tools allow that state).
- Specified by:
anySelectedItemsin interfaceIContainer- Returns:
trueif at least one item on any item list is selected.
-
deleteSelectedItems
public void deleteSelectedItems()Delete all selected items, across all item lists.Includes protected layers and respects visibility/locking.
- Specified by:
deleteSelectedItemsin interfaceIContainer
-
getSelectedItems
Get all selected items, across all item lists.Includes protected layers, and does not consider layer locking: even a locked layer's currently-selected, visible items are returned (locking only prevents new selection/hit-testing, not reporting of items that are already selected). Delegates to
Layer.getSelectedItems().- Specified by:
getSelectedItemsin interfaceIContainer- Returns:
- a list of all currently selected items; never
null
-
selectAllItems
public void selectAllItems(boolean select) Select or deselect all items, across all item lists.Includes protected layers and respects locking.
- Specified by:
selectAllItemsin interfaceIContainer- Parameters:
select- the selection flag.
-
zoom
public void zoom(double xmin, double xmax, double ymin, double ymax) Zooms to the specified area.- Specified by:
zoomin interfaceIContainer- Parameters:
xmin- minimum x coordinate.xmax- maximum x coordinate.ymin- minimum y coordinate.ymax- maximum y coordinate.
-
getToolBar
Get this container's tool bar interface.- Specified by:
getToolBarin interfaceIContainer- Returns:
- this container's tool bar, or
null.
-
setToolBar
Set this container's tool bar.Installs the toolbar and creates the tool handler via
createToolHandler(), which subclasses may override to supply a different handler without requiring aninstanceofbranch here.- Specified by:
setToolBarin interfaceIContainer- Parameters:
toolBar- the new toolbar interface.
-
createToolHandler
Factory method that creates theBaseToolHandlerappropriate for this container.The default implementation returns a plain
BaseToolHandler. Subclasses that require specialised tool behaviour (e.g.MapContainer) should override this method to return their own handler rather than relying on aninstanceofcheck insetToolBar(edu.cnu.mdi.graphics.toolbar.AToolBar).- Returns:
- a new tool handler bound to this container; never
null
-
setToolBarState
public void setToolBarState()Check and set the toolbar state (e.g., button enable/disable) -
getLocation
Convert the mouse event location to a world point.- Parameters:
me- mouse event- Returns:
- world location, or null
-
updateStatusText
Update the toolbar status text with the current mouse location.- Specified by:
updateStatusTextin interfaceIContainer- Parameters:
pp- the current mouse location in local (screen) coordinateswp- the current mouse location in world coordinates
-
feedbackTrigger
Convenience method to update the location string in the toolbar.Updates the toolbar status text (if present) and feedback control (if present) with the current mouse location in both local and world coordinates.
- Specified by:
feedbackTriggerin interfaceIContainer- Parameters:
mouseEvent- the causal event.dragging-trueif we are dragging
-
getView
Get the view (internal frame) that holds this container.- Specified by:
getViewin interfaceIContainer- Returns:
- the view (internal frame) that holds this container.
-
onFilesDropped
Called when files are dropped onto this container's canvas.The default implementation logs each dropped filename and then delegates to
BaseView.filesDropped(List)if a view is attached. Subclasses may override this to handle files differently before or instead of passing them to the view.- Parameters:
files- the validated files that were dropped; nevernull
-
itemChanged
Responds to item change events fired by layers owned by this container.The base implementation:
- Updates the toolbar state (e.g. enables/disables the delete button) when an item is selected or deselected.
- Marks the affected item dirty on any change, triggering a repaint
on the next
refresh()call.
MOVEDorDELETED.- Specified by:
itemChangedin interfaceItemChangeListener- Parameters:
layer- the layer containing the changed itemitem- the affected item; may benullfor layer-level eventstype- the type of change
-
setFeedbackPane
Sets the feedback pane. This is an optional alternative to a HUD.- Specified by:
setFeedbackPanein interfaceIContainer- Parameters:
feedbackPane- the feedback pane.
-
getFeedbackPane
Get the optional feedback pane.- Specified by:
getFeedbackPanein interfaceIContainer- Returns:
- the feedbackPane
-
getFeedbackControl
Return the object that controls the container's feedback. You can and and remove feedback providers using this object.- Specified by:
getFeedbackControlin interfaceIContainer- Returns:
- the object that controls the container's feedback.
-
getComponent
Get the underlying JComponent- Specified by:
getComponentin interfaceIContainer- Returns:
- the underlying component
-
setAfterDraw
Set the after-draw drawable for this container.- Specified by:
setAfterDrawin interfaceIContainer- Parameters:
afterDraw- the new after-draw drawable.
-
getAfterDraw
- Returns:
- after-draw drawable (may be null)
-
setBeforeDraw
Set the before-draw drawable.- Specified by:
setBeforeDrawin interfaceIContainer- Parameters:
beforeDraw- the new before-draw drawable.
-
getBeforeDraw
- Returns:
- before-draw drawable (may be null)
-
getWorldSystem
Get the current world system.Note: implementations may return the live, mutable rectangle backing the container's viewport, not a defensive copy (unlike
IContainer.setWorldSystem(java.awt.geom.Rectangle2D.Double)andresetWorldSystem, which both copy). Mutating the returned rectangle directly can silently change the container's viewport without going throughsetDirty/refresh. Callers that need to keep a stable snapshot should copy it themselves.- Specified by:
getWorldSystemin interfaceIContainer- Returns:
- the world system; may be the container's live instance
-
setWorldSystem
Set the world system (does not cause redraw)- Specified by:
setWorldSystemin interfaceIContainer- Parameters:
wr- the new world system
-
setAffineTransforms
protected void setAffineTransforms()Compute transforms for world to local and local to world conversion. -
localToWorld
This converts a screen or local polygon to a world polygon.- Specified by:
localToWorldin interfaceIContainer- Parameters:
polygon- contains the local (screen-pixel) polygon.worldPolygon- will hold the resultant world polygon.
-
worldToLocal
This converts a world polygon to a screen or pixel polygon.- Specified by:
worldToLocalin interfaceIContainer- Parameters:
polygon- will hold the resultant local (screen-pixel) polygon.worldPolygon- contains the world polygon.
-
getImage
Get the background image.- Specified by:
getImagein interfaceIContainer- Returns:
- the fully painted background image.
-
prepareForExit
public void prepareForExit()Releases hover resources held by this container.- Specified by:
prepareForExitin interfaceIContainer
-
getHoverWindow
Lazily creates the hover popup window.- Specified by:
getHoverWindowin interfaceIContainer- Returns:
- the hover popup, or
nullif the component is not yet realized
-
hoverUp
Description copied from interface:HoverListenerCalled when a hover event starts. Implementations can use the provided HoverEvent to access the source component and hover location.- Specified by:
hoverUpin interfaceHoverListener- Parameters:
he- the HoverEvent containing details about the hover action
-
hoverDown
Description copied from interface:HoverListenerCalled when a hover event ends. Implementations can perform cleanup or state updates as needed when the hover is no longer active.- Specified by:
hoverDownin interfaceHoverListener- Parameters:
he- the HoverEvent containing details about the hover action that is ending
-