Commit 7f3118a3 authored by Robert Smith's avatar Robert Smith
Browse files

Worked on JavaFX Plant View bugs



Made progress on correcting bugs with the JavaFX Plant View which
prevent it from being initialized.
Signed-off-by: Robert Smith's avatarRobert Smith <SmithRW@ornl.gov>
parent e383f4d2
<?xml version="1.0" encoding="UTF-8"?>
<!--<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.ice.io.hdf.HdfIOFactory">
<implementation class="org.eclipse.ice.io.hdf.HdfIOFactory"/>
<reference bind="setHdfIORegistry" cardinality="1..1" interface="org.eclipse.ice.io.hdf.IHdfIORegistry" name="IHdfIORegistry" policy="dynamic" unbind="unsetHdfIORegistry"/>
</scr:component>
-->
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.ice.io.hdf.HdfIORegistry">
<implementation class="org.eclipse.ice.io.hdf.HdfIORegistry"/>
<service>
......@@ -6,3 +6,4 @@
</service>
<reference bind="registerHdfIOFactory" cardinality="1..n" interface="org.eclipse.ice.io.hdf.IHdfIOFactory" name="IHdfIOFactory" policy="dynamic"/>
</scr:component>
-->
\ No newline at end of file
......@@ -91,4 +91,5 @@ public class JunctionMesh extends ShapeMesh {
public void setZOut(double ZOut) {
setProperty("Z Output", Double.toString(ZOut));
}
}
......@@ -10,6 +10,11 @@
*******************************************************************************/
package org.eclipse.ice.viz.service.geometry.reactor;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.ice.viz.service.datastructures.VizObject.UpdateableSubscriptionType;
import org.eclipse.ice.viz.service.modeling.AbstractController;
import org.eclipse.ice.viz.service.modeling.TubeMesh;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -105,6 +110,67 @@ public class PipeMesh extends TubeMesh {
setProperty("Rod Diameter", Double.toString(rodDiameter));
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.viz.service.modeling.ShapeMesh#addEntityByCategory(org.
* eclipse.ice.viz.service.modeling.AbstractController, java.lang.String)
*/
@Override
public void addEntityByCategory(AbstractController entity,
String category) {
// If adding an input or output, add it without registering
// as a listener, to avoid circular updates
if ("Input".equals(category) || "Output".equals(category)) {
// Get the entities for the given category
List<AbstractController> catList = entities.get(category);
// If the list is null, make an empty one
if (catList == null) {
catList = new ArrayList<AbstractController>();
}
// Prevent a part from being added multiple times
else if (catList.contains(entity)) {
return;
}
// If the entity is already present in this category, don't add a
// second
// entry for it
else
for (AbstractController currentEntity : catList) {
if (entity == currentEntity) {
return;
}
}
// Add the entity to the list and put it in the map
catList.add(entity);
entities.put(category, catList);
// Notify listeners of the new child
UpdateableSubscriptionType[] eventTypes = {
UpdateableSubscriptionType.Child };
updateManager.notifyListeners(eventTypes);
}
// Otherwise, add it normally
else {
super.addEntityByCategory(entity, category);
}
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.viz.service.modeling.ShapeMesh#setProperty(java.lang.
* String, java.lang.String)
*/
@Override
public void setProperty(String property, String value) {
......
......@@ -63,7 +63,7 @@ public class FXGeometryCanvas extends FXVizCanvas implements IPlantView {
* The shape under which all parts in the model will be contained
* as children
*/
public FXGeometryCanvas(ShapeController source) {
public FXGeometryCanvas(AbstractController source) {
super(source);
}
......
......@@ -51,8 +51,7 @@ public class FXGeometryVizService extends AbstractVizService {
throws Exception {
if (geometry instanceof ShapeController
|| geometry instanceof FXPlantViewRootController) {
FXGeometryCanvas canvas = new FXGeometryCanvas(
(ShapeController) geometry);
FXGeometryCanvas canvas = new FXGeometryCanvas(geometry);
return canvas;
} else {
......
......@@ -157,7 +157,8 @@ public class ViewFactory {
// TODO This should be getting all services and presenting the user with
// a choice, instead of hardcoding the JavaFX editor in.
IVizService service = factory.get("ICE Geometry Editor");
// IVizService service = factory.get("ICE Geometry Editor");
IVizService service = new FXGeometryVizService();
// Create a converter for the plant composite
FXPlantCompositeConverter converter = new FXPlantCompositeConverter(
......
......@@ -542,15 +542,17 @@ public class FXPlantCompositeConverter implements IVizUpdateableListener {
public PipeController addPipe(Pipe plantComp) {
// Create a new pipe
PipeMesh mesh = new PipeMesh();
PipeController pipe = (PipeController) factory
.createController(mesh);
// Set the pipe's properties
pipe.setProperty("Id", Integer.toString(plantComp.getId()));
pipe.setLength(plantComp.getLength());
pipe.setRadius(plantComp.getRadius());
pipe.setInnerRadius(plantComp.getRadius());
pipe.setAxialSamples(plantComp.getNumElements());
mesh.setProperty("Id", Integer.toString(plantComp.getId()));
mesh.setLength(plantComp.getLength());
mesh.setRadius(plantComp.getRadius());
mesh.setInnerRadius(plantComp.getRadius());
mesh.setAxialSamples(plantComp.getNumElements());
// Create the view and controller
PipeController pipe = (PipeController) factory
.createController(mesh);
// Get the data describing the pipe's location. Position is the
// center of the pipe's input end, while orientation is a vector
......
......@@ -389,6 +389,17 @@ public class FXReactorView extends AbstractView implements IWireFramePart {
return points;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.viz.service.modeling.AbstractView#getRepresentation()
*/
@Override
public Object getRepresentation() {
return node;
}
/*
* (non-Javadoc)
*
......
......@@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory;
*/
public class VizServiceFactoryHolder {
//The VizServiceFactory held by the VizServiceFactory
// The VizServiceFactory held by the VizServiceFactory
private static IVizServiceFactory factory;
/**
......@@ -45,26 +45,29 @@ public class VizServiceFactoryHolder {
*/
public static void setVizServiceFactory(IVizServiceFactory input) {
VizServiceFactoryHolder.factory = input;
Logger staticLogger = LoggerFactory.getLogger(VizServiceFactoryHolder.class);
Logger staticLogger = LoggerFactory
.getLogger(VizServiceFactoryHolder.class);
IConfigurationElement[] elements = Platform.getExtensionRegistry()
.getConfigurationElementsFor("org.eclipse.ice.viz.service.IVizServiceFactory");
.getConfigurationElementsFor(
"org.eclipse.ice.viz.service.IVizServiceFactory");
staticLogger.info("Available configuration elements");
for(IConfigurationElement element : elements){
for (IConfigurationElement element : elements) {
staticLogger.info(element.getName());
}
return;
}
/**
* Remove the given VizServiceFactory if it is held by the VizServiceFactoryHolder.
* Remove the given VizServiceFactory if it is held by the
* VizServiceFactoryHolder.
*
* @input A VizServiceFactory to remove.
* @input A VizServiceFactory to remove.
*/
public static void unsetVizServiceFactory(IVizServiceFactory input) {
if(input == factory){
factory = null;
if (input == factory) {
factory = null;
}
return;
}
......
......@@ -136,7 +136,7 @@ public class ShapeMesh extends AbstractMesh {
}
// Force changes to the parent category to go through the setParent()
// funcgtion
// function
else {
setParent((ShapeController) newEntity);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment