Commit 31c947c3 authored by Jay Jay Billings's avatar Jay Jay Billings
Browse files

Removed some reactor files.



Removed some reactor files that were either missed or readded by
mistake.
Signed-off-by: default avatarJay Jay Billings <billingsjj@ornl.gov>
parent 61ecf044
/*******************************************************************************
* Copyright (c) 2013, 2014 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation - Jay Jay Billings,
* Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson,
* Claire Saunders, Matthew Wang, Anna Wojtowicz
*******************************************************************************/
package org.eclipse.ice.client.widgets.reactoreditor.lwr;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.ice.client.widgets.reactoreditor.DataSource;
import org.eclipse.ice.client.widgets.reactoreditor.IAnalysisView;
import org.eclipse.ice.client.widgets.reactoreditor.IAnalysisWidgetFactory;
import org.eclipse.ice.client.widgets.reactoreditor.IStateBrokerHandler;
import org.eclipse.ice.reactor.LWRRod;
import org.eclipse.ice.reactor.Tube;
import org.eclipse.ice.reactor.bwr.BWReactor;
import org.eclipse.ice.reactor.plant.PlantComposite;
import org.eclipse.ice.reactor.pwr.ControlBank;
import org.eclipse.ice.reactor.pwr.FuelAssembly;
import org.eclipse.ice.reactor.pwr.IncoreInstrument;
import org.eclipse.ice.reactor.pwr.PressurizedWaterReactor;
import org.eclipse.ice.reactor.pwr.RodClusterAssembly;
import org.eclipse.jface.wizard.IWizard;
/**
* This class implements the IAnalysisWidgetFactory interface for Reactor
* analysis.
*
* @author Jordan H. Deyton
*
*/
public class AnalysisWidgetFactory implements IAnalysisWidgetFactory {
/**
* An IViewFactory factory needs to be able to initialize an IAnalysisView.
* The necessary parameters for an IAnalysisView are passed into the method
* createView().
*
* @author Jordan H. Deyton
*
*/
private interface IViewFactory {
/**
* Creates an IAnalysisView.
*
* @param dataSource
* The data source for the IAnalysisView.
* @return An implementation of IAnalysisView.
*/
public IAnalysisView createView(DataSource dataSource);
}
/**
* A manually ordered List of IAnalysisView names.
*/
private final List<String> viewNames;
/**
* A Map of IViewFactories used to instantiate IAnalysisViews keyed on the
* IAnalysisView names.
*/
private final Map<String, IViewFactory> viewFactoryMap;
/**
* The default constructor.
*/
public AnalysisWidgetFactory() {
// The number of views we support.
int viewCount = 1;
// Populate the List of names in the order that we want them to appear.
viewNames = new ArrayList<String>(viewCount);
viewNames.add(PlantAnalysisView.name);
viewNames.add(CoreAnalysisView.name);
viewNames.add(AssemblyAnalysisView.name);
viewNames.add(RodAnalysisView.name);
viewNames.add(PlotAnalysisView.name);
// Populate the Map of factories. For each view, add a new factory that
// can create that particular view.
viewFactoryMap = new HashMap<String, IViewFactory>(viewCount);
viewFactoryMap.put(PlantAnalysisView.name, new IViewFactory() {
@Override
public IAnalysisView createView(DataSource dataSource) {
return new PlantAnalysisView(dataSource);
}
});
viewFactoryMap.put(CoreAnalysisView.name, new IViewFactory() {
@Override
public IAnalysisView createView(DataSource dataSource) {
return new CoreAnalysisView(dataSource);
}
});
viewFactoryMap.put(AssemblyAnalysisView.name, new IViewFactory() {
@Override
public IAnalysisView createView(DataSource dataSource) {
return new AssemblyAnalysisView(dataSource);
}
});
viewFactoryMap.put(RodAnalysisView.name, new IViewFactory() {
@Override
public IAnalysisView createView(DataSource dataSource) {
return new RodAnalysisView(dataSource);
}
});
viewFactoryMap.put(PlotAnalysisView.name, new IViewFactory() {
@Override
public IAnalysisView createView(DataSource dataSource) {
IAnalysisView view = null;
if (dataSource == DataSource.Comparison) {
// For comparison data, we must return a special view!
view = new ComparisonPlotAnalysisView(dataSource);
} else {
view = new PlotAnalysisView(dataSource);
}
return view;
}
});
return;
}
/* ---- Implements IAnalysisWidgetFactory. ---- */
@Override
public List<String> getAvailableViews(DataSource dataSource) {
// We don't want the main package to modify our original list, so make
// the returned list unmodifiable.
if (dataSource == DataSource.Comparison) {
return new ArrayList<String>(Arrays.asList(PlotAnalysisView.name));
} else {
return Collections.unmodifiableList(viewNames);
}
}
@Override
public IAnalysisView createView(String viewName, DataSource dataSource) {
IAnalysisView view = null;
// Grab the factory for this view type and create its IAnalysisView.
IViewFactory factory = viewFactoryMap.get(viewName);
if (factory != null) {
view = factory.createView(dataSource);
}
return view;
}
@Override
public List<Class<?>> getModelClasses() {
List<Class<?>> classes = new ArrayList<Class<?>>();
classes.add(PressurizedWaterReactor.class);
classes.add(BWReactor.class);
classes.add(FuelAssembly.class);
classes.add(RodClusterAssembly.class);
classes.add(LWRRod.class);
classes.add(ControlBank.class);
classes.add(IncoreInstrument.class);
classes.add(Tube.class);
classes.add(PlantComposite.class);
return classes;
}
@Override
public IStateBrokerHandler createStateBrokerHandler() {
return new StateBrokerHandler();
}
@Override
public IWizard createWizard(Object selection) {
// Use a WizardProvider to create the wizard
WizardProvider provider = new WizardProvider();
return provider.getWizard(selection);
}
/* -------------------------------------------- */
}
/*******************************************************************************
* Copyright (c) 2014 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation - Jay Jay Billings,
* Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson,
* Claire Saunders, Matthew Wang, Anna Wojtowicz
*******************************************************************************/
package org.eclipse.ice.client.widgets.reactoreditor.lwr;
import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.DragTracker;
import org.eclipse.gef.Request;
import org.eclipse.gef.requests.SelectionRequest;
import org.eclipse.gef.tools.SelectEditPartTracker;
import org.eclipse.ice.analysistool.IDataProvider;
import org.eclipse.ice.client.widgets.reactoreditor.grid.Cell;
import org.eclipse.ice.client.widgets.reactoreditor.grid.Cell.State;
import org.eclipse.ice.client.widgets.reactoreditor.grid.CircularCellEditPart;
import org.eclipse.ice.client.widgets.reactoreditor.grid.IGridListener;
import org.eclipse.ice.reactor.LWRComponent;
/**
* The AssemblyCellEditPart provides the EditPart for a Cell in a Grid. It is
* instantiated by the {@link AssemblyEditPartFactory}.
*
* @author Jordan
*
*/
public class AssemblyCellEditPart extends CircularCellEditPart {
/**
* An IGridListener that listens for Cell click/selection events. The
* listener needs to be notified when this EditPart's Figure is clicked and
* selected.
*/
private final IGridListener listener;
/**
* The default constructor.
*
* @param listener
* An IGridListener that listens for Cell click/selection events.
*/
public AssemblyCellEditPart(IGridListener listener) {
this.listener = listener;
}
/**
* Sets the SFRComponent tied to this EditPart and its associated Figure.
*
* @param lwrComp
* The new SFRComponent (typically an SFRPin).
* @param lwrData
* The IDataProvider associated with it.
*/
public void setComponent(LWRComponent lwrComp, IDataProvider lwrData) {
RodFigure figure = (RodFigure) getFigure();
figure.setComponent(lwrComp);
figure.setDataProvider(lwrData);
return;
}
/*
* This method creates a Figure representing a rod.
*
* (non-Javadoc)
*
* @see
* org.eclipse.ice.client.widgets.reactoreditor.grid.CircularCellEditPart
* #createFigure()
*/
@Override
protected IFigure createFigure() {
// Get the model.
Cell cell = (Cell) getModel();
// Construct a new figure for the model if possible.
RodFigure figure = null;
if (cell.getState() != State.INVALID) {
figure = new RodFigure();
figure.setState(cell.getState());
}
return figure;
}
/**
* This method notifies the View and Model of changes to the selection of
* the EditPart. It is overridden to provide updates to an
* {@link IGridListener}.
*/
@Override
protected void fireSelectionChanged() {
super.fireSelectionChanged();
Cell model = (Cell) getModel();
// Push an update to the broker if this Cell has been selected.
if (model.getSelected()) {
listener.selectCell(model.getIndex());
}
return;
}
/**
* This method returns a dragTracker to use for selection of EditParts. We
* override it here to provide selection of only one figure at a time.
*/
@Override
public DragTracker getDragTracker(Request req) {
DragTracker tracker = null;
Cell model = (Cell) getModel();
// Only set a tracker if the cell is enabled and we have a
// SelectionRequest.
// Only reply to left-clicks.
if (!model.getDisabled() && req instanceof SelectionRequest
&& ((SelectionRequest) req).getLastButtonPressed() == 1) {
tracker = new SelectEditPartTracker(this);
// The cell has been clicked!
listener.clickCell(model.getIndex());
}
return tracker;
}
}
/*******************************************************************************
* Copyright (c) 2014 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation - Jay Jay Billings,
* Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson,
* Claire Saunders, Matthew Wang, Anna Wojtowicz
*******************************************************************************/
package org.eclipse.ice.client.widgets.reactoreditor.lwr;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
import org.eclipse.ice.client.widgets.reactoreditor.grid.Cell;
import org.eclipse.ice.client.widgets.reactoreditor.grid.Grid;
import org.eclipse.ice.client.widgets.reactoreditor.grid.GridEditPart;
import org.eclipse.ice.client.widgets.reactoreditor.grid.IGridListener;
/**
* This class connects GEF EditParts to the GridEditor's model so that the
* appropriate EditParts can be created from the corresponding model. This is
* for rectangular grids.
* <p>
* The AssemblyEditPartFactory uses {@link GridEditPart}s for the Grid and
* {@link AssemblyCellEditPart}s for the Cells.
* </p>
*
* @author Jordan H. Deyton
*
*/
public class AssemblyEditPartFactory implements EditPartFactory {
/**
* An IGridListener that can listen for click/selection events. This needs
* to be passed to any EditParts corresponding to Cells that can be clicked.
*/
private final IGridListener listener;
/**
* The default constructor.
*
* @param listener
* An IGridListener that listens for click/selection events for
* the Cells.
*/
public AssemblyEditPartFactory(IGridListener listener) {
this.listener = listener;
}
/**
* Overrides the default behavior to connect Grids and Cells to their
* corresponding EditParts (GridEditPart and CellEditPart).
*/
@Override
public EditPart createEditPart(EditPart context, Object model) {
// The code here is based off of the tutorials here:
// http://www.eclipsecon.org/2008/?page=sub/&id=102
// http://www.vainolo.com/2011/06/21/creating-a-gef-editor-%E2%80%93-part-4-showing-the-model-on-the-editor/
EditPart editPart = null;
if (model instanceof Grid) {
editPart = new GridEditPart();
} else if (model instanceof Cell) {
editPart = new AssemblyCellEditPart(listener);
}
if (editPart != null) {
editPart.setModel(model);
}
return editPart;
}
}
/*******************************************************************************
* Copyright (c) 2014, 2015 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Jordan Deyton - Initial API and implementation and/or initial documentation
* Jordan Deyton - bug 474742
*
*******************************************************************************/
package org.eclipse.ice.client.widgets.reactoreditor.lwr;
import java.util.ArrayList;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.GridData;
import org.eclipse.draw2d.GridLayout;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.ice.client.widgets.reactoreditor.MaterialShape;
import org.eclipse.ice.reactor.LWRComponent;
import org.eclipse.ice.reactor.LWRRod;
import org.eclipse.ice.reactor.MaterialBlock;
import org.eclipse.ice.reactor.Ring;
import org.eclipse.ice.reactor.Tube;
import org.eclipse.swt.graphics.Color;
/**
* This class extends the RodFigure, which provides a radial view of an
* {@link LWRComponent}, usually {@link LWRRod}s, to instead provide an axial or
* vertical view of the component.
*
* @author Jordan H. Deyton
*
*/
// FIXME The MouseListeners for the rod shapes aren't working.
public class AxialRodFigure extends RodFigure {
/**
* A new figure to contain a column of axial data.
*/
private final Figure data;
/**
* The default constructor. Responsible for creating a default, axial
* (vertical slice) view of a rod.
*/
public AxialRodFigure() {
// Set up the default RodFigure first.
super();
GridLayout layout;
// Change the overall layout of the geometry figure to a GridLayout. We
// want to stack all of the material blocks in a column.
layout = new GridLayout(1, false);
layout.horizontalSpacing = 0;
layout.verticalSpacing = 0;
layout.marginWidth = 0;
layout.marginHeight = 0;
geometry.setLayoutManager(layout);
// We also want to use a figure to contain several data labels, one for
// each axial level. These should be put into a column like geometry.
data = new Figure();
layout = new GridLayout(1, false);
layout.horizontalSpacing = 0;
layout.verticalSpacing = 0;
layout.marginWidth = 0;
layout.marginHeight = 0;
data.setLayoutManager(layout);
data.setVisible(false);
data.setBorder(null);
data.setBackgroundColor(ColorConstants.cyan);
add(data);
return;
}
/**
* Overrides the default function to use the custom data figure.
*
* @param displayType
* The new display type.
*/
@Override
public void setDisplayType(DisplayType displayType) {
// Only proceed if the display type changed.
if (displayType != this.displayType) {
this.displayType = displayType;
if (displayType == DisplayType.GEOMETRY) {
defaultFigure.setVisible(false);
geometry.setVisible(true);
data.setVisible(false);
} else if (displayType == DisplayType.DATA) {
defaultFigure.setVisible(true);
geometry.setVisible(false);
data.setVisible(true);
// // Refresh the data figure.
} else {
defaultFigure.setVisible(true);
geometry.setVisible(false);
data.setVisible(false);
// Remove the custom background color from the default figure.
defaultFigure.setBackgroundColor(null);
}
}
return;
}
/**
* Overrides the parent behavior to provide an axial view of the component's
* data.
*/
@Override
protected void refreshData() {
// Clear the current figure.
data.removeAll();
double value;
Color bg;
Color fg;
Label label;
GridData gridData;
// Add all data for the current feature to labels arranged in a column.
for (int i = featureData.size() - 1; i >= 0; i--) {
value = featureData.get(i).getValue();
// Compute the background color of the value based on the current
// color factory.
int color = colorFactory
.findColor((value - minValue) / (maxValue - minValue));
bg = colorFactory.createColor(null, color);
// Determine the proper foreground color so that the text will not
// be an eye sore. This uses the Rec. 709 luma coefficients. We use
// that with a threshold value to determine if the text should be
// white or black.