@SuppressWarnings("unchecked") protected AbstractLayout(Graph<V,E> graph, Transformer<V,Point2D> initializer) { this.graph = graph; Transformer<V, ? extends Object> chain = ChainedTransformer.getInstance(initializer, CloneTransformer.getInstance()); this.locations = LazyMap.decorate(new HashMap<V,Point2D>(), (Transformer<V,Point2D>)chain); initialized = true; }
@SuppressWarnings("unchecked") protected AbstractLayout(Graph<V,E> graph, Transformer<V,Point2D> initializer, Dimension size) { this.graph = graph; Transformer<V, ? extends Object> chain = ChainedTransformer.getInstance(initializer, CloneTransformer.getInstance()); this.locations = LazyMap.decorate(new HashMap<V,Point2D>(), (Transformer<V,Point2D>)chain); this.size = size; }
@SuppressWarnings("unchecked") public void setInitializer(Transformer<V,Point2D> initializer) { if(this.equals(initializer)) { throw new IllegalArgumentException("Layout cannot be initialized with itself"); } Transformer<V, ? extends Object> chain = ChainedTransformer.getInstance(initializer, CloneTransformer.getInstance()); this.locations = LazyMap.decorate(new HashMap<V,Point2D>(), (Transformer<V, Point2D>)chain); initialized = true; }
@SuppressWarnings("unchecked") protected AbstractLayout(Graph graph, Transformer<Node,Point2D> initializer) { this.graph = graph; Transformer<Node, ? extends Object> chain = ChainedTransformer.getInstance(initializer, CloneTransformer.getInstance()); this.locations = LazyMap.decorate(new HashMap<Node,Point2D>(), (Transformer<Node,Point2D>)chain); initialized = true; }
/** * Initializer * * @param inVdat VarData Object */ public CustomQueryView(VarData inVdat, VarSifter inGui) { vdat = inVdat; gui = inGui; String[] origSampleNames = vdat.returnSampleNames(); // The original names - DON'T CHANGE THIS!! sampleNames = new String[origSampleNames.length]; annotNames = vdat.returnDataNames(); dataTypeAt = vdat.returnDataTypeAt(); sampleIndexOf = new HashMap<String,Integer>(origSampleNames.length); annoSize = dataTypeAt.size(); annotMap = vdat.returnAnnotMap(); for (int i=0; i<origSampleNames.length; i++) { String n = origSampleNames[i]; sampleIndexOf.put(n, i); sampleNames[i] = n; } graph = new DelegateForest<CustomVertex,Integer>(); layout = new TreeLayout<CustomVertex,Integer>(graph); vv = new VisualizationViewer<CustomVertex,Integer>(layout); VertexLabelAsShapeRenderer<CustomVertex,Integer> vlasr = new VertexLabelAsShapeRenderer<CustomVertex,Integer>(vv.getRenderContext()); vv.getRenderContext().setVertexLabelTransformer( new ChainedTransformer<CustomVertex,String>(new Transformer[]{ new ToStringLabeller<String>(), new Transformer<String,String>() { public String transform(String input) { return "<html><center>"+input; } } })); vv.getRenderContext().setVertexShapeTransformer(vlasr); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); vv.getRenderer().setVertexLabelRenderer(vlasr); final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse(); modeBox = graphMouse.getModeComboBox(); modeBox.setMaximumSize(modeBox.getPreferredSize()); modeBox.addItemListener(graphMouse.getModeListener()); graphMouse.setMode(ModalGraphMouse.Mode.PICKING); vv.setGraphMouse(graphMouse); String out = ""; sampleList = new JList(sampleNames); annotList = new JList(annotNames); initQuery(); initTable(); }
public CachingLayout(Layout<V, E> delegate) { super(delegate); this.locationMap = LazyMap.<V,Point2D>decorate(new HashMap<V,Point2D>(), new ChainedTransformer<V, Point2D>(new Transformer[]{delegate, CloneTransformer.<Point2D>getInstance()})); }
public ObservableCachingLayout(Layout<V, E> delegate) { super(delegate); this.locationMap = LazyMap.<V,Point2D>decorate(new HashMap<V,Point2D>(), new ChainedTransformer<V, Point2D>(new Transformer[]{delegate, CloneTransformer.<Point2D>getInstance()})); }