ComponentListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, IDocumentContainer, ITemplateContainer, ITemplatePanel, IXHTMLPanel, org.xhtmlrenderer.extend.UserInterface, org.xhtmlrenderer.simple.extend.FormSubmissionListenerRequestWizardpublic class TemplateWizard extends JDialog implements ITemplatePanel
This is an ITemplatePanel with next/previous buttons by which
the user can walk through a list of pages. The pages that make up the
wizard are defined in the member pages.
When you want to do something on a page change, use setHandler(nl.nikhef.jgridstart.gui.util.TemplateWizard.PageListener) with
a TemplateWizard.PageListener interface as argument. One can use setStep(int) and
setStepRelative(int) to change the current page.
To give the user an overview of the available steps in the wizard, there is
a variable wizard.contents.html which can be inserted in each step
using the default template substitutions. It can be
fixed to the viewport with css like position: fixed.
updateWizardProperties(int) generates this variable, which can be customized
by derived classes by overriding either that method, or getWizardContentsLine(int, int).
The default implementation of getWizardContentsLine(int, int) retrieves the HTML document title for each page to construct the overview of the available steps.
| Modifier and Type | Class | Description |
|---|---|---|
static interface |
TemplateWizard.PageListener |
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategyContainer.AccessibleAWTContainerDialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeJDialog.AccessibleJDialogWindow.AccessibleAWTWindow, Window.Type| Modifier and Type | Field | Description |
|---|---|---|
protected JPanel |
btnLeft |
|
protected JPanel |
btnRight |
|
protected Action |
cancelAction |
"Cancel"/"Close" action
|
protected TemplateWizard.PageListener |
handler |
Listener for page changes
|
protected Action |
nextAction |
"Next" action
|
ArrayList<URL> |
pages |
wizard page templates for each step
|
protected TemplateButtonPanel |
pane |
actual dialog content with HTML and buttons
|
protected Action |
prevAction |
"Previous" action
|
protected int |
step |
currently active step (base 0), -1 for not initialized
|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTDEFAULT_MODALITY_TYPEABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHaccessibleContext, rootPane, rootPaneCheckingEnabledDISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE| Constructor | Description |
|---|---|
TemplateWizard() |
|
TemplateWizard(Dialog owner) |
|
TemplateWizard(Dialog owner,
Properties p) |
|
TemplateWizard(Frame owner) |
|
TemplateWizard(Frame owner,
Properties p) |
|
TemplateWizard(Properties p) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addMouseTrackingListener(org.xhtmlrenderer.swing.FSMouseListener l) |
|
void |
componentHidden(ComponentEvent e) |
|
void |
componentMoved(ComponentEvent e) |
|
void |
componentResized(ComponentEvent e) |
|
void |
componentShown(ComponentEvent e) |
|
Properties |
data() |
Return the properties.
|
Document |
getDocument() |
|
protected TemplateDocument |
getDocument(int i) |
return the TemplateDocument by index.
|
String |
getDocumentTitle() |
Returns the title as reported by the NamespaceHandler assigned to the SharedContext in this panel.
|
protected String |
getDocumentTitle(int step) |
Returns the title of a step
|
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() |
|
protected String |
getWizardContentsLine(int step,
int current) |
Returns the contents line for a page.
|
protected void |
initialize() |
Initialize and build the dialog
The background colour is set to the default control background colour as
specified by UIManager.
|
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.
|
protected Document |
retrieveDocument(URL url) |
|
void |
setBackground(Color c) |
|
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 |
setHandler(TemplateWizard.PageListener l) |
set the handler to be called when a page switch is done.
|
void |
setSharedContext(org.xhtmlrenderer.layout.SharedContext ctx) |
Sets the
RenderingContext attribute of the XHTMLPanel object. |
void |
setStep(int s) |
set the currently displayed page
|
void |
setStepRelative(int delta) |
go to another page by relative distance
|
void |
setSubmitAction(Action e) |
Set the action to perform on form submission.
|
void |
setVisible(boolean visible) |
Shows or hides the dialog.
|
void |
submit(String query) |
|
void |
updateWizardProperties(int step) |
Update the wizard properties for a step.
|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleadd, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTreeaddNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBackaddImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFrontprotected int step
protected TemplateButtonPanel pane
protected JPanel btnRight
protected JPanel btnLeft
protected Action nextAction
protected Action prevAction
protected Action cancelAction
protected TemplateWizard.PageListener handler
public TemplateWizard()
public TemplateWizard(Dialog owner)
public TemplateWizard(Frame owner)
public TemplateWizard(Properties p)
public TemplateWizard(Dialog owner, Properties p)
public TemplateWizard(Frame owner, Properties p)
protected TemplateDocument getDocument(int i)
The document is loaded on demand. Always use this method to access the document, or else it may not be loaded.
null on failureprotected String getDocumentTitle(int step)
public void setStep(int s)
public void setStepRelative(int delta)
public void updateWizardProperties(int step)
This generaties the properties wizard.* which can be
referenced in the template. The following variables are defined
by default:
wizard.contents.html - list of pages (html)
Note that property wizard.contents.html.volatile are
set to true to avoid it being saved to disk for persistent
property stores (like jGridstart's CertificatePair).
Derived classes may add and/or override wizard properties. Please
make sure to set the wizard.foo.html.volatile property
as well to avoid property clutter.
step - step for which the contents is displayed; the default
implementation marks the currently displayed step.protected String getWizardContentsLine(int step, int current)
Default implementation returns a li item with an optional class
wizard-current if it is the current page, or
wizard-future if it is a step later than the current one.
step - step to return contents for; index in pagescurrent - the currently active steppublic void setVisible(boolean visible)
This also sets the current step to the first one if none is selected as of yet (only when there are pages defined).
setVisible in class Dialogprotected void initialize()
public void setHandler(TemplateWizard.PageListener l)
protected Document retrieveDocument(URL url) throws SAXException, IOException, ParserConfigurationException
This version explicitly allows the use of default caches to enable
resource caching from URLs obtained with Class.getResource(java.lang.String).
public void setBackground(Color c)
setBackground in class Dialogpublic 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()
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).
Actually calls setStep(int) so that the TemplateWizard.PageListener
and other hooks are properly updated.
refresh in interface ITemplateContainertruepublic 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.