Search in sources :

Example 16 with AggregationMethod

use of org.knime.base.node.viz.aggregation.AggregationMethod in project knime-core by knime.

the class PieNodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    m_allRows.validateSettings(settings);
    m_noOfRows.validateSettings(settings);
    m_pieColumn.validateSettings(settings);
    m_aggrMethod.validateSettings(settings);
    final String aggrMethod = ((SettingsModelString) m_aggrMethod.createCloneWithValidatedValue(settings)).getStringValue();
    final AggregationMethod method = AggregationMethod.getMethod4Command(aggrMethod);
    m_aggrColumn.validateSettings(settings);
    if (!AggregationMethod.COUNT.equals(method)) {
        final String value = ((SettingsModelString) m_aggrColumn.createCloneWithValidatedValue(settings)).getStringValue();
        if (value == null) {
            throw new InvalidSettingsException("No aggregation column only valid for method count");
        }
    }
}
Also used : AggregationMethod(org.knime.base.node.viz.aggregation.AggregationMethod) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 17 with AggregationMethod

use of org.knime.base.node.viz.aggregation.AggregationMethod in project knime-core by knime.

the class PieNodeModel method getVizModel.

/**
 * @return the {@link PieVizModel}. Could be null.
 */
public D getVizModel() {
    D vizModel = null;
    try {
        vizModel = getVizModelInternal();
    } catch (final TooManySectionsException e) {
        setWarningMessage(e.getMessage());
        LOGGER.error(e.getMessage());
    }
    if (vizModel == null) {
        return null;
    }
    final AggregationMethod method = AggregationMethod.getMethod4Command(m_aggrMethod.getStringValue());
    vizModel.setAggregationMethod(method);
    return vizModel;
}
Also used : AggregationMethod(org.knime.base.node.viz.aggregation.AggregationMethod) TooManySectionsException(org.knime.base.node.viz.pie.util.TooManySectionsException)

Aggregations

AggregationMethod (org.knime.base.node.viz.aggregation.AggregationMethod)17 HistogramLayout (org.knime.base.node.viz.histogram.HistogramLayout)5 Rectangle2D (java.awt.geom.Rectangle2D)4 ColorColumn (org.knime.base.node.viz.histogram.util.ColorColumn)4 Point (java.awt.Point)3 Rectangle (java.awt.Rectangle)3 AbstractHistogramVizModel (org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel)3 DataColumnSpec (org.knime.core.data.DataColumnSpec)3 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)3 Color (java.awt.Color)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 ItemEvent (java.awt.event.ItemEvent)2 ItemListener (java.awt.event.ItemListener)2 Arc2D (java.awt.geom.Arc2D)2 ChangeEvent (javax.swing.event.ChangeEvent)2 ChangeListener (javax.swing.event.ChangeListener)2 BinDataModel (org.knime.base.node.viz.histogram.datamodel.BinDataModel)2 Dimension (java.awt.Dimension)1 Graphics2D (java.awt.Graphics2D)1