Package com.treemap.swing
Class DefaultTreeMapController<N,Row,Column>
java.lang.Object
com.treemap.swing.DefaultTreeMapController<N,Row,Column>
- All Implemented Interfaces:
TreeMapController<JComponent,
N, Row, Column, Color, Font>
public class DefaultTreeMapController<N,Row,Column>
extends Object
implements TreeMapController<JComponent,N,Row,Column,Color,Font>
Default controller mediating user interactions with a TreeMapView. It currently supports selection, zooming, panning
and drilling.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionprotected Component
createPopupMenuEntry
(N node, Column c) boolean
boolean
boolean
boolean
void
setImprovedBorderZooming
(boolean improvedBorderZooming) Enabling it will make use of the DefaultTreeMapController.zoomingCenterFunction() to correct the focus point of the zoom.void
setMultipleSelectionEnabled
(boolean multipleSelectionEnabled) void
setPopupMenu
(JPopupMenu popupMenu) void
setSelectOnPopupTrigger
(boolean selectOnPopupTrigger) Defines whether selection will occur prior to the display of the context menu.void
setView
(TreeMapView<JComponent, N, Row, Column, Color, Font> view) Replace the view currently under control.void
setZoomingEnabled
(boolean zoomingEnabled) Controls whether the zooming is permitted.protected double
zoomingCenterFunction
(double center) Currently returnsMath.tanh(x * 3)
.
-
Field Details
-
_view
-
-
Constructor Details
-
DefaultTreeMapController
public DefaultTreeMapController() -
DefaultTreeMapController
-
-
Method Details
-
zoomingCenterFunction
protected double zoomingCenterFunction(double center) Currently returnsMath.tanh(x * 3)
. Can be overridden to use other (e.g. logistic) function.- Parameters:
center
- the center within a normalized (-1..1) range- Returns:
- the new center within a normalized (-1..1) range
-
setView
Replace the view currently under control.- Specified by:
setView
in interfaceTreeMapController<JComponent,
N, Row, Column, Color, Font> - Parameters:
view
- the TreeMapView to use
-
createPopupMenuEntry
- Throws:
URISyntaxException
-
isMultipleSelectionEnabled
public boolean isMultipleSelectionEnabled() -
setMultipleSelectionEnabled
public void setMultipleSelectionEnabled(boolean multipleSelectionEnabled) -
isSelectOnPopupTrigger
public boolean isSelectOnPopupTrigger() -
setSelectOnPopupTrigger
public void setSelectOnPopupTrigger(boolean selectOnPopupTrigger) Defines whether selection will occur prior to the display of the context menu.- Parameters:
selectOnPopupTrigger
- true if selection should occur, false otherwise
-
getPopupMenu
-
setPopupMenu
-
isImprovedBorderZooming
public boolean isImprovedBorderZooming() -
setImprovedBorderZooming
public void setImprovedBorderZooming(boolean improvedBorderZooming) Enabling it will make use of the DefaultTreeMapController.zoomingCenterFunction() to correct the focus point of the zoom.- Parameters:
improvedBorderZooming
- true to enable customized zooming function, false otherwise.
-
setZoomingEnabled
public void setZoomingEnabled(boolean zoomingEnabled) Description copied from interface:TreeMapController
Controls whether the zooming is permitted.- Specified by:
setZoomingEnabled
in interfaceTreeMapController<JComponent,
N, Row, Column, Color, Font> - Parameters:
zoomingEnabled
- true to enable zooming, false otherwise.
-
isZoomingEnabled
public boolean isZoomingEnabled()- Specified by:
isZoomingEnabled
in interfaceTreeMapController<JComponent,
N, Row, Column, Color, Font>
-