* instances for the new view, and sets the functions and renderers related
* @param key The new view's name
*/
public void addView(String key) {
putLayout(key, new StaticLayout(_myGraph));
AbstractLayout l = getLayout(key);
putVisualizationModel(key, new DefaultVisualizationModel(l, borderDimension));
VisualizationModel vm = getVisualizationModel(key);
putPR(key, new NexsmPluggableRenderer());
PluggableRenderer pr = getPR(key);
putVV(key, new VisualizationViewer(vm, pr, _dim));
VisualizationViewer vv = getVV(key);
putVV(key + "satellite", new SatelliteVisualizationViewer(vv, l, new PluggableRenderer(), new Dimension(160,160)));
vv.setName(key);
vv.setBorder(BorderFactory.createEtchedBorder());
vv.setLayout(null);
if (getBooleanParam("showcenterdot") != null) {
if (getBooleanParam("showcenterdot"))
addCenterDotPostRenderer(key);
}
if (getBooleanParam("showborder") != null) {
if (getBooleanParam("showborder"))
addBorderPreRenderer(key);
}
NexsmEditingModalGraphMouse graphMouse = new NexsmEditingModalGraphMouse(this);
vv.setGraphMouse(graphMouse);
graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
pr.setGraphLabelRenderer(nglr);
pr.setVertexStringer(vs);
Predicate hiddenVertex = new HiddenVertexPredicate(userdatumkey+key);
Predicate showEdge = new ShowEdgePredicate(userdatumkey+key);
pr.setVertexIncludePredicate(hiddenVertex);
pr.setEdgeIncludePredicate(showEdge);
PluggableRenderer satelliteRenderer = (PluggableRenderer)getVV(key + "satellite").getRenderer();
satelliteRenderer.setVertexIncludePredicate(hiddenVertex);
satelliteRenderer.setEdgeIncludePredicate(showEdge);
satelliteRenderer.setVertexPaintFunction(
new PickableVertexPaintFunction(satelliteRenderer, Color.BLUE, Color.BLACK, Color.ORANGE));
pr.setVertexIconFunction(vi);
pr.setVertexShapeFunction(vi);
pr.setEdgeStrokeFunction(new ConstantEdgeStrokeFunction(2));
pr.setEdgePaintFunction(new NexsmEdgePaint());
Color c = _colorparams.get("defaultbackgroundcolor");
if (c != null)
vv.setBackground(c);
else
vv.setBackground(Color.white);
vv.setPickSupport(new ShapePickSupport());
vv.setPickedState(pstate);
l.initialize(_dim, _rndDecorator);
// TODO add these later when they work as they should be
// addLogicalZoomControls(key);
// addImagePreRenderer(key);
// addErrorPostRenderer(key);
}