/// <summary>
        /// Sets up the data to be displayed in the table.
        /// </summary>
        private void setupData()
        {
            int           num      = 0;
            int           size     = _data.size();
            StateMod_Well well     = null;
            string        id       = null;
            double        total    = 0;
            int           rowCount = 0;

            __data = new System.Collections.IList[__COLUMNS];
            for (int i = 0; i < __COLUMNS; i++)
            {
                __data[i] = new List <object>();
            }

            __rowMap = new List <object>();

            StateMod_ReturnFlow rf = null;

            System.Collections.IList returnFlows = null;
            for (int i = 0; i < size; i++)
            {
                total = 0;
                well  = (StateMod_Well)_data.get(i);
                id    = well.getID();

                if (__isDepletion)
                {
                    num         = well.getNrtnw2();
                    returnFlows = well.getDepletions();
                }
                else
                {
                    num         = well.getNrtnw();
                    returnFlows = well.getReturnFlows();
                }
                for (int j = 0; j < num; j++)
                {
                    rf = (StateMod_ReturnFlow)returnFlows[j];
                    __data[__COL_ID].Add(id);
                    __data[__COL_NODE_ID].Add(rf.getCrtnid());
                    __data[__COL_PERCENT].Add(new double?(rf.getPcttot()));
                    __data[__COL_DELAY_ID].Add("" + rf.getIrtndl());
                    total += rf.getPcttot();
                    __rowMap.Add(new int?(rowCount));
                    rowCount++;
                }

                __data[__COL_ID].Add(id);
                __data[__COL_NODE_ID].Add("TOTAL");
                __data[__COL_PERCENT].Add(new double?(total));
                __data[__COL_DELAY_ID].Add("");

                rowCount++;
            }
            _rows = rowCount;
        }
        /// <summary>
        /// Sets up the GUI
        /// </summary>
        public virtual void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            __addDepletion    = new JButton(__BUTTON_ADD_DEPLETION);
            __deleteDepletion = new JButton(__BUTTON_DELETE_DEPLETION);
            __deleteDepletion.setEnabled(false);
            __helpJButton = new JButton(__BUTTON_HELP);
            __helpJButton.setEnabled(false);
            __closeJButton = new JButton(__BUTTON_CLOSE);
            JButton cancelJButton = new JButton(__BUTTON_CANCEL);
            JButton applyJButton  = new JButton(__BUTTON_APPLY);

            // AWT portion
            GridBagLayout gb         = new GridBagLayout();
            JPanel        mainJPanel = new JPanel();

            mainJPanel.setLayout(gb);

            FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);
            JPanel     p1 = new JPanel();

            p1.setLayout(fl);

            GridLayout gl         = new GridLayout(2, 2, 1, 1);
            JPanel     info_panel = new JPanel();

            info_panel.setLayout(gl);

            JPanel main_panel = new JPanel();

            main_panel.setLayout(new BorderLayout());

            info_panel.add(new JLabel("Well:"));
            info_panel.add(new JLabel(__currentWell.getID()));
            info_panel.add(new JLabel("Well name:"));
            info_panel.add(new JLabel(__currentWell.getName()));

            if (__editable)
            {
                p1.add(__addDepletion);
                p1.add(__deleteDepletion);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__closeJButton);

            PropList p = new PropList("StateMod_Well_Depletion_JFrame.JWorksheet");

            p.add("JWorksheet.ShowPopupMenu=true");
            p.add("JWorksheet.AllowCopy=true");
            p.add("JWorksheet.SelectionMode=SingleRowSelection");

            int[]            widths = null;
            JScrollWorksheet jsw    = null;

            try
            {
//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> nodes = (java.util.List<StateMod_RiverNetworkNode>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK).getData());
                IList <StateMod_RiverNetworkNode> nodes = (IList <StateMod_RiverNetworkNode>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK).getData());
                IList <StateMod_ReturnFlow>       v     = new List <StateMod_ReturnFlow>();
                IList <StateMod_ReturnFlow>       v2    = __currentWell.getDepletions();
                StateMod_ReturnFlow rf;
                for (int i = 0; i < v2.Count; i++)
                {
                    rf = (StateMod_ReturnFlow)v2[i].clone();
                    rf.setCrtnid(rf.getCrtnid() + StateMod_Util.findNameInVector(rf.getCrtnid(), nodes, true));
                    v.Add(rf);
                }

                StateMod_ReturnFlow_TableModel   tmw = new StateMod_ReturnFlow_TableModel(__dataset, v, __editable, false);
                StateMod_ReturnFlow_CellRenderer crw = new StateMod_ReturnFlow_CellRenderer(tmw);

                jsw         = new JScrollWorksheet(crw, tmw, p);
                __worksheet = jsw.getJWorksheet();

                IList <string> ids = StateMod_Util.createIdentifierListFromStateModData(nodes, true, null);
                __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RIVER_NODE, ids, false);

                IList <StateMod_DelayTable> delayIDs = null;
                if (__dataset.getIday() == 1)
                {
//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> delayIDs0 = (java.util.List<StateMod_DelayTable>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_DAILY).getData());
                    IList <StateMod_DelayTable> delayIDs0 = (IList <StateMod_DelayTable>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_DAILY).getData());
                    delayIDs = delayIDs0;
                }
                else
                {
//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> delayIDs0 = (java.util.List<StateMod_DelayTable>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY).getData());
                    IList <StateMod_DelayTable> delayIDs0 = (IList <StateMod_DelayTable>)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY).getData());
                    delayIDs = delayIDs0;
                }
                ids = StateMod_Util.createIdentifierListFromStateModData(delayIDs, true, null);
                __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RETURN_ID, ids, false);
                widths = crw.getColumnWidths();
            }
            catch (Exception e)
            {
                Message.printWarning(2, routine, e);
                jsw         = new JScrollWorksheet(0, 0, p);
                __worksheet = jsw.getJWorksheet();
            }
            __worksheet.setPreferredScrollableViewportSize(null);

            __worksheet.setHourglassJFrame(this);
            __worksheet.addMouseListener(this);
            __worksheet.addKeyListener(this);

            main_panel.add(jsw, "Center");
            main_panel.add(p1, "South");
            JGUIUtil.addComponent(mainJPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(mainJPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH);

            getContentPane().add(mainJPanel);

            JPanel bottomJPanel = new JPanel();

            bottomJPanel.setLayout(gb);
            __messageJTextField = new JTextField();
            __messageJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
            __statusJTextField = new JTextField(5);
            __statusJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            getContentPane().add("South", bottomJPanel);

            __addDepletion.addActionListener(this);
            __deleteDepletion.addActionListener(this);
            __closeJButton.addActionListener(this);
            __helpJButton.addActionListener(this);
            applyJButton.addActionListener(this);
            cancelJButton.addActionListener(this);

            pack();
            setSize(520, 280);
            JGUIUtil.center(this);
            setVisible(true);

            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Read a well input file. </summary>
        /// <param name="filename"> name of file containing well information </param>
        /// <returns> status(always 0 since exception handling is now used) </returns>
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public static java.util.List<StateMod_Well> readStateModFile(String filename) throws Exception
        public static IList <StateMod_Well> readStateModFile(string filename)
        {
            string routine = "StateMod_Well.readStateModFile";
            IList <StateMod_Well> theWellStations = new List <StateMod_Well>();

            int[]               format_1 = new int[] { StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_INTEGER, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_SPACE, StringUtil.TYPE_STRING, StringUtil.TYPE_SPACE, StringUtil.TYPE_DOUBLE };
            int[]               format_1w = new int[] { 12, 24, 12, 8, 8, 1, 12, 1, 12 };
            int[]               format_2 = new int[] { StringUtil.TYPE_SPACE, StringUtil.TYPE_STRING, StringUtil.TYPE_INTEGER, StringUtil.TYPE_INTEGER, StringUtil.TYPE_INTEGER, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_INTEGER, StringUtil.TYPE_INTEGER };
            int[]               format_2w = new int[] { 36, 12, 8, 8, 8, 8, 8, 8, 8 };
            int[]               format_4 = new int[] { StringUtil.TYPE_SPACE, StringUtil.TYPE_STRING, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_INTEGER };
            int[]               format_4w = new int[] { 36, 12, 8, 8 };
            string              iline = null;
            string              s = null;
            IList <object>      v = new List <object>(9);
            StreamReader        @in = null;
            StateMod_Well       aWell = null;
            StateMod_ReturnFlow aReturnNode = null;
            IList <string>      effv = null;
            int nrtn, ndepl;

            Message.printStatus(1, routine, "Reading well file: " + filename);

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

                    aWell = new StateMod_Well();

                    StringUtil.fixedRead(iline, format_1, format_1w, v);
                    if (Message.isDebugOn)
                    {
                        Message.printDebug(50, routine, "iline: " + iline);
                    }
                    aWell.setID(((string)v[0]).Trim());
                    aWell.setName(((string)v[1]).Trim());
                    aWell.setCgoto(((string)v[2]).Trim());
                    aWell.setSwitch((int?)v[3]);
                    aWell.setDivcapw((double?)v[4]);
                    aWell.setCdividyw(((string)v[5]).Trim());
                    aWell.setPrimary((double?)v[6]);

                    // user data

                    iline = @in.ReadLine();
                    StringUtil.fixedRead(iline, format_2, format_2w, v);
                    if (Message.isDebugOn)
                    {
                        Message.printDebug(50, routine, "iline: " + iline);
                    }
                    aWell.setIdvcow2(((string)v[0]).Trim());
                    aWell.setIdvcomw((int?)v[1]);
                    // Don't set the number of return flow data get(2) or depletion data get(3) because
                    // those will be calculated
                    nrtn  = ((int?)v[2]).Value;
                    ndepl = ((int?)v[3]).Value;
                    aWell.setDivefcw((double?)v[4]);
                    aWell.setAreaw((double?)v[5]);
                    aWell.setIrturnw((int?)v[6]);
                    aWell.setDemsrcw((int?)v[7]);
                    if (aWell.getDivefcw() >= 0)
                    {
                        // Efficiency line won't be included - set each value to the average
                        for (int i = 0; i < 12; i++)
                        {
                            aWell.setDiveff(i, aWell.getDivefcw());
                        }
                    }
                    else
                    {
                        // 12 efficiency values
                        iline = @in.ReadLine();
                        effv  = StringUtil.breakStringList(iline, " ", StringUtil.DELIM_SKIP_BLANKS);
                        for (int i = 0; i < 12; i++)
                        {
                            aWell.setDiveff(i, (string)effv[i]);
                        }
                    }

                    // return flow data

                    if (Message.isDebugOn)
                    {
                        Message.printDebug(50, routine, "Number of return flows: " + nrtn);
                    }
                    for (int i = 0; i < nrtn; i++)
                    {
                        iline = @in.ReadLine();
                        StringUtil.fixedRead(iline, format_4, format_4w, v);
                        if (Message.isDebugOn)
                        {
                            Message.printDebug(50, routine, "Fixed read returned " + v.Count + " elements");
                        }

                        aReturnNode = new StateMod_ReturnFlow(StateMod_DataSet.COMP_WELL_STATIONS);
                        s           = ((string)v[0]).Trim();
                        if (s.Length <= 0)
                        {
                            aReturnNode.setCrtnid(s);
                            Message.printWarning(2, routine, "Return node for structure \"" + aWell.getID() + "\" is blank. ");
                        }
                        else
                        {
                            aReturnNode.setCrtnid(s);
                        }

                        aReturnNode.setPcttot(((double?)v[1]));
                        aReturnNode.setIrtndl(((int?)v[2]));
                        aWell.addReturnFlow(aReturnNode);
                    }

                    // depletion data

                    for (int i = 0; i < ndepl; i++)
                    {
                        iline = @in.ReadLine();
                        StringUtil.fixedRead(iline, format_4, format_4w, v);

                        aReturnNode = new StateMod_ReturnFlow(StateMod_DataSet.COMP_WELL_STATIONS);
                        s           = ((string)v[0]).Trim();
                        if (s.Length <= 0)
                        {
                            aReturnNode.setCrtnid(s);
                            Message.printWarning(2, routine, "Return node for structure \"" + aWell.getID() + "\" is blank. ");
                        }
                        else
                        {
                            aReturnNode.setCrtnid(s);
                        }

                        aReturnNode.setPcttot(((double?)v[1]));
                        aReturnNode.setIrtndl(((int?)v[2]));
                        aWell.addDepletion(aReturnNode);
                    }

                    theWellStations.Add(aWell);
                }
            }
            catch (Exception e)
            {
                routine   = null;
                format_1  = null;
                format_1w = null;
                format_2  = null;
                format_2w = null;
                format_4  = null;
                format_4w = null;
                s         = null;
                v         = null;
                if (@in != null)
                {
                    @in.Close();
                }
                @in         = null;
                aWell       = null;
                aReturnNode = null;
                effv        = null;
                Message.printWarning(2, routine, e);
                throw e;
            }
            routine   = null;
            format_1  = null;
            format_1w = null;
            format_2  = null;
            format_2w = null;
            format_4  = null;
            format_4w = null;
            iline     = null;
            s         = null;
            v         = null;
            if (@in != null)
            {
                @in.Close();
            }
            @in         = null;
            aWell       = null;
            aReturnNode = null;
            effv        = null;
            return(theWellStations);
        }
