/** * Do import for the specified type and file name. * * @param modelType the model type * @param fileName the file name */ public void doImport(InformationModelType modelType, final String fileName) { Preconditions.checkNotNull(modelType); Preconditions.checkNotNull(fileName); // Make sure in application thread. FxUtils.checkFxUserThread(); // Update UI. modelTypeLabel.setText(modelType.getDisplayName()); fileNameLabel.setText(fileName); // Instantiate appropriate importer class. ImportHandler importHandler = null; switch (modelType) { case CEM: importHandler = new CEMImporter(); break; case HeD: importHandler = new HeDImporter(); break; case FHIM: importHandler = new FHIMImporter(); break; default: throw new UnsupportedOperationException( modelType.getDisplayName() + " import not yet supported in ISAAC."); } // Do work in background. Task<InformationModel> task = new ImporterTask(fileName, importHandler); // Bind cursor to task state. ObjectBinding<Cursor> cursorBinding = Bindings.when(task.runningProperty()).then(Cursor.WAIT).otherwise(Cursor.DEFAULT); this.getScene().cursorProperty().bind(cursorBinding); Thread t = new Thread(task, "Importer_" + modelType); t.setDaemon(true); t.start(); }
public void setConcept(ConceptVersionBI concept) { // Make sure in application thread. FxUtils.checkFxUserThread(); controller_.setConcept(concept); }