Package org.xtce.apps.editor.ui
Class XTCEViewerContainerDrawing
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.xtce.apps.editor.ui.XTCEViewerContainerDrawing
-
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible
public class XTCEViewerContainerDrawing extends JPanel
The Container/Telecommand drawing class that serves as a JPanel, which extends JComponent in Java Swing.- Author:
- David Overeem
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXTCEViewerContainerDrawing.OrientationEnumeration to describe the orientation of the container/telecommand drawing.-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
-
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_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XTCEViewerContainerDrawingdeepCopy()Function to copy this XTCEViewerContainerDrawing to another one so that it can be used in another JScrollPane.DimensiongetPreferredSize()Method to report the needed size of the drawing, which is often requested during painting operations of the JScrollPane that contains this custom drawing component.voidpaintComponent(Graphics ggg)Method to draw the container/telecommand contents picture onto the Java Swing supplied Graphics object when requested by the event dispatch thread, which occurs quite often as it checks for updates.voidreOrient(XTCEViewerContainerDrawing.Orientation newOrientation)Method to change the orientation flag to a new setting, either LEFT_TO_RIGHT or TOP_TO_BOTTOM and sets the drawing flag to cause a redraw at the next opportunity.voidsave(File fileName)Method to save the drawing to an image file on the filesystem.-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
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, 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, 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
-
Methods 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, validateTree
-
Methods 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, 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
-
-
-
-
Method Detail
-
getPreferredSize
public Dimension getPreferredSize()
Method to report the needed size of the drawing, which is often requested during painting operations of the JScrollPane that contains this custom drawing component.- Overrides:
getPreferredSizein classJComponent- Returns:
- Dimension object containing the calculated dimensions needed to see the entire drawing.
-
paintComponent
public void paintComponent(Graphics ggg)
Method to draw the container/telecommand contents picture onto the Java Swing supplied Graphics object when requested by the event dispatch thread, which occurs quite often as it checks for updates. This function contains a short circuit to prevent drawing this very frequently. The flag is set to false when doing a re-orientation of the picture using the reOrient() method. Other methods can also potentially cause a change to the drawing assumptions and should implement something similar to reOrient(). After calling such a function, the graphical interface caller should then call repaint(), which is provided by the Java Swing interface on this class through inheritance. This will have the new drawing ready on the next screen update.- Overrides:
paintComponentin classJComponent- Parameters:
ggg- Graphics object to use to make the drawing, which must be supplied by Java Swing for screen drawings, but it also suppled in this case when the image is being written to a file using a BufferedImage object instead of the Swing display.
-
reOrient
public void reOrient(XTCEViewerContainerDrawing.Orientation newOrientation)
Method to change the orientation flag to a new setting, either LEFT_TO_RIGHT or TOP_TO_BOTTOM and sets the drawing flag to cause a redraw at the next opportunity. After browsing this class, the reader might wonder why there is not a corresponding set of methods for the alias preferences. Since changes to those also need to repaint the table on the graphical user interface, it instead generated a new version of this object.- Parameters:
newOrientation- Orientation enumerations, which is local to this class, and can be either LEFT_TO_RIGHT or TOP_TO_BOTTOM.
-
save
public void save(File fileName) throws XTCEDatabaseException
Method to save the drawing to an image file on the filesystem. This method supports several file formats. In includes those that are supported by the Java ImageIO class.- Parameters:
fileName- File containing the name and path to store the output image to. It must contain the file extension for the image type or this function will throw with an error.- Throws:
XTCEDatabaseException- thrown in the event that the image could not be written. The target file and the cause will be reported.
-
deepCopy
public XTCEViewerContainerDrawing deepCopy()
Function to copy this XTCEViewerContainerDrawing to another one so that it can be used in another JScrollPane. Without the cloning, the JScrollPane Viewport on the new display will "take over" the object and it will disappear from the main display window. To say that this is a deep copy is not really true, but good enough for the purposes of this class in the graphical user interface.- Returns:
- XTCEViewerContainerDrawing copied from this one. Note that the big references, like the content model, are still references to the original data.
-
-