use of org.knime.base.node.viz.pie.datamodel.PieVizModel 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();
}
}
});
}
use of org.knime.base.node.viz.pie.datamodel.PieVizModel in project knime-core by knime.
the class PiePlotter method updatePaintModel.
/**
* {@inheritDoc}
*/
@Override
public void updatePaintModel() {
final PieVizModel vizModel = getVizModel();
if (vizModel == null) {
LOGGER.debug("VizModel was null");
return;
}
final PieDrawingPane drawingPane = getPieDrawingPane();
drawingPane.reset();
if (m_infoMsg == null) {
setPieSections(vizModel);
} else {
drawingPane.setInfoMsg(m_infoMsg);
}
drawingPane.setVizModel(vizModel);
}
use of org.knime.base.node.viz.pie.datamodel.PieVizModel in project knime-core by knime.
the class PiePlotter method hiLiteSelected.
/**
* {@inheritDoc}
*/
@Override
public void hiLiteSelected() {
final PieVizModel vizModel = getVizModel();
if (vizModel == null || !vizModel.supportsHiliting()) {
LOGGER.debug("VizModel doesn't support hiliting or was null");
return;
}
final Set<RowKey> selectedKeys = vizModel.getSelectedKeys();
delegateHiLite(selectedKeys);
repaint();
}
use of org.knime.base.node.viz.pie.datamodel.PieVizModel in project knime-core by knime.
the class PiePlotter method selectElementsIn.
/**
* {@inheritDoc}
*/
@Override
public void selectElementsIn(final Rectangle selectionRectangle) {
final PieVizModel vizModel = getVizModel();
if (vizModel == null) {
return;
}
vizModel.selectElement(selectionRectangle);
if (vizModel.explodeSelectedSections()) {
updatePaintModel();
}
final P properties = getPropertiesPanel();
if (properties != null) {
properties.updateHTMLDetailsPanel(vizModel.getHTMLDetailData());
}
repaint();
}
use of org.knime.base.node.viz.pie.datamodel.PieVizModel in project knime-core by knime.
the class PiePlotter method unHiLiteAll.
/**
* {@inheritDoc}
*/
public void unHiLiteAll(KeyEvent event) {
final PieVizModel vizModel = getVizModel();
if (vizModel == null || !vizModel.supportsHiliting()) {
LOGGER.debug("VizModel doesn't support hiliting or was null");
return;
}
vizModel.unHiliteAll();
repaint();
}
Aggregations