| Line | Hits | Source |
|---|---|---|
| 1 | /******************************************************************************* | |
| 2 | * Demetrix process modelling system | |
| 3 | * | |
| 4 | * Copyright (c) 2003, 2004 Dimitri A. Pissarenko | |
| 5 | * | |
| 6 | * This file is part of Demetrix. | |
| 7 | * | |
| 8 | * Demetrix is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2.1 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * Demetrix is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with Demetrix; if not, write to the Free Software | |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 | * | |
| 22 | * For further information you may | |
| 23 | * | |
| 24 | * - send an e-mail in Russian, German or English to dimitri.pissarenko@gmx.net | |
| 25 | * - look at http://sourceforge.net/projects/demetrix/ | |
| 26 | * - look at http://demetrix.sourceforge.net/ | |
| 27 | * - look at http://members.inode.at/d.pissarenko/ | |
| 28 | * | |
| 29 | *****************************************************************************/ | |
| 30 | /* | |
| 31 | * Created on 22.01.2004 | |
| 32 | */ | |
| 33 | package net.sourceforge.demetrix.util; | |
| 34 | ||
| 35 | import java.awt.Rectangle; | |
| 36 | import java.util.HashMap; | |
| 37 | import java.util.Map; | |
| 38 | ||
| 39 | import org._3pq.jgrapht.ext.JGraphModelAdapter; | |
| 40 | import org.jgraph.graph.DefaultGraphCell; | |
| 41 | import org.jgraph.graph.GraphConstants; | |
| 42 | ||
| 43 | /** | |
| 44 | * @author Dimitri Pissarenko | |
| 45 | * | |
| 46 | */ | |
| 47 | public class GraphVertexPositioningHelper { | |
| 48 | private static GraphVertexPositioningHelper instance; | |
| 49 | 1 | private GraphVertexPositioningHelper() { |
| 50 | 1 | } |
| 51 | public static GraphVertexPositioningHelper getInstance() { | |
| 52 | 1 | if (instance == null) { |
| 53 | 1 | instance = new GraphVertexPositioningHelper(); |
| 54 | } | |
| 55 | 1 | return instance; |
| 56 | } | |
| 57 | public void positionVertexAt( | |
| 58 | Object vertex, | |
| 59 | int x, | |
| 60 | int y, | |
| 61 | JGraphModelAdapter jgraphAdapter) { | |
| 62 | 0 | DefaultGraphCell cell = jgraphAdapter.getVertexCell(vertex); |
| 63 | 0 | Map attr = cell.getAttributes(); |
| 64 | 0 | Rectangle b = GraphConstants.getBounds(attr); |
| 65 | ||
| 66 | 0 | GraphConstants.setBounds(attr, new Rectangle(x, y, b.width, b.height)); |
| 67 | ||
| 68 | 0 | Map cellAttr = new HashMap(); |
| 69 | 0 | cellAttr.put(cell, attr); |
| 70 | 0 | jgraphAdapter.edit(cellAttr); |
| 71 | 0 | } |
| 72 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |