Package ptolemy.gui

Examples of ptolemy.gui.Query$QueryScrollPane


                MessageHandler.error("State container has no container!");
                return;
            }

            // Open a dialog to get the refinement name and class.
            Query query = new Query();
            String defaultName = container.uniqueName(state.getName());
            query.addLine("Name", "Name", defaultName);

            // See whether the configuration offers state refinements.
            Configuration configuration = ((FSMGraphController) getController())
                    .getConfiguration();
            Entity refinements = configuration.getEntity("_stateRefinements");

            // Default choices.
            String[] choiceClasses = { "ptolemy.domains.fsm.modal.Refinement",
                    "ptolemy.domains.fsm.modal.ModalController" };
            String[] choiceNames = { "Default Refinement",
                    "State Machine Refinement" };

            // Check the configuration to see whether the default is overridden.
            if (refinements instanceof CompositeEntity) {
                // There is a specification.
                List refinementList = ((CompositeEntity) refinements)
                        .entityList();
                choiceNames = new String[refinementList.size()];
                choiceClasses = new String[refinementList.size()];

                Iterator iterator = refinementList.iterator();
                int count = 0;

                while (iterator.hasNext()) {
                    Entity entity = (Entity) iterator.next();
                    choiceNames[count] = entity.getName();
                    choiceClasses[count++] = entity.getClass().getName();
                }
            }

            query
                    .addChoice("Class", "Class", choiceNames, choiceNames[0],
                            true);

            // FIXME: Need a frame owner for first arg.
            // Perhaps calling getController(), which returns a GraphController
            // will be a good start.
            ComponentDialog dialog = new ComponentDialog(null,
                    "Specify Refinement", query);

            if (!dialog.buttonPressed().equals("OK")) {
                return;
            }

            final String newName = query.getStringValue("Name");

            if (container.getEntity(newName) != null) {
                MessageHandler.error("There is already a refinement with name "
                        + newName + ".");
                return;
            }

            int choiceIndex = query.getIntValue("Class");
            String newClass = choiceClasses[choiceIndex];

            String currentRefinements = state.refinementName.getExpression();

            if ((currentRefinements == null) || currentRefinements.equals("")) {
View Full Code Here


            for (int i = 0; i < refinements.length; i++) {
                choices[i] = ((Nameable) refinements[i]).getName();
            }

            // Open a dialog to get the refinement name and class.
            Query query = new Query();
            query.addChoice("Refinement", "Refinement", choices, choices[0],
                    false);

            // FIXME: Need a frame owner for first arg.
            // Perhaps calling getController(), which returns a GraphController
            // will be a good start.
            ComponentDialog dialog = new ComponentDialog(null,
                    "Specify Refinement", query);

            if (!dialog.buttonPressed().equals("OK")) {
                return;
            }

            String refinementName = query.getStringValue("Refinement");
            StringBuffer newRefinements = new StringBuffer();
            String currentRefinements = state.refinementName.getExpression();
            StringTokenizer tokenizer = new StringTokenizer(currentRefinements,
                    ",");
View Full Code Here

        /** Perform the action. */
        public void actionPerformed(ActionEvent e) {
            super.actionPerformed(e);
            // Dialog to ask for a case name.
            Query query = new Query();
            query.addLine("case", "Pattern that the control input must match",
                    "");
            ComponentDialog dialog = new ComponentDialog(CaseGraphFrame.this,
                    "Add Case", query);
            if (dialog.buttonPressed().equals("OK")) {
                final String pattern = query.getStringValue("case");
                // NOTE: We do not use a TransitionRefinement because we don't
                // want the sibling input ports that come with output ports.
                String moml = "<entity name=\""
                        + StringUtilities.escapeForXML(pattern) + "\" class=\""
                        + _case.refinementClassName() + "\"/>";
View Full Code Here

        /** Perform the action. */
        public void actionPerformed(ActionEvent e) {
            super.actionPerformed(e);
            // Dialog to ask for a case name.
            Query query = new Query();
            List refinements = _case.entityList(Refinement.class);
            if (refinements.size() < 2) {
                MessageHandler.error("No cases to remove.");
            } else {
                String[] caseNames = new String[refinements.size() - 1];
                Iterator cases = refinements.iterator();
                int i = 0;
                while (cases.hasNext()) {
                    String name = ((Nameable) cases.next()).getName();
                    if (!name.equals("default")) {
                        caseNames[i] = name;
                        i++;
                    }
                }
                query.addChoice("case", "Remove case", caseNames, caseNames[0]);
                ComponentDialog dialog = new ComponentDialog(
                        CaseGraphFrame.this, "Remove Case", query);
                if (dialog.buttonPressed().equals("OK")) {
                    final String name = query.getStringValue("case");
                    String moml = "<deleteEntity name=\""
                            + StringUtilities.escapeForXML(name) + "\"/>";

                    // The following is, regrettably, copied from ModalTransitionController.
                    MoMLChangeRequest change = new MoMLChangeRequest(this,
View Full Code Here

                MessageHandler.error("Transition container has no container!");
                return;
            }

            // Open a dialog to get the refinement name and class.
            Query query = new Query();
            String defaultName = container.uniqueName(transition.getName());
            query.addLine("Name", "Name", defaultName);

            // See whether the configuration offers transition refinements.
            Configuration configuration = ((FSMGraphController) getController())
                    .getConfiguration();
            Entity refinements = configuration
                    .getEntity("_transitionRefinements");

            // Default choices.
            String[] choiceClasses = { "ptolemy.domains.fsm.modal.TransitionRefinement" };
            String[] choiceNames = { "Default Refinement" };

            // Check the configuration to see whether the default is overridden.
            if (refinements instanceof CompositeEntity) {
                // There is a specification.
                List refinementList = ((CompositeEntity) refinements)
                        .entityList();
                choiceNames = new String[refinementList.size()];
                choiceClasses = new String[refinementList.size()];

                Iterator iterator = refinementList.iterator();
                int count = 0;

                while (iterator.hasNext()) {
                    Entity entity = (Entity) iterator.next();
                    choiceNames[count] = entity.getName();
                    choiceClasses[count++] = entity.getClass().getName();
                }
            }

            query
                    .addChoice("Class", "Class", choiceNames, choiceNames[0],
                            true);

            // FIXME: Need a frame owner for first arg.
            // Perhaps calling getController(), which returns a GraphController
            // will be a good start.
            ComponentDialog dialog = new ComponentDialog(null,
                    "Specify Refinement", query);

            if (!dialog.buttonPressed().equals("OK")) {
                return;
            }

            final String newName = query.getStringValue("Name");

            if (container.getEntity(newName) != null) {
                MessageHandler.error("There is already a refinement with name "
                        + newName + ".");
                return;
            }

            int choiceIndex = query.getIntValue("Class");
            String newClass = choiceClasses[choiceIndex];

            String currentRefinements = transition.refinementName
                    .getExpression();
View Full Code Here

            // NOTE: Should the size be hardwired here?
            pane.setPreferredSize(new Dimension(600, 300));
            add(pane);

            // Add a query with font properties.
            _fontProperties = new Query();

            String[] sizes = { "9", "10", "11", "12", "14", "18", "24", "32" };
            _fontProperties.addChoice("fontSize", "font size", sizes,
                    _fontSize, true);
View Full Code Here

            for (int i = 0; i < refinements.length; i++) {
                choices[i] = ((Nameable) refinements[i]).getName();
            }

            // Open a dialog to get the refinement name and class.
            Query query = new Query();
            query.addChoice("Refinement", "Refinement", choices, choices[0],
                    false);

            // FIXME: Need a frame owner for first arg.
            // Perhaps calling getController(), which returns a GraphController
            // will be a good start.
            ComponentDialog dialog = new ComponentDialog(null,
                    "Specify Refinement", query);

            if (!dialog.buttonPressed().equals("OK")) {
                return;
            }

            String refinementName = query.getStringValue("Refinement");
            StringBuffer newRefinements = new StringBuffer();
            String currentRefinements = transition.refinementName
                    .getExpression();
            StringTokenizer tokenizer = new StringTokenizer(currentRefinements,
                    ",");
View Full Code Here

                    // rather than instances.
                    NamedObj model = getModel();

                    if (model instanceof Actor) {
                        // Dialog to ask for a delay time.
                        Query query = new Query();
                        query.addLine("delay",
                                "Time (in ms) to hold highlight", Long
                                        .toString(_lastDelayTime));

                        ComponentDialog dialog = new ComponentDialog(
                                ActorGraphFrame.this, "Delay for Animation",
                                query);

                        if (dialog.buttonPressed().equals("OK")) {
                            try {
                                _lastDelayTime = Long.parseLong(query
                                        .getStringValue("delay"));
                                _controller.setAnimationDelay(_lastDelayTime);

                                Director director = ((Actor) model)
                                        .getDirector();
View Full Code Here

        /**
         * Instantiate a class by first opening a dialog to get a class name and
         * then issuing a change request.
         */
        public void actionPerformed(ActionEvent e) {
            Query query = new Query();
            query.setTextWidth(60);
            query.addLine("class", "Class name", _lastAttributeClassName);

            ComponentDialog dialog = new ComponentDialog(ActorGraphFrame.this,
                    "Instantiate Attribute", query);

            if (dialog.buttonPressed().equals("OK")) {
                // Get the associated Ptolemy model.
                GraphController controller = getJGraph().getGraphPane()
                        .getGraphController();
                AbstractBasicGraphModel model = (AbstractBasicGraphModel) controller
                        .getGraphModel();
                NamedObj context = model.getPtolemyModel();

                _lastAttributeClassName = query.getStringValue("class");

                // Find the root for the instance name.
                String rootName = _lastAttributeClassName;
                int period = rootName.lastIndexOf(".");

View Full Code Here

        /**
         * Instantiate a class by first opening a dialog to get a class name and
         * then issuing a change request.
         */
        public void actionPerformed(ActionEvent e) {
            Query query = new Query();
            query.setTextWidth(60);
            query.addLine("class", "Class name", _lastEntityClassName);
            query.addLine("location", "Location (URL)", _lastLocation);

            ComponentDialog dialog = new ComponentDialog(ActorGraphFrame.this,
                    "Instantiate Entity", query);

            if (dialog.buttonPressed().equals("OK")) {
                // Get the associated Ptolemy model.
                GraphController controller = getJGraph().getGraphPane()
                        .getGraphController();
                AbstractBasicGraphModel model = (AbstractBasicGraphModel) controller
                        .getGraphModel();
                NamedObj context = model.getPtolemyModel();

                _lastEntityClassName = query.getStringValue("class");
                _lastLocation = query.getStringValue("location");

                // Find the root for the instance name.
                String rootName = _lastEntityClassName;
                int period = rootName.lastIndexOf(".");

View Full Code Here

TOP

Related Classes of ptolemy.gui.Query$QueryScrollPane

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.