Package org.eclipse.gef.cloudio.internal.ui

## 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`

    public class TagCloudViewer
    extends ContentViewer

A model-based adapter for a `TagCloud`.

### Field Summary

### Fields inherited from class org.eclipse.jface.viewers.Viewer

`WIDGET_DATA_KEY`

### Constructor Summary

Constructors
`TagCloudViewer​(TagCloud cloud)` Create a new TagCloudViewer for the given `TagCloud`, which must not be `null`.

### Method Summary

All Methods Instance Methods Concrete Methods
`TagCloud` `getCloud()` Returns the `TagCloud` managed by this viewer.
`Control` `getControl()`
`ILayouter` `getLayouter()`
`int` `getMaxWords()` Returns the maximum number of elements which will be displayed by the cloud.
`ISelection` `getSelection()` Returns the currently selected elements, as an `IStructuredSelection`.
`protected void` `initListeners()` Initialize the default tag cloud listeners.
`protected void` `initMouseWheelListener()` Initialize the mouse wheel listener to support zooming in and out.
`protected void` `initSelectionListener()` Initialize default selection behaviour: Words can be selected by mouse click, and selection listeners are notified when the selection changed.
`protected void` `initToolTipSupport()` Initialize tool tip support when the cursor hovers a word.
`protected void` `inputChanged​(java.lang.Object input, java.lang.Object oldInput)`
`void` `refresh()`
`void` `reset​(IProgressMonitor monitor, boolean recalc)` Resets the `TagCloud`.
`void` `setBoost​(int boost)`
`void` `setBoostFactor​(float boostFactor)`
`void` `setContentProvider​(IContentProvider contentProvider)` Sets the content provider of this viewer, which must be an `IStructuredContentProvider`.
`void` `setInput​(java.lang.Object input, IProgressMonitor progressMonitor)` Same as `ContentViewer.setInput(Object)`, but with an `IProgressMonitor` to provide feedback during the layout phase.
`void` `setLabelProvider​(IBaseLabelProvider labelProvider)` Sets the label provider of this viewer, which must be an `ICloudLabelProvider`.
`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()` Calls `TagCloud.zoomFit()` to scale the cloud such that it fits the current visible area.
`void` `zoomIn()` Zooms in
`void` `zoomOut()` Zooms out
`void` `zoomReset()` 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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### TagCloudViewer

    public TagCloudViewer​(TagCloud cloud)

Create a new TagCloudViewer for the given `TagCloud`, which must not be `null`.

Parameters:
  `cloud` -

### Method Detail

#### 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

    public Control getControl()

Specified by:
  `getControl` in class `Viewer`

#### getSelection

    public ISelection getSelection()

Returns the currently selected elements, as an `IStructuredSelection`. Returns an empty selection if no elements are selected.

Specified by:
  `getSelection` in interface `ISelectionProvider`
Specified by:
  `getSelection` in class `Viewer`

#### refresh

    public void refresh()

Specified by:
  `refresh` in class `Viewer`

#### setSelection

    public void setSelection​(ISelection selection,
                             boolean reveal)

Specified by:
  `setSelection` in class `Viewer`

#### reset

    public void reset​(IProgressMonitor monitor,
                      boolean recalc)

Resets the `TagCloud`. If `recalc` is `true`, the displayed elements will be updated with the values provided by the used `ICloudLabelProvider`. Otherwise, the cloud will only be re-layouted, keeping fonts, colors and angles untouched.

Parameters:
  `monitor` -
  `recalc` -

#### getCloud

    public TagCloud getCloud()

Returns the `TagCloud` managed by this viewer.

Returns:
  the `TagCloud` of this viewer

#### setLabelProvider

    public void setLabelProvider​(IBaseLabelProvider labelProvider)

Sets the label provider of this viewer, which must be an `ICloudLabelProvider`.

Overrides:
  `setLabelProvider` in class `ContentViewer`

#### setContentProvider

    public void setContentProvider​(IContentProvider contentProvider)

Sets the content provider of this viewer, which must be an `IStructuredContentProvider`.

Overrides:
  `setContentProvider` in class `ContentViewer`

#### inputChanged

    protected void inputChanged​(java.lang.Object input,
                                java.lang.Object oldInput)

Overrides:
  `inputChanged` in class `Viewer`

#### 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()

Calls `TagCloud.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

    public void setInput​(java.lang.Object input,
                         IProgressMonitor progressMonitor)

Same as `ContentViewer.setInput(Object)`, but with an `IProgressMonitor` to provide feedback during the layout phase.

Parameters:
  `input` -
  `progressMonitor` -

#### setBoostFactor

    public void setBoostFactor​(float boostFactor)

#### setLayouter

    public void setLayouter​(ILayouter layouter)

#### getLayouter

    public ILayouter getLayouter()