use of org.knime.base.node.viz.plotter.AbstractDrawingPane in project knime-core by knime.
the class PiePlotter method registerPropertiesChangeListener.
/**
* Registers all histogram properties listener to the histogram
* properties panel.
*/
private void registerPropertiesChangeListener() {
m_props.addShowSectionOutlineChangedListener(new ItemListener() {
public void itemStateChanged(final ItemEvent e) {
final PieVizModel vizModel = getVizModel();
if (vizModel != null) {
vizModel.setDrawSectionOutline(e.getStateChange() == ItemEvent.SELECTED);
final AbstractDrawingPane drawingPane = getPieDrawingPane();
drawingPane.repaint();
}
}
});
m_props.addLabelDisplayListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
final PieVizModel vizModel = getVizModel();
if (vizModel != null) {
final P props = getPropertiesPanel();
if (props != null) {
vizModel.setLabelDisplayPolicy(props.getLabelDisplayPolicy());
final AbstractDrawingPane drawingPane = getPieDrawingPane();
drawingPane.repaint();
}
}
}
});
m_props.addValueScaleListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
final PieVizModel vizModel = getVizModel();
if (vizModel != null) {
final P props = getPropertiesPanel();
if (props != null) {
vizModel.setValueScale(props.getValueScale());
final AbstractDrawingPane drawingPane = getPieDrawingPane();
drawingPane.repaint();
}
}
}
});
m_props.addShowDetailsListener(new ItemListener() {
public void itemStateChanged(final ItemEvent e) {
final PieVizModel vizModel = getVizModel();
if (vizModel != null) {
if (vizModel.setShowDetails(e.getStateChange() == ItemEvent.SELECTED)) {
final AbstractDrawingPane drawingPane = getPieDrawingPane();
drawingPane.repaint();
}
}
}
});
m_props.addPieSizeChangeListener(new ChangeListener() {
public void stateChanged(final ChangeEvent e) {
final JSlider source = (JSlider) e.getSource();
final int pieSize = source.getValue();
final PieVizModel vizModel = getVizModel();
if (vizModel == null) {
return;
}
if (vizModel.setPieSize((pieSize / 100.0))) {
updatePaintModel();
}
}
});
m_props.addExplodeSizeChangeListener(new ChangeListener() {
public void stateChanged(final ChangeEvent e) {
final JSlider source = (JSlider) e.getSource();
final int explodeSize = source.getValue();
final PieVizModel vizModel = getVizModel();
if (vizModel == null) {
return;
}
if (vizModel.setExplodeSize((explodeSize / 100.0))) {
updatePaintModel();
}
}
});
m_props.addAggrMethodListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
final PieVizModel vizModel = getVizModel();
if (vizModel == null) {
return;
}
final String methodName = e.getActionCommand();
if (!AggregationMethod.valid(methodName)) {
throw new IllegalArgumentException("No valid aggregation method");
}
final AggregationMethod aggrMethod = AggregationMethod.getMethod4Command(methodName);
if (vizModel.setAggregationMethod(aggrMethod)) {
updatePaintModel();
}
}
});
m_props.addShowMissingValSectionListener(new ItemListener() {
public void itemStateChanged(final ItemEvent e) {
final PieVizModel vizModel = getVizModel();
if (vizModel == null) {
return;
}
if (vizModel.setShowMissingValSection(e.getStateChange() == ItemEvent.SELECTED)) {
// reset the details view if the missing section was selected
final P properties = getPropertiesPanel();
if (properties != null) {
properties.updateHTMLDetailsPanel(vizModel.getHTMLDetailData());
}
updatePaintModel();
}
}
});
m_props.addExplodeSelectedSectionListener(new ItemListener() {
public void itemStateChanged(final ItemEvent e) {
final PieVizModel vizModel = getVizModel();
if (vizModel == null) {
return;
}
if (vizModel.setExplodeSelectedSections(e.getStateChange() == ItemEvent.SELECTED)) {
updatePaintModel();
}
}
});
}
Aggregations