Class XTCEViewerContainerDrawing

    • 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:
        getPreferredSize in class JComponent
        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:
        paintComponent in class JComponent
        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.