Package org.jgraph

Examples of org.jgraph.JGraph$GraphSelectionRedirector


                    path += "." + ext;
                }
               
                OutputStream out = new FileOutputStream(path);
               
                JGraph graph = dataDomainGraphTab.getGraph();
                BufferedImage img = graph.getImage(null, 0);
                ImageIO.write(img, ext, out);
                out.flush();
                out.close();
            }
            catch (IOException ex) {
View Full Code Here


                getDependanciesGraph(project)
               
//                getGraph(project)
        );
       
        JGraph jgraph = new JGraph( adapter );
        jgraph.setDisconnectable(false);
       
        JFrame f = new JFrame();
        f.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
View Full Code Here

      techtreePanel = new JPanel(new BorderLayout());
      techtreePanel.setOpaque(false);
      GraphModel gmodel = new DefaultGraphModel();
      GraphLayoutCache gcache = new GraphLayoutCache(gmodel,
        new DefaultCellViewFactory());
      JGraph graphPanel = new JGraph(gmodel, gcache);
     
      DefaultGraphCell[] cells = new DefaultGraphCell[144];
     
      int i = 0;
      // buildings in building techtree
      DefaultGraphCell ks = createGraphCell("Ks", 315, 20, 1, Productions.BUILDING); // K�ruterschule
      DefaultGraphCell kh = createGraphCell("Kh", 315, 70, 2, Productions.BUILDING); // Kristallh�hle
      DefaultGraphCell ha = createGraphCell("Ha", 395, 70, 2, Productions.BUILDING); // Harzader
      DefaultGraphCell bdl = createGraphCell("BdL", 315, 120, 1, Productions.BUILDING); // Baum des Lebens
      DefaultGraphCell sw = createGraphCell("Sw", 395, 170, 1, Productions.BUILDING); // Steinwurzel
      DefaultGraphCell kb = createGraphCell("Kb", 315, 170, 1, Productions.BUILDING); // Kriegsbrunnen
      DefaultGraphCell ph = createGraphCell("Ph", 235, 120, 1, Productions.BUILDING); // Palasthof
      DefaultGraphCell xdk = createGraphCell("XdK", 235, 170, 1, Productions.BUILDING); // Xhodotorischer Kokon
      DefaultGraphCell kt = createGraphCell("Kt", 155, 170, 1, Productions.BUILDING); // Kristallturm
      DefaultGraphCell sm = createGraphCell("Sm", 75, 170, 1, Productions.BUILDING); // Steinmantel
      DefaultGraphCell ia = createGraphCell("IA", 475, 170, 1, Productions.BUILDING); // Irres Auge
      DefaultGraphCell zs = createGraphCell("Zs", 235, 220, 1, Productions.BUILDING); // Zuchtstation
      DefaultGraphCell kk = createGraphCell("KK", 235, 270, 1, Productions.BUILDING); // Kristallines Katapult
      DefaultGraphCell gg = createGraphCell("GG", 475, 45, 1, Productions.BUILDING); // Geheime Grotte
      DefaultGraphCell hs = createGraphCell("Hs", 155, 45, 1, Productions.BUILDING); // Heldenstatue
     
      // Units and buildings in units trees
      DefaultGraphCell bdlDRE = createGraphCell("BdL", 15, 315, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell zsDRE = createGraphCell("Zs", 15, 345, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell hsDRE = createGraphCell("Hs", 15, 375, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell dre = createGraphCell("Dre", 85, 345, 1, Productions.UNIT);
     
      DefaultGraphCell zsEHW = createGraphCell("Zs", 15, 405, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell ehw = createGraphCell("Ehw", 85, 405, 1, Productions.UNIT);
     
      DefaultGraphCell xdkKob = createGraphCell("XdK", 155, 315, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell kob = createGraphCell("Kob", 225, 315, 1, Productions.UNIT);
     
      DefaultGraphCell kbEIK = createGraphCell("Kb", 155, 345, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell xdkEIK = createGraphCell("XdK", 155, 375, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell eik = createGraphCell("Eik", 225, 345, 1, Productions.UNIT);
     
      DefaultGraphCell phKDM = createGraphCell("Ph", 15, 435, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell xdkKDM = createGraphCell("XdK", 15, 465, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell kdm = createGraphCell("KdM", 85, 435, 1, Productions.UNIT);
     
      DefaultGraphCell bdlKRP = createGraphCell("BdL", 155, 465, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell xdkKRP = createGraphCell("XdK", 155, 435, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell kbKRP = createGraphCell("Kb", 155, 405, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell krp = createGraphCell("Krp", 225, 435, 1, Productions.UNIT);
     
      DefaultGraphCell phHYZ = createGraphCell("Ph", 295, 315, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell zsHYZ = createGraphCell("Zs", 295, 345, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell hyz = createGraphCell("HyZ", 365, 315, 1, Productions.UNIT);
     
      DefaultGraphCell phWIZ = createGraphCell("Ph", 295, 375, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell zsWIZ = createGraphCell("Zs", 295, 405, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell wiz = createGraphCell("WiZ", 365, 375, 1, Productions.UNIT);
     
      DefaultGraphCell phEBS = createGraphCell("Ph", 295, 435, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell xdkEBS = createGraphCell("Xdk", 295, 465, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell ebs = createGraphCell("Ebs", 365, 435, 1, Productions.UNIT);
     
      DefaultGraphCell smAXZ = createGraphCell("Sm", 435, 375, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell xdkAXZ = createGraphCell("XdK", 435, 345, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell kbAXZ = createGraphCell("Kb", 435, 315, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell axz = createGraphCell("AxZ", 505, 345, 1, Productions.UNIT);
     
      DefaultGraphCell smDAZ = createGraphCell("Sm", 435, 465, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell xdkDAZ = createGraphCell("XdK", 435, 435, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell kbDAZ = createGraphCell("Kb", 435, 405, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell daz = createGraphCell("Daz", 505, 435, 1, Productions.UNIT);
     
      DefaultGraphCell sihKB = createGraphCell("Kb", 575, 405, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell sihBDL = createGraphCell("BdL", 575, 435, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell sihSM = createGraphCell("Sm", 575, 465, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell sihZS = createGraphCell("Zs", 645, 465, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell sih = createGraphCell("SiH", 645, 435, 1, Productions.UNIT);
     
      DefaultGraphCell efmPH = createGraphCell("Ph", 575, 315, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell efmBDL = createGraphCell("BdL", 575, 345, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell efmKT = createGraphCell("Kt", 575, 375, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell efmXDK = createGraphCell("XdK", 645, 375, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell efm = createGraphCell("Efm", 645, 345, 1, Productions.UNIT);
     
      DefaultGraphCell fefPH = createGraphCell("Ph", 575, 225, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell fefKT = createGraphCell("Kt", 575, 255, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell fefZS = createGraphCell("Zs", 575, 285, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell fefBDL = createGraphCell("BdL", 645, 285, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell fef = createGraphCell("Fef", 645, 255, 1, Productions.UNIT);
     
      DefaultGraphCell stfPH = createGraphCell("Ph", 575, 135, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell stfKB = createGraphCell("Kb", 575, 165, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell stfKT = createGraphCell("Kt", 575, 195, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell stfZS = createGraphCell("Zs", 645, 195, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell stf = createGraphCell("Stf", 645, 165, 1, Productions.UNIT);
     
      DefaultGraphCell swbKB = createGraphCell("Kb", 575, 45, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell swbBDL = createGraphCell("BdL", 575, 75, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell swbZS = createGraphCell("Zs", 575, 105, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell swb = createGraphCell("SwB", 645, 75, 1, Productions.UNIT);
     
      DefaultGraphCell briPH = createGraphCell("Ph", 15, 255, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell briXDK = createGraphCell("XdK", 15, 285, 1, Productions.UNIT_BUILDING);
      DefaultGraphCell bri = createGraphCell("Bri", 85, 255, 1, Productions.UNIT);
     
      // cells of buildings
      cells[i++] = ks;
      cells[i++] = kh;
      cells[i++] = ha;
      cells[i++] = bdl;
      cells[i++] = sw;
      cells[i++] = kb;
      cells[i++] = ph;
      cells[i++] = xdk;
      cells[i++] = kt;
      cells[i++] = sm;
      cells[i++] = ia;
      cells[i++] = zs;
      cells[i++] = kk;
      cells[i++] = gg;
      cells[i++] = hs;
     
      // cells of units and buildings for units
      cells[i++] = bdlDRE;
      cells[i++] = zsDRE;
      cells[i++] = hsDRE;
      cells[i++] = dre;
      cells[i++] = zsEHW;
      cells[i++] = ehw;
      cells[i++] = xdkKob;
      cells[i++] = kob;
      cells[i++] = kbEIK;
      cells[i++] = xdkEIK;
      cells[i++] = eik;
      cells[i++] = phKDM;
      cells[i++] = xdkKDM;
      cells[i++] = kdm;
      cells[i++] = bdlKRP;
      cells[i++] = xdkKRP;
      cells[i++] = kbKRP;
      cells[i++] = krp;
      cells[i++] = zsHYZ;
      cells[i++] = phHYZ;
      cells[i++] = hyz;
      cells[i++] = phWIZ;
      cells[i++] = zsWIZ;
      cells[i++] = wiz;
      cells[i++] = phEBS;
      cells[i++] = xdkEBS;
      cells[i++] = ebs;
      cells[i++] = kbAXZ;
      cells[i++] = xdkAXZ;
      cells[i++] = smAXZ;
      cells[i++] = axz;
      cells[i++] = kbDAZ;
      cells[i++] = xdkDAZ;
      cells[i++] = smDAZ;
      cells[i++] = daz;
      cells[i++] = sih;
      cells[i++] = sihBDL;
      cells[i++] = sihKB;
      cells[i++] = sihSM;
      cells[i++] = sihZS;
      cells[i++] = efm;
      cells[i++] = efmBDL;
      cells[i++] = efmKT;
      cells[i++] = efmPH;
      cells[i++] = efmXDK;
      cells[i++] = fef;
      cells[i++] = fefBDL;
      cells[i++] = fefKT;
      cells[i++] = fefPH;
      cells[i++] = fefZS;
      cells[i++] = stf;
      cells[i++] = stfKB;
      cells[i++] = stfKT;
      cells[i++] = stfPH;
      cells[i++] = stfZS;
      cells[i++] = swb;
      cells[i++] = swbBDL;
      cells[i++] = swbKB;
      cells[i++] = swbZS;
      cells[i++] = bri;
      cells[i++] = briPH;
      cells[i++] = briXDK;
     
      // arrows
      cells[i++] = createGraphEdge("10", bdlDRE, dre, GraphConstants.PERMILLE * 0.2, -4);
      cells[i++] = createGraphEdge("5", zsDRE, dre, GraphConstants.PERMILLE * 0.2, -4);
      cells[i++] = createGraphEdge("1", hsDRE, dre, GraphConstants.PERMILLE * 0.3, -4);
      cells[i++] = createGraphEdge("1", zsEHW, ehw, GraphConstants.PERMILLE * 0.3, -4);
      cells[i++] = createGraphEdge("1", xdkKob, kob, GraphConstants.PERMILLE * 0.3, -4);
      cells[i++] = createGraphEdge("10", kbEIK, eik, GraphConstants.PERMILLE * 0.3, -4);
      cells[i++] = createGraphEdge("2", xdkEIK, eik, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("5", phKDM, kdm, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("1", xdkKDM, kdm, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("20", kbKRP, krp, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("3", xdkKRP, krp, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("15", bdlKRP, krp, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("15", phHYZ, hyz, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("2", zsHYZ, hyz, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("25", phWIZ, wiz, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("3", zsWIZ, wiz, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("35", phEBS, ebs, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("5", xdkEBS, ebs, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("30", kbAXZ, axz, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("5", xdkAXZ, axz, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("10", smAXZ, axz, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("40", kbDAZ, daz, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("7", xdkDAZ, daz, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("15", smDAZ, daz, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("50", sihKB, sih, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("45", sihBDL, sih, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("25", sihSM, sih, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("15", sihZS, sih, GraphConstants.PERMILLE * 0.3, -15);
      cells[i++] = createGraphEdge("55", efmPH, efm, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("50", efmBDL, efm, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("10", efmKT, efm, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("14", efmXDK, efm, GraphConstants.PERMILLE * 0.3, -15);
      cells[i++] = createGraphEdge("20", fefPH, fef, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("5", fefKT, fef, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("4", fefZS, fef, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("20", fefBDL, fef, GraphConstants.PERMILLE * 0.3, -15);
      cells[i++] = createGraphEdge("15", stfPH, stf, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("15", stfKB, stf, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("10", stfKT, stf, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("5", stfZS, stf, GraphConstants.PERMILLE * 0.3, -15);
      cells[i++] = createGraphEdge("60", swbKB, swb, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("50", swbBDL, swb, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("20", swbZS, swb, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("45", briPH, bri, GraphConstants.PERMILLE * 0.3, -5);
      cells[i++] = createGraphEdge("8", briXDK, bri, GraphConstants.PERMILLE * 0.3, -5);
     
      // Kristallh�hle -> Heldenstatue
      List<Point2D> ctrPnts26 = new ArrayList<Point2D>();
      ctrPnts26.add(new Point2D.Double(315, 75));
      ctrPnts26.add(new Point2D.Double(295, 55));
      ctrPnts26.add(new Point2D.Double(205, 55));
      cells[i++] = createGraphEdge("2", ctrPnts26, GraphConstants.PERMILLE*0.2, 8);
     
      // Kristallh�hle -> Geheime Grotte
      List<Point2D> ctrPnts25 = new ArrayList<Point2D>();
      ctrPnts25.add(new Point2D.Double(365, 75));
      ctrPnts25.add(new Point2D.Double(385, 55));
      ctrPnts25.add(new Point2D.Double(475, 55));
      cells[i++] = createGraphEdge("2", ctrPnts25, GraphConstants.PERMILLE*0.2, -8);
     
      // Kristallturm -> Kristallines Katapult
      List<Point2D> ctrPnts24 = new ArrayList<Point2D>();
      ctrPnts24.add(new Point2D.Double(180, 190));
      ctrPnts24.add(new Point2D.Double(180, 280));
      ctrPnts24.add(new Point2D.Double(235, 280));
      cells[i++] = createGraphEdge("5", ctrPnts24, GraphConstants.PERMILLE*0.5, 8);
     
      // Palasthof -> Steinmantel
      List<Point2D> ctrPnts23 = new ArrayList<Point2D>();
      ctrPnts23.add(new Point2D.Double(235, 125));
      ctrPnts23.add(new Point2D.Double(100, 125));
      ctrPnts23.add(new Point2D.Double(100, 170));
      cells[i++] = createGraphEdge("5", ctrPnts23, GraphConstants.PERMILLE*0.85, -8);
     
      // Palasthof -> Kristallturm
      List<Point2D> ctrPnts22 = new ArrayList<Point2D>();
      ctrPnts22.add(new Point2D.Double(235, 130));
      ctrPnts22.add(new Point2D.Double(180, 130));
      ctrPnts22.add(new Point2D.Double(180, 170));
      cells[i++] = createGraphEdge("3", ctrPnts22, GraphConstants.PERMILLE*0.75, -8);
     
      // Palasthof -> Zuchtstation
      List<Point2D> ctrPnts21 = new ArrayList<Point2D>();
      ctrPnts21.add(new Point2D.Double(235, 135));
      ctrPnts21.add(new Point2D.Double(215, 155));
      ctrPnts21.add(new Point2D.Double(215, 230));
      ctrPnts21.add(new Point2D.Double(235, 230));
      cells[i++] = createGraphEdge("1", ctrPnts21, GraphConstants.PERMILLE*0.75, 8);
     
      // Kristallh�hle -> Kristallines Katapult
      List<Point2D> ctrPnts20 = new ArrayList<Point2D>();
      ctrPnts20.add(new Point2D.Double(315, 85));
      ctrPnts20.add(new Point2D.Double(305, 95));
      ctrPnts20.add(new Point2D.Double(305, 275));
      ctrPnts20.add(new Point2D.Double(285, 275));
      cells[i++] = createGraphEdge("15", ctrPnts20, GraphConstants.PERMILLE*0.85, -8);
     
      // Harzader -> Kristallines Katapult
      List<Point2D> ctrPnts19 = new ArrayList<Point2D>();
      ctrPnts19.add(new Point2D.Double(445, 80));
      ctrPnts19.add(new Point2D.Double(535, 80));
      ctrPnts19.add(new Point2D.Double(535, 285));
      ctrPnts19.add(new Point2D.Double(285, 285));
      cells[i++] = createGraphEdge("5", ctrPnts19, GraphConstants.PERMILLE/2, -8);
     
      // Steinwurzel -> Zuchtstation
      List<Point2D> ctrPnts18 = new ArrayList<Point2D>();
      ctrPnts18.add(new Point2D.Double(420, 190));
      ctrPnts18.add(new Point2D.Double(420, 230));
      ctrPnts18.add(new Point2D.Double(285, 230));
      cells[i++] = createGraphEdge("3", ctrPnts18, GraphConstants.PERMILLE/2, 8);
     
      // Steinwurzel -> Irres Auge
      List<Point2D> ctrPnts17 = new ArrayList<Point2D>();
      ctrPnts17.add(new Point2D.Double(445, 180));
      ctrPnts17.add(new Point2D.Double(475, 180));
      cells[i++] = createGraphEdge("1", ctrPnts17, GraphConstants.PERMILLE/2, -8);
     
      // Xhodotorischer Kokon -> Kriegsbrunnen
      List<Point2D> ctrPnts16 = new ArrayList<Point2D>();
      ctrPnts16.add(new Point2D.Double(285, 180));
      ctrPnts16.add(new Point2D.Double(315, 180));
      cells[i++] = createGraphEdge("5", ctrPnts16, GraphConstants.PERMILLE/4, -8);
     
      // Palasthof -> Xhodotorischer Kokon
      List<Point2D> ctrPnts15 = new ArrayList<Point2D>();
      ctrPnts15.add(new Point2D.Double(260, 140));
      ctrPnts15.add(new Point2D.Double(260, 170));
      cells[i++] = createGraphEdge("1", ctrPnts15, GraphConstants.PERMILLE/2, 8);
     
      // Kr�uterschule -> Kristallh�hle
      List<Point2D> ctrPnts2 = new ArrayList<Point2D>();
      ctrPnts2.add(new Point2D.Double(340, 40));
      ctrPnts2.add(new Point2D.Double(340, 70));
      cells[i++] = createGraphEdge("1", ctrPnts2, GraphConstants.PERMILLE/2, -8);
     
      // Kristallh�hle -> Baum des Lebens
      List<Point2D> ctrPnts4 = new ArrayList<Point2D>();
      ctrPnts4.add(new Point2D.Double(340, 90));
      ctrPnts4.add(new Point2D.Double(340, 120));
      cells[i++] = createGraphEdge("1", ctrPnts4, GraphConstants.PERMILLE/2, -8);
     
      // Baum des Lebens -> Steinwurzel
      List<Point2D> ctrPnts6 = new ArrayList<Point2D>();
      ctrPnts6.add(new Point2D.Double(365, 135));
      ctrPnts6.add(new Point2D.Double(420, 135));
      ctrPnts6.add(new Point2D.Double(420, 170));
      cells[i++] = createGraphEdge("3", ctrPnts6, GraphConstants.PERMILLE/2, 9);
     
      // Kristallh�hle -> Harzader
      List<Point2D> ctrPnts8 = new ArrayList<Point2D>();
      ctrPnts8.add(new Point2D.Double(365, 80));
      ctrPnts8.add(new Point2D.Double(395, 80));
      cells[i++] = createGraphEdge("10", ctrPnts8, GraphConstants.PERMILLE*0.7, 11);
     
      // Kr�uterschule -> Harzader
      List<Point2D> ctrPnts9 = new ArrayList<Point2D>();
      ctrPnts9.add(new Point2D.Double(365, 30));
      ctrPnts9.add(new Point2D.Double(420, 30));
      ctrPnts9.add(new Point2D.Double(420, 70));
      cells[i++] = createGraphEdge("15", ctrPnts9, GraphConstants.PERMILLE/2, -8);
     
      // Baum des Lebens -> Harzader
      List<Point2D> ctrPnts10 = new ArrayList<Point2D>();
      ctrPnts10.add(new Point2D.Double(365, 125));
      ctrPnts10.add(new Point2D.Double(420, 125));
      ctrPnts10.add(new Point2D.Double(420, 90));
      cells[i++] = createGraphEdge("10", ctrPnts10, GraphConstants.PERMILLE/2, -8);
     
      // Baum des Lebens -> Kriegsbrunnen
      List<Point2D> ctrPnts11 = new ArrayList<Point2D>();
      ctrPnts11.add(new Point2D.Double(340, 140));
      ctrPnts11.add(new Point2D.Double(340, 170));
      cells[i++] = createGraphEdge("5", ctrPnts11, GraphConstants.PERMILLE/2, -8);
     
      // Kr�uterschule -> Palasthof
      List<Point2D> ctrPnts12 = new ArrayList<Point2D>();
      ctrPnts12.add(new Point2D.Double(315, 25));
      ctrPnts12.add(new Point2D.Double(247.5, 25));
      ctrPnts12.add(new Point2D.Double(247.5, 120));
      cells[i++] = createGraphEdge("3", ctrPnts12, GraphConstants.PERMILLE/2, 8);
     
      // Kristallh�hle -> Palasthof
      List<Point2D> ctrPnts13 = new ArrayList<Point2D>();
      ctrPnts13.add(new Point2D.Double(315, 80));
      ctrPnts13.add(new Point2D.Double(272.5, 80));
      ctrPnts13.add(new Point2D.Double(272.5, 120));
      cells[i++] = createGraphEdge("3", ctrPnts13, GraphConstants.PERMILLE/2, 8);
     
      // Baum des Lebens -> Palasthof
      List<Point2D> ctrPnts14 = new ArrayList<Point2D>();
      ctrPnts14.add(new Point2D.Double(315, 130));
      ctrPnts14.add(new Point2D.Double(285, 130));
      cells[i++] = createGraphEdge("5", ctrPnts14, GraphConstants.PERMILLE*0.75, 9);
     
      // graph can't be modified
      graphPanel.getGraphLayoutCache().insert(cells);
      graphPanel.setOpaque(false);
      graphPanel.setEditable(false);
      graphPanel.setMoveable(false);
      graphPanel.setSelectionEnabled(false);
     
      techtreePanel.add(graphPanel, BorderLayout.CENTER);
     
      JPanel infoPanel = new JPanel();
      JTextArea ta = new JTextArea("Der Graph oben zeigt die Voraussetzungen f�r die jeweiligen Geb�ude. Die Zahl am Pfeil zeigt an, welche Stufe das Geb�ude zu Beginn\n" +
View Full Code Here

        // create a visualization using JGraph, via an adapter
        jgAdapter = new JGraphModelAdapter<String, DefaultEdge>(g);

       
        jgraph = new JGraph(jgAdapter);
    }
View Full Code Here

    {
        this.control = control;
        g = new ListenableDirectedGraph(DefaultEdge.class);

        GraphModel graphModel = new JGraphModelAdapter(g);
        graph = new JGraph(graphModel);

        //Add selection Listener to graph
        graph.addGraphSelectionListener(new GraphSelectionListenerImp(control));
     
    }
View Full Code Here

  public static void main(String[] args) {

    // Construct Model and Graph
    GraphModel model = new DefaultGraphModel();
    JGraph graph = new JGraph(model);

    // Control-drag should clone selection
    graph.setCloneable(true);

    // Enable edit without final RETURN keystroke
    graph.setInvokesStopCellEditing(true);

    // When over a cell, jump to its default port (we only have one, anyway)
    graph.setJumpToDefaultPort(true);

    // Insert all three cells in one call, so we need an array to store them
    DefaultGraphCell[] cells = new DefaultGraphCell[3];

    // Create Hello Vertex
    cells[0] = createVertex("Hello", 20, 20, 40, 20, null, false);

    // Create World Vertex
    cells[1] = createVertex("World", 140, 140, 40, 20, Color.ORANGE, true);

    // Create Edge
    DefaultEdge edge = new DefaultEdge();
    // Fetch the ports from the new vertices, and connect them with the edge
    edge.setSource(cells[0].getChildAt(0));
    edge.setTarget(cells[1].getChildAt(0));
    cells[2] = edge;

    // Set Arrow Style for edge
    int arrow = GraphConstants.ARROW_CLASSIC;
    GraphConstants.setLineEnd(edge.getAttributes(), arrow);
    GraphConstants.setEndFill(edge.getAttributes(), true);

    // Insert the cells via the cache, so they get selected
    graph.getGraphLayoutCache().insert(cells);

    // Show in Frame
    JFrame frame = new JFrame();
    frame.getContentPane().add(new JScrollPane(graph));
    //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
View Full Code Here

        return "icon-zoom-in.png";
    }
   
    @Override
    public void performAction(ActionEvent e) {
        JGraph graph = dataDomainGraphTab.getGraph();
        graph.setScale(graph.getScale() * GraphBuilder.ZOOM_FACTOR);
    }
View Full Code Here

        return "icon-zoom-out.png";
    }
   
    @Override
    public void performAction(ActionEvent e) {
        JGraph graph = dataDomainGraphTab.getGraph();
        graph.setScale(graph.getScale() / GraphBuilder.ZOOM_FACTOR);
    }
View Full Code Here

            }
           
            try {               
                OutputStream out = new FileOutputStream(path);
               
                JGraph graph = dataDomainGraphTab.getGraph();
                BufferedImage img = graph.getImage(null, 0);
               
                try {
                    ImageIO.write(img, ext, out);
                    out.flush();
                }
View Full Code Here

        if (graph != null) {
            // graph already built, exiting silently
            return;
        }

        graph = new JGraph();
        GraphModel model = new DefaultGraphModel();
        graph.setModel(model);

        setProjectController(mediator);
        setDataDomain(domain);
View Full Code Here

TOP

Related Classes of org.jgraph.JGraph$GraphSelectionRedirector

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.