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:
ComponentListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,UserInterface
,FormSubmissionListener
- Direct Known Subclasses:
XHTMLPanel
A Swing
JPanel
that encloses the Flying Saucer renderer
for easy integration into Swing applications.- Author:
- Joshua Marinacci
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
Field Summary
Fields inherited from class org.xhtmlrenderer.swing.RootPanel
active_element, focus_element, hovered_element
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDocumentListener
(DocumentListener listener) Adds the specified Document listener to receive Document events from this component.void
void
Returns the title as reported by the NamespaceHandler assigned to the SharedContext in this panel.Gets the fixedRectangle attribute of the BasicPanel objectgetURL()
boolean
Gets the active attribute of the UserInterface objectboolean
boolean
Gets the focus attribute of the UserInterface objectboolean
Gets the hover attribute of the UserInterface objectboolean
boolean
isOpaque()
Returns whether the background of thisBasicPanel
will be painted when it is rendered.void
void
paintPage
(Graphics2D g, int pageNo) void
void
reloadDocument
(String URI) Reloads the document using the same base URL and namespace handler.void
reloadDocument
(Document doc) Reloads the document using the same base URL and namespace handler.void
removeDocumentListener
(DocumentListener listener) Removes the specified Document listener from receive Document events from this component.void
void
Scroll the panel to make the specified point be on screen.void
setCenteredPagedView
(boolean centeredPagedView) void
setDocument
(InputStream stream, String url, NamespaceHandler nsh) void
setDocument
(String url) void
setDocument
(String url, NamespaceHandler nsh) void
setDocument
(Document doc, String url) void
setDocumentFromString
(String content, String url, NamespaceHandler nsh) void
void
setInteractive
(boolean interactive) void
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.void
setOpaque
(boolean opaque) Specifies whether the background of thisBasicPanel
will be painted when it is rendered.void
void
void
Called by XhtmlForm when a form is submitted.Methods inherited from class org.xhtmlrenderer.swing.RootPanel
addNotify, componentHidden, componentMoved, componentResized, componentShown, doDocumentLayout, find, find, getLayoutContext, getLayoutWidth, getRootBox, getRootLayer, getScreenExtents, isPrintView, newRenderingContext, removeNotify, resetScrollPosition, setDocument, setRootBox
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, 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
-
Constructor Details
-
BasicPanel
public BasicPanel() -
BasicPanel
-
-
Method Details
-
addDocumentListener
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
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.
-
paintComponent
-
paintPage
-
assignPagePrintPositions
-
printTree
public void printTree() -
setLayout
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. -
setSize
-
setDocument
-
setDocumentFromString
-
setDocument
-
setDocument
-
setDocument
-
reloadDocument
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
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
-
getDocument
-
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.
-
isHover
Description copied from interface:UserInterface
Gets the hover attribute of the UserInterface object- Specified by:
isHover
in interfaceUserInterface
- Overrides:
isHover
in classRootPanel
- Parameters:
e
- PARAM- Returns:
- The hover value
-
isActive
Description copied from interface:UserInterface
Gets the active attribute of the UserInterface object- Specified by:
isActive
in interfaceUserInterface
- Overrides:
isActive
in classRootPanel
- Parameters:
e
- PARAM- Returns:
- The active value
-
isFocus
Description copied from interface:UserInterface
Gets the focus attribute of the UserInterface object- Specified by:
isFocus
in interfaceUserInterface
- Overrides:
isFocus
in classRootPanel
- Parameters:
e
- PARAM- Returns:
- The focus value
-
isOpaque
public boolean isOpaque()Returns whether the background of thisBasicPanel
will be painted when it is rendered.- Overrides:
isOpaque
in classJComponent
- Returns:
true
if the background of thisBasicPanel
will be painted,false
if it will not.
-
setOpaque
public void setOpaque(boolean opaque) Specifies whether the background of thisBasicPanel
will be painted when it is rendered.- Overrides:
setOpaque
in classJComponent
- Parameters:
opaque
-true
if the background of thisBasicPanel
should be painted,false
if it should not.
-
getFixedRectangle
Description copied from class:RootPanel
Gets the fixedRectangle attribute of the BasicPanel object- Overrides:
getFixedRectangle
in classRootPanel
- Returns:
- The fixedRectangle value
-
scrollTo
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
-
removeMouseTrackingListener
-
getMouseTrackingListeners
-
isCenteredPagedView
public boolean isCenteredPagedView() -
setCenteredPagedView
public void setCenteredPagedView(boolean centeredPagedView) -
submit
Description copied from interface:FormSubmissionListener
Called by XhtmlForm when a form is submitted.- Specified by:
submit
in interfaceFormSubmissionListener
- Parameters:
url
- the entire query string as composed from form elements and the form's action URL
-
setFormSubmissionListener
-