Package org.openquark.gems.client.DisplayedGem

Examples of org.openquark.gems.client.DisplayedGem.DisplayedPartInput


            // Check that the input number is within bounds.
            int inputIndex = ((PartInput)part).getInputNum();
            if (inputIndex < displayedGem.getNDisplayedArguments()) {

                // Check that the displayed input corresponds to the input part.
                DisplayedPartInput displayedPartInput = displayedGem.getDisplayedInputPart(inputIndex);
                if (displayedPartInput.getPartInput() == part) {
                    return displayedPartInput;
                }
            }

            // We might be in an inconsistent state.  Check against all displayed input parts..
            for (int i = 0, nDisplayedArgs = displayedGem.getNDisplayedArguments(); i < nDisplayedArgs; i++) {
                DisplayedPartInput displayedPartInput = displayedGem.getDisplayedInputPart(i);
                if (displayedPartInput.getPartInput() == part) {
                    return displayedPartInput;
                }
            }

            return null;
View Full Code Here


     * @return DisplayedConnection the displayed connection which was created.
     */
    private DisplayedConnection handleConnectionAdded(Connection connection) {
        // Create a new displayed connection.
        DisplayedPartOutput dSource = (DisplayedPartOutput)getDisplayedPartConnectable(connection.getSource());
        DisplayedPartInput dDest = (DisplayedPartInput)getDisplayedPartConnectable(connection.getDestination());
        DisplayedConnection displayedConnection = new DisplayedConnection(dSource, dDest);

        // bind connections
        dSource.bindDisplayedConnection(displayedConnection);
        dDest.bindDisplayedConnection(displayedConnection);

        // Add to the map.
        connectionDisplayMap.put(displayedConnection.getConnection(), displayedConnection);

        // Add the connection listener
View Full Code Here

        if (inputs.length == 1) {

            // Display the same menu as the table top, if there is only one input.
            DisplayedGem dGem = gemCutter.getTableTop().getDisplayedGem(inputs[0].getGem());
            DisplayedPartInput dInput = dGem.getDisplayedInputPart(inputs[0].getInputNum());

            JPopupMenu popupMenu = gemCutter.getTableTopPanel().getGemPartPopupMenu(dInput, false);

            // Add our Intellicut menu item first.
            popupMenu.add(GemCutter.makeNewMenuItem(getIntellicutAction(inputs[0])), 0);
View Full Code Here

           
            if (intellicutMode == IntellicutMode.PART_OUTPUT) {
               
                int nArgs = displayedGem.getNDisplayedArguments();
                for (int i = 0; i < nArgs; i++) {
                    DisplayedPartInput dInput = displayedGem.getDisplayedInputPart(i);
                    if (dInput != null) {
                        intellicutCheckParts.add(dInput);
                    }
                }
View Full Code Here

                    // Set the source part
                    connectionDragAnchorPart = (DisplayedPartConnectable) partPressed;
                   
                } else if (partPressed instanceof DisplayedPartInput) {
                   
                    DisplayedPartInput sinkPart = (DisplayedPartInput)partPressed;
                   
                    // If we were in intellicut mode part source, possibly auto connect it.
                    if (prevIntellicutMode == IntellicutManager.IntellicutMode.PART_OUTPUT &&
                            tableTop.handleIntellicutAutoConnectGesture(sinkPart)) {

                        // disable dragging if we autoconnected
                        setDragMode(DragMode.ABORTED);
                        return;
                    }
                   
                    // We could be starting a drag.  Adjust the apparent press point to be the connection point
                    pressedAt = sinkPart.getConnectionPoint();
                   
                    // Set the source part
                    connectionDragAnchorPart = (DisplayedPartConnectable) partPressed;
                }
               
View Full Code Here

            partPopupMenu.add(GemCutter.makeNewMenuItem(getIntellicutAction(part)));
            partPopupMenu.add(separator);
        }
       
        if (part instanceof DisplayedPartInput) {
            DisplayedPartInput inputPart = (DisplayedPartInput) part;
           
            if (!inputPart.isConnected()) {
                partPopupMenu.add(GemCutter.makeNewMenuItem(getConnectValueGemAction(inputPart)));
               
                if (!(inputPart.getPartInput().getGem() instanceof CollectorGem)) {
                   
                    if (inputPart.getPartInput().isBurnt()) {
                        partPopupMenu.add(GemCutter.makeNewMenuItem(getUnburnAction(inputPart)));
                       
                    } else {
                        partPopupMenu.add(GemCutter.makeNewMenuItem(getBurnAction(inputPart)));
                    }
                }
            }
           
            // Create popup menu item for retargeting inputs.
            final JMenu retargetInputMenu = GemCutter.makeNewMenu(GemCutter.getResourceString("PopItem_RetargetInput"));
            partPopupMenu.add(retargetInputMenu);
           
            // Get the targetable collectors, enable the menu item if not empty and if the input is not connected.
            List<CollectorGem> targetableCollectorList = getTargetableCollectors(inputPart.getPartInput());
            retargetInputMenu.setEnabled(!targetableCollectorList.isEmpty() && !inputPart.isConnected());
           
            CollectorGem currentArgTarget = GemGraph.getInputArgumentTarget(inputPart.getPartInput());

            // Create submenu items for retargeting to an enclosing collector.
            for (final CollectorGem targetableCollector : targetableCollectorList) {
               
                // Make the new menu item.
                JMenuItem newMenuItem = GemCutter.makeNewMenuItem(getRetargetInputArgumentAction(inputPart.getPartInput(), targetableCollector));
               
                // Enable if its not already targeted to this collector.
                newMenuItem.setEnabled(targetableCollector != currentArgTarget);
               
                // Add the menu item.
View Full Code Here

TOP

Related Classes of org.openquark.gems.client.DisplayedGem.DisplayedPartInput

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.