Package org.eclipse.zest.cloudio
Class TagCloud
- All Implemented Interfaces:
- Drawable
- 
Field Summary
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddMouseListener(MouseListener listener) voidaddMouseMoveListener(MouseMoveListener listener) voidaddMouseTrackListener(MouseTrackListener listener) voidaddMouseWheelListener(MouseWheelListener listener) voidaddSelectionListener(SelectionListener listener) protected voidcalcExtents(IProgressMonitor monitor) intgetBoost()floatprotected RectangleReturns the maximum cloud area.Returns theImageDataof the text layer image (all rendered elements, unscaled, without highlighted selection).intintReturns the set of selected elements.getWords()doublegetZoom()intlayoutCloud(IProgressMonitor monitor, boolean recalc) Does a full relayout of all displayed elements.protected intlayoutWords(Collection<Word> wordsToUse, IProgressMonitor monitor) Generates the layout of the given words.voidvoidremoveMouseListener(MouseListener listener) voidremoveMouseMoveListener(MouseMoveListener listener) voidremoveMouseTrackListener(MouseTrackListener listener) voidremoveMouseWheelListener(MouseWheelListener listener) voidremoveSelectionListener(SelectionListener listener) voidsetAntiAlias(boolean enabled) Enable or disable antialiasing.voidsetBackground(Color color) voidsetBackgroundMask(ImageData bgData) Set a background mask to define the drawable area of the cloud.voidsetBoost(int boost) Enable boosting for the firstboostelements.voidsetBoostFactor(float boostFactor) voidsetLayouter(ILayouter layouter) voidsetMaxFontSize(int maxSize) Sets the maximum font size (which must be a value greater 0).voidsetMinFontSize(int size) Sets the minimum font size.voidsetOpacity(int opacity) Sets the opacity of the words, which must be a value between 0 and 255 (inclusive).voidsetSelection(Set<Word> words) Marks the set of elements as selected.voidsetSelectionColor(Color color) Sets the highlight color of the cloud.intsetWords(List<Word> values, IProgressMonitor monitor) Sets the given list as input of the tag cloud, replacing any previous content.voidzoomFit()Resets the zoom such that the generated cloud will fit extactly into the available space (unless the zoom factor is too small or too large).voidzoomIn()Zooms in, by the factor of 10 percent.voidzoomOut()Zooms out, by the factor of 10 percent.voidResets the zoom to 100 % (original size)Methods inherited from class org.eclipse.swt.widgets.CanvasdrawBackground, getCaret, getIME, scroll, setCaret, setFont, setIMEMethods inherited from class org.eclipse.swt.widgets.Compositechanged, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, redraw, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toStringMethods inherited from class org.eclipse.swt.widgets.ScrollablecomputeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsModeMethods inherited from class org.eclipse.swt.widgets.ControladdControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods inherited from class org.eclipse.swt.widgets.WidgetaddDisposeListener, addListener, addTypedListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setDataMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.swt.graphics.DrawableisAutoScalable
- 
Constructor Details- 
TagCloudCreates a new Tag cloud on the given parent. When using this constructor, please read the following carefully:
 Parameteraccuracydefines the size of the raster used when placing strings, and must be a value greater than0. An accuracy of1will theoretically give best results, as the drawable area is analyzed most detailed, but this will also be very slow.
 ParametermaxSizedefines the maximum size of the drawable area and must be a power-of ofaccuracy, such thataccuracy^n=maxSizeholds.
 To add scroll bars to the cloud, useSWT.HORIZONTALandSWT.VERTICAL.- Parameters:
- parent-
- style-
- accuracy-
- maxSize-
 
