Package ptolemy.actor.gui

Examples of ptolemy.actor.gui.Tableau


        }

        Effigy effigy = ((TableauFrame) parent).getEffigy();

        // FIXME: Is the cast safe?
        Tableau tableau = (Tableau) effigy.getEntity("JNICodeGeneratorGUI");

        if (tableau == null) {
            try {
                tableau = new Tableau(effigy, "JNICodeGeneratorGUI");
            } catch (KernelException e) {
                throw new InternalErrorException(e);
            }
        }

        Frame frame = tableau.getFrame();

        if (frame == null) {
            try {
                frame = new JNICodeGeneratorGUI(codeGenerator, tableau);
            } catch (KernelException e) {
View Full Code Here


            Effigy containerEffigy = Configuration.findEffigy(toplevel());
            try {
                _effigy = new PtolemyEffigy(containerEffigy,
                        "ModelDisplay Effigy");
                _effigy.setModel(_entity);
                _tableau = new Tableau(_effigy, "tableau");
            } catch (NameDuplicationException e) {
                throw new IllegalActionException(this, e,
                        "Failed to create tableau.");
            }
            _frame = new TableauFrame(_tableau);
View Full Code Here

         @param parent The parent window, or null if there is none.
         */
        public void createEditor(NamedObj object, Frame parent) {
            try {
                Effigy effigy = ((TableauFrame) parent).getEffigy();
                Tableau tableau = _tableauFactory.createTableau(effigy);
                if (tableau == null) {
                    throw new Exception("Tableau factory returns null.");
                }
                tableau.setEditable(effigy.isModifiable());
                tableau.show();
            } catch (Exception ex) {
                throw new InternalErrorException(object, ex,
                        "Cannot generate code. Perhaps outside Vergil?");
            }
        }
View Full Code Here

                    try {
                        _parser.reset();
                        // Export the model into moml string and then import it
                        // again. Needed b some models with unnoticeable state.
                        NamedObj newModel = _parser.parse(model.exportMoML());
                        Tableau tableau = configuration.openModel(newModel,
                                effigy);
                        if (_tableaus[i] != null) {
                            _tableaus[i].close();
                        }
                        _tableaus[i] = tableau;

                        JFrame frame = tableau.getFrame();
                        // Compute location of the new frame.
                        RecordToken location =
                            (RecordToken) screenLocation.getToken();
                        int x = ((IntToken) location.get("x")).intValue();
                        int y = ((IntToken) location.get("y")).intValue();
                        Point newLocation = frame.getLocation();
                        if (x >= 0) {
                            newLocation.x = x;
                        }
                        if (y >= 0) {
                            newLocation.y = y;
                        }
                        // Move the frame to the edge if it exceeds the screen.
                        Dimension size = frame.getSize();
                        Toolkit toolkit = Toolkit.getDefaultToolkit();
                        Dimension screenSize = toolkit.getScreenSize();
                        newLocation.x = Math.min(newLocation.x,
                                screenSize.width - size.width);
                        newLocation.y = Math.min(newLocation.y,
                                screenSize.height - size.height);
                        frame.setLocation(newLocation);
                        frame.addWindowListener(this);

                        String titleString = null;
                        if (titleValue.equals("")) {
                            URI uri = URIAttribute.getModelURI(newModel);
                            if (uri != null) {
                                URI modelURI = new URI(uri.getScheme(), uri
                                        .getUserInfo(), uri.getHost(), uri
                                        .getPort(), uri.getPath()
                                        + newModel.getName() + ".xml", null,
                                        null);
                                titleString = modelURI.toString() + " ("
                                        + getName() + ")";
                            }
                        } else {
                            titleString = titleValue;
                        }
                        tableau.setTitle(titleString);
                    } catch (NameDuplicationException e) {
                        throw new IllegalActionException(this, e,
                                "Cannot open model.");
                    } catch (Exception e) {
                        throw new IllegalActionException(this, e,
View Full Code Here

        setModified(false);
        close();

        MoMLParser parser = new MoMLParser();
        try {
            Tableau tableau = getFrameController().getConfiguration().openModel(
                    parser.parse(moml));
            Frame frame = tableau.getFrame();
            if (modified && (frame instanceof TableauFrame)) {
                ((TableauFrame) tableau.getFrame()).setModified(true);
            }
        } catch (Exception e) {
            MessageHandler.error("Cannot open default tableau for the "
                    + "model.", e);
        }
View Full Code Here

                object = getTarget();
            }

            try {
                BasicGraphFrame frame = _controller.getFrame();
                Tableau tableau = frame.getTableau();

                // effigy is the whole model.
                Effigy effigy = (Effigy) tableau.getContainer();

                // We want to open a new window that behaves as a
                // child of the model window.  So, we create a new text
                // effigy inside this one.  Specify model's effigy as
                // a container for this new effigy.
View Full Code Here

                getFrameController().getConfiguration();
            if (configuration == null) {
                throw new InternalErrorException("Cannot get configuration.");
            }

            Tableau tableau = configuration.openModel(model);
            MatchResultViewer viewer = (MatchResultViewer) tableau.getFrame();
            viewer.setMatchResult(results);
            viewer.setSourceFileName(sourceFileName);
            viewer.setTransformationRule(
                    getFrameController().getTransformationRule());
            return viewer;
View Full Code Here

        }

        Effigy effigy = ((TableauFrame) parent).getEffigy();

        // FIXME: Is the cast safe?
        Tableau tableau = (Tableau) effigy.getEntity("codeGeneratorGUI");

        if (tableau == null) {
            try {
                tableau = new Tableau(effigy, "codeGeneratorGUI");
            } catch (KernelException e) {
                throw new InternalErrorException(e);
            }
        }

        Frame frame = tableau.getFrame();

        if (frame == null) {
            try {
                frame = new CodeGeneratorGUI(codeGenerator, tableau);
            } catch (KernelException e) {
View Full Code Here

                    // NOTE: Used to use for the first argument the following,
                    // but it seems to not work for relative file references:
                    // new URL("file", null, _directory.getAbsolutePath()
                    Configuration configuration = getConfiguration();
                    Tableau newAutomatonTableau = configuration.openModel(url,
                            url, url.toExternalForm());

                    // compose the two interface automata and show result
                    InterfaceAutomaton model1 = (InterfaceAutomaton) getFrame()
                            .getModel();
                    InterfaceAutomatonGraphFrame graphFrame2 = (InterfaceAutomatonGraphFrame) newAutomatonTableau
                            .getFrame();
                    InterfaceAutomaton model2 = (InterfaceAutomaton) graphFrame2
                            .getModel();

                    InterfaceAutomaton composition = model1.compose(model2);
View Full Code Here

                // one that agrees to open the model.
                while (factories.hasNext() && (factory == null)) {
                    factory = (TableauFactory) factories.next();

                    try {
                        Tableau tableau = factory.createTableau(effigy);

                        if (tableau != null) {
                            // The first tableau is a master if the container
                            // of the containing effigy is the model directory.
                            // Used to do this:
                            // if (effigy.getContainer() instanceof ModelDirectory) {
                            if (effigy.masterEffigy() == effigy) {
                                tableau.setMaster(true);
                            }

                            tableau.setEditable(effigy.isModifiable());

                            //THALES MODIF
                            catchTableau(tableau);
                            tableau.show();
                            return tableau;
                        }
                    } catch (Exception ex) {
                        // Ignore so we keep trying.
                        factory = null;
                    }
                }
            }
        }

        // Defer to the configuration.
        // Create a tableau if there is a tableau factory.
        factory = (TableauFactory) getAttribute("tableauFactory");

        if (factory != null) {
            // If this fails, we do not want the effigy to linger
            try {
                Tableau tableau = factory.createTableau(effigy);

                if (tableau == null) {
                    throw new Exception("Tableau factory returns null.");
                }

                // The first tableau is a master if the container
                // of the containing effigy is the model directory.
                if (effigy.getContainer() instanceof ModelDirectory) {
                    tableau.setMaster(true);
                }

                tableau.setEditable(effigy.isModifiable());

                //THALES MODIF
                catchTableau(tableau);
                tableau.show();
                return tableau;
            } catch (Exception ex) {
                // Note that we can't rethrow the exception here
                // because removing the effigy may result in
                // the application exiting.
View Full Code Here

TOP

Related Classes of ptolemy.actor.gui.Tableau

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.