Ejemplo n.º 4
0
        /// <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_Well well = (StateMod_Well)_data.get(row);

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

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

            case COL_RIVER_NODE_ID:
                return(well.getCgoto());

            case COL_SWITCH:
                return(new int?(well.getSwitch()));

            case COL_DAILY_ID:
                return(well.getCdividyw());

            case COL_CAPACITY:
                return(new double?(well.getDivcapw()));

            case COL_DIVERSION_ID:
                return(well.getIdvcow2());

            case COL_DEMAND_TYPE:
                return(new int?(well.getIdvcomw()));

            case COL_EFF_ANNUAL:
                /*
                 * double d = well.getDivefcw();
                 * double d2 = 0;
                 * if (d != 0 && d < 0) {
                 *      d2 = d * -1;
                 * }
                 * if (d == 0) {
                 *      d2 = 0;
                 * }
                 * return new Double(d2);
                 */

                // this is done to prevent -0.00 values

                /*
                 * double d = well.getDivefcw();
                 * double d2 = 0;
                 * if (d == 0) {
                 *      d2 = 0;
                 * }
                 * return new Double(d2);
                 */
                return(new double?(well.getDivefcw()));

            case COL_AREA:
                return(new double?(well.getAreaw()));

            case COL_USE_TYPE:
                return(new int?(well.getIrturnw()));

            case COL_DEMAND_SOURCE:
                return(new int?(well.getDemsrcw()));

            case COL_PRIMARY:
                return(new double?(well.getPrimary()));

            case COL_EFF_01:
                return(new double?(well.getDiveff(0)));

            case COL_EFF_02:
                return(new double?(well.getDiveff(1)));

            case COL_EFF_03:
                return(new double?(well.getDiveff(2)));

            case COL_EFF_04:
                return(new double?(well.getDiveff(3)));

            case COL_EFF_05:
                return(new double?(well.getDiveff(4)));

            case COL_EFF_06:
                return(new double?(well.getDiveff(5)));

            case COL_EFF_07:
                return(new double?(well.getDiveff(6)));

            case COL_EFF_08:
                return(new double?(well.getDiveff(7)));

            case COL_EFF_09:
                return(new double?(well.getDiveff(8)));

            case COL_EFF_10:
                return(new double?(well.getDiveff(9)));

            case COL_EFF_11:
                return(new double?(well.getDiveff(10)));

            case COL_EFF_12:
                return(new double?(well.getDiveff(11)));

            default:
                return("");
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Responds to action performed events. </summary>
        /// <param name="e"> the ActionEvent that happened. </param>
        public virtual void actionPerformed(ActionEvent e)
        {
            string routine = "StateMod_Well_Right_JFrame.actionPerformed";

            string action = e.getActionCommand();

            if (action.Equals(__BUTTON_ADD_RIGHT))
            {
                StateMod_WellRight aRight = new StateMod_WellRight();
                aRight._isClone = true;
                StateMod_WellRight last = (StateMod_WellRight)__worksheet.getLastRowData();

                if (last == null)
                {
                    aRight.setID(StateMod_Util.createNewID(__currentWell.getID()));
                    aRight.setCgoto(__currentWell.getID());
                }
                else
                {
                    aRight.setID(StateMod_Util.createNewID(last.getID()));
                    aRight.setCgoto(last.getCgoto());
                }
                __worksheet.addRow(aRight);
                __worksheet.scrollToLastRow();
                __worksheet.selectLastRow();
                __deleteRight.setEnabled(true);
            }
            else if (action.Equals(__BUTTON_DEL_RIGHT))
            {
                int row = __worksheet.getSelectedRow();
                if (row != -1)
                {
                    int x = (new ResponseJDialog(this, "Delete right", "Delete well right?", ResponseJDialog.YES | ResponseJDialog.NO)).response();
                    if (x == ResponseJDialog.NO)
                    {
                        return;
                    }

                    __worksheet.cancelEditing();
                    __worksheet.deleteRow(row);
                    __deleteRight.setEnabled(false);
                }
                else
                {
                    Message.printWarning(1, routine, "Must select desired right to delete.");
                }
            }
            else if (action.Equals(__BUTTON_HELP))
            {
                // REVISIT HELP (JTS - 2003-06-10)
            }
            else if (action.Equals(__BUTTON_CLOSE))
            {
                if (saveData())
                {
                    setVisible(false);
                    dispose();
                }
            }
            else if (action.Equals(__BUTTON_APPLY))
            {
                saveData();
            }
            else if (action.Equals(__BUTTON_CANCEL))
            {
                setVisible(false);
                dispose();
            }
        }
        /// <summary>
        /// Sets up the data lists to display the reservoir collection data in the GUI.
        /// </summary>
        private void setupData()
        {
            int[]         years        = null;
            int           yearArrayLen = 0;
            int           nwell        = _data.size();
            int           nParts       = 0;
            int           nIdTypes     = 0;
            StateMod_Well well         = null;
            string        colType      = null;
            string        id           = null;
            string        partType     = null;

            System.Collections.IList ids     = null;
            System.Collections.IList idTypes = null;
            string idType = null;

            __data = new System.Collections.IList[__COLUMNS];
            for (int i = 0; i < __COLUMNS; i++)
            {
                __data[i] = new List <object>();
            }

            int rows = 0;

            for (int i = 0; i < nwell; i++)
            {
                well = (StateMod_Well)_data.get(i);
                id   = well.getID();

                years    = well.getCollectionYears();
                colType  = well.getCollectionType();
                partType = well.getCollectionPartType();

                if (years == null)
                {
                    yearArrayLen = 1;             // Cause the loop below to go through once
                }
                else
                {
                    yearArrayLen = years.Length;
                }

                for (int j = 0; j < yearArrayLen; j++)
                {
                    // Part IDs for the year
                    if ((years == null) || (years.Length == 0))
                    {
                        ids = well.getCollectionPartIDs(0);
                    }
                    else
                    {
                        ids = well.getCollectionPartIDs(years[j]);
                    }
                    if (ids == null)
                    {
                        nParts = 0;
                    }
                    else
                    {
                        nParts = ids.Count;
                    }
                    // Part ID types for the year.
                    idTypes = well.getCollectionPartIDTypes();
                    if (idTypes == null)
                    {
                        nIdTypes = 0;
                    }
                    else
                    {
                        nIdTypes = idTypes.Count;
                    }

                    for (int k = 0; k < nParts; k++)
                    {
                        __data[__COL_ID].Add(id);
                        __data[__COL_YEAR].Add(new int?(years[j]));
                        __data[__COL_COL_TYPE].Add(colType);
                        __data[__COL_PART_TYPE].Add(partType);
                        __data[__COL_PART_ID].Add(ids[k]);
                        idType = "";
                        if (nIdTypes != 0)
                        {
                            idType = (string)idTypes[k];                     // Should align with ids.get(k)
                        }
                        __data[__COL_PART_ID_TYPE].Add(idType);
                        rows++;
                    }
                }
            }
            _rows = rows;
        }
        /// <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_Well well = (StateMod_Well)_data.get(row);

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

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

            case COL_DAILY_ID:
                return(well.getCdividyw());

            case COL_CAPACITY:
                return(new double?(well.getDivcapw()));

            case COL_DIVERSION_ID:
                return(well.getIdvcow2());

            case COL_DEMAND_TYPE:
                return(new int?(well.getIdvcomw()));

            case COL_EFF_ANNUAL:
                return(new double?(well.getDivefcw()));

            case COL_AREA:
                return(new double?(well.getAreaw()));

            case COL_USE_TYPE:
                return(new int?(well.getIrturnw()));

            case COL_DEMAND_SOURCE:
                return(new int?(well.getDemsrcw()));

            case COL_PRIMARY:
                return(new double?(well.getPrimary()));

            case COL_EFF_01:
                return(new double?(well.getDiveff(0)));

            case COL_EFF_02:
                return(new double?(well.getDiveff(1)));

            case COL_EFF_03:
                return(new double?(well.getDiveff(2)));

            case COL_EFF_04:
                return(new double?(well.getDiveff(3)));

            case COL_EFF_05:
                return(new double?(well.getDiveff(4)));

            case COL_EFF_06:
                return(new double?(well.getDiveff(5)));

            case COL_EFF_07:
                return(new double?(well.getDiveff(6)));

            case COL_EFF_08:
                return(new double?(well.getDiveff(7)));

            case COL_EFF_09:
                return(new double?(well.getDiveff(8)));

            case COL_EFF_10:
                return(new double?(well.getDiveff(9)));

            case COL_EFF_11:
                return(new double?(well.getDiveff(10)));

            case COL_EFF_12:
                return(new double?(well.getDiveff(11)));

            default:
                return("");
            }
        }
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        private void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            __addReturnFlow    = new JButton(__BUTTON_ADD_RETURN_FLOW);
            __deleteReturnFlow = new JButton(__BUTTON_DEL_RETURN_FLOW);
            __deleteReturnFlow.setEnabled(false);
            __helpJButton = new JButton(__BUTTON_HELP);
            __helpJButton.setEnabled(false);
            __closeJButton = new JButton(__BUTTON_CLOSE);
            JButton cancelJButton = new JButton(__BUTTON_CANCEL);
            JButton applyJButton  = new JButton(__BUTTON_APPLY);

            GridBagLayout gb         = new GridBagLayout();
            JPanel        mainJPanel = new JPanel();

            mainJPanel.setLayout(gb);

            FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);
            JPanel     p1 = new JPanel();

            p1.setLayout(fl);

            GridLayout gl         = new GridLayout(2, 2, 1, 1);
            JPanel     info_panel = new JPanel();

            info_panel.setLayout(gl);

            JPanel main_panel = new JPanel();

            main_panel.setLayout(new BorderLayout());

            info_panel.add(new JLabel("Well:"));
            info_panel.add(new JLabel(__currentWell.getID()));
            info_panel.add(new JLabel("Well name:"));
            info_panel.add(new JLabel(__currentWell.getName()));

            if (__editable)
            {
                p1.add(__addReturnFlow);
                p1.add(__deleteReturnFlow);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__closeJButton);

            PropList p = new PropList("StateMod_Well_ReturnFlow_JFrame.JWorksheet");

            p.add("JWorksheet.ShowPopupMenu=true");
            p.add("JWorksheet.AllowCopy=true");
            p.add("JWorksheet.SelectionMode=SingleRowSelection");

            int[]            widths = null;
            JScrollWorksheet jsw    = null;

            try
            {
                System.Collections.IList nodes = (System.Collections.IList)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK).getData());
                System.Collections.IList v     = new List <object>();
                System.Collections.IList v2    = __currentWell.getReturnFlows();
                StateMod_ReturnFlow      rf;
                for (int i = 0; i < v2.Count; i++)
                {
                    rf = (StateMod_ReturnFlow)((StateMod_ReturnFlow)v2[i]).clone();
                    rf.setCrtnid(rf.getCrtnid() + StateMod_Util.findNameInVector(rf.getCrtnid(), nodes, true));
                    v.Add(rf);
                }

                StateMod_ReturnFlow_TableModel   tmw = new StateMod_ReturnFlow_TableModel(__dataset, v, __editable, true);
                StateMod_ReturnFlow_CellRenderer crw = new StateMod_ReturnFlow_CellRenderer(tmw);

                jsw         = new JScrollWorksheet(crw, tmw, p);
                __worksheet = jsw.getJWorksheet();

                v = StateMod_Util.createIdentifierListFromStateModData(nodes, true, null);
                __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RIVER_NODE, v, false);

                // 10
                System.Collections.IList delayIDs = null;
                if (__dataset.getIday() == 1)
                {
                    delayIDs = (System.Collections.IList)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_DAILY).getData());
                }
                else
                {
                    delayIDs = (System.Collections.IList)(__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY).getData());
                }
                v = StateMod_Util.createIdentifierListFromStateModData(delayIDs, true, null);
                __worksheet.setColumnJComboBoxValues(StateMod_ReturnFlow_TableModel.COL_RETURN_ID, v, false);
                widths = crw.getColumnWidths();
            }
            catch (Exception e)
            {
                Message.printWarning(2, routine, e);
                jsw         = new JScrollWorksheet(0, 0, p);
                __worksheet = jsw.getJWorksheet();
            }
            __worksheet.setPreferredScrollableViewportSize(null);

            __worksheet.setHourglassJFrame(this);
            __worksheet.addMouseListener(this);
            __worksheet.addKeyListener(this);

            main_panel.add(jsw, "Center");
            main_panel.add(p1, "South");
            JGUIUtil.addComponent(mainJPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(mainJPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH);

            getContentPane().add(mainJPanel);

            JPanel bottomJPanel = new JPanel();

            bottomJPanel.setLayout(gb);
            __messageJTextField = new JTextField();
            __messageJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
            __statusJTextField = new JTextField(5);
            __statusJTextField.setEditable(false);
            JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            getContentPane().add("South", bottomJPanel);

            __addReturnFlow.addActionListener(this);
            __deleteReturnFlow.addActionListener(this);
            __closeJButton.addActionListener(this);
            __helpJButton.addActionListener(this);
            applyJButton.addActionListener(this);
            cancelJButton.addActionListener(this);

            pack();
            setSize(520, 280);
            JGUIUtil.center(this);
            setVisible(true);

            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }
        }