Class HtmlBlockPanel

All Implemented Interfaces:
ClipboardOwner, ImageObserver, MenuContainer, Serializable, NodeRenderer, RenderableContainer

public class HtmlBlockPanel extends JComponent implements NodeRenderer, RenderableContainer, ClipboardOwner
A Swing component that renders a HTML block, given by a DOM root or an internal element, typically a DIV. This component cannot render FRAMESETs. HtmlBlockPanel is used by HtmlPanel whenever the DOM is determined not to be a FRAMESET.
See Also:
  • Field Details

    • defaultOverflowX

      protected int defaultOverflowX
    • defaultOverflowY

      protected int defaultOverflowY
    • endSelection

      protected RenderableSpot endSelection
    • frameContext

      protected final FrameContext frameContext
    • rblock

      protected RBlock rblock
    • rcontext

      protected final HtmlRendererContext rcontext
    • startSelection

      protected RenderableSpot startSelection
    • ucontext

      protected final UserAgentContext ucontext
  • Constructor Details

  • Method Details

    • addComponent

      public Component addComponent(Component component)

      addComponent.

      Specified by:
      addComponent in interface RenderableContainer
      Parameters:
      component - a Component object.
      Returns:
      a Component object.
    • addDelayedPair

      public void addDelayedPair(DelayedPair pair)

      addDelayedPair.

      Specified by:
      addDelayedPair in interface RenderableContainer
      Parameters:
      pair - a DelayedPair object.
    • clearDelayedPairs

      public void clearDelayedPairs()

      clearDelayedPairs.

      Specified by:
      clearDelayedPairs in interface RenderableContainer
    • copy

      public boolean copy()

      copy.

      Returns:
      a boolean.
    • doLayout

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

      public void focus()

      focus.

      Specified by:
      focus in interface RenderableContainer
    • getDelayedPairs

      public List<DelayedPair> getDelayedPairs()

      getDelayedPairs.

      Specified by:
      getDelayedPairs in interface RenderableContainer
      Returns:
      a List object.
    • getFirstLineHeight

      public int getFirstLineHeight()

      getFirstLineHeight.

      Returns:
      a Integer object.
    • getGUIPoint

      public Point getGUIPoint(int clientX, int clientY)

      getGUIPoint.

      Specified by:
      getGUIPoint in interface RenderableContainer
      Parameters:
      clientX - a Integer object.
      clientY - a Integer object.
      Returns:
      a Point object.
    • getPaintedBackgroundColor

      public Color getPaintedBackgroundColor()

      getPaintedBackgroundColor.

      Specified by:
      getPaintedBackgroundColor in interface RenderableContainer
      Returns:
      a Color object.
    • getParentContainer

      public RenderableContainer getParentContainer()

      getParentContainer.

      Specified by:
      getParentContainer in interface RenderableContainer
      Returns:
      a RenderableContainer object.
    • getPreferredSize

      public Dimension getPreferredSize()
      If the preferred size has been set with JComponent.setPreferredSize(Dimension), then that size is returned. Otherwise a preferred size is calculated by rendering the HTML DOM, provided one is available and a preferred width other than -1 has been set with
      invalid reference
      #setPreferredWidth(int)
      . An arbitrary preferred size is returned in other scenarios.
      Overrides:
      getPreferredSize in class JComponent
    • getRootNode

      public NodeImpl getRootNode()

      getRootNode.

      Returns:
      a NodeImpl object.
    • getRootRenderable

      public BoundableRenderable getRootRenderable()

      getRootRenderable.

      Returns:
      a BoundableRenderable object.
    • getSelectionNode

      public Node getSelectionNode()

      getSelectionNode.

      Returns:
      a Node object.
    • getSelectionText

      public String getSelectionText()

      getSelectionText.

      Returns:
      a String object.
    • hasSelection

      public boolean hasSelection()

      hasSelection.

      Returns:
      a boolean.
    • invalidateLayoutUpTree

      public void invalidateLayoutUpTree()

      invalidateLayoutUpTree.

      Specified by:
      invalidateLayoutUpTree in interface RenderableContainer
    • isSelectionAvailable

      public boolean isSelectionAvailable()

      isSelectionAvailable.

      Returns:
      a boolean.
    • lostOwnership

      public void lostOwnership(Clipboard arg0, Transferable arg1)
      Specified by:
      lostOwnership in interface ClipboardOwner
    • paint

      public void paint(Graphics g)
      Overrides:
      paint in class JComponent
    • paintChildren

      protected void paintChildren(Graphics g)
      Overrides:
      paintChildren in class JComponent
    • relayout

      public void relayout()

      relayout.

      Specified by:
      relayout in interface RenderableContainer
    • repaint

      public void repaint(ModelNode modelNode)
      Implementation of UINode.repaint().
      Parameters:
      modelNode - a ModelNode object.
    • revalidatePanel

      protected void revalidatePanel()

      revalidatePanel.

    • scrollBy

      public void scrollBy(double xOffset, double yOffset)

      scrollBy.

      Parameters:
      xOffset - a Double object.
      yOffset - a Double object.
    • scrollTo

      public void scrollTo(Node node)
      Scrolls the body area to the node given, if it is part of the current document.

      This method should be called from the GUI thread.

      Parameters:
      node - A DOM node.
    • scrollTo

      public void scrollTo(Rectangle bounds, boolean xIfNeeded, boolean yIfNeeded)
      Scrolls the body area to the given location.

      This method should be called from the GUI thread.

      Parameters:
      bounds - The bounds in the scrollable block area that should become visible.
      xIfNeeded - If this parameter is true, scrolling will only occur if the requested bounds are not currently visible horizontally.
      yIfNeeded - If this parameter is true, scrolling will only occur if the requested bounds are not currently visible vertically.
    • setDefaultOverflowX

      public void setDefaultOverflowX(int defaultOverflowX)

      Setter for the field defaultOverflowX.

      Parameters:
      defaultOverflowX - a Integer object.
    • setDefaultOverflowY

      public void setDefaultOverflowY(int defaultOverflowY)

      Setter for the field defaultOverflowY.

      Parameters:
      defaultOverflowY - a Integer object.
    • setRootNode

      public void setRootNode(NodeImpl node)

      setRootNode.

      Sets the root node to render. This method should be invoked in the GUI dispatch thread.
      Specified by:
      setRootNode in interface NodeRenderer
      Parameters:
      node - a NodeImpl object.
    • setSelectionEnd

      public void setSelectionEnd(RenderableSpot rpoint)

      setSelectionEnd.

      Parameters:
      rpoint - a RenderableSpot object.
    • setSelectionStart

      public void setSelectionStart(RenderableSpot rpoint)

      setSelectionStart.

      Parameters:
      rpoint - a RenderableSpot object.
    • updateAllWidgetBounds

      public void updateAllWidgetBounds()

      updateAllWidgetBounds.

      Specified by:
      updateAllWidgetBounds in interface RenderableContainer
    • getInsets

      public Insets getInsets(boolean hscroll, boolean vscroll)

      getInsets.

      Specified by:
      getInsets in interface RenderableContainer
      Parameters:
      hscroll - a boolean.
      vscroll - a boolean.
      Returns:
      a Insets object.
    • getInsetsMarginBorder

      public Insets getInsetsMarginBorder(boolean hscroll, boolean vscroll)

      getInsetsMarginBorder.

      Specified by:
      getInsetsMarginBorder in interface RenderableContainer
      Parameters:
      hscroll - a boolean.
      vscroll - a boolean.
      Returns:
      a Insets object.
    • getVisualHeight

      public int getVisualHeight()

      getVisualHeight.

      Specified by:
      getVisualHeight in interface RenderableContainer
      Returns:
      a Integer object.
    • getVisualWidth

      public int getVisualWidth()

      getVisualWidth.

      Specified by:
      getVisualWidth in interface RenderableContainer
      Returns:
      a Integer object.
    • getVisualBounds

      public Rectangle getVisualBounds()

      getVisualBounds.

      Specified by:
      getVisualBounds in interface RenderableContainer
      Returns:
      a Rectangle object.
    • translateDescendentPoint

      public Point translateDescendentPoint(BoundableRenderable descendent, int x, int y)

      translateDescendentPoint.

      Specified by:
      translateDescendentPoint in interface RenderableContainer
      Parameters:
      descendent - a BoundableRenderable object.
      x - a Integer object.
      y - a Integer object.
      Returns:
      a Point object.
    • getOriginRelativeToAbs

      public Point getOriginRelativeToAbs(RCollection bodyLayout)

      getOriginRelativeToAbs.

      Specified by:
      getOriginRelativeToAbs in interface RenderableContainer
      Parameters:
      bodyLayout - a RCollection object.
      Returns:
      a Point object.
    • validateAll

      protected void validateAll()

      validateAll.