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.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected RenderableSpotprotected final FrameContextprotected final HtmlRendererContextprotected RenderableSpotprotected final UserAgentContextFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionHtmlBlockPanel(Color background, boolean opaque, UserAgentContext pcontext, HtmlRendererContext rcontext, FrameContext frameContext) Constructor for HtmlBlockPanel. -
Method Summary
Modifier and TypeMethodDescriptionaddComponent(Component component) addComponent.voidaddDelayedPair(DelayedPair pair) addDelayedPair.voidclearDelayedPairs.booleancopy()copy.voiddoLayout()voidfocus()focus.getDelayedPairs.intgetFirstLineHeight.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.intgetVisualHeight.intgetVisualWidth.booleanhasSelection.voidinvalidateLayoutUpTree.booleanisSelectionAvailable.voidlostOwnership(Clipboard arg0, Transferable arg1) voidprotected voidvoidrelayout()relayout.voidImplementation of UINode.repaint().protected voidrevalidatePanel.voidscrollBy(double xOffset, double yOffset) scrollBy.voidScrolls the body area to the given location.voidScrolls the body area to the node given, if it is part of the current document.voidsetDefaultOverflowX(int defaultOverflowX) Setter for the field defaultOverflowX.voidsetDefaultOverflowY(int defaultOverflowY) Setter for the field defaultOverflowY.voidsetRootNode(NodeImpl node) setRootNode.voidsetSelectionEnd(RenderableSpot rpoint) setSelectionEnd.voidsetSelectionStart(RenderableSpot rpoint) setSelectionStart.translateDescendentPoint(BoundableRenderable descendent, int x, int y) translateDescendentPoint.voidupdateAllWidgetBounds.protected voidvalidateAll.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, updateUIMethods 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, validateTreeMethods 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, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.loboevolution.html.renderer.RenderableContainer
getInnerHeight, getInnerWidth, getY, repaint
-
Field Details
-
defaultOverflowX
protected int defaultOverflowX -
defaultOverflowY
protected int defaultOverflowY -
endSelection
-
frameContext
-
rcontext
-
startSelection
-
ucontext
-
-
Constructor Details
-
HtmlBlockPanel
public HtmlBlockPanel(Color background, boolean opaque, UserAgentContext pcontext, HtmlRendererContext rcontext, FrameContext frameContext) Constructor for HtmlBlockPanel.
- Parameters:
background- aColorobject.opaque- a boolean.pcontext- aUserAgentContextobject.rcontext- aHtmlRendererContextobject.frameContext- aFrameContextobject.
-
-
Method Details
-
addComponent
addComponent.
- Specified by:
addComponentin interfaceRenderableContainer- Parameters:
component- aComponentobject.- Returns:
- a
Componentobject.
-
addDelayedPair
addDelayedPair.
- Specified by:
addDelayedPairin interfaceRenderableContainer- Parameters:
pair- aDelayedPairobject.
-
clearDelayedPairs
public void clearDelayedPairs()clearDelayedPairs.
- Specified by:
clearDelayedPairsin interfaceRenderableContainer
-
copy
public boolean copy()copy.
- Returns:
- a boolean.
-
doLayout
public void doLayout() -
focus
public void focus()focus.
- Specified by:
focusin interfaceRenderableContainer
-
getDelayedPairs
getDelayedPairs.
- Specified by:
getDelayedPairsin interfaceRenderableContainer- Returns:
- a
Listobject.
-
getFirstLineHeight
public int getFirstLineHeight()getFirstLineHeight.
- Returns:
- a
Integerobject.
-
getGUIPoint
getGUIPoint.
- Specified by:
getGUIPointin interfaceRenderableContainer- Parameters:
clientX- aIntegerobject.clientY- aIntegerobject.- Returns:
- a
Pointobject.
-
getPaintedBackgroundColor
getPaintedBackgroundColor.
- Specified by:
getPaintedBackgroundColorin interfaceRenderableContainer- Returns:
- a
Colorobject.
-
getParentContainer
getParentContainer.
- Specified by:
getParentContainerin interfaceRenderableContainer- Returns:
- a
RenderableContainerobject.
-
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 with. An arbitrary preferred size is returned in other scenarios.invalid reference
#setPreferredWidth(int)- Overrides:
getPreferredSizein classJComponent
-
getRootNode
getRootNode.
- Returns:
- a
NodeImplobject.
-
getRootRenderable
getRootRenderable.
- Returns:
- a
BoundableRenderableobject.
-
getSelectionNode
getSelectionNode.
- Returns:
- a
Nodeobject.
-
getSelectionText
getSelectionText.
- Returns:
- a
Stringobject.
-
hasSelection
public boolean hasSelection()hasSelection.
- Returns:
- a boolean.
-
invalidateLayoutUpTree
public void invalidateLayoutUpTree()invalidateLayoutUpTree.
- Specified by:
invalidateLayoutUpTreein interfaceRenderableContainer
-
isSelectionAvailable
public boolean isSelectionAvailable()isSelectionAvailable.
- Returns:
- a boolean.
-
lostOwnership
- Specified by:
lostOwnershipin interfaceClipboardOwner
-
paint
- Overrides:
paintin classJComponent
-
paintChildren
- Overrides:
paintChildrenin classJComponent
-
relayout
public void relayout()relayout.
- Specified by:
relayoutin interfaceRenderableContainer
-
repaint
Implementation of UINode.repaint().- Parameters:
modelNode- aModelNodeobject.
-
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- aIntegerobject.
-
setDefaultOverflowY
public void setDefaultOverflowY(int defaultOverflowY) Setter for the field defaultOverflowY.
- Parameters:
defaultOverflowY- aIntegerobject.
-
setRootNode
setRootNode.
Sets the root node to render. This method should be invoked in the GUI dispatch thread.- Specified by:
setRootNodein interfaceNodeRenderer- Parameters:
node- aNodeImplobject.
-
setSelectionEnd
setSelectionEnd.
- Parameters:
rpoint- aRenderableSpotobject.
-
setSelectionStart
setSelectionStart.
- Parameters:
rpoint- aRenderableSpotobject.
-
updateAllWidgetBounds
public void updateAllWidgetBounds()updateAllWidgetBounds.
- Specified by:
updateAllWidgetBoundsin interfaceRenderableContainer
-
getInsets
getInsets.
- Specified by:
getInsetsin interfaceRenderableContainer- Parameters:
hscroll- a boolean.vscroll- a boolean.- Returns:
- a
Insetsobject.
-
getInsetsMarginBorder
getInsetsMarginBorder.
- Specified by:
getInsetsMarginBorderin interfaceRenderableContainer- Parameters:
hscroll- a boolean.vscroll- a boolean.- Returns:
- a
Insetsobject.
-
getVisualHeight
public int getVisualHeight()getVisualHeight.
- Specified by:
getVisualHeightin interfaceRenderableContainer- Returns:
- a
Integerobject.
-
getVisualWidth
public int getVisualWidth()getVisualWidth.
- Specified by:
getVisualWidthin interfaceRenderableContainer- Returns:
- a
Integerobject.
-
getVisualBounds
getVisualBounds.
- Specified by:
getVisualBoundsin interfaceRenderableContainer- Returns:
- a
Rectangleobject.
-
translateDescendentPoint
translateDescendentPoint.
- Specified by:
translateDescendentPointin interfaceRenderableContainer- Parameters:
descendent- aBoundableRenderableobject.x- aIntegerobject.y- aIntegerobject.- Returns:
- a
Pointobject.
-
getOriginRelativeToAbs
getOriginRelativeToAbs.
- Specified by:
getOriginRelativeToAbsin interfaceRenderableContainer- Parameters:
bodyLayout- aRCollectionobject.- Returns:
- a
Pointobject.
-
validateAll
protected void validateAll()validateAll.
-