Class HTMLGridPanel

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DOWN
      the DOWN directions for moving/zooming.
      protected java.awt.geom.Rectangle2D extent
      the extent of this panel.
      protected java.text.NumberFormat formatter
      the formatter to use.
      protected static java.awt.Color GRIDCOLOR
      gridColor.
      protected double gridSize
      the gridSize in world Units.
      protected java.awt.geom.Rectangle2D homeExtent
      the extent of this panel.
      protected HTMLGraphics2D htmlGraphics2D
      the HTMLGraphics2D 'shadow' canvas.
      protected java.awt.Dimension lastDimension
      the last computed Dimension.
      static int LEFT
      the LEFT directions for moving/zooming.
      protected java.awt.Dimension preferredSize
      the last computed Dimension.
      static int RIGHT
      the RIGHT directions for moving/zooming.
      protected boolean showGrid
      show the grid.
      protected boolean showToolTip
      whether to show a tooltip with the coordinates or not.
      protected java.awt.Dimension size
      the last computed Dimension.
      static int UP
      the UP directions for moving/zooming.
      protected java.awt.geom.Point2D worldCoordinate
      the last known world coordinate of the mouse.
      static double ZOOMFACTOR
      the ZOOM factor.
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor Description
      HTMLGridPanel​(java.awt.geom.Rectangle2D extent)
      constructs a new GridPanel.
      HTMLGridPanel​(java.awt.geom.Rectangle2D extent, java.awt.Dimension size)
      constructs a new GridPanel.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void displayWorldCoordinateToolTip()
      Display a tooltip with the last known world coordinates of the mouse, in case the tooltip should be displayed.
      protected void drawGrid​(java.awt.Graphics g)
      Added to make sure the recursive render-call calls THIS render method instead of a potential super-class defined 'paintComponent' render method.
      java.awt.Color getBackground()  
      java.lang.String getDrawingCommands()
      Return the set of drawing commands.
      java.awt.geom.Rectangle2D getExtent()
      returns the extent of this panel.
      java.awt.Font getFont()  
      java.awt.FontMetrics getFontMetrics​(java.awt.Font font)  
      int getHeight()  
      java.awt.Dimension getPreferredSize()  
      java.awt.Dimension getSize()  
      java.lang.String getToolTipText()  
      int getWidth()  
      java.awt.geom.Point2D getWorldCoordinate()  
      void home()
      resets the panel to its original extent.
      boolean imageUpdate​(java.awt.Image img, int infoflags, int x, int y, int width, int height)
      boolean isDirty()  
      boolean isShowGrid()  
      boolean isShowing()  
      boolean isShowToolTip()  
      void paintComponent​(HTMLGraphics2D g)
      Draw the grid.
      void pan​(int direction, double percentage)
      pans the panel in a specified direction.
      void repaint()
      Repaint the shadow canvas.
      void setBackground​(java.awt.Color background)  
      void setFont​(java.awt.Font font)  
      void setPreferredSize​(java.awt.Dimension preferredSize)  
      void setShowGrid​(boolean showGrid)  
      void setShowing​(boolean showing)  
      void setShowToolTip​(boolean showToolTip)  
      void setSize​(java.awt.Dimension size)  
      void setToolTipText​(java.lang.String toolTipText)  
      void setWorldCoordinate​(java.awt.geom.Point2D point)
      Set the world coordinates based on a mouse move.
      void showGrid​(boolean bool)
      show the grid?
      void zoom​(double factor)
      zooms in/out.
      void zoom​(double factor, int mouseX, int mouseY)
      zooms in/out.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DOWN

        public static final int DOWN
        the DOWN directions for moving/zooming.
        See Also:
        Constant Field Values
      • LEFT

        public static final int LEFT
        the LEFT directions for moving/zooming.
        See Also:
        Constant Field Values
      • RIGHT

        public static final int RIGHT
        the RIGHT directions for moving/zooming.
        See Also:
        Constant Field Values
      • GRIDCOLOR

        protected static final java.awt.Color GRIDCOLOR
        gridColor.
      • extent

        protected java.awt.geom.Rectangle2D extent
        the extent of this panel.
      • homeExtent

        protected java.awt.geom.Rectangle2D homeExtent
        the extent of this panel.
      • showGrid

        protected boolean showGrid
        show the grid.
      • gridSize

        protected double gridSize
        the gridSize in world Units.
      • formatter

        protected java.text.NumberFormat formatter
        the formatter to use.
      • lastDimension

        protected java.awt.Dimension lastDimension
        the last computed Dimension.
      • size

        protected java.awt.Dimension size
        the last computed Dimension.
      • preferredSize

        protected java.awt.Dimension preferredSize
        the last computed Dimension.
      • worldCoordinate

        protected java.awt.geom.Point2D worldCoordinate
        the last known world coordinate of the mouse.
      • showToolTip

        protected boolean showToolTip
        whether to show a tooltip with the coordinates or not.
      • htmlGraphics2D

        protected HTMLGraphics2D htmlGraphics2D
        the HTMLGraphics2D 'shadow' canvas.
    • Constructor Detail

      • HTMLGridPanel

        public HTMLGridPanel​(java.awt.geom.Rectangle2D extent)
        constructs a new GridPanel.
        Parameters:
        extent - Rectangle2D; the extent to show.
      • HTMLGridPanel

        public HTMLGridPanel​(java.awt.geom.Rectangle2D extent,
                             java.awt.Dimension size)
        constructs a new GridPanel.
        Parameters:
        extent - Rectangle2D; the initial extent.
        size - Dimension; the size of the panel in pixels.
    • Method Detail

      • getDrawingCommands

        public java.lang.String getDrawingCommands()
        Return the set of drawing commands.
        Returns:
        the set of drawing commands
      • paintComponent

        public void paintComponent​(HTMLGraphics2D g)
        Draw the grid.
        Parameters:
        g - HTMLGraphics2D; the virtual Graphics2D canvas to enable writing to the browser
      • showGrid

        public final void showGrid​(boolean bool)
        show the grid?
        Parameters:
        bool - boolean; true/false
      • getExtent

        public final java.awt.geom.Rectangle2D getExtent()
        returns the extent of this panel.
        Returns:
        Rectangle2D
      • setWorldCoordinate

        public final void setWorldCoordinate​(java.awt.geom.Point2D point)
        Set the world coordinates based on a mouse move.
        Parameters:
        point - Point2D; the x,y world coordinates
      • getWorldCoordinate

        public final java.awt.geom.Point2D getWorldCoordinate()
        Returns:
        worldCoordinate
      • displayWorldCoordinateToolTip

        public final void displayWorldCoordinateToolTip()
        Display a tooltip with the last known world coordinates of the mouse, in case the tooltip should be displayed.
      • isShowToolTip

        public final boolean isShowToolTip()
        Returns:
        showToolTip
      • setShowToolTip

        public final void setShowToolTip​(boolean showToolTip)
        Parameters:
        showToolTip - boolean; set showToolTip
      • pan

        public final void pan​(int direction,
                              double percentage)
        pans the panel in a specified direction.
        Parameters:
        direction - int; the direction
        percentage - double; the percentage
      • home

        public final void home()
        resets the panel to its original extent.
      • isShowGrid

        public final boolean isShowGrid()
        Returns:
        Returns the showGrid.
      • setShowGrid

        public final void setShowGrid​(boolean showGrid)
        Parameters:
        showGrid - boolean; The showGrid to set.
      • zoom

        public final void zoom​(double factor)
        zooms in/out.
        Parameters:
        factor - double; The zoom factor
      • zoom

        public final void zoom​(double factor,
                               int mouseX,
                               int mouseY)
        zooms in/out.
        Parameters:
        factor - double; The zoom factor
        mouseX - int; x-position of the mouse around which we zoom
        mouseY - int; y-position of the mouse around which we zoom
      • drawGrid

        protected void drawGrid​(java.awt.Graphics g)
        Added to make sure the recursive render-call calls THIS render method instead of a potential super-class defined 'paintComponent' render method.
        Parameters:
        g - Graphics; the graphics object
      • repaint

        public void repaint()
        Repaint the shadow canvas.
      • getSize

        public final java.awt.Dimension getSize()
        Returns:
        size
      • setSize

        public final void setSize​(java.awt.Dimension size)
        Parameters:
        size - Dimension; set size
      • getBackground

        public final java.awt.Color getBackground()
        Returns:
        background
      • setBackground

        public final void setBackground​(java.awt.Color background)
        Parameters:
        background - Color; set background
      • getWidth

        public final int getWidth()
        Returns:
        width
      • getHeight

        public final int getHeight()
        Returns:
        height
      • getPreferredSize

        public final java.awt.Dimension getPreferredSize()
        Returns:
        preferredSize
      • setPreferredSize

        public final void setPreferredSize​(java.awt.Dimension preferredSize)
        Parameters:
        preferredSize - Dimension; set preferredSize
      • getToolTipText

        public final java.lang.String getToolTipText()
        Returns:
        toolTipText
      • setToolTipText

        public final void setToolTipText​(java.lang.String toolTipText)
        Parameters:
        toolTipText - String; set toolTipText
      • isShowing

        public final boolean isShowing()
        Returns:
        showing
      • setShowing

        public final void setShowing​(boolean showing)
        Parameters:
        showing - boolean; set showing
      • getFont

        public final java.awt.Font getFont()
        Returns:
        font
      • setFont

        public final void setFont​(java.awt.Font font)
        Parameters:
        font - Font; set font
      • getFontMetrics

        public final java.awt.FontMetrics getFontMetrics​(java.awt.Font font)
        Parameters:
        font - Font; the font to calculate the fontmetrics for
        Returns:
        fontMetrics
      • isDirty

        public final boolean isDirty()
        Returns:
        dirty
      • imageUpdate

        public boolean imageUpdate​(java.awt.Image img,
                                   int infoflags,
                                   int x,
                                   int y,
                                   int width,
                                   int height)
        Specified by:
        imageUpdate in interface java.awt.image.ImageObserver