Package ptolemy.kernel

Examples of ptolemy.kernel.InstantiableNamedObj


            // Determine which entity was selected for the create instance action.
            super.actionPerformed(e);

            // NOTE: This cast should be safe because this controller is
            // used for actors.
            InstantiableNamedObj object = (InstantiableNamedObj) getTarget();
            NamedObj container = object.getContainer();

            // Assumes MoML parser will convert to instance.
            if (!object.isClassDefinition()) {
                // Object is already an instance. Do nothing.
                return;
            }

            // If the class has objects that defer to it, then
            // refuse to convert.
            boolean hasDeferrals = false;
            List deferred = object.getChildren();
            StringBuffer names = new StringBuffer();

            if (deferred != null) {
                // List contains weak references, so it's not
                // sufficient to just check the length.
                Iterator deferrers = deferred.iterator();

                while (deferrers.hasNext()) {
                    WeakReference deferrer = (WeakReference) deferrers.next();
                    NamedObj deferrerObject = (NamedObj) deferrer.get();

                    if (deferrerObject != null) {
                        hasDeferrals = true;

                        if (names.length() > 0) {
                            names.append(", ");
                        }

                        names.append(deferrerObject.getFullName());
                    }
                }
            }

            if (hasDeferrals) {
                MessageHandler.error("Cannot convert to instance because "
                        + "there are instances and/or subclasses:\n"
                        + names.toString());
                return;
            }

            String moml = "<entity name=\"" + object.getName() + "\"/>";
            MoMLChangeRequest request = new MoMLChangeRequest(this, container,
                    moml);
            container.requestChange(request);
        }
View Full Code Here


                return;
            }

            try {
                if (target instanceof InstantiableNamedObj) {
                    InstantiableNamedObj deferTo = (InstantiableNamedObj) ((InstantiableNamedObj) target)
                            .getParent();

                    if (deferTo != null) {
                        _configuration.openModel(deferTo);
                        return;
View Full Code Here

                            Iterator deferrers = deferredFrom.iterator();

                            while (deferrers.hasNext()) {
                                WeakReference reference = (WeakReference) deferrers
                                        .next();
                                InstantiableNamedObj deferrer = (InstantiableNamedObj) reference
                                        .get();

                                if (deferrer != null) {
                                    // Got a live one.
                                    // Need to determine whether the name is
                                    // absolute or relative.
                                    String replacementName = newName;

                                    if (deferrer.getClassName().startsWith(".")) {
                                        replacementName = _current
                                                .getFullName();
                                    }

                                    deferrer.setClassName(replacementName);
                                }
                            }
                        }
                    }
                }
View Full Code Here

        // and also unless this is an object that contains a TableauFactory.
        // I.e., by default, when you open an instance of a class, what
        // is opened is the class definition, not the instance, unless
        // the instance contains a TableauFactory, in which case, we defer
        // to that TableauFactory.
        InstantiableNamedObj deferredTo = null;
        boolean isClass = false;

        if (entity instanceof InstantiableNamedObj) {
            deferredTo = (InstantiableNamedObj) ((InstantiableNamedObj) entity)
                    .getParent();
View Full Code Here

     */
    public Tableau openModel(NamedObj entity) throws IllegalActionException,
            NameDuplicationException {
        // If the entity defers its MoML definition to another,
        // then open that other.
        InstantiableNamedObj deferredTo = null;

        if (entity instanceof InstantiableNamedObj) {
            deferredTo = (InstantiableNamedObj) ((InstantiableNamedObj) entity)
                    .getParent();
        }
View Full Code Here

TOP

Related Classes of ptolemy.kernel.InstantiableNamedObj

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.