|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent com.jidesoft.treemap.TreeMap<N>
public class TreeMap<N>
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.jidesoft.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:
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
TreeMap()
Creates a TreeMap component with default settings and configuration. |
|
TreeMap(TableModel tableModel)
Creates a TreeMap component with the specified Swing TableModel. |
|
TreeMap(TreeMapModel<N> model)
Creates a TreeMap component with the its native data model. |
Method Summary | |
---|---|
protected TreeMapController<N> |
createController(TreeMapView<N> view)
|
protected TreeMapModel |
createTreeMapModel(TableModel tableModel)
|
protected TreeMapView<N> |
createView()
|
TreeMapController<N> |
getController()
Returns the controller used for the treemap. |
TreeMapModel<N> |
getModel()
Returns the model used for the treemap. |
TreeMapView<N> |
getView()
Returns the view used for the treemap. |
static void |
main(String[] args)
Sort of a Hello World! application to demonstrate the most basic use of the TreeMap API |
void |
setAggregation(Aggregation aggregation)
Defines the aggregation scheme to use to aggregate values of the treemap. |
void |
setAlgorithm(Algorithm algorithm)
Defines the algorithm to use to lay out the treemap. |
void |
setBackground(int column)
Defines the field to use for background labeling. |
void |
setBackgroundByName(String columnName)
Defines the field to use for background labeling. |
void |
setColor(int column)
Defines the field to use for coloring. |
void |
setColorByName(String columnName)
Defines the field to use for coloring. |
void |
setController(TreeMapController<N> controller)
Sets the controller to be used for the treemap and register the view currently in use. |
void |
setDepth(Depth depth)
Defines the depth to use to lay out the treemap. |
void |
setGroupBy(int... columns)
Defines the fields to be use for grouping. |
void |
setGroupByByNames(String... columnNames)
Defines the fields to be use for grouping. |
void |
setHeaderBackgroundColor(Color color)
Sets the background color to use for drawing the headers. |
void |
setHeaderFont(Font font)
Sets the font used for labeling the headings. |
void |
setHeaderForegroundColor(Color color)
Sets the foreground color to use for drawing the headers. |
void |
setHeight(int column)
Defines the field to use for mapping the height. |
void |
setHeightByName(String columnName)
Defines the field to use for mapping the height. |
void |
setLabeling(Labeling labeling)
Defines the labeling scheme to use to draw the treemap. |
void |
setLabelingBackgroundColor(Color color)
Sets the background color to use for drawing the labels. |
void |
setLabelingFont(Font font)
Sets the font used for labeling. |
void |
setLabelingForegroundColor(Color color)
Sets the foreground color to use for drawing the labels. |
void |
setLabels(int... columns)
Defines the fields to be use for labeling. |
void |
setLabelsByNames(String... columnNames)
Defines the fields to be use for labeling. |
void |
setLightSourceAmbient(double value)
Sets the light source ambient intensity used for drawing the cushions. |
void |
setLightSourceHeight(double value)
Sets the light source height used for drawing the cushions. |
void |
setLightSourceX(double value)
Sets the light source X position used for drawing the cushions. |
void |
setLightSourceY(double value)
Sets the light source Y position used for drawing the cushions. |
void |
setLightSourceZ(double value)
Sets the light source Z position used for drawing the cushions. |
void |
setNesting(Nesting nesting)
Defines the nesting to use to lay out the treemap. |
void |
setOrdering(Ordering ordering)
Defines the ordering to use to lay out the treemap. |
void |
setRendering(Rendering rendering)
Defines the rendering scheme to use to draw the treemap. |
void |
setScale(Scale scale)
Defines the scaling scheme to use to project values the treemap. |
void |
setSize(int column)
Defines the field to use to represent the size. |
void |
setSizeByName(String columnName)
Defines the field to use to represent the size. |
void |
setView(TreeMapView<N> view)
Sets the view to be used for the treemap and register the model currently in use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TreeMap()
public TreeMap(TreeMapModel<N> model)
model
- a TreeMapModelpublic TreeMap(TableModel tableModel)
tableModel
- a Swing TableModelMethod Detail |
---|
public TreeMapModel<N> getModel()
public TreeMapView<N> getView()
public void setView(TreeMapView<N> view)
view
- the view to be usedpublic TreeMapController<N> getController()
public void setController(TreeMapController<N> controller)
controller
- the controller in usepublic void setGroupBy(int... columns)
columns
- the indexes of the columns to be used for groupingDefaultTreeMapSettings.getGroupByTreeMapFields()
public void setGroupByByNames(String... columnNames)
columnNames
- the names of the columns to be used for groupingDefaultTreeMapSettings.getGroupByTreeMapFields()
public void setLabels(int... columns)
columns
- the indexes of the columns to be used for labelingDefaultTreeMapSettings.getLabelTreeMapFields()
public void setLabelsByNames(String... columnNames)
columnNames
- the names of the columns to be used for labelingDefaultTreeMapSettings.getLabelTreeMapFields()
public void setBackground(int column)
column
- the index of the column to be used for background labelingDefaultTreeMapSettings.getBackgroundTreeMapField()
public void setBackgroundByName(String columnName)
columnName
- the name of the column to be used for background labelingDefaultTreeMapSettings.getBackgroundTreeMapField()
public void setSize(int column)
column
- the index of the column to be used for representing the sizeDefaultTreeMapSettings.getSizeTreeMapField()
public void setSizeByName(String columnName)
columnName
- the name of the column to be used for representing the sizeDefaultTreeMapSettings.getSizeTreeMapField()
public void setColor(int column)
column
- the index of the column to be used for coloringDefaultTreeMapSettings.getColorTreeMapField()
public void setColorByName(String columnName)
columnName
- the name of the column to be used for coloringDefaultTreeMapSettings.getColorTreeMapField()
public void setHeight(int column)
column
- the index of the column to be used for mapping the heightDefaultTreeMapSettings.getHeightTreeMapField()
public void setHeightByName(String columnName)
columnName
- the name of the column to be used for mapping the heightDefaultTreeMapSettings.getHeightTreeMapField()
public void setAlgorithm(Algorithm algorithm)
algorithm
- the algorithm to useDefaultTreeMapSettings.getAlgorithm()
,
AlgorithmFactory
public void setAggregation(Aggregation aggregation)
aggregation
- the aggregation scheme to useDefaultTreeMapSettings.getAggregation()
,
AggregationFactory
public void setScale(Scale scale)
scale
- the scale scheme to useDefaultTreeMapSettings.getScale()
,
ScaleFactory
public void setNesting(Nesting nesting)
nesting
- the nesting scheme to useDefaultTreeMapSettings.getNesting()
,
NestingFactory
public void setOrdering(Ordering ordering)
ordering
- the ordering to useDefaultTreeMapSettings.getOrdering()
,
OrderingFactory
public void setDepth(Depth depth)
depth
- the depth to useDefaultTreeMapSettings.getDepth()
,
DepthFactory
public void setLabeling(Labeling labeling)
labeling
- the labeling schem to useDefaultTreeMapFieldSettings.getLabeling()
,
LabelingFactory
public void setRendering(Rendering rendering)
rendering
- the rendering scheme to useDefaultTreeMapSettings.getRendering()
,
RenderingFactory
public void setLightSourceHeight(double value)
value
- the heightDefaultTreeMapSettings.getLightSourceHeight()
public void setLightSourceAmbient(double value)
value
- the ambient intensityDefaultTreeMapSettings.getLightSourceAmbient()
public void setLightSourceX(double value)
value
- the X positionDefaultTreeMapSettings.getLightSourceX()
public void setLightSourceY(double value)
value
- the Y positionDefaultTreeMapSettings.getLightSourceY()
public void setLightSourceZ(double value)
value
- the Z positionDefaultTreeMapSettings.getLightSourceZ()
public void setLabelingFont(Font font)
font
- the font to be usedDefaultTreeMapSettings.getLabelingFont()
public void setLabelingForegroundColor(Color color)
color
- the color to be usedDefaultTreeMapSettings.getLabelingForeground()
public void setLabelingBackgroundColor(Color color)
color
- the color to be usedDefaultTreeMapSettings.getLabelingEffectColor()
public void setHeaderFont(Font font)
font
- the font to be usedDefaultTreeMapSettings.getHeaderFont()
public void setHeaderForegroundColor(Color color)
color
- the color to be usedDefaultTreeMapSettings.getHeaderForeground()
public void setHeaderBackgroundColor(Color color)
color
- the color to be usedDefaultTreeMapSettings.getHeaderBackground()
protected TreeMapModel createTreeMapModel(TableModel tableModel)
protected TreeMapView<N> createView()
protected TreeMapController<N> createController(TreeMapView<N> view)
public static void main(String[] args)
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |