ComponentListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, IDocumentContainer, ITemplateContainer, ITemplatePanel, IXHTMLPanel, org.xhtmlrenderer.extend.UserInterface, org.xhtmlrenderer.simple.extend.FormSubmissionListenerpublic class TemplateButtonPanel extends JPanel implements ITemplatePanel
TemplatePanel in a scrolled window with buttons below.
This is a thin layer over TemplatePanel that adds optional buttons
below the document view. It may be viewed as a kind of JOptionPane
with a TemplatePanel as dialog contents, but the buttons here are
to be supplied explicitely. TemplateWizard is an example that adds
previous/next buttons.
Additionally, links are opened in an external web browser using
URLLauncher.
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategyContainer.AccessibleAWTContainerJComponent.AccessibleJComponentJPanel.AccessibleJPanel| Modifier and Type | Field | Description |
|---|---|---|
protected int |
btnBorderWidth |
empty space around buttons
|
protected JPanel |
buttonpane |
pane containing the buttons
|
protected TemplatePanel |
contentpane |
the actual html template pane
|
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor | Description |
|---|---|
TemplateButtonPanel() |
|
TemplateButtonPanel(String src) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addButton(JButton btn,
boolean isDefault) |
adds an action to the button list
|
void |
addButton(JButton btn,
boolean isDefault,
boolean isLast) |
adds an action to the button list
|
void |
addButton(JPanel panel,
JButton btn,
boolean isDefault) |
adds an action to the button list
|
void |
addButton(JPanel panel,
JButton btn,
boolean isDefault,
boolean isLast) |
adds an action to the button list
|
void |
addMouseTrackingListener(org.xhtmlrenderer.swing.FSMouseListener l) |
|
void |
addSeparator() |
adds a seperator to the button list
|
void |
componentHidden(ComponentEvent e) |
|
void |
componentMoved(ComponentEvent e) |
|
void |
componentResized(ComponentEvent e) |
|
void |
componentShown(ComponentEvent e) |
|
Properties |
data() |
Return the properties.
|
JPanel |
getButtonPane() |
returns the bottom JPanel that can contain the buttons.
|
Document |
getDocument() |
|
String |
getDocumentTitle() |
Returns the title as reported by the NamespaceHandler assigned to the SharedContext in this panel.
|
Component |
getFormComponent(String name) |
Return the Swing/AWT component for a form element by name.
|
Map<String,Component> |
getFormComponents() |
Return the list of Swing/AWT components.
|
List<?> |
getMouseTrackingListeners() |
|
org.xhtmlrenderer.layout.SharedContext |
getSharedContext() |
|
URL |
getURL() |
|
boolean |
isActive(Element e) |
|
boolean |
isFocus(Element e) |
|
boolean |
isHover(Element e) |
|
boolean |
print() |
print the contents of this pane.
|
boolean |
refresh() |
Refresh the contents so that all parsing is redone.
|
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 |
removeMouseTrackingListener(org.xhtmlrenderer.swing.FSMouseListener l) |
|
void |
replaceLinkListener(org.xhtmlrenderer.swing.LinkListener llnew) |
Replace the listener that is activated when a link is clicked.
|
void |
setData(Properties p) |
Set the properties to use for the template and form elements.
|
void |
setDocument(File file) |
Renders a Document read from an InputStream using a URL
as a base URL for relative paths.
|
void |
setDocument(InputStream stream,
String url) |
Renders a Document read from an InputStream using a URL
as a base URL for relative paths.
|
void |
setDocument(InputStream stream,
String url,
org.xhtmlrenderer.extend.NamespaceHandler nsh) |
|
void |
setDocument(String uri) |
Loads and renders a Document given a uri.
|
void |
setDocument(String url,
org.xhtmlrenderer.extend.NamespaceHandler nsh) |
|
void |
setDocument(TemplateDocument doc) |
Renders an ITemplateDocument instance.
|
void |
setDocument(TemplateDocument doc,
org.xhtmlrenderer.extend.NamespaceHandler nsh) |
|
void |
setDocument(Document doc) |
Renders an XML Document instance.
|
void |
setDocument(Document doc,
String url) |
Renders a Document using a URL as a base URL for relative
paths.
|
void |
setDocumentFromString(String content,
String url,
org.xhtmlrenderer.extend.NamespaceHandler nsh) |
|
void |
setFormSubmissionListener(org.xhtmlrenderer.simple.extend.FormSubmissionListener fsl) |
|
void |
setSharedContext(org.xhtmlrenderer.layout.SharedContext ctx) |
Sets the
RenderingContext attribute of the XHTMLPanel object. |
void |
setSubmitAction(Action e) |
Set the action to perform on form submission.
|
void |
submit(String query) |
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, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleadd, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaddAncestorListener, 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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, updategetAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIprotected TemplatePanel contentpane
protected JPanel buttonpane
protected final int btnBorderWidth
public TemplateButtonPanel()
public TemplateButtonPanel(String src) throws IOException
IOExceptionpublic JPanel getButtonPane()
By default, horizontal glue is added as the first element, so that
when you use Container.add(java.awt.Component), elements are right-aligned. If you
really want to have this differently, call Container.removeAll()
on the returned JPanel after construction of this
TemplateButtonPanel.
public void addButton(JPanel panel, JButton btn, boolean isDefault, boolean isLast)
panel - Panel to add the button to; useful when creating sub-panelsbtn - Button to addisDefault - true whether this is the default action (set on only one)isLast - whether this is the final button to add, for refreshingpublic void addButton(JPanel panel, JButton btn, boolean isDefault)
panel - Panel to add the button to; useful when creating sub-panelsbtn - Button to addisDefault - true whether this is the default action (set on only one)public void addButton(JButton btn, boolean isDefault, boolean isLast)
The button needs to have an Action specified at this moment.
btn - Button to addisDefault - true whether this is the default action (set on only one)isLast - whether this is the final button to add, for refreshingpublic void addButton(JButton btn, boolean isDefault)
The button needs to have an Action specified at this moment.
btn - Button to addisDefault - true whether this is the default action (set on only one)public void addSeparator()
This is implemented as some whitespace to visually separate buttons
public void addMouseTrackingListener(org.xhtmlrenderer.swing.FSMouseListener l)
addMouseTrackingListener in interface IXHTMLPanelpublic void componentHidden(ComponentEvent e)
componentHidden in interface ComponentListenerpublic void componentMoved(ComponentEvent e)
componentMoved in interface ComponentListenerpublic void componentResized(ComponentEvent e)
componentResized in interface ComponentListenerpublic void componentShown(ComponentEvent e)
componentShown in interface ComponentListenerpublic Properties data()
ITemplateContainerUse this to retrieve data from form elements. The name of each element has a corresponding property key, and the value of the property is updated when the form element changes.
data in interface ITemplateContainerpublic Document getDocument()
getDocument in interface IDocumentContainerpublic String getDocumentTitle()
IDocumentContainergetDocumentTitle in interface IDocumentContainerpublic List<?> getMouseTrackingListeners()
getMouseTrackingListeners in interface IXHTMLPanelpublic org.xhtmlrenderer.layout.SharedContext getSharedContext()
getSharedContext in interface IXHTMLPanelpublic URL getURL()
getURL in interface IDocumentContainerpublic boolean isActive(Element e)
isActive in interface org.xhtmlrenderer.extend.UserInterfacepublic boolean isFocus(Element e)
isFocus in interface org.xhtmlrenderer.extend.UserInterfacepublic boolean isHover(Element e)
isHover in interface org.xhtmlrenderer.extend.UserInterfacepublic boolean print()
throws PrinterException
IXHTMLPanelA print dialog is shown first.
print in interface IXHTMLPanelPrinterExceptionpublic boolean refresh()
ITemplateContainerNote that the template may or may not be retrieved again from its source.
This happens automatically in ITemplateContainer.setData(java.util.Properties) and ITemplateContainer.setDocument(nl.nikhef.xhtmlrenderer.swing.TemplateDocument).
refresh in interface ITemplateContainerpublic void reloadDocument(Document doc)
IDocumentContainerreloadDocument in interface IDocumentContainerdoc - The document to reload.public void reloadDocument(String URI)
IDocumentContainerreloadDocument in interface IDocumentContainerURI - A URI for the Document to load, for example, file.toURL().toExternalForm().public void removeMouseTrackingListener(org.xhtmlrenderer.swing.FSMouseListener l)
removeMouseTrackingListener in interface IXHTMLPanelpublic void replaceLinkListener(org.xhtmlrenderer.swing.LinkListener llnew)
IXHTMLPanelThis is a convenience method that first removes all LinkListeners, and then adds the supplied one.
replaceLinkListener in interface IXHTMLPanelllnew - New LinkListener to use for this panelpublic void setData(Properties p)
ITemplateContainerAlso reparses the document and updates the panel, if a template was set.
setData in interface ITemplateContainerp - New properties to setpublic void setDocument(TemplateDocument doc)
ITemplateContainersetDocument in interface ITemplateContainerdoc - template to show, this will be processed with the data
supplied by this container.public void setDocument(TemplateDocument doc, org.xhtmlrenderer.extend.NamespaceHandler nsh)
public void setDocument(Document doc, String url)
IDocumentContainersetDocument in interface IDocumentContainerdoc - The new document valueurl - The new document valuepublic void setDocument(Document doc)
IDocumentContainersetDocument in interface IDocumentContainerdoc - The document to render.public void setDocument(File file) throws Exception
IDocumentContainersetDocument in interface IDocumentContainerfile - The file to read the Document from. Relative paths
will be resolved based on the file's parent directory.Exceptionpublic void setDocument(InputStream stream, String url, org.xhtmlrenderer.extend.NamespaceHandler nsh)
setDocument in interface IDocumentContainerpublic void setDocument(InputStream stream, String url) throws Exception
IDocumentContainersetDocument in interface IDocumentContainerstream - The stream to read the Document from.url - The URL used to resolve relative path references.Exceptionpublic void setDocument(String url, org.xhtmlrenderer.extend.NamespaceHandler nsh)
setDocument in interface IDocumentContainerpublic void setDocument(String uri)
IDocumentContainersetDocument in interface IDocumentContainerpublic void setDocumentFromString(String content, String url, org.xhtmlrenderer.extend.NamespaceHandler nsh)
setDocumentFromString in interface IDocumentContainerpublic void setFormSubmissionListener(org.xhtmlrenderer.simple.extend.FormSubmissionListener fsl)
setFormSubmissionListener in interface IXHTMLPanelpublic void setSharedContext(org.xhtmlrenderer.layout.SharedContext ctx)
IXHTMLPanelRenderingContext attribute of the XHTMLPanel object. Generally
you should not use this unless you have a heavily customized context to
use. To modify just some rendering behavior, consider using
IXHTMLPanel.getSharedContext() to retrieve the current context, and using
mutators to change its behavior.setSharedContext in interface IXHTMLPanelctx - A new RenderingContext to use for rendering.public void setSubmitAction(Action e)
ITemplateContainerIf this is set to null, the standard behaviour is done: posting data to the url supplied by the form.
setSubmitAction in interface ITemplateContainerpublic void submit(String query)
submit in interface org.xhtmlrenderer.simple.extend.FormSubmissionListenerpublic Component getFormComponent(String name)
ITemplatePanel
Note that multiple radio buttons have the same name, so for these the
name is actually in the form name.value.
getFormComponent in interface ITemplatePanelname - like myfield in >input type="text" name="myfield" /<public Map<String,Component> getFormComponents()
ITemplatePanelgetFormComponents in interface ITemplatePanelITemplatePanel.getFormComponent(java.lang.String)Copyright © 2010-2018 Nikhef / Stichting FOM. All Rights Reserved.