Package org.apache.commons.collections15.functors

Examples of org.apache.commons.collections15.functors.ExceptionFactory


        vv2 = new VisualizationViewer<String,Number>(visualizationModel, preferredSize);
        vv3 = new VisualizationViewer<String,Number>(visualizationModel, preferredSize);
       
        vv1.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<String,Number>());
        vv2.getRenderContext().setVertexShapeTransformer(
            new ConstantTransformer(new Rectangle2D.Float(-6,-6,12,12)));

        vv2.getRenderContext().setEdgeShapeTransformer(new EdgeShape.QuadCurve<String,Number>());
       
        vv3.getRenderContext().setEdgeShapeTransformer(new EdgeShape.CubicCurve<String,Number>());
View Full Code Here


        vv.setBackground(Color.white);
        vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
        // add a listener for ToolTips
        vv.setVertexToolTipTransformer(new ToStringLabeller());
        vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
        rings = new Rings();

        Container content = getContentPane();
        final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
        content.add(panel);
View Full Code Here

        final Box box = new Box(10,10,10,
            Box.GENERATE_NORMALS |
            Box.ENABLE_GEOMETRY_PICKING,
            redLook);

    this.edgeAppearanceTransformer = new ConstantTransformer(lightGrayLook);
    this.edgeShapeTransformer = new Transformer<Context<Graph<V,E>,E>,Node>() {

      public Node transform(Context<Graph<V,E>,E> ec) {
        LineArray lineArray = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
        lineArray.setCoordinates(0, new Point3f[]{new Point3f(0,-.5f,0),new Point3f(0,.5f,0)});
        lineArray.setColor(0, new Color3f(1,1,1));
        lineArray.setColor(1, new Color3f(1,1,1));
        Shape3D shape = new Shape3D();
        shape.setGeometry(lineArray);
        return shape;
//        return new Cylinder(1, 1,
//            Cylinder.GENERATE_NORMALS |
//            Cylinder.ENABLE_GEOMETRY_PICKING,
//             26, 26, lightGrayLook);
      }};
    this.vertexAppearanceTransformer = new ConstantTransformer(redLook);
    this.vertexShapeTransformer = new Transformer<V,Node>() {

      public Node transform(V arg0) {
        return new Sphere(10,
            Sphere.GENERATE_NORMALS |
View Full Code Here

            public void actionPerformed(ActionEvent ae) {
              Dimension d = vv.getSize();//new Dimension(600,600);
                if (switchLayout.getText().indexOf("Spring") > 0) {
                    switchLayout.setText("Switch to FRLayout");
                    layout =
                      new SpringLayout<Number,Number>(g, new ConstantTransformer(EDGE_LENGTH));
                    layout.setSize(d);
                Relaxer relaxer = new VisRunner((IterativeContext)layout);
                relaxer.stop();
                relaxer.prerelax();
                StaticLayout<Number,Number> staticLayout =
View Full Code Here

          public String transform(String input) {
            return "<html><center>Vertex<p>"+input;
          }}}));
        vv.getRenderContext().setVertexShapeTransformer(vlasr);
        vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.red));
        vv.getRenderContext().setEdgeDrawPaintTransformer(new ConstantTransformer(Color.yellow));
        vv.getRenderContext().setEdgeStrokeTransformer(new ConstantTransformer(new BasicStroke(2.5f)));
       
        // customize the renderer
        vv.getRenderer().setVertexRenderer(new GradientVertexRenderer<String,Number>(Color.gray, Color.white, true));
        vv.getRenderer().setVertexLabelRenderer(vlasr);
View Full Code Here

        vv.setBackground(Color.white);
        vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
        // add a listener for ToolTips
        vv.setVertexToolTipTransformer(new ToStringLabeller());
        vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
        rings = new Rings(radialLayout);
       
        Container content = getContentPane();
        final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
        content.add(panel);
View Full Code Here

        vv.setBackground(Color.white);
        vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
        // add a listener for ToolTips
        vv.setVertexToolTipTransformer(new ToStringLabeller());
        vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
        rings = new Rings();
       
        setLtoR(vv);
       
        Container content = getContentPane();
