|
||||||||||
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
org.faceless.pdf2.viewer2.ToggleViewerWidget
public abstract class ToggleViewerWidget
An subclass of 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.
Constructor Summary | |
---|---|
protected |
ToggleViewerWidget(String name,
String groupname)
Create a new ToggleViewerWidget |
Method Summary | |
---|---|
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 |
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. |
Methods inherited from class org.faceless.pdf2.viewer2.ViewerWidget |
---|
createActionListener, getComponent, getViewer, isButtonEnabledByDefault, isDocumentRequired, isMenuEnabledByDefault, setButton, setComponent, setDocumentRequired, setMenu, setMenu, setToolBarEnabled, setToolBarEnabledAlways, setToolBarFloatable, setToolBarFloating, 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 |
---|
protected ToggleViewerWidget(String name, String groupname)
name
- the name of the Widgetgroupname
- the group this widget is part of, or null
for no groupMethod Detail |
---|
public void initialize(PDFViewer viewer)
ViewerFeature
initialize
in class ViewerWidget
public final String getGroupName()
null
if no group was specified
public 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 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 group
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |