Search in sources :

Example 26 with ModelContent

use of org.knime.core.node.ModelContent in project knime-core by knime.

the class AbstractSimplePortObjectSpec method getViews.

/**
 * {@inheritDoc}
 */
@Override
public JComponent[] getViews() {
    ModelContent model = new ModelContent("Model Content Spec");
    save(model);
    return new JComponent[] { new ModelContentOutPortView(model) };
}
Also used : ModelContent(org.knime.core.node.ModelContent) JComponent(javax.swing.JComponent) ModelContentOutPortView(org.knime.core.node.workflow.ModelContentOutPortView)

Example 27 with ModelContent

use of org.knime.core.node.ModelContent in project knime-core by knime.

the class AbstractSimplePortObject method getViews.

/**
 * {@inheritDoc}
 */
@Override
public JComponent[] getViews() {
    try {
        ModelContent model = new ModelContent("Model Content");
        save(model, new ExecutionMonitor());
        return new JComponent[] { new ModelContentOutPortView(model) };
    } catch (CanceledExecutionException cee) {
    // should not be possible
    }
    return null;
}
Also used : CanceledExecutionException(org.knime.core.node.CanceledExecutionException) ModelContent(org.knime.core.node.ModelContent) JComponent(javax.swing.JComponent) ExecutionMonitor(org.knime.core.node.ExecutionMonitor) ModelContentOutPortView(org.knime.core.node.workflow.ModelContentOutPortView)

Example 28 with ModelContent

use of org.knime.core.node.ModelContent in project knime-core by knime.

the class ColorHandlerPortObject method getViews.

/**
 * {@inheritDoc}
 */
@Override
public JComponent[] getViews() {
    ModelContent model = new ModelContent("Color");
    getSpec().getColumnSpec(0).getColorHandler().save(model);
    return new JComponent[] { new ModelContentOutPortView(model) };
}
Also used : ModelContent(org.knime.core.node.ModelContent) JComponent(javax.swing.JComponent) ModelContentOutPortView(org.knime.core.node.workflow.ModelContentOutPortView)

Example 29 with ModelContent

use of org.knime.core.node.ModelContent in project knime-core by knime.

the class NaiveBayesLearnerNodeModel method saveInternals.

/**
 * {@inheritDoc}
 */
@Override
protected void saveInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException {
    final File modelFile = new File(nodeInternDir, CFG_DATA);
    final FileOutputStream modelOut = new FileOutputStream(modelFile);
    final ModelContent myModel = new ModelContent(CFG_DATA_MODEL);
    m_model.savePredictorParams(myModel);
    myModel.saveToXML(modelOut);
}
Also used : ModelContent(org.knime.core.node.ModelContent) FileOutputStream(java.io.FileOutputStream) File(java.io.File)

Aggregations

ModelContent (org.knime.core.node.ModelContent)29 File (java.io.File)15 FileOutputStream (java.io.FileOutputStream)15 BufferedOutputStream (java.io.BufferedOutputStream)12 GZIPOutputStream (java.util.zip.GZIPOutputStream)11 ModelContentWO (org.knime.core.node.ModelContentWO)7 JComponent (javax.swing.JComponent)6 ModelContentOutPortView (org.knime.core.node.workflow.ModelContentOutPortView)6 DataTableSpec (org.knime.core.data.DataTableSpec)3 ZipEntry (java.util.zip.ZipEntry)2 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)2 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 OutputStream (java.io.OutputStream)1 LinkedHashSet (java.util.LinkedHashSet)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 DataColumnSpec (org.knime.core.data.DataColumnSpec)1 DataColumnSpecCreator (org.knime.core.data.DataColumnSpecCreator)1 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)1