本文整理汇总了Java中org.jgraph.graph.GraphLayoutCache类的典型用法代码示例。如果您正苦于以下问题:Java GraphLayoutCache类的具体用法?Java GraphLayoutCache怎么用?Java GraphLayoutCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GraphLayoutCache类属于org.jgraph.graph包,在下文中一共展示了GraphLayoutCache类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setLayouting
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
/** Sets the layouting flag to the given value. */
public void setLayouting(boolean layouting) {
if (layouting != this.layouting) {
this.layouting = layouting;
if (layouting) {
// start the layouting
getModel().beginUpdate();
} else {
// reroute the loops
GraphLayoutCache cache = getGraphLayoutCache();
for (CellView view : cache.getRoots()) {
if (view instanceof EdgeView && ((EdgeView) view).isLoop()) {
view.update(cache);
}
}
// end the layouting
getModel().endUpdate();
}
}
}
示例2: testJGraph
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
@Test
public void testJGraph() throws Exception {
GraphModel model = new DefaultGraphModel();
GraphLayoutCache view = new GraphLayoutCache(model, new DefaultCellViewFactory());
JGraph graph = new JGraph(model, view);
DefaultGraphCell[] cells = new DefaultGraphCell[3];
cells[0] = createCell("hello", true);
cells[1] = createCell("world", false);
DefaultEdge edge = new DefaultEdge();
GraphConstants.setLineStyle(edge.getAttributes(), GraphConstants.ARROW_LINE);
edge.setSource(cells[0].getChildAt(0));
edge.setTarget(cells[1].getChildAt(0));
cells[2] = edge;
graph.getGraphLayoutCache().insert(cells);
JOptionPane.showMessageDialog(null, new JScrollPane(graph));
}
示例3: ItGraph
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
public ItGraph(GraphLayoutCache cache, ItToolBar graphToolBar, PropertiesTabbedPane propertiesPane,
Element xmlProject, Element xmlDiagram, Element xmlCommonData, String language) {
super(cache);
this.toolBar = graphToolBar;
this.propertiesPane = propertiesPane;
this.project = xmlProject;
this.diagram = xmlDiagram;
this.commonData = xmlCommonData;
this.language = language;
setUI(new ItGraphUI());
setDisconnectable(false);
setEdgeLabelsMovable(true);
getModel().addGraphModelListener(this);
addGraphSelectionListener(this);
add(getPopupMenu(null));
addKeyListener(this);
}
示例4: getTopPetriPane
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
/**
* This method initializes topPetriPanel
*
* @return javax.swing.JPanel
*/
private JRootPane getTopPetriPane() {
if (topPetriPane == null) {
petriToolBar = new ItToolBar("","PetriNet");
petriToolBar.setName("PetriToolBar");
GraphModel model = new DefaultGraphModel();
GraphLayoutCache view = new GraphLayoutCache(model, new ItCellViewFactory());
petriDiagramGraph = new ItGraph(view, petriToolBar, null, null, null, commonData, "PetriNet");
petriToolBar.setGraph(petriDiagramGraph);
petriDiagramGraph.setVisible(false);
topPetriScrollPane = new JScrollPane(petriDiagramGraph);
topPetriPane = new JRootPane();
topPetriPane.setLayout(new BorderLayout());
topPetriPane.add(petriToolBar, BorderLayout.NORTH);
topPetriPane.add(topPetriScrollPane, BorderLayout.CENTER);
//panel.setContentPane(graphScrollPane);
petriDiagramGraph.setVisible(true);
}
return topPetriPane;
}
示例5: openEditStateTab
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
public void openEditStateTab(Element diagram, Element domain, Element project){
ItToolBar toolBar = new ItToolBar(diagram.getName(),"UML");
toolBar.addCloseEditButton();
toolBar.setName(diagram.getChildText("name"));
GraphModel model = new DefaultGraphModel();
GraphLayoutCache view = new GraphLayoutCache(model, new ItCellViewFactory());
ItGraph diagramGraph = new ItGraph(view, toolBar, propertiesPane, project, diagram, ItSIMPLE.getCommonData(), "UML");
toolBar.setGraph(diagramGraph);
diagramGraph.setVisible(false);
JScrollPane graphScrollPane = new JScrollPane(diagramGraph);
JRootPane panel = new JRootPane();
panel.setLayout(new BorderLayout());
panel.add(toolBar, BorderLayout.NORTH);
panel.add(graphScrollPane, BorderLayout.CENTER);
diagramGraph.buildEditStateDiagram(domain);
diagramGraph.setVisible(true);
addTab("Current State", new ImageIcon("resources/images/"+diagram.getName()+".png"), panel);
if (getTabCount() > 1){
setSelectedIndex(getTabCount()-1);
}
editStateTabIndex = getTabCount() - 1;
}
示例6: route
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
@Override
public List<?> route(GraphLayoutCache cache, EdgeView edgeView) {
List<Point2D> result = null;
if (isRoutable(edgeView)) {
JEdge<?> jEdge = (JEdge<?>) edgeView.getCell();
// find out the source bounds
VertexView sourceView = (VertexView) edgeView.getSource()
.getParentView();
// first refresh the source view, otherwise the view bounds
// might be out of date
sourceView.refresh(cache, cache, true);
JGraph<?> jGraph = jEdge.getJGraph();
assert jGraph != null; // guaranteed by now
jGraph.updateAutoSize(sourceView);
Rectangle2D sourceBounds = sourceView.getBounds();
VisualMap visuals = jEdge.getVisuals();
Point2D startPoint = edgeView.getPoint(0);
Point2D midPoint = edgeView.getPoint(1);
if (startPoint.equals(midPoint) || sourceBounds.contains(midPoint)) {
// modify end point so it lies outside node bounds
midPoint.setLocation(sourceBounds.getMaxX() + DEFAULT_LOOP_SIZE, midPoint.getY());
}
Point2D endPoint = edgeView.getPoint(edgeView.getPointCount() - 1);
result = new ArrayList<>(3);
result.add(startPoint);
result.add(midPoint);
result.add(endPoint);
visuals.setPoints(result);
GraphConstants.setPoints(edgeView.getAllAttributes(), result);
}
return result;
}
示例7: getGraphLayoutCache
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
@Override
public JGraphLayoutCache getGraphLayoutCache() {
JGraphLayoutCache result;
GraphLayoutCache superCache = super.getGraphLayoutCache();
if (superCache instanceof JGraphLayoutCache) {
result = (JGraphLayoutCache) superCache;
} else {
result = createGraphLayoutCache();
if (getModel() != null) {
result.setModel(getModel());
}
setGraphLayoutCache(result);
}
return result;
}
示例8: ERDesignerGraph
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
public ERDesignerGraph(Model aDBModel, GraphModel aModel,
GraphLayoutCache aLayoutCache) {
super(aModel, aLayoutCache);
model = aDBModel;
setMoveIntoGroups(true);
setMoveOutOfGroups(true);
}
示例9: createGraph
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
public static JGraph createGraph() {
DefaultGraphModel defaultGraphModel = new DefaultGraphModel();
GraphLayoutCache graphLayoutCache = new GraphLayoutCache(defaultGraphModel, new CustomCellViewFactory());
JGraph newGraph = new JGraph(defaultGraphModel, graphLayoutCache);
newGraph.setDisconnectable(false);
newGraph.setAntiAliased(true);
newGraph.setEditable(false);
return newGraph;
}
示例10: setTrackingFor
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
/**
* Makes this component track the provided graph and scroller. Set
* parameters to <code>null</code> to unbind thie component.
*
* @param graph
* the graph component. May be <code>null</code>
* @param scroller
* the croller, usually the one that holds the graph. May be
* <code>null</code>
*/
public void setTrackingFor(JGraph graph, JScrollPane scroller) {
if (this.peerGraph != null) {
this.peerGraph.getModel().removeGraphModelListener(scrollerListener);
this.peerGraph.removePropertyChangeListener(graphPropertyChangeListener);
}
this.peerGraph = graph;
if (this.peerGraph != null) {
this.peerGraph.getModel().addGraphModelListener(scrollerListener);
this.peerGraph.addPropertyChangeListener(graphPropertyChangeListener);
this.displayGraph.setGraphLayoutCache(peerGraph.getGraphLayoutCache());
} else {
this.displayGraph.setGraphLayoutCache(new GraphLayoutCache());
}
//
if (this.peerScroller != null) {
this.peerScroller.getHorizontalScrollBar().removeAdjustmentListener(
scrollerListener);
this.peerScroller.getVerticalScrollBar().removeAdjustmentListener(
scrollerListener);
}
this.peerScroller = scroller;
if (this.peerScroller != null) {
this.peerScroller.getHorizontalScrollBar().addAdjustmentListener(
scrollerListener);
this.peerScroller.getVerticalScrollBar().addAdjustmentListener(
scrollerListener);
}
update();
repaint();
}
示例11: loadGraph
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
private void loadGraph(String fileName) throws FileNotFoundException, IOException, Throwable {
ASTGraph ast = new ASTGraph();
ParseOutput objects = ast.parseFile(fileName);
graph.setGraphLayoutCache(new GraphLayoutCache());
DefaultGraphCell[] cells = ast.generateTree((SimpleNode) objects.ast);
graph.getGraphLayoutCache().insert(cells);
graph.clearSelection();
}
示例12: MicroarrayGraph
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
public MicroarrayGraph(GraphModel model, GraphLayoutCache cache, GraphPanel graphPanel) {
super(model, cache);
this.model = model;
this.graphPanel = graphPanel;
this.setBackground(Color.WHITE);
// Direct call to parents L&F update, see this.updateUI()
super.updateUI();
/*
* Regardles of the updateUI-call jus before the font size of graph cell is fixed only when the first cell is added. To handle
* situations when the font size is changed before importing any data we force the jgraph to initialise itself by inserting dummy
* vertex and removing it. This *should* happen before any repaint operation, and thus the vertex won't ever show.
*/
GroupVertex vertex = new GroupVertex(0, 0, null, this);
getGraphLayoutCache().insert(vertex);
getGraphLayoutCache().remove(new Object[] { vertex });
// registers the graph object with the tooltip manager
ToolTipManager.sharedInstance().registerComponent(this);
model.addGraphModelListener(this);
// start listening
application.getDataManager().addDataChangeListener(this);
application.addClientEventListener(this);
}
示例13: getGraphLayoutCache
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
public GraphLayoutCache getGraphLayoutCache() {
return graphLayoutCache;
}
示例14: getGraphLayoutCache
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
public GraphLayoutCache getGraphLayoutCache() {
return graphLayoutCache;
}
示例15: DBWizardEREditor
import org.jgraph.graph.GraphLayoutCache; //导入依赖的package包/类
/** Creates new form DBWizardEREditor */
public DBWizardEREditor()
{
initComponents();
ApplicationContext.getInstance().getRandomiserInstances();
ApplicationContext.getInstance().getRandomiserTypes();
alDBTableGenerator = new ArrayList<DBTableGenerator>();
hmDBTableGenerator = new HashMap<String, DBTableGenerator>();
hmPorts = new HashMap<Object, Object>();
GraphModel model = new DefaultGraphModel();
GraphLayoutCache view = new GraphLayoutCache(model, new DBGraphCellViewFactory());
//GraphLayoutCache view = new GraphLayoutCache(model, new DefaultCellViewFactory());
graph = new JGraph(model, view);
graph.setSizeable(true);
graph.setMarqueeHandler(createMarqueeHandler());
// Make Ports Visible by Default
graph.setPortsVisible(true);
// Use the Grid (but don't make it Visible)
graph.setGridEnabled(true);
// Set the Grid Size to 10 Pixel
graph.setGridSize(10);
// Set the Tolerance to 2 Pixel
graph.setTolerance(2);
// Accept edits if click on background
graph.setInvokesStopCellEditing(true);
// Allows control-drag
graph.setCloneable(true);
// Jump to default port on connect
graph.setJumpToDefaultPort(true);
setLayout(new BorderLayout());
toolbar = createToolBar();
add(toolbar, BorderLayout.NORTH);
add(new JScrollPane(graph), BorderLayout.CENTER);
popupDB = new DBPopup(this);
}