Package org.openquark.gems.client.Gem

Examples of org.openquark.gems.client.Gem.PartConnectable


        /**
         * {@inheritDoc}
         */
        public void typeChanged(TypeChangeEvent e) {
            // When a part's type changes, repaint for the new type.
            PartConnectable partChanged = (PartConnectable)e.getSource();
            DisplayedPartConnectable displayedPartConnectable = getDisplayedPartConnectable(partChanged);
            if (displayedPartConnectable != null) {
                getTableTopPanel().repaint(displayedPartConnectable.getBounds());
            }
        }
View Full Code Here


        if (!(partClicked instanceof DisplayedPartConnectable)) {
            return false;
        }

        // start intellicut mode if sink or source part, and not a burnt input
        PartConnectable part = ((DisplayedPartConnectable) partClicked).getPartConnectable();
        if ((part instanceof PartInput && !((PartInput)part).isBurnt()) ||
                (part instanceof PartOutput)) {

            if (!part.isConnected()) {

                // Special Case: We do not start Intellicut if the input part is out of range of the TableTop.
                if (((DisplayedPartConnectable) partClicked).getConnectionPoint().getY() <= 0) {
                    return false;
                }          

                // Sometimes (Eg: Broken Code gem), the TypeExpr is null, and should not have intellicut used on it.
                if (part.getType() == null) {
                    return false;
                }

                // Proceed with Intellicut mode.
                getIntellicutManager().startIntellicutModeForTableTop((DisplayedPartConnectable) partClicked);
View Full Code Here

        if (intellicutPart == null) {
            return true;
        }

        Connection connection = null;
        PartConnectable part = intellicutPart.getPartConnectable();

        if (intellicutMode == IntellicutMode.PART_INPUT) {
               
            // Figure out if we should connect the gem by burning it or by just connecting it.
            // We want to perform whatever action results in the highest type closeness.

            AutoburnInfo autoburnInfo = AutoburnLogic.getAutoburnInfo(part.getType(), dGem.getGem(), gemCutter.getTypeCheckInfo());
            AutoburnUnifyStatus burnStatus = autoburnInfo.getAutoburnUnifyStatus();
           
            boolean attemptToConnect = burnStatus.isAutoConnectable();
       
            if (burnStatus == AutoburnUnifyStatus.UNAMBIGUOUS) {

                // Perform the burn if it is unambiguous.
                attemptToConnect = autoburnGem(dGem, autoburnInfo);
               
            } else if (burnStatus == AutoburnUnifyStatus.UNAMBIGUOUS_NOT_NECESSARY) {

                // Only burn it if that is better than not burning it.
                int noBurnTypeCloseness = TypeExpr.getTypeCloseness(part.getType(), dGem.getGem().getOutputPart().getType(), gemCutter.getPerspective().getWorkingModuleTypeInfo());
                if (autoburnInfo.getMaxTypeCloseness() > noBurnTypeCloseness) {
                    attemptToConnect = autoburnGem(dGem, autoburnInfo);
                }
            }
          
View Full Code Here

        if (dSourcePart == null || dSinkPart == null) {
            return;
        }

        PartConnectable sourcePart = dSourcePart.getPartConnectable();
        PartConnectable sinkPart = dSinkPart.getPartConnectable();

        int lineDashSize = -1;
        int lineSpaceSize = -1;
        float lineDashPhase = -1;
       
        if (GemGraph.arePartsConnectable(sourcePart, sinkPart) && GemGraph.isConnectionValid(sourcePart, sinkPart)) {

            // Get the burn status for the two gems
            Gem sourceGem = sourcePart.getGem();
            TypeExpr destTypeExpr = sinkPart.getType();
            AutoburnUnifyStatus autoburnUnifyStatus = GemGraph.isAncestorOfBrokenGemForest(sourceGem) ?
                                        AutoburnUnifyStatus.NOT_POSSIBLE
                                    :   AutoburnLogic.getAutoburnInfo(destTypeExpr, sourceGem, gemCutter.getTypeCheckInfo()).getAutoburnUnifyStatus();
   
            if (autoburnUnifyStatus.isConnectableWithoutBurning()) {
View Full Code Here

                   
            if (partOver instanceof DisplayedPartOutput ||
                (partOver instanceof DisplayedPartInput && !((DisplayedPartInput)partOver).getPartInput().isBurnt())) {
   
                DisplayedPartConnectable dPartConnectable = (DisplayedPartConnectable)partOver;
                PartConnectable partConnectable = dPartConnectable.getPartConnectable();
   
                if (!partConnectable.isConnected()) {
       
                    if (lastPartConnectable == null || lastPartConnectable == partConnectable) {

                        // We're hovering over the same part or a new part. Therefore we start a new show timer
                        // if there isn't a timer already running.
View Full Code Here

            // Make sure we are trying to connect inputs to outputs and vice versa.
            if ((connectionDragAnchorPart instanceof DisplayedPartOutput && partUnder instanceof DisplayedPartInput) ||
                    (connectionDragAnchorPart instanceof DisplayedPartInput && partUnder instanceof DisplayedPartOutput)){

                // Assign the source and sink parts depending what we are hovering over.
                PartConnectable sourcePart;
                PartInput sinkPart;
               
                if (connectionDragAnchorPart instanceof DisplayedPartOutput) {
                    sourcePart = connectionDragAnchorPart.getPartConnectable();
                    sinkPart = ((DisplayedPartInput)partUnder).getPartInput();
                   
                } else {
                    sourcePart = ((DisplayedPartConnectable)partUnder).getPartConnectable();
                    sinkPart = ((DisplayedPartInput)connectionDragAnchorPart).getPartInput();
                }
               
                Gem sourceGem = sourcePart.getGem();
                Gem sinkGem = sinkPart.getGem();
               
                if (sourceGem instanceof ValueGem) {
                   
                    // Check if a value gem can be connected.
View Full Code Here

            namingPolicy = new ScopedEntityNamingPolicy.UnqualifiedUnlessAmbiguous(currentModuleTypeInfo);
        }

        // If it is an input or an output, then we deal with it here.
        if (displayedPart != null && displayedPart instanceof DisplayedPartConnectable) {
            PartConnectable part = ((DisplayedPartConnectable)displayedPart).getPartConnectable();
            toolTip = ToolTipHelpers.getPartToolTip(part, tableTop.getGemGraph(), namingPolicy, this);
           
        } else if (displayedPart instanceof DisplayedPartBody) {
           
            Gem gem = ((DisplayedPartBody) displayedPart).getGem();
View Full Code Here

TOP

Related Classes of org.openquark.gems.client.Gem.PartConnectable

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.