コード例 #1
0
        /// <summary>
        /// Checks to see if the __deleteRight button should be enabled or not.
        /// </summary>
        private void checkDeleteRightButton()
        {
            int row = __worksheet.getSelectedRow();

            if (row == -1)
            {
                JGUIUtil.setEnabled(__deleteRight, false);
            }
            else
            {
                JGUIUtil.setEnabled(__deleteRight, true);
            }
        }
コード例 #2
0
        /// <summary>
        /// Check the GUI state.  In particular, indicate whether the graph buttons should
        /// be enabled.
        /// </summary>
        private void checkGUIState()
        {
            IList <StateMod_ReservoirAreaCap> rv = __currentRes.getAreaCaps();

            if ((rv != null) && (rv.Count > 0))
            {
                bool area_ok = true, seepage_ok = true;
                // Check for data all one value...
                int size = rv.Count;
                StateMod_ReservoirAreaCap ac = null;
                double value;
                // REVISIT SAM 2006-08-20
                // JFreeChart has a problem when the values are the same as
                // the previous values.  However, for now, increment the values
                // slightly when graphing rather than disabling the graph.
                // Go ahead and disable if all values are the same.
                double area0 = 0.0, seepage0 = 0.0;
                bool   area_all_same = true, seepage_all_same = true;
                for (int i = 0; i < size; i++)
                {
                    ac    = (StateMod_ReservoirAreaCap)rv[i];
                    value = ac.getSurarea();

                    /*
                     * if ( value == value_prev ) {
                     *      area_ok = false;
                     *      break;
                     * }
                     */
                    if (i == 0)
                    {
                        area0 = value;
                    }
                    else
                    {
                        if (value != area0)
                        {
                            area_all_same = false;
                        }
                    }
                }
                for (int i = 0; i < size; i++)
                {
                    ac    = (StateMod_ReservoirAreaCap)rv[i];
                    value = ac.getSeepage();

                    /*
                     * if ( value == value_prev ) {
                     *      seepage_ok = false;
                     *      break;
                     * }
                     */
                    if (i == 0)
                    {
                        seepage0 = value;
                    }
                    else
                    {
                        if (value != seepage0)
                        {
                            seepage_all_same = false;
                        }
                    }
                }
                if (area_all_same)
                {
                    area_ok = false;
                }
                if (seepage_all_same)
                {
                    seepage_ok = false;
                }
                JGUIUtil.setEnabled(__GraphArea_JButton, area_ok);
                JGUIUtil.setEnabled(__GraphSeepage_JButton, seepage_ok);
            }
            else
            {
                JGUIUtil.setEnabled(__GraphArea_JButton, false);
                JGUIUtil.setEnabled(__GraphSeepage_JButton, false);
            }
            // Only enable the graph buttons if the new charting package is in the
            // path.  This will allow for some graceful transition to distribution
            // of the new software.
            if (!IOUtil.classCanBeLoaded("org.jfree.chart.ChartPanel"))
            {
                JGUIUtil.setEnabled(__GraphArea_JButton, false);
                JGUIUtil.setEnabled(__GraphSeepage_JButton, false);
            }
        }