Ejemplo n.º 1
0
        /// <summary>
        /// From AbstractTableMode.  Returns the data that should be placed in the JTable at the given row and column. </summary>
        /// <param name="row"> the row for which to return data. </param>
        /// <param name="col"> the column for which to return data. </param>
        /// <returns> the data that should be placed in the JTable at the given row and col. </returns>
        public virtual object getValueAt(int row, int col)
        {
            if (_sortOrder != null)
            {
                row = _sortOrder[row];
            }

            object o = (object)_data.get(row);

            if (o is TS)
            {
                TS ts = (TS)o;
                switch (col)
                {
                case COL_ID:
                    return(ts.getIdentifier().ToString());

                case COL_NAME:
                    return(ts.getDescription());

                default:
                    return("");
                }
            }
            else if ((__component.getComponentType() == StateMod_DataSet.COMP_IRRIGATION_PRACTICE_TS_YEARLY) || (__component.getComponentType() == StateMod_DataSet.COMP_CONSUMPTIVE_WATER_REQUIREMENT_TS_MONTHLY) || (__component.getComponentType() == StateMod_DataSet.COMP_CONSUMPTIVE_WATER_REQUIREMENT_TS_DAILY) || (__component.getComponentType() == StateMod_DataSet.COMP_STATECU_STRUCTURE))
            {
                // StateCU_Data...
                StateCU_Data data = (StateCU_Data)_data.get(row);
                switch (col)
                {
                case COL_ID:
                    return(data.getID());

                case COL_NAME:
                    return(data.getName());

                default:
                    return("");
                }
            }
            else
            {     // StateMod_Data...
                StateMod_Data data = (StateMod_Data)_data.get(row);
                switch (col)
                {
                case COL_ID:
                    return(data.getID());

                case COL_NAME:
                    return(data.getName());

                default:
                    return("");
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the appropriate ID Vector for the given structure type. </summary>
        /// <param name="type"> the structure type for which to return the ID Vector. </param>
        /// <returns> the ID Vector for the structure type. </returns>
        private System.Collections.IList getTypeIDVector(string type)
        {
            int size = __riverNetwork.Count;

            StateMod_Data node = null;
            string        name = null;

            System.Collections.IList v = new List <object>();
            // loops through to (num - 1) because the last element of the network Vector is "END"
            for (int i = 0; i < size; i++)
            {
                node = (StateMod_Data)__riverNetwork[i];

                name = node.getName();
                if (type.Equals(__OTHtype) || name.EndsWith(type, StringComparison.Ordinal))
                {
                    v.Add(node);
                }
            }
            return(v);
        }