SwingTreeMap

A facade to the TreeMap model-view-controller (MVC) architecture. In brief, the controller collects user input, the model manipulates application data, and the view presents results to the user. This class wraps a TreeMapModel, TreeMapView, and TreeMapController together. It allows easy loading of the data and customization of the most common settings.

Here is a simplistic example of how to get started with this class within minutes:

`
import com.treemap.TreeMap;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

public class Hello {
public static void main(String[] args) {
// Defining the data, column names and types
Object[][] data = new Object[][]{
{"Hello", 12, 3.0},
{"from", 11, 4.0},
{"the", 9, 5.0},
{"TreeMap", 8, 6.0},
{"World!", 7, 7.0},
};
Object[] columnNames = new Object[]{"Name", "Value", "Strength"};
final Class[] columnTypes = new Class[]{String.class, Integer.class, Double.class};

// Creating a standard Swing TableModel
TableModel tableModel = new DefaultTableModel(data, columnNames) {
public Class getColumnClass(int columnIndex) {
return columnTypes[columnIndex];
}
};

// Creating the TreeMap
TreeMap treeMap = new TreeMap(tableModel);

// Tuning the appearance of the TreeMap
treeMap.setSizeByName("Value");
treeMap.setColor(2);
treeMap.setBackgroundByName("Name");
treeMap.setLabels();

// Creating a frame to display
final JFrame frame = new JFrame("Hello from the TreeMap World!");
frame.setSize(600, 600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(treeMap);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
`
*

The code above will produce the following output:

Constructors

Link copied to clipboard

Creates a TreeMap component with its native data model.

constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val component: CPComponent
Link copied to clipboard

Returns the controller used for the treemap.

Link copied to clipboard

Returns the model used for the treemap.

Link copied to clipboard

Returns the view used for the treemap.

Functions

Link copied to clipboard
open override fun setAggregation(aggregation: Aggregation?)

Defines the aggregation scheme to use to aggregate values of the treemap.

Link copied to clipboard
open override fun setAlgorithm(algorithm: Algorithm?)

Defines the algorithm to use to lay out the treemap.

Link copied to clipboard
open override fun setBackground(column: Int)

Defines the field to use for background labeling.

Link copied to clipboard
open override fun setBackgroundByName(columnName: String?)

Defines the field to use for background labeling.

Link copied to clipboard
open override fun setColor(column: Int)

Defines the field to use for coloring.

Link copied to clipboard
open override fun setColorByName(columnName: String?)

Defines the field to use for coloring.

Link copied to clipboard
open override fun setDepth(depth: Depth?)

Defines the depth to use to lay out the treemap.

Link copied to clipboard
open override fun setGroupBy(vararg columns: Int)

Defines the fields to be use for grouping.

Link copied to clipboard
open override fun setGroupByByNames(vararg columnNames: String?)

Defines the fields to be use for grouping.

Link copied to clipboard
open override fun setHeaderBackgroundColor(color: MkColor?)

Sets the background color to use for drawing the headers.

Link copied to clipboard
open override fun setHeaderFont(font: MkFont?)

Sets the font used for labeling the headings.

Link copied to clipboard
open override fun setHeaderForegroundColor(color: MkColor?)

Sets the foreground color to use for drawing the headers.

Link copied to clipboard
open override fun setHeight(column: Int)

Defines the field to use for mapping the height.

Link copied to clipboard
open override fun setHeightByName(columnName: String?)

Defines the field to use for mapping the height.

Link copied to clipboard
open override fun setLabeling(labeling: Labeling?)

Defines the labeling scheme to use to draw the treemap.

Link copied to clipboard
open override fun setLabelingBackgroundColor(color: MkColor?)

Sets the background color to use for drawing the labels.

Link copied to clipboard
open override fun setLabelingFont(font: MkFont?)

Sets the font used for labeling.

Link copied to clipboard
open override fun setLabelingForegroundColor(color: MkColor?)

Sets the foreground color to use for drawing the labels.

Link copied to clipboard
open override fun setLabels(vararg columns: Int)

Defines the fields to be use for labeling.

Link copied to clipboard
open override fun setLabelsByNames(vararg columnNames: String?)

Defines the fields to be use for labeling.

Link copied to clipboard
open override fun setLightSourceAmbient(value: Double)

Sets the light source ambient intensity used for drawing the cushions.

Link copied to clipboard
open override fun setLightSourceHeight(value: Double)

Sets the light source height used for drawing the cushions.

Link copied to clipboard
open override fun setLightSourceX(value: Double)

Sets the light source X position used for drawing the cushions.

Link copied to clipboard
open override fun setLightSourceY(value: Double)

Sets the light source Y position used for drawing the cushions.

Link copied to clipboard
open override fun setLightSourceZ(value: Double)

Sets the light source Z position used for drawing the cushions.

Link copied to clipboard
open override fun setNesting(nesting: Nesting?)

Defines the nesting to use to lay out the treemap.

Link copied to clipboard
open override fun setOrdering(ordering: Ordering?)

Defines the ordering to use to lay out the treemap.

Link copied to clipboard
open override fun setRendering(rendering: Rendering?)

Defines the rendering scheme to use to draw the treemap.

Link copied to clipboard
open override fun setScale(scale: Scale?)

Defines the scaling scheme to use to project values the treemap.

Link copied to clipboard
open override fun setSize(column: Int)

Defines the field to use to represent the size.

Link copied to clipboard
open override fun setSizeByName(columnName: String?)

Defines the field to use to represent the size.

Link copied to clipboard
open override fun setToolTip(vararg columns: Int)

Defines the fields to be use for grouping.

Link copied to clipboard
open override fun setToolTipByNames(vararg columnNames: String?)

Defines the fields to be use for grouping.