Package org.openquark.cal.valuenode

Examples of org.openquark.cal.valuenode.ValueNode


       
    }
   
    public Object getValueAt(int row, int col) {

        ValueNode rowValueNode = getListValueNode().getValueAt(row);
       
        if (!consolidatedColumns && isListRecord()) {
           
            if (rowValueNode instanceof RecordValueNode) {
                // A list of records
                if (elementTypeExprArray.length == 0) {               
                    return ValueEditorMessages.getString("VE_NoFieldsValue");
                } else {
                    return ((RecordValueNode)rowValueNode).getValueAt(col);
                }
           
            } else if (rowValueNode instanceof NTupleValueNode) {
                // A list of tuples.
                return ((NTupleValueNode)rowValueNode).getValueAt(col);

            } else {
                throw new IllegalStateException("Can't handle list of records where list elements are of type: " + rowValueNode.getClass());
            }

        } else {
            // Just a list.
            return rowValueNode;
View Full Code Here


    public void setValueAt(Object value, int row, int col) {

        // Need to check if it's just a list, or a list of records
        if (!consolidatedColumns && isListRecord()) {

            ValueNode rowValueNode = getListValueNode().getValueAt(row);
           
            if (rowValueNode instanceof RecordValueNode) {
                // A list of records.
                ((RecordValueNode)rowValueNode).setValueNodeAt(col, (ValueNode) value);
           
            } else if (rowValueNode instanceof NTupleValueNode) {
                // A list of tuples.
                ((NTupleValueNode)rowValueNode).setValueNodeAt(col, (ValueNode) value);
           
            } else {
                throw new IllegalStateException("Can't handle list of records where list elements are of type: " + rowValueNode.getClass());
            }

        } else {

            // Just a list.
View Full Code Here

        // Update the date.
        getUpdatedCalendar(calendar);

        // Save the updated date.
        ValueNode returnVN = new RelativeTimeValueNode(calendar.getTime(), getValueNode().getTypeExpr());
        replaceValueNode(returnVN, false);

        notifyValueCommitted();
    }
View Full Code Here

    /**
     * @see TableTopExplorerOwner#changeValueNode(ValueGem, ValueNode)
     */
    public void changeValueNode(ValueGem valueGem, ValueNode valueNode) {

        ValueNode oldValue = valueGem.getValueNode();
        if (valueNode.sameValue(oldValue)) {
            return;
        }
        gemCutter.getTableTop().handleValueGemCommitted(valueGem, oldValue, valueNode);
    }
View Full Code Here

        /**
         * Runs the specified code and returns the result as a Java Object.
         */
        private Object getObjectFromCode(String code) {
            ValueNode vn = getValueNodeFromCode(code);
            return (vn == null) ? null : vn.getValue();
        }
View Full Code Here

                editorPanel.removeAll();

                // Build the code necessary to execute the query.
                // TODO: what should happen if there are parameters in the code?
                String queryCode = generateResultsetFunctionBody();
                ValueNode vn = getValueNodeFromCode(queryCode);

                // If unable to run the query, display a message instead of the value editor.
                if (vn == null) {
                    // TODO: display the error message as well...
                    JTextArea messageText = new JTextArea(GeneratorMessages.getString("JDBCGF_PreviewErrorLabel"));
View Full Code Here

        // Loop thru the ValueEditors and reset their ValueNodes.
        for (final ValueEditor editor : valueEditorHierarchyManager.getTopValueEditors()) {

            // build the new ValueNode and give it to the argument panel
            TypeExpr leastConstrainedType = editor.getContext().getLeastConstrainedTypeExpr();
            ValueNode newNode = valueEditorHierarchyManager.getValueEditorManager().getValueNodeBuilderHelper().getValueNodeForTypeExpr(leastConstrainedType);

            editor.changeOwnerValue(newNode);
        }
    }
View Full Code Here

        }
   
        for (int i = 0; i < numArgs; i++) {
            Gem.PartInput argPart = argParts.get(i);
            ValueEditor argPanel = argPanels.get(i);
            ValueNode argNode = argPanel.getValueNode();
            gemCutter.getTableTop().cacheArgValue(argPart, argNode);
        }
    }
View Full Code Here

        // value entry mechanism.  Else, just use the debug output.
        if (!gemCutter.isDebugOutputMode()// && (numValues > 0) //&& !programmaticErrorFlagged
                /*&& valueNodeBuilderHelper.isConstructorNodeArgumentStackEmpty()*/) {
   
            // If there's an extra message, print it out.
            ValueNode vn = getOutputValueNode();
            if (executionResult == null) {
               
                // If we got a null result and no error, check for the case where the null represents a null foreign value.
               
                // foreignTypeConsApp will hold the TypeConsApp for the output value
                // if the value is a foreign value and the result is null.
                TypeConsApp foreignTypeConsApp = null;
                if (errorMessage == null && vn != null) {
                    TypeConsApp typeConsApp = vn.getTypeExpr().rootTypeConsApp();
                    if (typeConsApp != null && typeConsApp.getForeignTypeInfo() != null) {
                        foreignTypeConsApp = typeConsApp;
                    }
                }

                if (foreignTypeConsApp != null) {
                    // Make sure that the value node is a ForeignValueNode.

                    // An example of a problem this prevents:
                    //   The ColorValueNode is encapsulates a foreign Java value java.awt.Color, and so has a foreign type.
                    //   However, the color output editor may assume that it has a non-null editor.
                    if (!(vn instanceof ForeignValueNode)) {
                        vn = new ForeignValueNode(null, foreignTypeConsApp);
                    }
                    vn.setOutputJavaValue(null);
               
                } else {
                    vn = null;
                }
               
            } else {
                vn.setOutputJavaValue(executionResult);
            }
           
            // Make sure target is visible before we display results
            gemCutter.getTableTop().getTableTopPanel().scrollRectToVisible(targetDisplayedGem.getBounds());
            gemCutter.displayOutput(vn, targetDisplayedGem, messageTitle, errorMessage);
View Full Code Here

         */
        @Override
        public void valueCommitted(ValueEditorEvent evt) {
            ValueEditor committedEditor = (ValueEditor)evt.getSource();
           
            ValueNode oldValue = evt.getOldValue();
            ValueNode newValue = committedEditor.getValueNode();
           
            if (!oldValue.sameValue(newValue)) {
                switchValueNodeTypeExpr(oldValue, newValue);
                committedEditor.setSize(committedEditor.getPreferredSize());
            }
View Full Code Here

TOP

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

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.