View Full Code Here

       
        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
       
        final Transformer<String,Shape> ovals = vv.getRenderContext().getVertexShapeTransformer();
        final Transformer<String,Shape> squares =
          new ConstantTransformer(new Rectangle2D.Float(-10,-10,20,20));

        // add a listener for ToolTips
        vv.setVertexToolTipTransformer(new ToStringLabeller());
       
        Container content = getContentPane();
        GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv);
        content.add(gzsp);
       
        /**
         * the regular graph mouse for the normal view
         */
        final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();

        vv.setGraphMouse(graphMouse);
        vv.addKeyListener(graphMouse.getModeKeyListener());
       
        hyperbolicViewSupport =
            new ViewLensSupport<String,Number>(vv, new HyperbolicShapeTransformer(vv,
                vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)),
                    new ModalLensGraphMouse());
        hyperbolicLayoutSupport =
            new LayoutLensSupport<String,Number>(vv, new HyperbolicTransformer(vv,
                vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)),
                    new ModalLensGraphMouse());
        magnifyViewSupport =
            new ViewLensSupport<String,Number>(vv, new MagnifyShapeTransformer(vv,
                vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)),
                    new ModalLensGraphMouse(new LensMagnificationGraphMousePlugin(1.f, 6.f, .2f)));
        magnifyLayoutSupport =
            new LayoutLensSupport<String,Number>(vv, new MagnifyTransformer(vv,
                vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)),
                    new ModalLensGraphMouse(new LensMagnificationGraphMousePlugin(1.f, 6.f, .2f)));
        hyperbolicLayoutSupport.getLensTransformer().setLensShape(hyperbolicViewSupport.getLensTransformer().getLensShape());
        magnifyViewSupport.getLensTransformer().setLensShape(hyperbolicLayoutSupport.getLensTransformer().getLensShape());
        magnifyLayoutSupport.getLensTransformer().setLensShape(magnifyViewSupport.getLensTransformer().getLensShape());
       
        final ScalingControl scaler = new CrossoverScalingControl();

        JButton plus = new JButton("+");
        plus.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                scaler.scale(vv, 1.1f, vv.getCenter());
            }
        });
        JButton minus = new JButton("-");
        minus.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                scaler.scale(vv, 1/1.1f, vv.getCenter());
            }
        });
       
        ButtonGroup radio = new ButtonGroup();
        JRadioButton normal = new JRadioButton("None");
        normal.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                if(e.getStateChange() == ItemEvent.SELECTED) {
                    if(hyperbolicViewSupport != null) {
                        hyperbolicViewSupport.deactivate();
                    }
                    if(hyperbolicLayoutSupport != null) {
                        hyperbolicLayoutSupport.deactivate();
                    }
                    if(magnifyViewSupport != null) {
                        magnifyViewSupport.deactivate();
                    }
                    if(magnifyLayoutSupport != null) {
                        magnifyLayoutSupport.deactivate();
                    }
                }
            }
        });

        final JRadioButton hyperView = new JRadioButton("Hyperbolic View");
        hyperView.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent e) {
                hyperbolicViewSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
            }
        });
        final JRadioButton hyperModel = new JRadioButton("Hyperbolic Layout");
        hyperModel.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent e) {
                hyperbolicLayoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
            }
        });
        final JRadioButton magnifyView = new JRadioButton("Magnified View");
        magnifyView.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent e) {
                magnifyViewSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
            }
        });
        final JRadioButton magnifyModel = new JRadioButton("Magnified Layout");
        magnifyModel.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent e) {
                magnifyLayoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
            }
        });
        JLabel modeLabel = new JLabel("     Mode Menu >>");
        modeLabel.setUI(new VerticalLabelUI(false));
        radio.add(normal);
        radio.add(hyperModel);
        radio.add(hyperView);
        radio.add(magnifyModel);
        radio.add(magnifyView);
        normal.setSelected(true);
       
        graphMouse.addItemListener(hyperbolicLayoutSupport.getGraphMouse().getModeListener());
        graphMouse.addItemListener(hyperbolicViewSupport.getGraphMouse().getModeListener());
        graphMouse.addItemListener(magnifyLayoutSupport.getGraphMouse().getModeListener());
        graphMouse.addItemListener(magnifyViewSupport.getGraphMouse().getModeListener());
       
        ButtonGroup graphRadio = new ButtonGroup();
        JRadioButton graphButton = new JRadioButton("Graph");
        graphButton.setSelected(true);
        graphButton.addItemListener(new ItemListener() {

            public void itemStateChanged(ItemEvent e) {
                if(e.getStateChange() == ItemEvent.SELECTED) {
                    visualizationModel.setGraphLayout(graphLayout);
                    vv.getRenderContext().setVertexShapeTransformer(ovals);
                    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
                    vv.repaint();
                }
            }});
        JRadioButton gridButton = new JRadioButton("Grid");
        gridButton.addItemListener(new ItemListener() {

            public void itemStateChanged(ItemEvent e) {
                if(e.getStateChange() == ItemEvent.SELECTED) {
                    visualizationModel.setGraphLayout(gridLayout);
                    vv.getRenderContext().setVertexShapeTransformer(squares);
                    vv.getRenderContext().setVertexLabelTransformer(new ConstantTransformer(null));
                    vv.repaint();
                }
            }});
        graphRadio.add(graphButton);
        graphRadio.add(gridButton);
View Full Code Here

            new GradientVertexRenderer<String,Number>(
                Color.white, Color.red,
                Color.white, Color.blue,
                vv.getPickedVertexState(),
                false));
        vv.getRenderContext().setEdgeDrawPaintTransformer(new ConstantTransformer(Color.lightGray));
        vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
        vv.getRenderContext().setArrowDrawPaintTransformer(new ConstantTransformer(Color.lightGray));
       
        // add my listeners for ToolTips
        vv.setVertexToolTipTransformer(new ToStringLabeller<String>());
        vv.setEdgeToolTipTransformer(new Transformer<Number,String>() {
      public String transform(Number edge) {
View Full Code Here

                  } }));

      vv.getRenderContext().setEdgeDrawPaintTransformer(
            edgeLineColorTransformer);
      vv.getRenderContext().setEdgeStrokeTransformer(
            new ConstantTransformer(new BasicStroke(2.5f)));
      vv.getRenderer().setEdgeLabelRenderer(new BasicEdgeLabelRenderer());

      vv.setBackground(Color.white);

      // add a listener for ToolTips
View Full Code Here

TOP

Related Classes of org.apache.commons.collections15.functors.ExceptionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.