public abstract class ToggleViewerWidget extends ViewerWidget
ViewerWidget
which causes the widget to be toggled on
or off, rather than simply pushed. ToggleViewerWidget objects may be part of
a "group", in which case when this object is selected, all objects in the
same group are deselected.
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.
Modifier | Constructor and Description |
---|---|
protected |
ToggleViewerWidget(String name,
String groupname)
Create a new ToggleViewerWidget
|
Modifier and Type | Method and Description |
---|---|
void |
action(ViewerEvent event)
Toggle the active state of this widget by calling
setSelected(boolean) |
String |
getGroupName()
Return the name of the group this widget is part of, or
null
if no group was specified |
JComponent |
getGroupOwner()
Return the "owner" of this Widget's group.
|
ToggleViewerWidget |
getGroupSelection(String groupname)
Return the selected item in the specified group, or
null
if none of the items in that group are selected or no such group
exists. |
Collection<ToggleViewerWidget> |
getWidgets(String groupname)
Return a Collection of other
ToggleViewerWidget objects in the
specified group. |
void |
initialize(PDFViewer viewer)
Called when the feature is first added to a viewer
|
boolean |
isSelected()
Return whether this ViewerWidget is selected
|
void |
setGroupOwner(JComponent comp)
Set the "owner" for this Widget's group.
|
void |
setSelected(boolean selected)
Set whether this Widget is selected.
|
protected void |
updateViewport(DocumentViewport viewport,
boolean selected)
Called from
setSelected(boolean) , this method is called in each
viewport in use by the PDFViewer or DocumentPanel so
it can update its status. |
createActionListener, getComponent, getIcon, getViewer, isButtonEnabledByDefault, isDocumentRequired, isMenuEnabledByDefault, setButton, setComponent, setDocumentRequired, setMenu, setMenu, setToolBarEnabled, setToolBarEnabledAlways, setToolBarFloatable, setToolBarFloating, toString
getAllEnabledFeatures, getAllFeatures, getCustomJavaScript, getFeatureProperty, getFeatureURLProperty, getName, isEnabledByDefault, setFeatureName, teardown
public void initialize(PDFViewer viewer)
ViewerFeature
initialize
in class ViewerWidget
public final String getGroupName()
null
if no group was specifiedpublic final void setGroupOwner(JComponent comp)
PDFViewer
and set automatically - the only time
this method needs to be called manually is when no PDFViewer is
in use and these widgets are being applied directly to a
DocumentPanel
.comp
- the JComponent that owns the group this widget is part ofpublic final JComponent getGroupOwner()
public void action(ViewerEvent event)
setSelected(boolean)
action
in class ViewerWidget
public void setSelected(boolean selected)
setSelected(false)
on all the other
widgets in this group. Subclasses should override this method to do
whatever they need to do when their active status is changed.selected
- whether this Widget is active or notprotected void updateViewport(DocumentViewport viewport, boolean selected)
setSelected(boolean)
, this method is called in each
viewport in use by the PDFViewer
or DocumentPanel
so
it can update its status. By default it is a no-op.public boolean isSelected()
public ToggleViewerWidget getGroupSelection(String groupname)
null
if none of the items in that group are selected or no such group
exists. To get the selected item in this item's group, pass in the
value of getGroupName()
groupname
- the name of the grouppublic Collection<ToggleViewerWidget> getWidgets(String groupname)
ToggleViewerWidget
objects in the
specified group. To return the Collection containing objects in this
group, pass in the value of getGroupName()
.groupname
- the name of the groupCopyright © 2001-2017 Big Faceless Organization