use of au.gov.asd.tac.constellation.graph.manager.GraphManagerListener in project constellation by constellation-app.
the class FrameworkGraphManager method resultChanged.
@Override
public final void resultChanged(final LookupEvent ev) {
final Graph oldActiveGraph = activeGraph;
activeGraph = getActiveGraph();
if (activeGraph != oldActiveGraph) {
for (final GraphManagerListener listener : new ArrayList<>(listeners)) {
listener.newActiveGraph(activeGraph);
}
}
}
use of au.gov.asd.tac.constellation.graph.manager.GraphManagerListener in project constellation by constellation-app.
the class JDBCImportController method processImport.
@Override
public void processImport() throws PluginException {
final List<ImportDefinition> definitions = configurationPane.createDefinitions(false);
final Graph importGraph = currentDestination.getGraph();
final boolean schema = schemaInitialised;
if (currentDestination instanceof SchemaDestination) {
final GraphManagerListener graphListener = new GraphManagerListener() {
private boolean opened;
@Override
public void graphOpened(final Graph graph) {
// Do nothing
}
@Override
public void graphClosed(final Graph graph) {
// Do nothing
}
@Override
public synchronized void newActiveGraph(final Graph graph) {
if (graph == importGraph && !opened) {
opened = true;
GraphManager.getDefault().removeGraphManagerListener(this);
PluginExecutor.startWith(ImportJDBCPlugin.class.getName(), false).set(ImportJDBCPlugin.DEFINITIONS_PARAMETER_ID, definitions).set(ImportJDBCPlugin.CONNECTION_PARAMETER_ID, connection).set(ImportJDBCPlugin.SCHEMA_PARAMETER_ID, schema).set(ImportJDBCPlugin.QUERY_PARAMETER_ID, query).set(ImportJDBCPlugin.USERNAME_PARAMETER_ID, username).set(ImportJDBCPlugin.PASSWORD_PARAMETER_ID, password).followedBy(ArrangementPluginRegistry.GRID_COMPOSITE).followedBy(InteractiveGraphPluginRegistry.RESET_VIEW).executeWriteLater(importGraph);
}
}
};
GraphManager.getDefault().addGraphManagerListener(graphListener);
GraphOpener.getDefault().openGraph(importGraph, "graph");
} else {
PluginExecutor.startWith(ImportJDBCPlugin.class.getName(), false).set(ImportJDBCPlugin.DEFINITIONS_PARAMETER_ID, definitions).set(ImportJDBCPlugin.CONNECTION_PARAMETER_ID, connection).set(ImportJDBCPlugin.QUERY_PARAMETER_ID, query).set(ImportJDBCPlugin.USERNAME_PARAMETER_ID, username).set(ImportJDBCPlugin.PASSWORD_PARAMETER_ID, password).set(ImportJDBCPlugin.SCHEMA_PARAMETER_ID, schema).followedBy(ArrangementPluginRegistry.GRID_COMPOSITE).followedBy(InteractiveGraphPluginRegistry.RESET_VIEW).executeWriteLater(importGraph);
}
}
use of au.gov.asd.tac.constellation.graph.manager.GraphManagerListener in project constellation by constellation-app.
the class DelimitedImportController method processImport.
@Override
public void processImport() throws PluginException {
final List<ImportDefinition> definitions = configurationPane.createDefinitions(isFilesIncludeHeadersEnabled());
final Graph importGraph = currentDestination.getGraph();
final boolean schema = schemaInitialised;
final List<File> importFiles = new ArrayList<>(files);
final ImportFileParser parser = importFileParser;
if (currentDestination instanceof SchemaDestination) {
final GraphManagerListener graphManagerListener = new GraphManagerListener() {
private boolean opened = false;
@Override
public void graphOpened(Graph graph) {
// Do nothing
}
@Override
public void graphClosed(Graph graph) {
// Do nothing
}
@Override
public synchronized void newActiveGraph(final Graph graph) {
if (graph == importGraph && !opened) {
opened = true;
GraphManager.getDefault().removeGraphManagerListener(this);
PluginExecutor.startWith(ImportExportPluginRegistry.IMPORT_DELIMITED, false).set(ImportDelimitedPlugin.DEFINITIONS_PARAMETER_ID, definitions).set(ImportDelimitedPlugin.PARSER_PARAMETER_ID, parser).set(ImportDelimitedPlugin.FILES_PARAMETER_ID, importFiles).set(ImportDelimitedPlugin.SCHEMA_PARAMETER_ID, schema).set(ImportDelimitedPlugin.PARSER_PARAMETER_IDS_PARAMETER_ID, currentParameters).set(ImportDelimitedPlugin.FILES_INCLUDE_HEADERS_PARAMETER_ID, filesIncludeHeaders).followedBy(ArrangementPluginRegistry.GRID_COMPOSITE).followedBy(InteractiveGraphPluginRegistry.RESET_VIEW).executeWriteLater(importGraph);
}
}
};
GraphManager.getDefault().addGraphManagerListener(graphManagerListener);
GraphOpener.getDefault().openGraph(importGraph, "graph");
} else {
PluginExecutor.startWith(ImportExportPluginRegistry.IMPORT_DELIMITED, false).set(ImportDelimitedPlugin.DEFINITIONS_PARAMETER_ID, definitions).set(ImportDelimitedPlugin.PARSER_PARAMETER_ID, parser).set(ImportDelimitedPlugin.FILES_PARAMETER_ID, importFiles).set(ImportDelimitedPlugin.SCHEMA_PARAMETER_ID, schema).set(ImportDelimitedPlugin.FILES_INCLUDE_HEADERS_PARAMETER_ID, filesIncludeHeaders).followedBy(ArrangementPluginRegistry.GRID_COMPOSITE).followedBy(InteractiveGraphPluginRegistry.RESET_VIEW).executeWriteLater(importGraph);
}
}
Aggregations