/** * Create a new case editor tableau with the specified container, name, and default library. * * @param container The container. * @param name The name. * @param defaultLibrary The default library, or null to not specify one. * @exception IllegalActionException If the model associated with the container effigy is not an * instance of Case. * @exception NameDuplicationException If the container already contains an object with the * specified name. */ public CaseGraphTableau(PtolemyEffigy container, String name, LibraryAttribute defaultLibrary) throws IllegalActionException, NameDuplicationException { super(container, name); NamedObj model = container.getModel(); if (!(model instanceof Case)) { throw new IllegalActionException(this, "Cannot edit a model that is not an Case."); } createGraphFrame((Case) model, defaultLibrary); }
/** * Close the given tableau when the Java GUI thread is not busy. * * @param tableau The tableau to be closed. */ public static void closeTableau(final Tableau tableau) { Effigy effigy = (Effigy) tableau.getContainer(); if (effigy != null) { try { effigy.setContainer(null); } catch (KernelException e) { // Ignore if we can't remove the effigy from its // container. } } if (effigy instanceof PtolemyEffigy) { PtolemyEffigy ptolemyEffigy = (PtolemyEffigy) effigy; ptolemyEffigy.setModel(null); } SwingUtilities.invokeLater( new Runnable() { @Override public void run() { tableau.close(); } }); }