/** Cache the values entered by the user in VEPs dynamically-displayed on VM start. */
  void cacheArgumentValues() {

    // Collect the value entry panels which correspond to target arguments in the TableTop
    List<ValueEditor> argPanels = getArgumentPanels();

    List<Gem.PartInput> argParts = targetDisplayedGem.getTargetArguments();
    int numArgs = argParts.size();

    // sanity check
    if (numArgs != argPanels.size()) {
      throw new IllegalStateException(
          "Programming Error: matching "
              + numArgs
              + " arguments and "
              + argPanels.size()
              + " argument panels.");
    }

    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);
    }
  }
    private TypeExpr[] getArgTypes() {
      List<ValueEditor> argPanelList = getArgumentPanels();
      TypeExpr[] argTypes = new TypeExpr[argPanelList.size()];
      for (int i = 0, nArgs = argPanelList.size(); i < nArgs; i++) {
        ValueEditor argPanel = argPanelList.get(i);
        argTypes[i] = argPanel.getValueNode().getTypeExpr();
      }

      return argTypes;
    }
    private InputPolicy[] getInputPolicies() {
      List<ValueEditor> argPanelList = getArgumentPanels();
      InputPolicy[] ips = new InputPolicy[argPanelList.size()];
      for (int i = 0, nArgs = argPanelList.size(); i < nArgs; i++) {
        ValueEditor argPanel = argPanelList.get(i);
        ips[i] = argPanel.getValueNode().getInputPolicy();
      }

      return ips;
    }
    /** {@inheritDoc} */
    @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());
      }
    }
    private Object[] getRuntimeArgumentValues() {

      List<ValueEditor> argPanelList = getArgumentPanels();
      ArrayList<Object> inputJavaValues = new ArrayList<Object>();

      for (int i = 0, nArgs = argPanelList.size(); i < nArgs; i++) {
        ValueEditor argPanel = argPanelList.get(i);
        Object[] values = argPanel.getValueNode().getInputJavaValues();
        for (final Object value : values) {
          inputJavaValues.add(value);
        }
      }
      return inputJavaValues.toArray();
    }
  /** This method is called when the runtime is about to start evaluating. */
  @Override
  public void enterRunningState() {
    List<ValueEditor> argPanelList = getArgumentPanels();

    // If there are argument panels, we use these to specialize the target
    // type.
    int nPanels = argPanelList.size();
    TypeExpr[] argPanelTypes = new TypeExpr[nPanels];
    for (int i = 0; i < nPanels; i++) {
      ValueEditor argPanel = argPanelList.get(i);
      argPanelTypes[i] = argPanel.getValueNode().getTypeExpr();
    }

    gemCutter.getStatusMessageDisplayer().clearMessage(this);
    gemCutter.setTargetRunningButtons(true);

    // System.out.println ("DisplayedGemRunner.run()");
  }