|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.pdf2.viewer2.ViewerFeature
org.faceless.pdf2.viewer2.ViewerWidget
public class ViewerWidget
A type of ViewerFeature that adds a "widget" to a PDFViewer
. Widgets are typically
buttons on the toolbar, menu items and so on.
This code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.
ToggleViewerWidget
Constructor Summary | |
---|---|
ViewerWidget(String name)
Create a new Widget |
Method Summary | |
---|---|
void |
action(ViewerEvent event)
The method that's run when this feature is activated |
protected ActionListener |
createActionListener()
Return an ActionListener that will be called when this Widget is activated. |
JComponent |
getComponent()
Return the component representing this Widget. |
PDFViewer |
getViewer()
Get the Viewer this Feature has been added to. |
void |
initialize(PDFViewer viewer)
Called when the feature is first added to a viewer |
boolean |
isButtonEnabledByDefault()
Return true if the button component for this widget is enabled by default. |
boolean |
isDocumentRequired()
Return whether this widget should be inactive if no Document is selected. |
boolean |
isMenuEnabledByDefault()
Return true if the menu component for this widget is enabled by default. |
protected void |
setButton(String toolbar,
String icon,
String tooltip)
Set this feature to use a regular button in the toolbar. |
protected void |
setComponent(String toolbar,
JComponent component)
Set a custom component to be displayed in the ToolBar for this feature. |
protected void |
setDocumentRequired(boolean required)
Set whether this feature requires a PDF to be loaded. |
protected void |
setMenu(String menu)
Set a menu item for this feature. |
protected void |
setMenu(String menu,
char mnemonic)
Set a menu item for this feature, with an optional keyboard shortcut. |
protected void |
setToolBarEnabled(boolean enabled)
Set whether the toolbar this feature is stored in is enabled by default |
protected void |
setToolBarEnabledAlways(boolean always)
Set whether the toolbar this feature is stored in can be enabled or disabled |
protected void |
setToolBarFloatable(boolean floatable)
Set whether the toolbar this feature is stored in can be floated |
protected void |
setToolBarFloating(boolean floating)
Set whether this toolbar is always floating or not. |
String |
toString()
|
Methods inherited from class org.faceless.pdf2.viewer2.ViewerFeature |
---|
getAllEnabledFeatures, getAllFeatures, getCustomJavaScript, getFeatureProperty, getFeatureURLProperty, getName, isEnabledByDefault, setFeatureName, teardown |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ViewerWidget(String name)
Method Detail |
---|
public String toString()
toString
in class ViewerFeature
protected ActionListener createActionListener()
Quit.createActionListener()
public void initialize(PDFViewer viewer)
ViewerFeature
initialize
in class ViewerFeature
public final PDFViewer getViewer()
protected final void setDocumentRequired(boolean required)
public boolean isDocumentRequired()
setDocumentRequired(boolean)
protected final void setComponent(String toolbar, JComponent component)
toolbar
- the name of the toolbar to put the component incomponent
- the componentpublic JComponent getComponent()
public boolean isButtonEnabledByDefault()
public boolean isMenuEnabledByDefault()
protected final void setButton(String toolbar, String icon, String tooltip)
toolbar
- the name of the toolbar to put the component inicon
- the URL of the icon to usetooltip
- the tooltip to display for this buttonprotected final void setToolBarEnabled(boolean enabled)
protected final void setToolBarEnabledAlways(boolean always)
ToolbarDisabling
protected final void setToolBarFloatable(boolean floatable)
protected final void setToolBarFloating(boolean floating)
protected final void setMenu(String menu)
menu
- the menu hierarchy to use, separated with tabs - eg "File\tOpen"protected final void setMenu(String menu, char mnemonic)
menu
- the menu hierarchy to use, separated with tabs - eg "File\tOpen"mnemonic
- the keyboard shortcut to activate the menu - a lowercase or uppercase
character to activate the menu.public void action(ViewerEvent event)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |