Package org.openquark.gems.client.valueentry

Examples of org.openquark.gems.client.valueentry.ValueEditor$Info


        private void switchValueNodeTypeExpr(ValueNode oldValueNode, ValueNode newValueNode) {
       
            // Create the map from input to value node
            Map<PartInput, ValueNode> inputToValueNodeMap = new HashMap<PartInput, ValueNode>();
            for (final PartInput input : inputToEditorMap.keySet()) {
                ValueEditor editor = inputToEditorMap.get(input);
                inputToValueNodeMap.put(input, editor.getOwnerValueNode());
            }
       
            // Create the type switcher
            InputValueTypeSwitchHelper switcher = new InputValueTypeSwitchHelper(valueEditorManager.getValueNodeCommitHelper());

            // Get the switched values
            Map<PartInput, ValueNode> inputNewValueMap = switcher.getInputSwitchValues(oldValueNode, newValueNode, inputToValueNodeMap);
           
            // Now update with the switched values.
            for (final Map.Entry<PartInput, ValueNode> mapEntry : inputNewValueMap.entrySet()) {
                Gem.PartInput input = mapEntry.getKey();
                ValueNode newInputValue = mapEntry.getValue();
           
                ValueEditor editor = inputToEditorMap.get(input);

                editor.changeOwnerValue(newInputValue);
                editor.setSize(editor.getPreferredSize());
            }
        }
View Full Code Here


                    scName = ((FunctionalAgentGem) inputGem).getName();
                }

                // What we do next depends on whether we use cached sink values
                ValueNode cachedVN;
                final ValueEditor editor;
                if (canUseCachedArgs && (cachedVN = gemCutter.getTableTop().getCachedValue(inputPart)) != null) {
                    // use cached sink value to generate the VEP

                    // get a copy of the cached VN but with the new type expr
                    ValueNode newVN = cachedVN.copyValueNode();

                    // instantiate the VEP with the new VN (which has the old cached value)
                    editor = valueEditorDirector.getRootValueEditor(valueEditorHierarchyManager,
                                                                    newVN,
                                                                    scName,
                                                                    argumentNumber,
                                                                    new GemCutterMetadataRunner(gemCutter, inputGem));

                } else {
                    // don't use cached sink value.  Generate the default VEP for this sink.
                    TypeExpr inputType = specializedInputTypes[i];
                    editor = valueEditorDirector.getRootValueEditor(valueEditorHierarchyManager,
                                                                    inputType,
                                                                    scName,
                                                                    argumentNumber,
                                                                    new GemCutterMetadataRunner(gemCutter, inputGem));
                }

                // If this is a value entry panel then set the name of the input for use in tooltips
                if (editor instanceof ValueEntryPanel) {
                    ((ValueEntryPanel)editor).setArgumentName(inputPart.getArgumentName().getCompositeName());
                }
               
                // Position the editor next to the connection point.
                positionEditor(editor, inputPart);
               
                // Now add the editor to the table top.
                tableTopPanel.add(editor, 0);               

                // Add to the list of active entry panels
                valueEditorHierarchyManager.addTopValueEditor(editor);

                // Update the context and editor map
                editor.setContext(new ValueEditorContext() {
                    public TypeExpr getLeastConstrainedTypeExpr() {
                        return inputPart.getType();
                    }
                });
                inputToEditorMap.put(inputPart, editor);
               
                // If the editor resizes because it's value changes, make sure it stays aligned to the connection
                editor.addComponentListener(new ComponentAdapter() {
                    @Override
                    public void componentResized(ComponentEvent e) {
                        positionEditor((ValueEditor) e.getComponent(), inputPart);
                    }
                });
View Full Code Here

                customIcon = getInputIcon(argumentNode);
                customText = inputPart.getNameString();
          
                // If we're in run mode, show input values if available.
                if (inputToArgumentPanelMap != null) {
                    ValueEditor inputEditor = inputToArgumentPanelMap.get(inputPart);
                    if (inputEditor != null) {
                        customText += ": " + inputEditor.getValueNode().getTextValue();
                    }
                }

            } else {
                // Unrecognized node type.  What to do?
View Full Code Here

           
            // Just render the input dot.  Otherwise, render the whole cell.
            JComponent cellRendererComponent = new JLabel(CellRenderer.getInputIcon((ArgumentNode)value));
           
            // Set up the value editor stuff.
            ValueEditor mirroredValueEditor = getMirroredEntryPanel((ArgumentTreeNode)value);
            valueEditor = new AugmentedValueEditor(getValueEditorHierarchyManager(), cellRendererComponent, mirroredValueEditor);
            getValueEditorHierarchyManager().addTopValueEditor(valueEditor);
            getValueEditorHierarchyManager().addEditorToHierarchy(mirroredValueEditor, valueEditor);
           
           
View Full Code Here

TOP

Related Classes of org.openquark.gems.client.valueentry.ValueEditor$Info

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.