Package org.openquark.cal.valuenode

Examples of org.openquark.cal.valuenode.ValueNodeBuilderHelper


        valueRunner = new ValueRunner(workspaceManager);

        // TODOEL: the various runners should create their own builder helpers.
        //   Unfortunately we still rely on the value editor manager for vnbh initialization.
        ValueNodeBuilderHelper valueBuilderHelper = new ValueNodeBuilderHelper(perspective);
        ValueNodeBuilderHelper displayedGemBuilderHelper = new ValueNodeBuilderHelper(perspective);
       
        valueEditorManager = new ValueEditorManager(displayedGemBuilderHelper, getWorkspace(), typeColours, getTypeCheckInfo());
        displayedGemRunner = new DisplayedGemRunner(workspaceManager, this);
        tableTopEditorHierarchyManager = new ValueEditorHierarchyManager(valueEditorManager, getTableTopPanel());
        outputPanelHierarchyManager = new ValueEditorHierarchyManager(valueEditorManager, getLayeredPane());
View Full Code Here


                        // Have to convert a list of NTuples to a list of records.
                       
                        // Note: It might be better to move some of this code to nTupleValueNode.transmute(),
                        //   or ValueNodeTransformer.transform().  This duplicates some work though.
                       
                        ValueNodeBuilderHelper valueNodeBuilderHelper =
                            valueEditorHierarchyManager.getValueEditorManager().getValueNodeBuilderHelper();
                       
                        RecordValueNode.RecordValueNodeProvider recordVNProvider =
                            new RecordValueNode.RecordValueNodeProvider(valueNodeBuilderHelper);
                       
                        // Get the new record type.
                        TypeExpr recordTypeExpr = AbstractRecordValueNode.getRecordTypeForRenamedField(getListElementType(), oldName, newName);
                       
                        // Iterate through the list and convert tuple nodes to record nodes.
                        for (int i = 0; i < listSize; i++) {
                           
                            // Get the tuple node.
                            NTupleValueNode nTupleValueNode = (NTupleValueNode)listValueNode.getValueAt(i);
                           
                            // Get the list of values.
                            List<ValueNode> fieldValueList = new ArrayList<ValueNode>(nTupleValueNode.getValue());
                           
                            // Create and set the record value node with the list of values.
                            ValueNode recordValueNode = recordVNProvider.getNodeInstance(fieldValueList, null, recordTypeExpr);
                            ((ListValueNode)getValueNode()).setValueNodeAt(i, recordValueNode);
                        }
                   
                    } else {
                        // No conversion is necessary.
                    }
                   
                } else {
                    // Empty list, or list of record value nodes.
                   
                    // Iterate through the list of record nodes and change their type expressions
                   
                    for (int i = 0; i < listSize; i++) {
                       
                        AbstractRecordValueNode recordValueNode = (AbstractRecordValueNode)((ListValueNode)getValueNode()).getValueAt(i);
                        recordValueNode = recordValueNode.renameField(oldName, newName, valueEditorManager.getValueNodeBuilderHelper(), valueEditorManager.getValueNodeTransformer());
                        ((ListValueNode)getValueNode()).setValueNodeAt(i, recordValueNode);
                    }
                   
                }
               
                // Now change the list element type expression and update the value node
               
                Map<FieldName, TypeExpr> fieldNamesToTypeMap = new HashMap<FieldName, TypeExpr>();
                List<FieldName> existingFields = getListElementType().rootRecordType().getHasFieldNames();
                for (final FieldName existingFieldName : existingFields) {
                    TypeExpr existingFieldType = getListElementType().rootRecordType().getHasFieldType(existingFieldName);
                   
                    fieldNamesToTypeMap.put(existingFieldName, existingFieldType);
                }
                TypeExpr fieldTypeExpr = fieldNamesToTypeMap.remove(oldName);
                fieldNamesToTypeMap.put(newName, fieldTypeExpr);
               
                RecordType newRecordType = TypeExpr.makeNonPolymorphicRecordType(fieldNamesToTypeMap);
                ValueNodeBuilderHelper valueNodeBuilderHelper = valueEditorManager.getValueNodeBuilderHelper();
                replaceValueNode(getValueNode().transmuteValueNode(valueNodeBuilderHelper, valueEditorManager.getValueNodeTransformer(),
                    valueNodeBuilderHelper.getPreludeTypeConstants().makeListType(newRecordType)), true);
               
                // Select the column of the new field name
               
                int fieldIndex = getListElementType().rootRecordType().getHasFieldNames().indexOf(newName);
                if (getRowCount() > 0) {
View Full Code Here

                        fieldNamesToTypeMap.put(hasFieldName, hasFieldType);
                    }
                    fieldNamesToTypeMap.put(newFieldName, TypeExpr.makeParametricType());

                    RecordType newRecordType = TypeExpr.makeNonPolymorphicRecordType(fieldNamesToTypeMap);
                    ValueNodeBuilderHelper valueNodeBuilderHelper = valueEditorManager.getValueNodeBuilderHelper();
                    replaceValueNode(getValueNode().transmuteValueNode(valueNodeBuilderHelper, valueEditorManager.getValueNodeTransformer(),
                        valueNodeBuilderHelper.getPreludeTypeConstants().makeListType(newRecordType)), true);
                   
                    // Update column sizes after switch
                   
                    userHasResized();
                   
View Full Code Here

                        TypeExpr existingFieldType = getListElementType().rootRecordType().getHasFieldType(existingFieldName);
                        fieldNamesToTypeMap.put(existingFieldName, existingFieldType);
                    }
                    RecordType newRecordType = TypeExpr.makeNonPolymorphicRecordType(fieldNamesToTypeMap);
                   
                    ValueNodeBuilderHelper valueNodeBuilderHelper = valueEditorManager.getValueNodeBuilderHelper();
                    replaceValueNode(getValueNode().transmuteValueNode(valueNodeBuilderHelper, valueEditorManager.getValueNodeTransformer(),
                        valueNodeBuilderHelper.getPreludeTypeConstants().makeListType(newRecordType)), true);
                   
                    userHasResized();
                   
                    // Handle selection
                    int colCount = getColumnCount();
View Full Code Here

                        fieldNamesToTypeMap.put(existingFieldName, existingFieldType);
                    }
                   
                    RecordType newRecordType = TypeExpr.makeNonPolymorphicRecordType(fieldNamesToTypeMap);
                   
                    ValueNodeBuilderHelper valueNodeBuilderHelper = valueEditorManager.getValueNodeBuilderHelper();
                    replaceValueNode(getValueNode().transmuteValueNode(valueNodeBuilderHelper, valueEditorManager.getValueNodeTransformer(),
                        valueNodeBuilderHelper.getPreludeTypeConstants().makeListType(newRecordType)), true);
                    notifyValueChanged(getValueNode());
                }
            }
        }
       
View Full Code Here

TOP

Related Classes of org.openquark.cal.valuenode.ValueNodeBuilderHelper

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.