Class RootPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, FSCanvas, UserInterface, RepaintListener
Direct Known Subclasses:
BasicPanel

public class RootPanel extends JPanel implements Scrollable, UserInterface, FSCanvas, RepaintListener
See Also:
  • Field Details

    • rootBox

      private @Nullable Box rootBox
    • needRelayout

      private boolean needRelayout
    • cellRendererPane

      private @Nullable CellRendererPane cellRendererPane
    • documentListeners

      private final Set<DocumentListener> documentListeners
    • defaultFontFromComponent

      private boolean defaultFontFromComponent
    • sharedContext

      private final SharedContext sharedContext
    • layoutContext

      private volatile @Nullable LayoutContext layoutContext
    • enclosingScrollPane

      private @Nullable JScrollPane enclosingScrollPane
    • viewportMatchWidth

      private boolean viewportMatchWidth
    • default_scroll_mode

      private int default_scroll_mode
    • doc

      protected @Nullable Document doc
    • hovered_element

      @Nullable Element hovered_element
    • active_element

      @Nullable Element active_element
    • focus_element

      @Nullable Element focus_element
    • lastRepaintRunAt

      private long lastRepaintRunAt
    • maxRepaintRequestWaitMs

      private final long maxRepaintRequestWaitMs
      See Also:
    • repaintRequestPending

      private boolean repaintRequestPending
    • pendingRepaintCount

      private long pendingRepaintCount
  • Constructor Details

  • Method Details

    • getSharedContext

      public SharedContext getSharedContext()
    • getLayoutContext

      @CheckReturnValue public @Nullable LayoutContext getLayoutContext()
    • setDocument

      public void setDocument(Document doc, @Nullable String url, NamespaceHandler nsh)
    • resetScrollPosition

      public void resetScrollPosition()
    • setEnclosingScrollPane

      protected void setEnclosingScrollPane(@Nullable JScrollPane scrollPane)
      The method is invoked by addNotify() and removeNotify() to ensure that any enclosing JScrollPane works correctly with this panel. This method can be safely invoked with a null scrollPane.
      Parameters:
      scrollPane - the enclosing JScrollPane or null if the panel is no longer enclosed in a JScrollPane.
    • getEnclosingScrollPane

      protected @Nullable JScrollPane getEnclosingScrollPane()
    • getFixedRectangle

      public Rectangle getFixedRectangle()
      Gets the fixedRectangle attribute of the BasicPanel object
      Specified by:
      getFixedRectangle in interface FSCanvas
      Returns:
      The fixedRectangle value
    • addNotify

      public void addNotify()
      Overrides the default implementation to test for and configure any JScrollPane parent.
      Overrides:
      addNotify in class JComponent
    • removeNotify

      public void removeNotify()
      Overrides the default implementation un-configure any JScrollPane parent.
      Overrides:
      removeNotify in class JComponent
    • init

      protected final void init()
    • newRenderingContext

      public RenderingContext newRenderingContext(Graphics2D g)
    • newLayoutContext

      protected LayoutContext newLayoutContext(Graphics2D g)
    • getInitialExtents

      private Rectangle getInitialExtents(LayoutContext c)
    • getScreenExtents

      public Rectangle getScreenExtents()
    • doDocumentLayout

      public void doDocumentLayout(@Nullable Graphics g)
    • initFontFromComponent

      private void initFontFromComponent(BlockBox root)
    • addDocumentListener

      public void addDocumentListener(DocumentListener listener)
      Adds the specified Document listener to receive Document events from this component. If listener l is null, no exception is thrown and no action is performed.
      Parameters:
      listener - Contains the DocumentListener for DocumentEvent data.
    • removeDocumentListener

      public void removeDocumentListener(DocumentListener listener)
      Removes the specified Document listener from receive Document events from this component. If listener l is null, no exception is thrown and no action is performed.
      Parameters:
      listener - Contains the DocumentListener to remove.
    • hasDocumentListeners

      protected boolean hasDocumentListeners()
    • fireDocumentStarted

      protected void fireDocumentStarted()
    • fireDocumentLoaded

      protected void fireDocumentLoaded()
    • fireOnLayoutException

      protected void fireOnLayoutException(Throwable t)
    • fireOnRenderException

      protected void fireOnRenderException(Throwable t)
    • getCellRendererPane

      public CellRendererPane getCellRendererPane()
      Returns:
      a CellRendererPane suitable for drawing components in (with CellRendererPane.paintComponent)
    • isHover

      public boolean isHover(Element e)
      Description copied from interface: UserInterface
      Gets the hover attribute of the UserInterface object
      Specified by:
      isHover in interface UserInterface
      Parameters:
      e - PARAM
      Returns:
      The hover value
    • isActive

      public boolean isActive(Element e)
      Description copied from interface: UserInterface
      Gets the active attribute of the UserInterface object
      Specified by:
      isActive in interface UserInterface
      Parameters:
      e - PARAM
      Returns:
      The active value
    • isFocus

      public boolean isFocus(Element e)
      Description copied from interface: UserInterface
      Gets the focus attribute of the UserInterface object
      Specified by:
      isFocus in interface UserInterface
      Parameters:
      e - PARAM
      Returns:
      The focus value
    • relayout

      protected void relayout()
      Lays out the current document again, and re-renders.
    • getLayoutWidth

      public double getLayoutWidth()
    • isPrintView

      public boolean isPrintView()
    • getRootBox

      public @Nullable Box getRootBox()
    • setRootBox

      public void setRootBox(@Nullable Box rootBox)
    • getRootLayer

      public @Nullable Layer getRootLayer()
    • find

      public Box find(MouseEvent e)
    • find

      public @Nullable Box find(int x, int y)
    • doLayout

      public void doLayout()
      Overrides:
      doLayout in class Container
    • validate

      public void validate()
      Overrides:
      validate in class Container
    • isExtentsHaveChanged

      protected boolean isExtentsHaveChanged()
    • isNeedRelayout

      protected boolean isNeedRelayout()
    • setNeedRelayout

      protected void setNeedRelayout(boolean needRelayout)
    • repaintRequested

      public void repaintRequested(boolean doLayout)
      Specified by:
      repaintRequested in interface RepaintListener
    • isDefaultFontFromComponent

      public boolean isDefaultFontFromComponent()
    • setDefaultFontFromComponent

      public void setDefaultFontFromComponent(boolean defaultFontFromComponent)
    • getPreferredScrollableViewportSize

      public Dimension getPreferredScrollableViewportSize()
      Specified by:
      getPreferredScrollableViewportSize in interface Scrollable
    • getScrollableUnitIncrement

      public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
      Specified by:
      getScrollableUnitIncrement in interface Scrollable
    • getScrollableBlockIncrement

      public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
      Specified by:
      getScrollableBlockIncrement in interface Scrollable
    • getScrollableTracksViewportWidth

      public boolean getScrollableTracksViewportWidth()
      Specified by:
      getScrollableTracksViewportWidth in interface Scrollable
    • getScrollableTracksViewportHeight

      public boolean getScrollableTracksViewportHeight()
      Specified by:
      getScrollableTracksViewportHeight in interface Scrollable