Package org.openquark.cal.valuenode

Examples of org.openquark.cal.valuenode.DataConstructorValueNode


     * @see org.openquark.gems.client.valueentry.ValueEditor#setInitialValue()
     */
    @Override
    public void setInitialValue() {
       
        DataConstructorValueNode valueNode = getDataConstructorValueNode();
        TypeExpr valueNodeTypeExpr = valueNode.getTypeExpr();
       
        QualifiedName typeConstructorName = valueNode.getTypeExpr().rootTypeConsApp().getName();
        DataConstructor[] dataConsList = valueEditorManager.getPerspective().getDataConstructorsForType(typeConstructorName);

        DataConstructor currentDataCons = valueNode.getDataConstructor();

        ValueEditorListener childListener = new ChildValueEditorListener();
        KeyAdapter editorPanelKeyListener = new EditorPanelKeyListener();
       
        boolean haveAddedPanel = false;
        FontMetrics fontMetrics = getFontMetrics(getFont().deriveFont(Font.BOLD));
        ScopedEntityNamingPolicy namingPolicy = new UnqualifiedUnlessAmbiguous(valueEditorManager.getPerspective().getWorkingModuleTypeInfo());

        // Remove components in case this is called twice.
        contentPanel.removeAll();

        // Create an editor panel for each supported data constructor.
        for (final DataConstructor dataCons : dataConsList) {

            DataConstructorValueNode newValueNode = null;

            if (currentDataCons.getName().equals(dataCons.getName())) {
               
                // If this is the current data constructor, just transmute the value node.
                newValueNode = (DataConstructorValueNode) valueNode.transmuteValueNode(valueEditorManager.getValueNodeBuilderHelper(),
View Full Code Here


     * @param commitValueMap a committed value map from a ValueNodeCommitHelper
     */
    void updateValueNode(Map<ValueNode, ValueNode> commitValueMap) {

        // Get the new data constructor value node.
        DataConstructorValueNode newValueNode = (DataConstructorValueNode) commitValueMap.get(valueNode);
           
        if (newValueNode == null) {
            newValueNode = (DataConstructorValueNode) valueNode.copyValueNode();
        }
           
        List<ValueNode> newValueNodeChildren = new ArrayList<ValueNode>(newValueNode.getChildrenList());
                       
        // Iterate over the argument panels and update their value nodes.
        for (int i = 0; i < editorPanels.length; i++) {
               
            ValueEntryPanel vep = editorPanels[i].getValueEntryPanel();

            ValueNode oldChildValueNode = vep.getOwnerValueNode();
            ValueNode newChildValueNode = commitValueMap.get(oldChildValueNode);

            if (newChildValueNode != null) {

                vep.changeOwnerValue(newChildValueNode);
                vep.validate();
               
                // The preferred size may have changed if the value node type changed.
                editorPanels[i].setPreferredSize(vep.getPreferredSize());

                // Make sure we have the correct value nodes in the children list.
                newValueNodeChildren.set(i, newChildValueNode);
            }
        }
       
        newValueNode.setChildrenList(newValueNodeChildren);
       
        valueNode = newValueNode;
    }
View Full Code Here

TOP

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

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.