Package org.xhtmlrenderer.swing
Class BasicPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.xhtmlrenderer.swing.RootPanel
-
- org.xhtmlrenderer.swing.BasicPanel
-
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,Scrollable,FSCanvas,UserInterface,FormSubmissionListener,RepaintListener
- Direct Known Subclasses:
XHTMLPanel
@ParametersAreNonnullByDefault public abstract class BasicPanel extends RootPanel implements FormSubmissionListener
A SwingJPanelthat encloses the Flying Saucer renderer for easy integration into Swing applications.- Author:
- Joshua Marinacci
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
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
Fields Modifier and Type Field Description protected FormSubmissionListenerformSubmissionListener-
Fields inherited from class org.xhtmlrenderer.swing.RootPanel
active_element, doc, focus_element, hovered_element, sharedContext
-
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
Constructors Modifier Constructor Description protectedBasicPanel()protectedBasicPanel(UserAgentCallback uac)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMouseTrackingListener(FSMouseListener l)voidassignPagePrintPositions(Graphics2D g)protected voiddoRender(RenderingContext c, Layer root)DocumentgetDocument()StringgetDocumentTitle()Returns the title as reported by the NamespaceHandler assigned to the SharedContext in this panel.List<FSMouseListener>getMouseTrackingListeners()URLgetURL()booleanisCenteredPagedView()booleanisInteractive()booleanisOpaque()Returns whether the background of thisBasicPanelwill be painted when it is rendered.protected DocumentloadDocument(String uri)voidpaintComponent(Graphics g)voidpaintPage(Graphics2D g, int pageNo)voidprintTree()voidreloadDocument(String URI)Reloads the document using the same base URL and namespace handler.voidreloadDocument(Document doc)Reloads the document using the same base URL and namespace handler.voidremoveMouseTrackingListener(FSMouseListener l)protected voidresetMouseTracker()voidscrollTo(Point pt)Scroll the panel to make the specified point be on screen.voidsetCenteredPagedView(boolean centeredPagedView)protected voidsetDocument(InputStream stream, String url)voidsetDocument(InputStream stream, String url, NamespaceHandler nsh)voidsetDocument(String url)voidsetDocument(String url, NamespaceHandler nsh)voidsetDocument(Document doc, String url)voidsetDocumentFromString(String content, String url, NamespaceHandler nsh)protected voidsetDocumentRelative(String filename)Sets the new current document, where the new document is located relative, e.g.voidsetFormSubmissionListener(FormSubmissionListener fsl)voidsetInteractive(boolean interactive)voidsetLayout(LayoutManager l)Sets the layout attribute of the BasicPanel object Overrides the method to do nothing, since you shouldn't have a LayoutManager on an FS panel.voidsetOpaque(boolean opaque)Specifies whether the background of thisBasicPanelwill be painted when it is rendered.voidsetSharedContext(SharedContext ctx)voidsetSize(Dimension d)voidsubmit(String url)Called by XhtmlForm when a form is submitted.-
Methods inherited from class org.xhtmlrenderer.swing.RootPanel
addDocumentListener, addNotify, doDocumentLayout, doLayout, find, find, fireDocumentLoaded, fireDocumentStarted, fireOnLayoutException, fireOnRenderException, getCellRendererPane, getEnclosingScrollPane, getFixedRectangle, getLayoutContext, getLayoutWidth, getPreferredScrollableViewportSize, getRootBox, getRootLayer, getScreenExtents, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSharedContext, hasDocumentListeners, init, isActive, isDefaultFontFromComponent, isExtentsHaveChanged, isFocus, isHover, isNeedRelayout, isPrintView, newLayoutContext, newRenderingContext, relayout, removeDocumentListener, removeNotify, repaintRequested, resetScrollPosition, setDefaultFontFromComponent, setDocument, setEnclosingScrollPane, setNeedRelayout, setRootBox, validate
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, 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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
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, transferFocusDownCycle, 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, 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, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
formSubmissionListener
protected FormSubmissionListener formSubmissionListener
-
-
Constructor Detail
-
BasicPanel
protected BasicPanel()
-
BasicPanel
protected BasicPanel(UserAgentCallback uac)
-
-
Method Detail
-
paintComponent
public void paintComponent(Graphics g)
- Overrides:
paintComponentin classJComponent
-
doRender
protected void doRender(RenderingContext c, Layer root)
-
paintPage
public void paintPage(Graphics2D g, int pageNo)
-
assignPagePrintPositions
public void assignPagePrintPositions(Graphics2D g)
-
printTree
public void printTree()
-
setLayout
public void setLayout(LayoutManager l)
Sets the layout attribute of the BasicPanel object Overrides the method to do nothing, since you shouldn't have a LayoutManager on an FS panel.
-
setSharedContext
public void setSharedContext(SharedContext ctx)
-
setDocument
public void setDocument(InputStream stream, String url, NamespaceHandler nsh)
-
setDocumentFromString
public void setDocumentFromString(String content, @Nullable String url, NamespaceHandler nsh)
-
setDocument
public void setDocument(String url)
-
setDocument
public void setDocument(String url, NamespaceHandler nsh)
-
setDocument
protected void setDocument(InputStream stream, String url)
-
setDocumentRelative
protected void setDocumentRelative(String filename)
Sets the new current document, where the new document is located relative, e.g. using a relative URL.- Parameters:
filename- The new document to load
-
reloadDocument
public void reloadDocument(String URI)
Reloads the document using the same base URL and namespace handler. Reloading will pick up changes to styles within the document.- Parameters:
URI- A URI for the Document to load, for example, file.toURL().toExternalForm().
-
reloadDocument
public void reloadDocument(Document doc)
Reloads the document using the same base URL and namespace handler. Reloading will pick up changes to styles within the document.- Parameters:
doc- The document to reload.
-
getURL
public URL getURL()
-
getDocument
public Document getDocument()
-
getDocumentTitle
public String getDocumentTitle()
Returns the title as reported by the NamespaceHandler assigned to the SharedContext in this panel. For an HTML document, this will be the contents of /html/head/title.- Returns:
- the document title, or "" if the namespace handler cannot find a title, or if there is no current document in the panel.
-
isOpaque
public boolean isOpaque()
Returns whether the background of thisBasicPanelwill be painted when it is rendered.- Overrides:
isOpaquein classJComponent- Returns:
trueif the background of thisBasicPanelwill be painted,falseif it will not.
-
setOpaque
public void setOpaque(boolean opaque)
Specifies whether the background of thisBasicPanelwill be painted when it is rendered.- Overrides:
setOpaquein classJComponent- Parameters:
opaque-trueif the background of thisBasicPanelshould be painted,falseif it should not.
-
scrollTo
public void scrollTo(Point pt)
Scroll the panel to make the specified point be on screen. Typically, this will scroll the screen down to the y component of the point.
-
isInteractive
public boolean isInteractive()
-
setInteractive
public void setInteractive(boolean interactive)
-
addMouseTrackingListener
public void addMouseTrackingListener(FSMouseListener l)
-
removeMouseTrackingListener
public void removeMouseTrackingListener(FSMouseListener l)
-
getMouseTrackingListeners
public List<FSMouseListener> getMouseTrackingListeners()
-
resetMouseTracker
protected void resetMouseTracker()
-
isCenteredPagedView
public boolean isCenteredPagedView()
-
setCenteredPagedView
public void setCenteredPagedView(boolean centeredPagedView)
-
submit
public void submit(String url)
Description copied from interface:FormSubmissionListenerCalled by XhtmlForm when a form is submitted.- Specified by:
submitin interfaceFormSubmissionListener- Parameters:
url- the entire query string as composed of form elements and the form's action URL
-
setFormSubmissionListener
public void setFormSubmissionListener(FormSubmissionListener fsl)
-
-