/// <summary>
        /// Performs general and specific data checks on river network data. </summary>
        /// <param name="props"> A property list for specific properties </param>
        /// <param name="data_vector"> Vector of data to check.
        /// on checking this data. </param>
        private void checkRiverNetworkData(PropList props, System.Collections.IList data_vector)
        {
            //	 Create elements for the checks and check file
            string[] header = StateMod_RiverNetworkNode.getDataHeader();
            System.Collections.IList data = new List <object>();
            string title = "River Network Node";

            // Perform the general validation using the Data Table Model
            StateMod_Data_TableModel tm = new StateMod_RiverNetworkNode_Data_TableModel(data_vector);

            System.Collections.IList @checked = performDataValidation(tm, title);
            //String [] columnHeader = getDataTableModelColumnHeader( tm );
            string[] columnHeader = getColumnHeader(tm);

            // Do specific checks
            int size = 0;

            if (data_vector != null)
            {
                size = data_vector.Count;
            }
            data = doSpecificDataChecks(data_vector, props);
            // Add the data and checks to the check file.
            // Provides basic header information for this data check table
            string info = "The following " + title + " (" + data.Count +
                          " out of " + size + ") have no .....";

            // Create data models for Check file
            CheckFile_DataModel dm     = new CheckFile_DataModel(data, header, title, info, data.Count, size);
            CheckFile_DataModel gen_dm = new CheckFile_DataModel(@checked, columnHeader, title + " Missing or Invalid Data", "", __gen_problems, size);

            __check_file.addData(dm, gen_dm);
        }
        /// <summary>
        /// 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];
            }

            StateMod_RiverNetworkNode r = (StateMod_RiverNetworkNode)_data.get(row);

            switch (col)
            {
            case COL_ID:
                return(r.getID());

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

            case COL_COMMENT:
                return(r.getComment());

            case COL_CSTADN:
                return(r.getCstadn());

            case COL_GWMAXR:
                return(new double?(r.getGwmaxr()));

            default:
                return("");
            }
        }
        /// <summary>
        /// Processes a table selection (either via a mouse press or programmatically
        /// from selectTableIndex() by writing the old data back to the data set component
        /// and getting the next selection's data out of the data and displaying it on the form. </summary>
        /// <param name="index"> the index of the reservoir to display on the form. </param>
        private void processTableSelection(int index)
        {
            /*
             * Message.printStatus(1, "", "Current: " + __currentStationIndex);
             * Message.printStatus(1, "", "Last: " + __lastStationIndex);
             * Message.printStatus(1, "", "Orig: " + __worksheet.getOriginalRowNumber(index));
             * Message.printStatus(1, "", "Index: " + index);
             */
            __lastStationIndex    = __currentStationIndex;
            __currentStationIndex = __worksheet.getOriginalRowNumber(index);

            saveLastRecord();

            if (__worksheet.getSelectedRow() == -1)
            {
                JGUIUtil.disableComponents(__disables, true);
                return;
            }

            JGUIUtil.enableComponents(__disables, __textUneditables, __editable);

            StateMod_RiverNetworkNode rnn = (StateMod_RiverNetworkNode)__riverNetworkNodesVector[__currentStationIndex];

            __idJTextField.setText(rnn.getID());
            __nameJTextField.setText(rnn.getName());
            __nodeJTextField.setText(rnn.getCstadn());
            __commentJTextField.setText(rnn.getComment());
            checkViewButtonState();
        }
        /// <summary>
        /// Clones the data object. </summary>
        /// <returns> a cloned object. </returns>
        public override object clone()
        {
            StateMod_RiverNetworkNode r = (StateMod_RiverNetworkNode)base.clone();

            r._isClone = true;
            return(r);
        }
        /// <summary>
        /// Responds to Window closing events; closes the window and marks it closed
        /// in StateMod_GUIUtil. </summary>
        /// <param name="e"> the WindowEvent that happened. </param>
        public virtual void windowClosing(WindowEvent e)
        {
            saveCurrentRecord();
            int size = __riverNetworkNodesVector.Count;
            StateMod_RiverNetworkNode r = null;
            bool changed = false;

            for (int i = 0; i < size; i++)
            {
                r = (StateMod_RiverNetworkNode)__riverNetworkNodesVector[i];
                if (!changed && r.changed())
                {
                    changed = true;
                }
                r.acceptChanges();
            }
            if (changed)
            {
                __dataset.setDirty(StateMod_DataSet.COMP_RIVER_NETWORK, true);
            }
            if (__dataset_wm != null)
            {
                __dataset_wm.closeWindow(StateMod_DataSet_WindowManager.WINDOW_RIVER_NETWORK);
            }
            else
            {
                JGUIUtil.close(this);
            }
        }
        /// <summary>
        /// Constructor. </summary>
        /// <param name="dataset"> the dataset containing the data to show in the form. </param>
        /// <param name="editable"> whether the data on the gui can be edited or not. </param>
        public StateMod_RiverNetworkNode_JFrame(StateMod_DataSet dataset, StateMod_RiverNetworkNode node, bool editable) : base("")
        {
            JGUIUtil.setIcon(this, JGUIUtil.getIconImage());
            StateMod_GUIUtil.setTitle(this, dataset, "River Network Nodes", null);

            __dataset = dataset;
            __riverNetworkNodeComponent = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK);
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_RiverNetworkNode> riverNetworkNodesList = (java.util.List<StateMod_RiverNetworkNode>)__riverNetworkNodeComponent.getData();
            IList <StateMod_RiverNetworkNode> riverNetworkNodesList = (IList <StateMod_RiverNetworkNode>)__riverNetworkNodeComponent.getData();

            __riverNetworkNodesVector = riverNetworkNodesList;

            int size = __riverNetworkNodesVector.Count;
            StateMod_RiverNetworkNode r = null;

            for (int i = 0; i < size; i++)
            {
                r = (StateMod_RiverNetworkNode)__riverNetworkNodesVector[i];
                r.createBackup();
            }

            string id    = node.getID();
            int    index = StateMod_Util.locateIndexFromID(id, __riverNetworkNodesVector);

            __editable = editable;

            setupGUI(index);
        }
        /// <summary>
        /// Called when the Apply button is pressed. This commits any changes to the data
        /// objects.
        /// </summary>
        protected internal override void apply()
        {
            StateMod_RiverNetworkNode rnn = null;
            int size = _data.Count;

            for (int i = 0; i < size; i++)
            {
                rnn = (StateMod_RiverNetworkNode)_data[i];
                rnn.createBackup();
            }
        }
        /// <summary>
        /// Called when the cancel button is pressed.  This discards any changes made to
        /// the data objects.
        /// </summary>
        protected internal override void cancel()
        {
            StateMod_RiverNetworkNode rnn = null;
            int size = _data.Count;

            for (int i = 0; i < size; i++)
            {
                rnn = (StateMod_RiverNetworkNode)_data[i];
                rnn.restoreOriginal();
            }
        }
        /// <summary>
        /// Compares this object to another StateMod_RiverNetworkNode object. </summary>
        /// <param name="data"> the object to compare against. </param>
        /// <returns> 0 if they are the same, 1 if this object is greater than the other object, or -1 if it is less. </returns>
        public virtual int CompareTo(StateMod_Data data)
        {
            int res = base.CompareTo(data);

            if (res != 0)
            {
                return(res);
            }

            StateMod_RiverNetworkNode r = (StateMod_RiverNetworkNode)data;

            res = _cstadn.CompareTo(r._cstadn);
            if (res != 0)
            {
                return(res);
            }

            res = _comment.CompareTo(r._comment);
            if (res != 0)
            {
                return(res);
            }

            if (_gwmaxr < r._gwmaxr)
            {
                return(-1);
            }
            else if (_gwmaxr > r._gwmaxr)
            {
                return(1);
            }

            if (_related_smdata_type < r._related_smdata_type)
            {
                return(-1);
            }
            else if (_related_smdata_type > r._related_smdata_type)
            {
                return(1);
            }

            if (_related_smdata_type2 < r._related_smdata_type2)
            {
                return(-1);
            }
            else if (_related_smdata_type2 > r._related_smdata_type2)
            {
                return(1);
            }

            return(0);
        }
        /// <summary>
        /// Cancels any changes made to this object within a GUI since createBackup()
        /// was called and sets _original to null.
        /// </summary>
        public override void restoreOriginal()
        {
            StateMod_RiverNetworkNode r = (StateMod_RiverNetworkNode)_original;

            base.restoreOriginal();
            _cstadn               = r._cstadn;
            _comment              = r._comment;
            _gwmaxr               = r._gwmaxr;
            _related_smdata_type  = r._related_smdata_type;
            _related_smdata_type2 = r._related_smdata_type2;
            _isClone              = false;
            _original             = null;
        }
        /// <summary>
        /// Checks the states of the map and network view buttons based on the selected river network node.
        /// </summary>
        private void checkViewButtonState()
        {
            StateMod_RiverNetworkNode rin = getSelectedRiverNetworkNode();

            if (rin.getGeoRecord() == null)
            {
                // No spatial data are available
                __showOnMap_JButton.setEnabled(false);
            }
            else
            {
                // Enable the button...
                __showOnMap_JButton.setEnabled(true);
            }
        }
        /// <summary>
        /// Selects the desired ID in the left table and displays the appropriate data
        /// in the remainder of the window. </summary>
        /// <param name="id"> the identifier to select in the list. </param>
        public virtual void selectID(string id)
        {
            int rows = __worksheet.getRowCount();
            StateMod_RiverNetworkNode rnn = null;

            for (int i = 0; i < rows; i++)
            {
                rnn = (StateMod_RiverNetworkNode)__worksheet.getRowData(i);
                if (rnn.getID().Trim().Equals(id.Trim()))
                {
                    selectTableIndex(i);
                    return;
                }
            }
        }
        /// <summary>
        /// Saves the information associated with the currently-selected reservoir.
        /// The user doesn't need to hit the return key for the gui to recognize changes.
        /// The info is saved each time the user selects a differents tation or pressed
        /// the close button.
        /// </summary>
        private void saveInformation(int record)
        {
            if (!__editable || record == -1)
            {
                return;
            }

            if (!checkInput())
            {
                return;
            }

            StateMod_RiverNetworkNode rnn = (StateMod_RiverNetworkNode)__riverNetworkNodesVector[record];

            Message.printStatus(1, "", "Setting " + record + " cstadn: " + __nodeJTextField.getText());
            rnn.setCstadn(__nodeJTextField.getText());
            Message.printStatus(1, "", "Setting " + record + " comment: " + __commentJTextField.getText());
            rnn.setComment(__commentJTextField.getText());
        }
        /// <summary>
        /// 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];
            }

            StateMod_RiverNetworkNode r = (StateMod_RiverNetworkNode)_data.get(row);

            switch (col)
            {
            case COL_ID:
                return(r.getID());

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

            default:
                return("");
            }
        }
        /// <summary>
        /// Writes a list of StateMod_RiverNetworkNode objects to a list file.  A header
        /// is printed to the top of the file, containing the commands used to generate the
        /// file.  Any strings in the body of the file that contain the field delimiter will be wrapped in "...". </summary>
        /// <param name="filename"> the name of the file to which the data will be written. </param>
        /// <param name="delimiter"> the delimiter to use for separating field values. </param>
        /// <param name="update"> whether to update an existing file, retaining the current
        /// header (true) or to create a new file with a new header. </param>
        /// <param name="data"> the list of objects to write. </param>
        /// <param name="newComments"> new comments to add to the file header. </param>
        /// <exception cref="Exception"> if an error occurs. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void writeListFile(String filename, String delimiter, boolean update, java.util.List<StateMod_RiverNetworkNode> data, java.util.List<String> newComments) throws Exception
        public static void writeListFile(string filename, string delimiter, bool update, IList <StateMod_RiverNetworkNode> data, IList <string> newComments)
        {
            string routine = "StateMod_RiverNetworkNode.writeListFile";
            int    size    = 0;

            if (data != null)
            {
                size = data.Count;
            }

            IList <string> fields = new List <string>();

            fields.Add("ID");
            fields.Add("Name");
            fields.Add("DownstreamID");
            fields.Add("Comment");
            fields.Add("GWMaxRecharge");
            int fieldCount = fields.Count;

            string[] names   = new string[fieldCount];
            string[] formats = new string[fieldCount];
            int      comp    = StateMod_DataSet.COMP_RIVER_NETWORK;
            string   s       = null;

            for (int i = 0; i < fieldCount; i++)
            {
                s          = fields[i];
                names[i]   = StateMod_Util.lookupPropValue(comp, "FieldName", s);
                formats[i] = StateMod_Util.lookupPropValue(comp, "Format", s);
            }

            string oldFile = null;

            if (update)
            {
                oldFile = IOUtil.getPathUsingWorkingDir(filename);
            }

            int         j    = 0;
            PrintWriter @out = null;
            StateMod_RiverNetworkNode rnn = null;

            string[]       line = new string[fieldCount];
            IList <string> commentIndicators = new List <string>(1);

            commentIndicators.Add("#");
            IList <string> ignoredCommentIndicators = new List <string>(1);

            ignoredCommentIndicators.Add("#>");
            StringBuilder buffer = new StringBuilder();

            try
            {
                // Add some basic comments at the top of the file.  Do this to a copy of the
                // incoming comments so that they are not modified in the calling code.
                IList <string> newComments2 = null;
                if (newComments == null)
                {
                    newComments2 = new List <string>();
                }
                else
                {
                    newComments2 = new List <string>(newComments);
                }
                newComments2.Insert(0, "");
                newComments2.Insert(1, "StateMod river network as a delimited list file.");
                newComments2.Insert(2, "See also the generalized network file.");
                newComments2.Insert(3, "");
                @out = IOUtil.processFileHeaders(oldFile, IOUtil.getPathUsingWorkingDir(filename), newComments2, commentIndicators, ignoredCommentIndicators, 0);

                for (int i = 0; i < fieldCount; i++)
                {
                    if (i > 0)
                    {
                        buffer.Append(delimiter);
                    }
                    buffer.Append("\"" + names[i] + "\"");
                }

                @out.println(buffer.ToString());

                for (int i = 0; i < size; i++)
                {
                    rnn = (StateMod_RiverNetworkNode)data[i];

                    line[0] = StringUtil.formatString(rnn.getID(), formats[0]).Trim();
                    line[1] = StringUtil.formatString(rnn.getName(), formats[1]).Trim();
                    line[2] = StringUtil.formatString(rnn.getCstadn(), formats[2]).Trim();
                    line[3] = StringUtil.formatString(rnn.getComment(), formats[3]).Trim();
                    line[4] = StringUtil.formatString(rnn.getGwmaxr(), formats[4]).Trim();

                    buffer = new StringBuilder();
                    for (j = 0; j < fieldCount; j++)
                    {
                        if (j > 0)
                        {
                            buffer.Append(delimiter);
                        }
                        if (line[j].IndexOf(delimiter, StringComparison.Ordinal) > -1)
                        {
                            line[j] = "\"" + line[j] + "\"";
                        }
                        buffer.Append(line[j]);
                    }

                    @out.println(buffer.ToString());
                }
            }
            catch (Exception e)
            {
                Message.printWarning(3, routine, e);
                throw e;
            }
            finally
            {
                if (@out != null)
                {
                    @out.flush();
                    @out.close();
                }
            }
        }
        /// <summary>
        /// Write the new (updated) river network file to the StateMod river network
        /// file.  If an original file is specified, then the original header is carried into the new file. </summary>
        /// <param name="infile"> Name of old file or null if no old file to update. </param>
        /// <param name="outfile"> Name of new file to create (can be the same as the old file). </param>
        /// <param name="theRivs"> list of StateMod_RiverNetworkNode to write. </param>
        /// <param name="newcomments"> New comments to write in the file header. </param>
        /// <param name="doWell"> Indicates whether well modeling fields should be written. </param>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void writeStateModFile(String infile, String outfile, java.util.List<StateMod_RiverNetworkNode> theRivs, java.util.List<String> newcomments, boolean doWell) throws Exception
        public static void writeStateModFile(string infile, string outfile, IList <StateMod_RiverNetworkNode> theRivs, IList <string> newcomments, bool doWell)
        {
            PrintWriter    @out = null;
            IList <string> commentIndicators = new List <string>(1);

            commentIndicators.Add("#");
            IList <string> ignoredCommentIndicators = new List <string>(1);

            ignoredCommentIndicators.Add("#>");
            string routine = "StateMod_RiverNetworkNode.writeStateModFile";

            if (Message.isDebugOn)
            {
                Message.printDebug(2, routine, "Writing river network file \"" + outfile + "\" using \"" + infile + "\" header...");
            }

            try
            {
                // Process the header from the old file...
                @out = IOUtil.processFileHeaders(IOUtil.getPathUsingWorkingDir(infile), IOUtil.getPathUsingWorkingDir(outfile), newcomments, commentIndicators, ignoredCommentIndicators, 0);

                string cmnt   = "#>";
                string iline  = null;
                string format = null;
                StateMod_RiverNetworkNode riv = null;

                @out.println(cmnt + " *******************************************************");
                @out.println(cmnt + "  StateMod River Network File");
                @out.println(cmnt + "  WARNING - if .net file is available, it should be edited and the .rin");
                @out.println(cmnt + "  file should be created from the .net");
                @out.println(cmnt);
                @out.println(cmnt + "  format:  (a12, a24, a12, 1x, a12, 1x, f8.0)");
                @out.println(cmnt);
                @out.println(cmnt + "  ID           cstaid:  Station ID");
                @out.println(cmnt + "  Name         stanam:  Station name");
                @out.println(cmnt + "  Downstream   cstadn:  Downstream node ID");
                @out.println(cmnt + "  Comment     comment:  Alternate identifier/comment.");
                @out.println(cmnt + "  GWMax        gwmaxr:  Max recharge limit (cfs) - see iwell in control file.");
                @out.println(cmnt);
                @out.println(cmnt + "   ID                Name          DownStream     Comment    GWMax  ");
                @out.println(cmnt + "---------eb----------------------eb----------exb----------exb------e");
                if (doWell)
                {
                    format = "%-12.12s%-24.24s%-12.12s %-12.12s %8.8s";
                }
                else
                {
                    format = "%-12.12s%-24.24s%-12.12s %-12.12s";
                }
                @out.println(cmnt);
                @out.println(cmnt + "EndHeader");
                @out.println(cmnt);

                int num = 0;
                if (theRivs != null)
                {
                    num = theRivs.Count;
                }
                IList <object> v = new List <object>(5);
                for (int i = 0; i < num; i++)
                {
                    riv = theRivs[i];
                    v.Clear();
                    v.Add(riv.getID());
                    v.Add(riv.getName());
                    v.Add(riv.getCstadn());
                    v.Add(riv.getComment());
                    if (doWell)
                    {
                        // Format as string since main format uses string.
                        v.Add(StringUtil.formatString(riv.getGwmaxr(), "%8.0f"));
                    }
                    iline = StringUtil.formatString(v, format);
                    @out.println(iline);
                }
            }
            catch (Exception e)
            {
                Message.printWarning(3, routine, e);
                throw e;
            }
            finally
            {
                if (@out != null)
                {
                    @out.flush();
                    @out.close();
                }
            }
        }
        /// <summary>
        /// Read river network or stream gage information and return a list of StateMod_RiverNetworkNode. </summary>
        /// <param name="filename"> Name of file to read. </param>
        /// <exception cref="Exception"> if there is an error reading the file. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static java.util.List<StateMod_RiverNetworkNode> readStateModFile(String filename) throws Exception
        public static IList <StateMod_RiverNetworkNode> readStateModFile(string filename)
        {
            string rtn = "StateMod_RiverNetworkNode.readStateModFile";
            IList <StateMod_RiverNetworkNode> theRivs = new List <StateMod_RiverNetworkNode>();
            string         iline, s;
            IList <object> v = new List <object>(7);

            int[] format_0;
            int[] format_0w;
            format_0     = new int[7];
            format_0[0]  = StringUtil.TYPE_STRING;
            format_0[1]  = StringUtil.TYPE_STRING;
            format_0[2]  = StringUtil.TYPE_STRING;
            format_0[3]  = StringUtil.TYPE_STRING;
            format_0[4]  = StringUtil.TYPE_STRING;
            format_0[5]  = StringUtil.TYPE_STRING;
            format_0[6]  = StringUtil.TYPE_STRING;
            format_0w    = new int [7];
            format_0w[0] = 12;
            format_0w[1] = 24;
            format_0w[2] = 12;
            format_0w[3] = 1;
            format_0w[4] = 12;
            format_0w[5] = 1;
            format_0w[6] = 8;

            int linecount = 0;

            if (Message.isDebugOn)
            {
                Message.printDebug(10, rtn, "in " + rtn + " reading file: " + filename);
            }
            StreamReader @in = null;

            try
            {
                @in = new StreamReader(filename);
                while (!string.ReferenceEquals((iline = @in.ReadLine()), null))
                {
                    ++linecount;
                    // check for comments
                    if (iline.StartsWith("#", StringComparison.Ordinal) || iline.Trim().Length == 0)
                    {
                        continue;
                    }

                    // allocate new StateMod_RiverNetworkNode
                    StateMod_RiverNetworkNode aRiverNode = new StateMod_RiverNetworkNode();

                    // line 1
                    if (Message.isDebugOn)
                    {
                        Message.printDebug(50, rtn, "line 1: " + iline);
                    }
                    StringUtil.fixedRead(iline, format_0, format_0w, v);
                    if (Message.isDebugOn)
                    {
                        Message.printDebug(50, rtn, "Fixed read returned " + v.Count + " elements");
                    }
                    aRiverNode.setID(((string)v[0]).Trim());
                    aRiverNode.setName(((string)v[1]).Trim());
                    aRiverNode.setCstadn(((string)v[2]).Trim());
                    // 3 is whitespace
                    // Expect that we also may have the comment and possibly the gwmaxr value...
                    aRiverNode.setComment(((string)v[4]).Trim());
                    // 5 is whitespace
                    s = ((string)v[6]).Trim();
                    if (s.Length > 0)
                    {
                        aRiverNode.setGwmaxr(StringUtil.atod(s));
                    }

                    // add the node to the vector of river nodes
                    theRivs.Add(aRiverNode);
                }
            }
            catch (Exception e)
            {
                Message.printWarning(3, rtn, "Error reading \"" + filename + "\" at line " + linecount);
                throw e;
            }
            finally
            {
                if (@in != null)
                {
                    @in.Close();
                }
            }
            return(theRivs);
        }
        /// <summary>
        /// Responds to action performed events. </summary>
        /// <param name="e"> the ActionEvent that happened. </param>
        public virtual void actionPerformed(ActionEvent e)
        {
            string routine = "StateMod_RiverNetworkNode_JFrame.actionPerformed";

            if (Message.isDebugOn)
            {
                Message.printDebug(1, routine, "In actionPerformed: " + e.getActionCommand());
            }
            object source = e.getSource();

            if (source == __closeJButton)
            {
                saveCurrentRecord();
                int size = __riverNetworkNodesVector.Count;
                StateMod_RiverNetworkNode r = null;
                bool changed = false;
                for (int i = 0; i < size; i++)
                {
                    r = __riverNetworkNodesVector[i];
                    if (!changed && r.changed())
                    {
                        changed = true;
                    }
                    r.acceptChanges();
                }
                if (changed)
                {
                    __dataset.setDirty(StateMod_DataSet.COMP_RIVER_NETWORK, true);
                }
                if (__dataset_wm != null)
                {
                    __dataset_wm.closeWindow(StateMod_DataSet_WindowManager.WINDOW_RIVER_NETWORK);
                }
                else
                {
                    JGUIUtil.close(this);
                }
            }
            else if (source == __applyJButton)
            {
                saveCurrentRecord();
                int size = __riverNetworkNodesVector.Count;
                StateMod_RiverNetworkNode r = null;
                bool changed = false;
                for (int i = 0; i < size; i++)
                {
                    r = __riverNetworkNodesVector[i];
                    if (!changed && r.changed())
                    {
                        changed = true;
                    }
                    r.createBackup();
                }
                if (changed)
                {
                    __dataset.setDirty(StateMod_DataSet.COMP_RIVER_NETWORK, true);
                }
            }
            else if (source == __cancelJButton)
            {
                int size = __riverNetworkNodesVector.Count;
                StateMod_RiverNetworkNode r = null;
                for (int i = 0; i < size; i++)
                {
                    r = __riverNetworkNodesVector[i];
                    r.restoreOriginal();
                }
                if (__dataset_wm != null)
                {
                    __dataset_wm.closeWindow(StateMod_DataSet_WindowManager.WINDOW_RIVER_NETWORK);
                }
                else
                {
                    JGUIUtil.close(this);
                }
            }
            else if (source == __helpJButton)
            {
                // REVISIT HELP (JTS - 2003-08-18)
            }
            else if (source == __searchIDJRadioButton)
            {
                __searchName.setEditable(false);
                __searchID.setEditable(true);
            }
            else if (source == __searchNameJRadioButton)
            {
                __searchName.setEditable(true);
                __searchID.setEditable(false);
            }
            else if (source == __showOnMap_JButton)
            {
                GeoRecord geoRecord = getSelectedRiverNetworkNode().getGeoRecord();
                GRShape   shape     = geoRecord.getShape();
                __dataset_wm.showOnMap(getSelectedRiverNetworkNode(), "Node: " + getSelectedRiverNetworkNode().getID() + " - " + getSelectedRiverNetworkNode().getName(), new GRLimits(shape.xmin, shape.ymin, shape.xmax, shape.ymax), geoRecord.getLayer().getProjection());
            }
            else if (source == __showOnNetwork_JButton)
            {
                StateMod_Network_JFrame networkEditor = __dataset_wm.getNetworkEditor();
                if (networkEditor != null)
                {
                    HydrologyNode node = networkEditor.getNetworkJComponent().findNode(getSelectedRiverNetworkNode().getID(), false, false);
                    if (node != null)
                    {
                        __dataset_wm.showOnNetwork(getSelectedRiverNetworkNode(), "Node: " + getSelectedRiverNetworkNode().getID() + " - " + getSelectedRiverNetworkNode().getName(), new GRLimits(node.getX(), node.getY(), node.getX(), node.getY()));
                    }
                }
            }
            else if (source == __findNext)
            {
                searchWorksheet(__worksheet.getSelectedRow() + 1);
            }
            else if (source == __searchID || source == __searchName)
            {
                searchWorksheet(0);
            }
        }
