Package org.loboevolution.gui
Class HtmlBlockPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.loboevolution.gui.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:
-
Nested Class Summary
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
Modifier and TypeFieldDescriptionprotected int
protected int
protected RenderableSpot
protected final FrameContext
protected RBlock
protected final HtmlRendererContext
protected RenderableSpot
protected final UserAgentContext
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
-
Constructor Summary
ConstructorDescriptionHtmlBlockPanel
(Color background, boolean opaque, UserAgentContext pcontext, HtmlRendererContext rcontext, FrameContext frameContext) Constructor for HtmlBlockPanel. -
Method Summary
Modifier and TypeMethodDescriptionaddComponent
(Component component) addComponent.void
addDelayedPair
(DelayedPair pair) addDelayedPair.void
clearDelayedPairs.boolean
copy()
copy.void
doLayout()
void
focus()
focus.getDelayedPairs.int
getFirstLineHeight.getGUIPoint
(int clientX, int clientY) getGUIPoint.getInsets
(boolean hscroll, boolean vscroll) getInsets.getInsetsMarginBorder
(boolean hscroll, boolean vscroll) getInsetsMarginBorder.getOriginRelativeToAbs
(RCollection bodyLayout) getOriginRelativeToAbs.getPaintedBackgroundColor.getParentContainer.If the preferred size has been set withJComponent.setPreferredSize(Dimension)
, then that size is returned.getRootNode.getRootRenderable.getSelectionNode.getSelectionText.getVisualBounds.int
getVisualHeight.int
getVisualWidth.boolean
hasSelection.void
invalidateLayoutUpTree.boolean
isSelectionAvailable.void
lostOwnership
(Clipboard arg0, Transferable arg1) void
protected void
void
relayout()
relayout.void
Implementation of UINode.repaint().protected void
revalidatePanel.void
scrollBy
(double xOffset, double yOffset) scrollBy.void
Scrolls the body area to the given location.void
Scrolls the body area to the node given, if it is part of the current document.void
setDefaultOverflowX
(int defaultOverflowX) Setter for the field defaultOverflowX.void
setDefaultOverflowY
(int defaultOverflowY) Setter for the field defaultOverflowY.void
setRootNode
(NodeImpl node) setRootNode.void
setSelectionEnd
(RenderableSpot rpoint) setSelectionEnd.void
setSelectionStart
(RenderableSpot rpoint) setSelectionStart.translateDescendentPoint
(BoundableRenderable descendent, int x, int y) translateDescendentPoint.void
updateAllWidgetBounds.protected void
validateAll.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, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, getAccessibleContext, 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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.loboevolution.html.renderer.RenderableContainer
getInnerHeight, getInnerWidth, getY, repaint
-
Field Details
-
defaultOverflowX
protected int defaultOverflowX -
defaultOverflowY
protected int defaultOverflowY -
endSelection
-
frameContext
-
rblock
-
rcontext
-
startSelection
-
ucontext
-
-
Constructor Details
-
HtmlBlockPanel
public HtmlBlockPanel(Color background, boolean opaque, UserAgentContext pcontext, HtmlRendererContext rcontext, FrameContext frameContext) Constructor for HtmlBlockPanel.
- Parameters:
background
- aColor
object.opaque
- a boolean.pcontext
- aUserAgentContext
object.rcontext
- aHtmlRendererContext
object.frameContext
- aFrameContext
object.
-
-
Method Details
-
addComponent
addComponent.
- Specified by:
addComponent
in interfaceRenderableContainer
- Parameters:
component
- aComponent
object.- Returns:
- a
Component
object.
-
addDelayedPair
addDelayedPair.
- Specified by:
addDelayedPair
in interfaceRenderableContainer
- Parameters:
pair
- aDelayedPair
object.
-
clearDelayedPairs
public void clearDelayedPairs()clearDelayedPairs.
- Specified by:
clearDelayedPairs
in interfaceRenderableContainer
-
copy
public boolean copy()copy.
- Returns:
- a boolean.
-
doLayout
public void doLayout() -
focus
public void focus()focus.
- Specified by:
focus
in interfaceRenderableContainer
-
getDelayedPairs
getDelayedPairs.
- Specified by:
getDelayedPairs
in interfaceRenderableContainer
- Returns:
- a
List
object.
-
getFirstLineHeight
public int getFirstLineHeight()getFirstLineHeight.
- Returns:
- a
Integer
object.
-
getGUIPoint
getGUIPoint.
- Specified by:
getGUIPoint
in interfaceRenderableContainer
- Parameters:
clientX
- aInteger
object.clientY
- aInteger
object.- Returns:
- a
Point
object.
-
getPaintedBackgroundColor
getPaintedBackgroundColor.
- Specified by:
getPaintedBackgroundColor
in interfaceRenderableContainer
- Returns:
- a
Color
object.
-
getParentContainer
getParentContainer.
- Specified by:
getParentContainer
in interfaceRenderableContainer
- Returns:
- a
RenderableContainer
object.
-
getPreferredSize
If the preferred size has been set withJComponent.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 withinvalid reference
#setPreferredWidth(int)
- Overrides:
getPreferredSize
in classJComponent
-
getRootNode
getRootNode.
- Returns:
- a
NodeImpl
object.
-
getRootRenderable
getRootRenderable.
- Returns:
- a
BoundableRenderable
object.
-
getSelectionNode
getSelectionNode.
- Returns:
- a
Node
object.
-
getSelectionText
getSelectionText.
- Returns:
- a
String
object.
-
hasSelection
public boolean hasSelection()hasSelection.
- Returns:
- a boolean.
-
invalidateLayoutUpTree
public void invalidateLayoutUpTree()invalidateLayoutUpTree.
- Specified by:
invalidateLayoutUpTree
in interfaceRenderableContainer
-
isSelectionAvailable
public boolean isSelectionAvailable()isSelectionAvailable.
- Returns:
- a boolean.
-
lostOwnership
- Specified by:
lostOwnership
in interfaceClipboardOwner
-
paint
- Overrides:
paint
in classJComponent
-
paintChildren
- Overrides:
paintChildren
in classJComponent
-
relayout
public void relayout()relayout.
- Specified by:
relayout
in interfaceRenderableContainer
-
repaint
Implementation of UINode.repaint().- Parameters:
modelNode
- aModelNode
object.
-
revalidatePanel
protected void revalidatePanel()revalidatePanel.
-
scrollBy
public void scrollBy(double xOffset, double yOffset) scrollBy.
-
scrollTo
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
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
- aInteger
object.
-
setDefaultOverflowY
public void setDefaultOverflowY(int defaultOverflowY) Setter for the field defaultOverflowY.
- Parameters:
defaultOverflowY
- aInteger
object.
-
setRootNode
setRootNode.
Sets the root node to render. This method should be invoked in the GUI dispatch thread.- Specified by:
setRootNode
in interfaceNodeRenderer
- Parameters:
node
- aNodeImpl
object.
-
setSelectionEnd
setSelectionEnd.
- Parameters:
rpoint
- aRenderableSpot
object.
-
setSelectionStart
setSelectionStart.
- Parameters:
rpoint
- aRenderableSpot
object.
-
updateAllWidgetBounds
public void updateAllWidgetBounds()updateAllWidgetBounds.
- Specified by:
updateAllWidgetBounds
in interfaceRenderableContainer
-
getInsets
getInsets.
- Specified by:
getInsets
in interfaceRenderableContainer
- Parameters:
hscroll
- a boolean.vscroll
- a boolean.- Returns:
- a
Insets
object.
-
getInsetsMarginBorder
getInsetsMarginBorder.
- Specified by:
getInsetsMarginBorder
in interfaceRenderableContainer
- Parameters:
hscroll
- a boolean.vscroll
- a boolean.- Returns:
- a
Insets
object.
-
getVisualHeight
public int getVisualHeight()getVisualHeight.
- Specified by:
getVisualHeight
in interfaceRenderableContainer
- Returns:
- a
Integer
object.
-
getVisualWidth
public int getVisualWidth()getVisualWidth.
- Specified by:
getVisualWidth
in interfaceRenderableContainer
- Returns:
- a
Integer
object.
-
getVisualBounds
getVisualBounds.
- Specified by:
getVisualBounds
in interfaceRenderableContainer
- Returns:
- a
Rectangle
object.
-
translateDescendentPoint
translateDescendentPoint.
- Specified by:
translateDescendentPoint
in interfaceRenderableContainer
- Parameters:
descendent
- aBoundableRenderable
object.x
- aInteger
object.y
- aInteger
object.- Returns:
- a
Point
object.
-
getOriginRelativeToAbs
getOriginRelativeToAbs.
- Specified by:
getOriginRelativeToAbs
in interfaceRenderableContainer
- Parameters:
bodyLayout
- aRCollection
object.- Returns:
- a
Point
object.
-
validateAll
protected void validateAll()validateAll.
-