/* * Licensed Materials - Property of Perforce Software, Inc. * © Copyright Perforce Software, Inc. 2014, 2021 * © Copyright IBM Corp. 2009, 2014 * © Copyright ILOG 1996, 2009 * All Rights Reserved. * * Note to U.S. Government Users Restricted Rights: * The Software and Documentation were developed at private expense and * are "Commercial Items" as that term is defined at 48 CFR 2.101, * consisting of "Commercial Computer Software" and * "Commercial Computer Software Documentation", as such terms are * used in 48 CFR 12.212 or 48 CFR 227.7202-1 through 227.7202-4, * as applicable. */ import ilog.views.diagrammer.IlvDiagrammer; import ilog.views.diagrammer.IlvDiagrammerException; import ilog.views.diagrammer.project.IlvDiagrammerProject; import ilog.views.sdm.util.IlvSDMMutableStyleSheet; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.io.IOException; import java.net.URL; /** * A graph layout diagrammer contains the graph to layout. * * */ public class GraphLayoutDiagrammer extends IlvDiagrammer { private IlvSDMMutableStyleSheet styleSheet; /** * * @param projectURL */ public GraphLayoutDiagrammer(URL projectURL){ super(); setSelectMode(false); setScrollable(false); setEditingAllowed(false); setBackground(null); setOpaque(false); getView().setBackground(new java.awt.Color(0,0,0,0)); getView().setForeground(null); getView().setTransparent(true); styleSheet = new IlvSDMMutableStyleSheet(getEngine(), true, false); if(projectURL!=null){ IlvDiagrammerProject project; try { project = new IlvDiagrammerProject(projectURL); setProject(project); } catch (IlvDiagrammerException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } // Cascade the main style sheet with the mutable style sheet. // The mutable style sheet holds the temporary style changes that are // not statically stored in the main style sheet. try { getEngine().setStyleSheets(1, styleSheet.toString()); } catch (Exception e) { System.out.println("could not load the style sheet"); } addComponentListener(new ComponentListener(){ Override public void componentHidden(ComponentEvent arg0) { } Override public void componentMoved(ComponentEvent arg0) { } Override public void componentResized(ComponentEvent arg0) { fitToContents(); } Override public void componentShown(ComponentEvent arg0) { } }); } /** * Returns the mutable style sheet. */ public IlvSDMMutableStyleSheet getMutableStyleSheet() { return styleSheet; } }