ComponentListener
, ImageObserver
, MenuContainer
, Serializable
, EventListener
, Accessible
, IDocumentContainer
, ITemplateContainer
, ITemplatePanel
, IXHTMLPanel
, org.xhtmlrenderer.extend.UserInterface
, org.xhtmlrenderer.simple.extend.FormSubmissionListener
public 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.FlipBufferStrategy
Container.AccessibleAWTContainer
JComponent.AccessibleJComponent
JPanel.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_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
listenerList, 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, transferFocusUpCycle
add, 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, validateTree
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, 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, update
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
protected TemplatePanel contentpane
protected JPanel buttonpane
protected final int btnBorderWidth
public TemplateButtonPanel()
public TemplateButtonPanel(String src) throws IOException
IOException
public 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 IXHTMLPanel
public void componentHidden(ComponentEvent e)
componentHidden
in interface ComponentListener
public void componentMoved(ComponentEvent e)
componentMoved
in interface ComponentListener
public void componentResized(ComponentEvent e)
componentResized
in interface ComponentListener
public void componentShown(ComponentEvent e)
componentShown
in interface ComponentListener
public Properties data()
ITemplateContainer
Use 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 ITemplateContainer
public Document getDocument()
getDocument
in interface IDocumentContainer
public String getDocumentTitle()
IDocumentContainer
getDocumentTitle
in interface IDocumentContainer
public List<?> getMouseTrackingListeners()
getMouseTrackingListeners
in interface IXHTMLPanel
public org.xhtmlrenderer.layout.SharedContext getSharedContext()
getSharedContext
in interface IXHTMLPanel
public URL getURL()
getURL
in interface IDocumentContainer
public boolean isActive(Element e)
isActive
in interface org.xhtmlrenderer.extend.UserInterface
public boolean isFocus(Element e)
isFocus
in interface org.xhtmlrenderer.extend.UserInterface
public boolean isHover(Element e)
isHover
in interface org.xhtmlrenderer.extend.UserInterface
public boolean print() throws PrinterException
IXHTMLPanel
A print dialog is shown first.
print
in interface IXHTMLPanel
PrinterException
public boolean refresh()
ITemplateContainer
Note 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 ITemplateContainer
public void reloadDocument(Document doc)
IDocumentContainer
reloadDocument
in interface IDocumentContainer
doc
- The document to reload.public void reloadDocument(String URI)
IDocumentContainer
reloadDocument
in interface IDocumentContainer
URI
- A URI for the Document to load, for example, file.toURL().toExternalForm().public void removeMouseTrackingListener(org.xhtmlrenderer.swing.FSMouseListener l)
removeMouseTrackingListener
in interface IXHTMLPanel
public void replaceLinkListener(org.xhtmlrenderer.swing.LinkListener llnew)
IXHTMLPanel
This is a convenience method that first removes all LinkListeners, and then adds the supplied one.
replaceLinkListener
in interface IXHTMLPanel
llnew
- New LinkListener to use for this panelpublic void setData(Properties p)
ITemplateContainer
Also reparses the document and updates the panel, if a template was set.
setData
in interface ITemplateContainer
p
- New properties to setpublic void setDocument(TemplateDocument doc)
ITemplateContainer
setDocument
in interface ITemplateContainer
doc
- 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)
IDocumentContainer
setDocument
in interface IDocumentContainer
doc
- The new document valueurl
- The new document valuepublic void setDocument(Document doc)
IDocumentContainer
setDocument
in interface IDocumentContainer
doc
- The document to render.public void setDocument(File file) throws Exception
IDocumentContainer
setDocument
in interface IDocumentContainer
file
- The file to read the Document from. Relative paths
will be resolved based on the file's parent directory.Exception
public void setDocument(InputStream stream, String url, org.xhtmlrenderer.extend.NamespaceHandler nsh)
setDocument
in interface IDocumentContainer
public void setDocument(InputStream stream, String url) throws Exception
IDocumentContainer
setDocument
in interface IDocumentContainer
stream
- The stream to read the Document from.url
- The URL used to resolve relative path references.Exception
public void setDocument(String url, org.xhtmlrenderer.extend.NamespaceHandler nsh)
setDocument
in interface IDocumentContainer
public void setDocument(String uri)
IDocumentContainer
setDocument
in interface IDocumentContainer
public void setDocumentFromString(String content, String url, org.xhtmlrenderer.extend.NamespaceHandler nsh)
setDocumentFromString
in interface IDocumentContainer
public void setFormSubmissionListener(org.xhtmlrenderer.simple.extend.FormSubmissionListener fsl)
setFormSubmissionListener
in interface IXHTMLPanel
public void setSharedContext(org.xhtmlrenderer.layout.SharedContext ctx)
IXHTMLPanel
RenderingContext
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 IXHTMLPanel
ctx
- A new RenderingContext to use for rendering.public void setSubmitAction(Action e)
ITemplateContainer
If this is set to null, the standard behaviour is done: posting data to the url supplied by the form.
setSubmitAction
in interface ITemplateContainer
public void submit(String query)
submit
in interface org.xhtmlrenderer.simple.extend.FormSubmissionListener
public 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 ITemplatePanel
name
- like myfield
in >input type="text" name="myfield" /<
public Map<String,Component> getFormComponents()
ITemplatePanel
getFormComponents
in interface ITemplatePanel
ITemplatePanel.getFormComponent(java.lang.String)
Copyright © 2010-2018 Nikhef / Stichting FOM. All Rights Reserved.