HtmlView
- type representing the view as used by this viewerHtmlButton
- type representing buttons as used by this viewerpublic interface HTMLViewerSpi<HtmlView,HtmlButton>
OpenHTMLRegistration
, HTMLDialog
and
HTMLComponent
assumes the system to display the HTML page and connect
it with the underlaying code - that's a task for this SPI.
Implement this interface and register it using ServiceProvider
.
When requested (via HTMLViewerSpi.newView(org.netbeans.spi.htmlui.HTMLViewerSpi.Context)
method
show the HTML page
and run the
initialization code in the page
. There are
three possible ways to display an HTML user interface:
long lasting window
,
dialog with extra buttons
,
a separate HTMLViewerSpi.component(java.lang.Object, java.lang.Class)
to
embed into existing Swing or JavaFX interface.
Modifier and Type | Interface and Description |
---|---|
static class |
HTMLViewerSpi.Context
Context for interacting with the system infrastructure.
|
Modifier and Type | Method and Description |
---|---|
<C> C |
component(HtmlView view,
Class<C> type)
Converts the view to a component of the requested type.
|
HtmlButton |
createButton(HtmlView view,
String id)
Create a button.
|
String |
getId(HtmlView view,
HtmlButton b)
Extracts ID of a button created by
HTMLViewerSpi.createButton(java.lang.Object, java.lang.String) . |
HtmlView |
newView(HTMLViewerSpi.Context context)
Create new HTML view.
|
void |
runLater(HtmlView view,
Runnable r)
Runs a batch operation over the buttons in given view.
|
void |
setEnabled(HtmlView view,
HtmlButton b,
boolean enabled)
Sets enablement state for a button created by
HTMLViewerSpi.createButton(java.lang.Object, java.lang.String) . |
void |
setText(HtmlView view,
HtmlButton b,
String text)
Sets text for a button created by
HTMLViewerSpi.createButton(java.lang.Object, java.lang.String) . |
HtmlView newView(HTMLViewerSpi.Context context)
HTMLViewerSpi.Context.isWindow()
handles OpenHTMLRegistration
usagesHTMLViewerSpi.Context.isDialog()
handles HTMLDialog
usagesHTMLComponent
usagescontext
- information to display and callbacks to the infrastructurenull
if this viewer cannot handle the request<C> C component(HtmlView view, Class<C> type)
HTMLViewerSpi.Context.isWindow()
and HTMLViewerSpi.Context.isDialog()
return true
. Default implementation supports two values of type
:
JComponent
or Node class - alternative
implementations of this interface may not support all these types
and may also support other types.
Requesting Void
.class
means to realize
the component - e.g. make it visible.
C
- the type of requested componentview
- element representing the viewtype
- class of the requested componentClassCastException
- if the type
isn't supportedHtmlButton createButton(HtmlView view, String id)
HTMLDialog
specification describes. This method allows
one to create for example Swing buttons outside of the HTML page
to keep consistent user experience.view
- the viewid
- identification of the buttonString getId(HtmlView view, HtmlButton b)
HTMLViewerSpi.createButton(java.lang.Object, java.lang.String)
.view
- the viewb
- the buttonvoid setText(HtmlView view, HtmlButton b, String text)
HTMLViewerSpi.createButton(java.lang.Object, java.lang.String)
.view
- the viewb
- the buttontext
- new text to assign to the buttonvoid setEnabled(HtmlView view, HtmlButton b, boolean enabled)
HTMLViewerSpi.createButton(java.lang.Object, java.lang.String)
.view
- the viewb
- the buttonenabled
- the desired enablement state