| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
package org.jfree.chart.editor; |
| 27 | |
|
| 28 | |
import java.awt.Graphics2D; |
| 29 | |
import java.awt.GridBagLayout; |
| 30 | |
import java.awt.GridBagConstraints; |
| 31 | |
import java.awt.geom.Rectangle2D; |
| 32 | |
import java.awt.geom.Point2D; |
| 33 | |
import java.awt.Point; |
| 34 | |
import java.awt.Color; |
| 35 | |
import java.awt.Rectangle; |
| 36 | |
import java.util.ResourceBundle; |
| 37 | |
|
| 38 | |
import java.lang.IllegalArgumentException; |
| 39 | |
|
| 40 | |
import javax.swing.BorderFactory; |
| 41 | |
import javax.swing.JPanel; |
| 42 | |
import javax.swing.JCheckBox; |
| 43 | |
import javax.swing.event.ChangeEvent; |
| 44 | |
import javax.swing.event.ChangeListener; |
| 45 | |
|
| 46 | |
import org.jfree.ui.RectangleEdge; |
| 47 | |
|
| 48 | |
import org.jfree.chart.ChartMouseEvent; |
| 49 | |
import org.jfree.chart.ChartMouseListener; |
| 50 | |
import org.jfree.chart.axis.HeatMapAxis; |
| 51 | |
import org.jfree.chart.axis.CategoryLabelPositions; |
| 52 | |
import org.jfree.chart.entity.HCTreeNodeEntity; |
| 53 | |
import org.jfree.chart.entity.HeatMapBlockEntity; |
| 54 | |
import org.jfree.chart.entity.EntityCollection; |
| 55 | |
import org.jfree.chart.event.PlotChangeEvent; |
| 56 | |
import org.jfree.chart.plot.HCPlot; |
| 57 | |
import org.jfree.chart.renderer.RendererState; |
| 58 | |
import org.jfree.data.hc.HCDataset; |
| 59 | |
import org.jfree.data.hc.HeatMap; |
| 60 | |
import org.jfree.data.hc.DataRange; |
| 61 | |
import org.jfree.data.hc.HCTreeNode; |
| 62 | |
|
| 63 | |
|
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
public class HCOptionsEditor implements ChangeListener { |
| 69 | |
|
| 70 | |
|
| 71 | |
private JCheckBox horizontalClusteringCB; |
| 72 | |
private JCheckBox verticalClusteringCB; |
| 73 | |
private JCheckBox rowNamesCB; |
| 74 | |
private JCheckBox columnNamesCB; |
| 75 | |
private HCPlot plot; |
| 76 | |
|
| 77 | 20 | public HCOptionsEditor (HCPlot plot) { |
| 78 | |
|
| 79 | 20 | this.plot = plot; |
| 80 | 20 | this.horizontalClusteringCB = null; |
| 81 | 20 | this.verticalClusteringCB = null; |
| 82 | 20 | this.rowNamesCB = null; |
| 83 | 20 | this.columnNamesCB = null; |
| 84 | |
|
| 85 | 20 | } |
| 86 | |
|
| 87 | |
|
| 88 | |
|
| 89 | |
|
| 90 | |
|
| 91 | |
|
| 92 | |
public void stateChanged(ChangeEvent e) { |
| 93 | |
|
| 94 | 16 | if (e.getSource() == this.horizontalClusteringCB) { |
| 95 | |
|
| 96 | 4 | boolean value = this.horizontalClusteringCB.isSelected(); |
| 97 | 4 | if (value) this.plot.showColumnTree(); |
| 98 | 2 | else this.plot.hideColumnTree(); |
| 99 | |
|
| 100 | 4 | } else if (e.getSource() == this.verticalClusteringCB) { |
| 101 | |
|
| 102 | 4 | boolean value = this.verticalClusteringCB.isSelected(); |
| 103 | 4 | if (value) this.plot.showRowTree(); |
| 104 | 2 | else this.plot.hideRowTree(); |
| 105 | |
|
| 106 | 4 | } else if (e.getSource() == this.columnNamesCB) { |
| 107 | |
|
| 108 | 4 | boolean value = this.columnNamesCB.isSelected(); |
| 109 | 4 | if (value) this.plot.showColumnNames(); |
| 110 | 2 | else this.plot.hideColumnNames(); |
| 111 | |
|
| 112 | 4 | } else if (e.getSource() == this.rowNamesCB) { |
| 113 | |
|
| 114 | 4 | boolean value = this.rowNamesCB.isSelected(); |
| 115 | 4 | if (value) this.plot.showRowNames(); |
| 116 | 2 | else this.plot.hideRowNames(); |
| 117 | |
|
| 118 | |
} |
| 119 | |
|
| 120 | 16 | } |
| 121 | |
|
| 122 | |
|
| 123 | |
|
| 124 | |
|
| 125 | |
|
| 126 | |
public JPanel getPanel() { |
| 127 | 2 | ResourceBundle lr = ResourceBundle.getBundle("org.jfree.chart.editor.LocalizationBundle"); |
| 128 | 2 | JPanel panel = new JPanel(); |
| 129 | 2 | GridBagConstraints c = new GridBagConstraints(); |
| 130 | |
|
| 131 | 2 | panel.setLayout(new GridBagLayout()); |
| 132 | 2 | c.fill = GridBagConstraints.VERTICAL; |
| 133 | 2 | panel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); |
| 134 | |
|
| 135 | 2 | c.gridx = 0; |
| 136 | 2 | c.gridy = 0; |
| 137 | 2 | this.horizontalClusteringCB = new JCheckBox( |
| 138 | |
lr.getString("Show_column_clustering"), |
| 139 | |
this.plot.getColumnTreeVisibility() |
| 140 | |
); |
| 141 | 2 | this.horizontalClusteringCB.addChangeListener(this); |
| 142 | 2 | panel.add(this.horizontalClusteringCB,c); |
| 143 | |
|
| 144 | 2 | c.gridy++; |
| 145 | 2 | this.verticalClusteringCB = new JCheckBox( |
| 146 | |
lr.getString("Show_row_clustering"), |
| 147 | |
this.plot.getRowTreeVisibility() |
| 148 | |
); |
| 149 | 2 | this.verticalClusteringCB.addChangeListener(this); |
| 150 | 2 | panel.add(this.verticalClusteringCB,c); |
| 151 | |
|
| 152 | 2 | c.gridy++; |
| 153 | 2 | this.columnNamesCB = new JCheckBox( |
| 154 | |
lr.getString("Show_column_names"), |
| 155 | |
this.plot.getColumnNamesVisibility() |
| 156 | |
); |
| 157 | 2 | this.columnNamesCB.addChangeListener(this); |
| 158 | 2 | panel.add(this.columnNamesCB,c); |
| 159 | |
|
| 160 | 2 | c.gridy++; |
| 161 | 2 | this.rowNamesCB = new JCheckBox( |
| 162 | |
lr.getString("Show_row_names"), |
| 163 | |
this.plot.getRowNamesVisibility() |
| 164 | |
); |
| 165 | 2 | this.rowNamesCB.addChangeListener(this); |
| 166 | 2 | panel.add(this.rowNamesCB,c); |
| 167 | |
|
| 168 | 2 | return panel; |
| 169 | |
} |
| 170 | |
|
| 171 | |
} |
| 172 | |
|