Class TagCloudViewer
java.lang.Object
org.eclipse.jface.viewers.Viewer
org.eclipse.jface.viewers.ContentViewer
org.eclipse.gef.cloudio.internal.ui.TagCloudViewer
- All Implemented Interfaces:
IInputProvider
,IInputSelectionProvider
,ISelectionProvider
A model-based adapter for a
TagCloud
.-
Field Summary
Fields inherited from class org.eclipse.jface.viewers.Viewer
WIDGET_DATA_KEY
-
Constructor Summary
ConstructorDescriptionTagCloudViewer
(TagCloud cloud) Create a new TagCloudViewer for the givenTagCloud
, which must not benull
. -
Method Summary
Modifier and TypeMethodDescriptiongetCloud()
Returns theTagCloud
managed by this viewer.int
Returns the maximum number of elements which will be displayed by the cloud.Returns the currently selected elements, as anIStructuredSelection
.protected void
Initialize the default tag cloud listeners.protected void
Initialize the mouse wheel listener to support zooming in and out.protected void
Initialize default selection behaviour: Words can be selected by mouse click, and selection listeners are notified when the selection changed.protected void
Initialize tool tip support when the cursor hovers a word.protected void
inputChanged
(Object input, Object oldInput) void
refresh()
void
reset
(IProgressMonitor monitor, boolean recalc) Resets theTagCloud
.void
setBoost
(int boost) void
setBoostFactor
(float boostFactor) void
setContentProvider
(IContentProvider contentProvider) Sets the content provider of this viewer, which must be anIStructuredContentProvider
.void
setInput
(Object input, IProgressMonitor progressMonitor) Same asContentViewer.setInput(Object)
, but with anIProgressMonitor
to provide feedback during the layout phase.void
setLabelProvider
(IBaseLabelProvider labelProvider) Sets the label provider of this viewer, which must be anICloudLabelProvider
.void
setLayouter
(ILayouter layouter) void
setMaxWords
(int words) Sets the maximum number of elements which will be displayed by the cloud.void
setSelection
(ISelection selection, boolean reveal) void
zoomFit()
CallsTagCloud.zoomFit()
to scale the cloud such that it fits the current visible area.void
zoomIn()
Zooms invoid
zoomOut()
Zooms outvoid
Resets the zoom to 100%Methods inherited from class org.eclipse.jface.viewers.ContentViewer
getContentProvider, getInput, getLabelProvider, handleDispose, handleLabelProviderChanged, hookControl, labelProviderChanged, setInput
Methods inherited from class org.eclipse.jface.viewers.Viewer
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection
-
Constructor Details
-
TagCloudViewer
Create a new TagCloudViewer for the givenTagCloud
, which must not benull
.- Parameters:
cloud
-
-
-
Method Details
-
initListeners
protected void initListeners()Initialize the default tag cloud listeners. Can be overridden to modify the behaviour of the viewer. -
initToolTipSupport
protected void initToolTipSupport()Initialize tool tip support when the cursor hovers a word. -
initMouseWheelListener
protected void initMouseWheelListener()Initialize the mouse wheel listener to support zooming in and out. -
initSelectionListener
protected void initSelectionListener()Initialize default selection behaviour: Words can be selected by mouse click, and selection listeners are notified when the selection changed. -
getControl
- Specified by:
getControl
in classViewer
-
getSelection
Returns the currently selected elements, as anIStructuredSelection
. Returns an empty selection if no elements are selected.- Specified by:
getSelection
in interfaceISelectionProvider
- Specified by:
getSelection
in classViewer
-
refresh
public void refresh() -
setSelection
- Specified by:
setSelection
in classViewer
-
reset
Resets theTagCloud
. Ifrecalc
istrue
, the displayed elements will be updated with the values provided by the usedICloudLabelProvider
. Otherwise, the cloud will only be re-layouted, keeping fonts, colors and angles untouched.- Parameters:
monitor
-recalc
-
-
getCloud
Returns theTagCloud
managed by this viewer.- Returns:
- the
TagCloud
of this viewer
-
setLabelProvider
Sets the label provider of this viewer, which must be anICloudLabelProvider
.- Overrides:
setLabelProvider
in classContentViewer
-
setContentProvider
Sets the content provider of this viewer, which must be anIStructuredContentProvider
.- Overrides:
setContentProvider
in classContentViewer
-
inputChanged
- Overrides:
inputChanged
in classViewer
-
setMaxWords
public void setMaxWords(int words) Sets the maximum number of elements which will be displayed by the cloud. Note that there is no guarantee that this amount of elements will actually be displayed, as this depends on additional factors. -
zoomFit
public void zoomFit()CallsTagCloud.zoomFit()
to scale the cloud such that it fits the current visible area. -
zoomIn
public void zoomIn()Zooms in -
zoomOut
public void zoomOut()Zooms out -
zoomReset
public void zoomReset()Resets the zoom to 100% -
setBoost
public void setBoost(int boost) -
getMaxWords
public int getMaxWords()Returns the maximum number of elements which will be displayed by the cloud. Note that there is no guarantee that this amount of elements will actually be displayed, as this depends on additional factors.- Returns:
- the maximum number of words that can be placed
-
setInput
Same asContentViewer.setInput(Object)
, but with anIProgressMonitor
to provide feedback during the layout phase.- Parameters:
input
-progressMonitor
-
-
setBoostFactor
public void setBoostFactor(float boostFactor) -
setLayouter
-
getLayouter
-