use of org.knime.core.node.DefaultNodeProgressMonitor in project knime-core by knime.
the class JoinerJoinAnyTest method setUp.
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
NodeFactory<NodeModel> dummyFactory = (NodeFactory) new VirtualParallelizedChunkPortObjectInNodeFactory(new PortType[0]);
m_exec = new ExecutionContext(new DefaultNodeProgressMonitor(), new Node(dummyFactory), SingleNodeContainer.MemoryPolicy.CacheOnDisc, new HashMap<Integer, ContainerTable>());
}
use of org.knime.core.node.DefaultNodeProgressMonitor in project knime-core by knime.
the class TableNodeView method writeToCSV.
/**
* Called by the JMenu item "Write to CVS", it write the table as shown in
* table view to a CSV file.
*
* @param file the file to write to
*/
private void writeToCSV(final File file) {
// CSV Writer supports ExecutionMonitor. Some table may be big.
DefaultNodeProgressMonitor progMon = new DefaultNodeProgressMonitor();
ExecutionMonitor e = new ExecutionMonitor(progMon);
// Frame of m_tableView (if any)
Frame f = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, m_tableView);
final NodeProgressMonitorView progView = new NodeProgressMonitorView(f, progMon);
// CSV Writer does not support 1-100 progress (unknown row count)
progView.setShowProgress(false);
// Writing is done in a thread (allows repainting of GUI)
final CSVWriterThread t = new CSVWriterThread(file, e);
t.start();
// A thread that waits for t to finish and then disposes the prog view
new Thread(new Runnable() {
@Override
public void run() {
try {
t.join();
} catch (InterruptedException ie) {
// do nothing. Only dispose the view
} finally {
progView.dispose();
}
}
}).start();
progView.pack();
progView.setLocationRelativeTo(m_tableView);
progView.setVisible(true);
}
use of org.knime.core.node.DefaultNodeProgressMonitor in project knime-core by knime.
the class AbstractColumnTableSorterTest method setUp.
/**
* @throws java.lang.Exception
*/
@SuppressWarnings("rawtypes")
@Before
public void setUp() throws Exception {
@SuppressWarnings("unchecked") NodeFactory<NodeModel> dummyFactory = (NodeFactory) new VirtualParallelizedChunkPortObjectInNodeFactory(new PortType[0]);
m_exec = new ExecutionContext(new DefaultNodeProgressMonitor(), new Node(dummyFactory), SingleNodeContainer.MemoryPolicy.CacheOnDisc, new HashMap<Integer, ContainerTable>());
DataColumnSpec[] colSpecs = new DataColumnSpec[] { new DataColumnSpecCreator(FEATURE1, DoubleCell.TYPE).createSpec(), new DataColumnSpecCreator(FEATURE2, DoubleCell.TYPE).createSpec(), new DataColumnSpecCreator(STRING_FEATURE, StringCell.TYPE).createSpec(), new DataColumnSpecCreator(CLASS, StringCell.TYPE).createSpec() };
DataTableSpec spec = new DataTableSpec(colSpecs);
final BufferedDataContainer container = m_exec.createDataContainer(spec);
int i = 0;
container.addRowToTable(creatRow(i++, 1, 8, "A", "AClass8"));
container.addRowToTable(creatRow(i++, 2, 2, "Z", "ZClass2"));
container.addRowToTable(creatRow(i++, 3, 5, "B", "BClass5"));
container.addRowToTable(creatRow(i++, 4, 0, "E", "EClass0"));
container.addRowToTable(creatRow(i++, 5, 1, "F", "FClass1"));
container.addRowToTable(creatRow(i++, 6, 7, "G", "GClass7"));
container.addRowToTable(creatRow(i++, 7, 9, "H", "HClass9"));
container.addRowToTable(creatRow(i++, 8, 8, null, "Class8"));
container.close();
testTable = container.getTable();
final BufferedDataContainer emptyContainer = m_exec.createDataContainer(spec);
emptyContainer.close();
emptyTestTable = emptyContainer.getTable();
MemoryAlertSystemTest.forceGC();
}
use of org.knime.core.node.DefaultNodeProgressMonitor in project knime-core by knime.
the class Enh1536_CancelDuringLoad method testCancelWhileLoad.
@Test
public void testCancelWhileLoad() throws Exception {
int previousChildCount = WorkflowManager.ROOT.getNodeContainers().size();
LOAD_NODE_STATE_THREAD_LOCAL.set(LoadNodeState.Default);
DefaultNodeProgressMonitor progMon = NODE_PROGRESS_THREAD_LOCAL.get();
try {
final WorkflowLoadHelper loadHelper = new WorkflowLoadHelper(m_workflowDirectory);
WorkflowManager.ROOT.load(m_workflowDirectory, new ExecutionMonitor(progMon), loadHelper, true);
fail("Workflow should not load as it's canceled");
} catch (CanceledExecutionException e) {
assertEquals(LoadNodeState.MiddleNodeCanceled, LOAD_NODE_STATE_THREAD_LOCAL.get());
} finally {
LOAD_NODE_STATE_THREAD_LOCAL.set(null);
}
assertEquals(previousChildCount, WorkflowManager.ROOT.getNodeContainers().size());
}
use of org.knime.core.node.DefaultNodeProgressMonitor in project knime-core by knime.
the class CovarianceMatrixCalculatorTest method setUp.
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
@SuppressWarnings({ "unchecked", "rawtypes" }) NodeFactory<NodeModel> dummyFactory = (NodeFactory) new VirtualParallelizedChunkPortObjectInNodeFactory(new PortType[0]);
m_exec = new ExecutionContext(new DefaultNodeProgressMonitor(), new Node(dummyFactory), SingleNodeContainer.MemoryPolicy.CacheOnDisc, new HashMap<Integer, ContainerTable>());
}
Aggregations