Beispiel #19
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void saveComponent(RTi.Util.IO.DataSetComponent comp, String oldFilename,String newFilename, java.util.List<String> comments) throws Exception
        private void saveComponent(DataSetComponent comp, string oldFilename, string newFilename, IList <string> comments)
        {
            bool   daily = false;
            int    type  = comp.getComponentType();
            object data  = comp.getData();
            string name  = null;

            switch (type)
            {
            ////////////////////////////////////////////////////////
            // StateMod_* classes
            case StateMod_DataSet.COMP_CONTROL:
                StateMod_DataSet.writeStateModControlFile(__dataset, oldFilename, newFilename, comments);
                name = "Control";
                break;

            case StateMod_DataSet.COMP_DELAY_TABLES_DAILY:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_DelayTable> delayTablesDaily = (java.util.List<StateMod_DelayTable>)data;
                IList <StateMod_DelayTable> delayTablesDaily = (IList <StateMod_DelayTable>)data;
                StateMod_DelayTable.writeStateModFile(oldFilename, newFilename, delayTablesDaily, comments, __dataset.getInterv(), -1);
                name = "Delay Tables Daily";
                break;

            case StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_DelayTable> delayTablesMonthly = (java.util.List<StateMod_DelayTable>)data;
                IList <StateMod_DelayTable> delayTablesMonthly = (IList <StateMod_DelayTable>)data;
                StateMod_DelayTable.writeStateModFile(oldFilename, newFilename, delayTablesMonthly, comments, __dataset.getInterv(), -1);
                name = "Delay Tables Monthly";
                break;

            case StateMod_DataSet.COMP_DIVERSION_STATIONS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Diversion> diversionStations = (java.util.List<StateMod_Diversion>)data;
                IList <StateMod_Diversion> diversionStations = (IList <StateMod_Diversion>)data;
                StateMod_Diversion.writeStateModFile(oldFilename, newFilename, diversionStations, comments, daily);
                name = "Diversion";
                break;

            case StateMod_DataSet.COMP_DIVERSION_RIGHTS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_DiversionRight> diversionRights = (java.util.List<StateMod_DiversionRight>)data;
                IList <StateMod_DiversionRight> diversionRights = (IList <StateMod_DiversionRight>)data;
                StateMod_DiversionRight.writeStateModFile(oldFilename, newFilename, diversionRights, comments, daily);
                name = "Diversion Rights";
                break;

            case StateMod_DataSet.COMP_INSTREAM_STATIONS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_InstreamFlow> instreamFlow = (java.util.List<StateMod_InstreamFlow>)data;
                IList <StateMod_InstreamFlow> instreamFlow = (IList <StateMod_InstreamFlow>)data;
                StateMod_InstreamFlow.writeStateModFile(oldFilename, newFilename, instreamFlow, comments, daily);
                name = "Instream";
                break;

            case StateMod_DataSet.COMP_INSTREAM_RIGHTS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_InstreamFlowRight> instreamFlowRights = (java.util.List<StateMod_InstreamFlowRight>)data;
                IList <StateMod_InstreamFlowRight> instreamFlowRights = (IList <StateMod_InstreamFlowRight>)data;
                StateMod_InstreamFlowRight.writeStateModFile(oldFilename, newFilename, instreamFlowRights, comments);
                name = "Instream Rights";
                break;

            case StateMod_DataSet.COMP_OPERATION_RIGHTS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_OperationalRight> operationalRights = (java.util.List<StateMod_OperationalRight>)data;
                IList <StateMod_OperationalRight> operationalRights = (IList <StateMod_OperationalRight>)data;
                // 2 is the file version (introduced for StateMod version 12 change)
                StateMod_OperationalRight.writeStateModFile(oldFilename, newFilename, 2, operationalRights, comments, __dataset);
                name = "Operational Rights";
                break;

            case StateMod_DataSet.COMP_PLANS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Plan> planStations = (java.util.List<StateMod_Plan>)data;
                IList <StateMod_Plan> planStations = (IList <StateMod_Plan>)data;
                StateMod_Plan.writeStateModFile(oldFilename, newFilename, planStations, comments);
                name = "Plan";
                break;

            case StateMod_DataSet.COMP_RESERVOIR_STATIONS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Reservoir> reservoirStations = (java.util.List<StateMod_Reservoir>)data;
                IList <StateMod_Reservoir> reservoirStations = (IList <StateMod_Reservoir>)data;
                StateMod_Reservoir.writeStateModFile(oldFilename, newFilename, reservoirStations, comments, daily);
                name = "Reservoir";
                break;

            case StateMod_DataSet.COMP_RESERVOIR_RIGHTS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_ReservoirRight> reservoirRights = (java.util.List<StateMod_ReservoirRight>)data;
                IList <StateMod_ReservoirRight> reservoirRights = (IList <StateMod_ReservoirRight>)data;
                StateMod_ReservoirRight.writeStateModFile(oldFilename, newFilename, reservoirRights, comments);
                name = "Reservoir Rights";
                break;

            case StateMod_DataSet.COMP_RESPONSE:
                StateMod_DataSet.writeStateModFile(__dataset, oldFilename, newFilename, comments);
                name = "Response";
                break;

            case StateMod_DataSet.COMP_RIVER_NETWORK:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_RiverNetworkNode> riverNodes = (java.util.List<StateMod_RiverNetworkNode>)data;
                IList <StateMod_RiverNetworkNode> riverNodes = (IList <StateMod_RiverNetworkNode>)data;
                StateMod_RiverNetworkNode.writeStateModFile(oldFilename, newFilename, riverNodes, comments, true);
                name = "River Network";
                break;

            case StateMod_DataSet.COMP_STREAMESTIMATE_STATIONS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamEstimate> streamEstimateStations = (java.util.List<StateMod_StreamEstimate>)data;
                IList <StateMod_StreamEstimate> streamEstimateStations = (IList <StateMod_StreamEstimate>)data;
                StateMod_StreamEstimate.writeStateModFile(oldFilename, newFilename, streamEstimateStations, comments, daily);
                name = "Stream Estimate";
                break;

            case StateMod_DataSet.COMP_STREAMESTIMATE_COEFFICIENTS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamEstimate_Coefficients> streamEstimateCoefficients = (java.util.List<StateMod_StreamEstimate_Coefficients>)data;
                IList <StateMod_StreamEstimate_Coefficients> streamEstimateCoefficients = (IList <StateMod_StreamEstimate_Coefficients>)data;
                StateMod_StreamEstimate_Coefficients.writeStateModFile(oldFilename, newFilename, streamEstimateCoefficients, comments);
                name = "Stream Estimate Coefficients";
                break;

            case StateMod_DataSet.COMP_STREAMGAGE_STATIONS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamGage> streamGageStations = (java.util.List<StateMod_StreamGage>)data;
                IList <StateMod_StreamGage> streamGageStations = (IList <StateMod_StreamGage>)data;
                StateMod_StreamGage.writeStateModFile(oldFilename, newFilename, streamGageStations, comments, daily);
                name = "Streamgage Stations";
                break;

            case StateMod_DataSet.COMP_WELL_STATIONS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Well> wellStations = (java.util.List<StateMod_Well>)data;
                IList <StateMod_Well> wellStations = (IList <StateMod_Well>)data;
                StateMod_Well.writeStateModFile(oldFilename, newFilename, wellStations, comments);
                name = "Well";
                break;

            case StateMod_DataSet.COMP_WELL_RIGHTS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_WellRight> wellRights = (java.util.List<StateMod_WellRight>)data;
                IList <StateMod_WellRight> wellRights = (IList <StateMod_WellRight>)data;
                StateMod_WellRight.writeStateModFile(oldFilename, newFilename, wellRights, comments, (PropList)null);
                name = "Well Rights";
                break;

            //////////////////////////////////////////////////////
            // StateMod Time Series
            case StateMod_DataSet.COMP_CONSUMPTIVE_WATER_REQUIREMENT_TS_DAILY:
            case StateMod_DataSet.COMP_CONSUMPTIVE_WATER_REQUIREMENT_TS_MONTHLY:
            case StateMod_DataSet.COMP_DEMAND_TS_DAILY:
            case StateMod_DataSet.COMP_DEMAND_TS_AVERAGE_MONTHLY:
            case StateMod_DataSet.COMP_DEMAND_TS_MONTHLY:
            case StateMod_DataSet.COMP_DEMAND_TS_OVERRIDE_MONTHLY:
            case StateMod_DataSet.COMP_DIVERSION_TS_DAILY:
            case StateMod_DataSet.COMP_DIVERSION_TS_MONTHLY:
            case StateMod_DataSet.COMP_EVAPORATION_TS_MONTHLY:
            case StateMod_DataSet.COMP_INSTREAM_DEMAND_TS_AVERAGE_MONTHLY:
            case StateMod_DataSet.COMP_INSTREAM_DEMAND_TS_DAILY:
            case StateMod_DataSet.COMP_INSTREAM_DEMAND_TS_MONTHLY:
            case StateMod_DataSet.COMP_PRECIPITATION_TS_MONTHLY:
            case StateMod_DataSet.COMP_RESERVOIR_CONTENT_TS_DAILY:
            case StateMod_DataSet.COMP_RESERVOIR_CONTENT_TS_MONTHLY:
            case StateMod_DataSet.COMP_RESERVOIR_TARGET_TS_DAILY:
            case StateMod_DataSet.COMP_RESERVOIR_TARGET_TS_MONTHLY:
            case StateMod_DataSet.COMP_STREAMESTIMATE_NATURAL_FLOW_TS_DAILY:
            case StateMod_DataSet.COMP_STREAMESTIMATE_NATURAL_FLOW_TS_MONTHLY:
            case StateMod_DataSet.COMP_STREAMGAGE_NATURAL_FLOW_TS_DAILY:
            case StateMod_DataSet.COMP_STREAMGAGE_NATURAL_FLOW_TS_MONTHLY:
            case StateMod_DataSet.COMP_STREAMGAGE_HISTORICAL_TS_DAILY:
            case StateMod_DataSet.COMP_STREAMGAGE_HISTORICAL_TS_MONTHLY:
            case StateMod_DataSet.COMP_WELL_DEMAND_TS_DAILY:
            case StateMod_DataSet.COMP_WELL_DEMAND_TS_MONTHLY:
            case StateMod_DataSet.COMP_WELL_PUMPING_TS_DAILY:
            case StateMod_DataSet.COMP_WELL_PUMPING_TS_MONTHLY:
                double   missing  = -999.0;
                YearType yearType = null;
                if (__dataset.getCyrl() == YearType.CALENDAR)
                {
                    yearType = YearType.CALENDAR;
                }
                else if (__dataset.getCyrl() == YearType.WATER)
                {
                    yearType = YearType.WATER;
                }
                else if (__dataset.getCyrl() == YearType.NOV_TO_OCT)
                {
                    yearType = YearType.NOV_TO_OCT;
                }
                int precision = 2;

                // Do the following to avoid warnings
                IList <TS> tslist = null;
                if (data != null)
                {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<RTi.TS.TS> tslist0 = (java.util.List<RTi.TS.TS>)data;
                    IList <TS> tslist0 = (IList <TS>)data;
                    if (tslist0.Count > 0)
                    {
                        TS ts = tslist0[0];
                        missing = ts.getMissing();
                    }
                    tslist = tslist0;
                }

                StateMod_TS.writeTimeSeriesList(oldFilename, newFilename, comments, tslist, null, null, yearType, missing, precision);
                name = "TS (" + type + ")";
                break;

            default:
                name = "(something: " + type + ")";
                break;
            }
            comp.setDirty(false);
            Message.printStatus(1, "", "Component '" + name + "' written");
        }