Пример #1
0
        /*
         * Constructors
         */

        public ApplyOver(ListGroupNode list, ApplyType type)
        {
            _trueIf        = type;
            _listGroup     = list;
            _listGroupName = list.FullPath;

            _indexWindow = new IndexedDataWindow(_listGroup.DataWindow);
            _valid       = true;
        }
Пример #2
0
        public IndexedDataWindow(IndexedDataWindow indexedWindow)
        {
            _windows = new ArrayList();

            this._listGroup             = indexedWindow._listGroup;
            _listGroup.ListDataChanged += new ListEvent(listGroup_ListDataChanged);
            this._index = indexedWindow._index;

            indexedWindow.Parent.AddChildWindow(this);
        }
Пример #3
0
        public void Update()
        {
            if (_windowNames == null || _windowParent == null || !_windowParent.Valid)
            {
                return;
            }

            try
            {
                // we don't check for intermediate null results (which may happen if
                // the VariableTable has not been fully populated yet), but instead
                // allow NullPointerExceptions to be thrown, which we catch.

                if (_windowParent is IndexedDataWindow)
                {
                    IndexedDataWindow idxParent = (IndexedDataWindow)_windowParent;

                    _windowRef = ((Hashtable)_windowParent.Reference)[_windowNames[0]];

                    if (_windowNames.Length != 1)
                    {
                        // -1 is because list indices are 1-indexed
                        _windowRef = ((ArrayList)_windowRef)[idxParent.Index - 1];

                        // length-1 is to ensure we get a pointer to data, rather than data
                        for (int i = 1; i < _windowNames.Length - 1; i++)
                        {
                            _windowRef = ((Hashtable)_windowRef)[_windowNames[i]];
                        }
                    }
                }
                else
                {
                    _windowRef = _windowParent.Reference;

                    // length-1 is to ensure we get a pointer to data, rather than data
                    for (int i = 0; i < _windowNames.Length - 1; i++)
                    {
                        _windowRef = ((Hashtable)_windowRef)[_windowNames[i]];
                    }
                }

                // ensure we have a valid value
                if (this.Type.ValueSpace is BinarySpace || this.Value != null)
                {
                    // to make sure CIOs update when parent DataWindows move
                    ValueChanged();
                }
            }
            catch (Exception)
            {
                _windowRef = null;
            }
        }
Пример #4
0
        public void Update()
        {
            if (_windowNames == null || _windowParent == null || !_windowParent.Valid)
            {
                return;
            }

            try
            {
                // we don't check for intermediate null results (which may happen if
                // the VariableTable has not been fully populated yet), but instead
                // allow NullPointerExceptions to be thrown, which we catch.

                if (_windowParent is IndexedDataWindow)
                {
                    IndexedDataWindow idxParent = (IndexedDataWindow)_windowParent;

                    _windowRef = ((Hashtable)_windowParent.Reference)[_windowNames[0]];

                    if (_windowNames.Length != 1)
                    {
                        // -1 is because list indices are 1-indexed
                        _windowRef = ((ArrayList)_windowRef)[idxParent.Index - 1];

                        // length-1 is to ensure we get a pointer to data, rather than data
                        for (int i = 1; i < _windowNames.Length - 1; i++)
                        {
                            _windowRef = ((Hashtable)_windowRef)[_windowNames[i]];
                        }
                    }
                }
                else
                {
                    if (!_state.Defined)
                    {
                        return;
                    }

                    _windowRef = _windowParent.Reference;

                    // length-1 is to ensure we get a pointer to data, rather than data
                    for (int i = 0; i < _windowNames.Length - 1; i++)
                    {
                        _windowRef = ((Hashtable)_windowRef)[_windowNames[i]];
                    }
                }
            }
            catch (Exception)
            {
                _windowRef = null;
            }
        }
Пример #5
0
        public bool ResolveObject(VariableTable varTable)
        {
            _listGroup = varTable.GetListGroup(_listGroupName);

            if (_listGroup == null)
            {
                throw new PUC.Parsers.SpecParseException(_lineNumber, "List group references by " + PUC.Parsers.SpecParser21.APPLY_OVER_TAG + " element could not be found: " + _listGroupName);
            }

            _valid       = true;
            _indexWindow = new IndexedDataWindow(_listGroup.DataWindow);

            return(_valid);
        }
Пример #6
0
        protected void changeIndexWindow(IDataWindow dwin)
        {
            if (dwin.Parent is IndexedDataWindow)
            {
                IndexedDataWindow iwin = (IndexedDataWindow)dwin.Parent;

                if (iwin.ListGroup == _listGroup)
                {
                    dwin.Parent.RemoveChildWindow(dwin);
                    _indexWindow.AddChildWindow(dwin);
                }
            }
            else
            {
                changeIndexWindow(dwin.Parent);
            }
        }