Package org.openquark.gems.client.Gem

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


       
        try {
            // Add the newly-freed arguments to the dummy collector.
            Set<PartInput> freedArgumentSet = new LinkedHashSet<PartInput>();
            for (final Connection conn : oldConnections) {
                PartInput freedArgument = conn.getDestination();
                freedArgumentSet.add(freedArgument);
            }
            tempTarget.addArguments(0, freedArgumentSet);

            // Type the resulting graph..
View Full Code Here


            for (final PartInput oldPartInput : oldCollector.getTargetArguments()) {
                // Get the corresponding new argument.
                Gem newGem = oldToNewGemMap.get(oldPartInput.getGem());

                if (newGem != null) {
                    PartInput newArgument = newGem.getInputPart(oldPartInput.getInputNum());
                    newTargetingArguments.add(newArgument);
                }
            }
           
            // Remove the arguments from their old targets.
View Full Code Here

                        // Transmute the node to come up with a valueNode of our desired type
                        ValueNode valueNode = valueGem.getValueNode().transmuteValueNode(valueNodeBuilderHelper, valueNodeTransformer, newSourceType);
                       
                        // Create a temporary value gem and connect it.
                        ValueGem tempValueGem = new ValueGem(valueNode);
                        PartInput connectedInput = outputConnection.getDestination();
                        connectedInput.bindConnection(new Connection(tempValueGem.getOutputPart(), connectedInput));
                       
                        // Add to the set of temporarily disconnected value gem connections.
                        disconnectedValueGemConnections.add(outputConnection);
                    }
                }
View Full Code Here

       
        for (final Entry<CompositionNode.CompositionArgument, TypeExpr> mapEntry : argMap.entrySet()) {
            CompositionNode.CompositionArgument key = mapEntry.getKey();
           
            // must be an input argument.
            PartInput inputArgument = (PartInput)key;
            TypeExpr inputType = mapEntry.getValue();
            unboundPartToTypeMap.put(inputArgument, inputType);
        }
       
        return unboundPartToTypeMap;
View Full Code Here

   
        // get the list of unbound, unburnt parts in toGem's tree
        List<PartInput> inputList = obtainUnboundDescendantInputs(toGem, TraversalScope.TREE, InputCollectMode.UNBURNT_ONLY);
   
        // iterate through the parts and look for a match
        PartInput connectableInput = null;      
       
        for (int i = 0, numParts = inputList.size(); i < numParts; i++) {
       
            PartInput input = inputList.get(i);
   
            // check for parts which come from this gem, and can connect
            if (input.getGem() == toGem &&
                (isCompositionConnectionValid(fromPart, input, context.getContextModuleTypeInfo()) ||
                 isDefaultableValueGemSource(fromPart, input, context) ||
                 (isValidConnectionToRecordFieldSelection(fromPart, input, context.getContextModuleTypeInfo()) != null))) {

                // Do we have more than one match?
View Full Code Here

            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.
                    // They get special treatment since autoburning doesn't apply to value gems.
                   
                    ModuleTypeInfo currentModuleTypeInfo = tableTop.getCurrentModuleTypeInfo();
                    ValueEditorManager valueEditorManager = gemCutter.getValueEditorManager();
                   
                    if (!valueEditorManager.canInputDefaultValue(sinkPart.getType())) {
                        setCursor(connectNoParkCursor);
                       
                    } else if (GemGraph.isCompositionConnectionValid(sourcePart, sinkPart, currentModuleTypeInfo)) {
                        setCursor(connectCursor);
                       
                    } else if (GemGraph.isDefaultableValueGemSource(sourcePart, sinkPart, gemCutter.getConnectionContext())) {
                        setCursor(connectCursor);
                       
                    } else {
                        setCursor(connectNoParkCursor);
                    }
                } else if (sinkGem instanceof RecordFieldSelectionGem && !((RecordFieldSelectionGem)sinkGem).isFieldFixed()) {
                    if (GemGraph.isValidConnectionToRecordFieldSelection(sourcePart, sinkPart, tableTop.getCurrentModuleTypeInfo()) != null) {
                        setCursor(connectCursor);
                    } else {
                        setCursor(connectNoParkCursor);
                    }
                } else if (GemGraph.arePartsConnectable(sourcePart, sinkPart)) {

                    // Check if the parts can be connected either through burning or direct connection.
                    // Even if they can be connected without autoburning we want to at least try burning them.
                    // Why? Because it might be better to burn the gem than just connecting it. We want to
                    // at least consider that possibility and recommend the best choice to the user.

                    if (tableTop.getBurnManager().getAutoburnLastResult() == AutoburnLogic.AutoburnAction.BURNED) {

                        // If the gem has already been burnt previously then keep showing the burn cursor.
                        // Don't try and burn the gem again since that will just show the connect cursor,
                        // since the autoburn logic already sees the gem as being burnt.

                        setCursor(burnCursor);
                       
                    } else if (GemGraph.isConnectionValid(sourcePart, sinkPart)) {
                       
                        // Try making a connection using autoburning.
                       
                        AutoburnLogic.AutoburnAction autoBurnResult = tableTop.getBurnManager().handleAutoburnGemGesture(sourceGem, sinkPart.getType(), true);
                       
                        if (autoBurnResult == AutoburnLogic.AutoburnAction.BURNED) {
                            setCursor(burnCursor);
                           
                        } else if (autoBurnResult == AutoburnLogic.AutoburnAction.MULTIPLE) {
View Full Code Here

TOP

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

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.