[TASK] A lot of cleanup + a new component.
This commit is contained in:
@@ -2,6 +2,7 @@ package lu.jpt.csparqlproject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Observer;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -10,7 +11,8 @@ import eu.larkc.csparql.cep.api.RdfStream;
|
||||
import eu.larkc.csparql.core.engine.CsparqlEngine;
|
||||
import eu.larkc.csparql.core.engine.CsparqlEngineImpl;
|
||||
import eu.larkc.csparql.core.engine.CsparqlQueryResultProxy;
|
||||
import lu.jpt.csparqlproject.gui.TextObserverWindow;
|
||||
import lu.jpt.csparqlproject.gui.FancyTextObserverWindow;
|
||||
import lu.jpt.csparqlproject.gui.RawTextObserverWindow;
|
||||
import lu.jpt.csparqlproject.rentacar.RentACarSimulation;
|
||||
import lu.jpt.csparqlproject.util.CsparqlQueryHelper;
|
||||
|
||||
@@ -167,12 +169,29 @@ public class SimulationContext {
|
||||
SimulationContext.logger.error(query);
|
||||
}
|
||||
this.queryResultProxies.add(resultProxy);
|
||||
resultProxy.addObserver(new TextObserverWindow("[ResultProxy] " + queryName));
|
||||
Observer resultObserver = this.createResultObserverWindow(queryName);
|
||||
resultProxy.addObserver(resultObserver);
|
||||
}
|
||||
// Setup complete, ready to run.
|
||||
SimulationContext.logger.info("Simulation set up and ready to go!");
|
||||
this.currentState = SimulationState.INITIALIZED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a query result observer depending on the given queryName.
|
||||
* This is useful if a querys result set is larger than usual.
|
||||
* @param queryName
|
||||
* @return Observer for query result
|
||||
*/
|
||||
private Observer createResultObserverWindow(String queryName) {
|
||||
Observer observer = null;
|
||||
if(false && queryName.equals("getEvents")) {
|
||||
observer = new RawTextObserverWindow("[ResultProxy] " + queryName);
|
||||
} else {
|
||||
observer = new FancyTextObserverWindow("[ResultProxy] " + queryName);
|
||||
}
|
||||
return observer;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user