- 
TagCloudCreates a new Tag cloud on the given parent. To add scroll bars to the cloud, useSWT.HORIZONTALandSWT.VERTICAL. This is a shortcut toTagCloud(Composite, int, int, int), which sets the accuracy to5and the maximum size of the drawable area to5120.- Parameters:
- parent-
- style-
 
 
- 
- 
Method Details- 
zoomResetpublic void zoomReset()Resets the zoom to 100 % (original size)
- 
getZoompublic double getZoom()
- 
zoomFitpublic void zoomFit()Resets the zoom such that the generated cloud will fit extactly into the available space (unless the zoom factor is too small or too large).
- 
zoomInpublic void zoomIn()Zooms in, by the factor of 10 percent.
- 
zoomOutpublic void zoomOut()Zooms out, by the factor of 10 percent.
- 
getCloudAreaReturns the maximum cloud area.
- 
calcExtentsCalculates the bounds of each word, by determining theRectangleaPathwould require to render an element.- Parameters:
- monitor-
 
- 
layoutWordsGenerates the layout of the given words.- Parameters:
- wordsToUse-
- monitor- may be- null.
- Returns:
- the number of words which could be placed
 
- 
setWordsSets the given list as input of the tag cloud, replacing any previous content. By default, available word positions will be determined in-order, starting with the element at position 0.- Parameters:
- values-
- monitor-
 
- 
setBackgroundMaskSet a background mask to define the drawable area of the cloud. The image must be a square containing black and white pixels only. It is scaled to the full size of the drawable region. Black pixels are interpreted as used, such that strings will be drawn on white areas only. If parameterbgDataisnull, the old mask will be removed.- Parameters:
- bgData- a square containing b&w pixels only
 
- 
addMouseListener- Overrides:
- addMouseListenerin class- Control
 
- 
addMouseMoveListener- Overrides:
- addMouseMoveListenerin class- Control
 
- 
addMouseTrackListener- Overrides:
- addMouseTrackListenerin class- Control
 
- 
addMouseWheelListener- Overrides:
- addMouseWheelListenerin class- Control
 
- 
addSelectionListener
- 
removeMouseListener- Overrides:
- removeMouseListenerin class- Control
 
- 
removeMouseMoveListener- Overrides:
- removeMouseMoveListenerin class- Control
 
- 
removeMouseTrackListener- Overrides:
- removeMouseTrackListenerin class- Control
 
- 
removeMouseWheelListener- Overrides:
- removeMouseWheelListenerin class- Control
 
- 
removeSelectionListener
- 
setSelectionMarks the set of elements as selected.- Parameters:
- words- must not be- null.
 
- 
redrawTextLayerImagepublic void redrawTextLayerImage()
- 
getSelectionReturns the set of selected elements. Never returnsnull.
- 
setSelectionColorSets the highlight color of the cloud. Default color is red.- Parameters:
- color-
 
- 
setBackground- Overrides:
- setBackgroundin class- Control
 
- 
layoutCloudDoes a full relayout of all displayed elements.- Parameters:
- monitor-
 
- 
setMaxFontSizepublic void setMaxFontSize(int maxSize) Sets the maximum font size (which must be a value greater 0). Note that strings which are too large to fit into the cloud region will be skipped. By default, this value is 500.- Parameters:
- maxSize-
 
- 
setOpacitypublic void setOpacity(int opacity) Sets the opacity of the words, which must be a value between 0 and 255 (inclusive). Currently not very useful...- Parameters:
- opacity-
 
- 
setMinFontSizepublic void setMinFontSize(int size) Sets the minimum font size. Should be a reasonable value > 0 (twice ofaccuracyis recommended). By default, this value is 12.- Parameters:
- size-
 
- 
getImageDataReturns theImageDataof the text layer image (all rendered elements, unscaled, without highlighted selection). Can be used to print or export the cloud.
- 
setBoostpublic void setBoost(int boost) Enable boosting for the firstboostelements. By default, no elements are boosted.- Parameters:
- boost-
 
- 
setAntiAliaspublic void setAntiAlias(boolean enabled) Enable or disable antialiasing. Enabled by default.- Parameters:
- enabled-
 
- 
setBoostFactorpublic void setBoostFactor(float boostFactor) 
- 
getSelectionColor
- 
setLayouter
- 
getMaxFontSizepublic int getMaxFontSize()
- 
getMinFontSizepublic int getMinFontSize()
- 
getBoostpublic int getBoost()
- 
getBoostFactorpublic float getBoostFactor()
- 
getWords
- 
getLayouter
 
-