/// <summary>
        /// Checks to see if the mouse event would trigger display of the popup menu.
        /// The popup menu does not display if it is null. </summary>
        /// <param name="e"> the MouseEvent that happened. </param>
        private void showPopupMenu(MouseEvent e)
        {
            string routine = "StateMod_DataSet_JTree.showPopupMenu";

            if (!e.isPopupTrigger() || !__display_data_objects)
            {
                // Do not do anything...
                return;
            }
            TreePath path = getPathForLocation(e.getX(), e.getY());

            if (path == null)
            {
                return;
            }
            __popup_Node = (SimpleJTree_Node)path.getLastPathComponent();
            // First remove the menu items that are currently in the menu...
            __popup_JPopupMenu.removeAll();
            object           data = null; // Data object associated with the node
            DataSetComponent comp2;       // Used to check components in groups.

            // Now reset the popup menu based on the selected node...
            if (__display_data_objects)
            {
                // Get the data for the node.  If the node is a data object,
                // the type can be checked to know what to display.
                // The tree is displaying data objects so the popup will show
                // specific JFrames for each data group.  If the group folder
                // was selected, then display the JFrame showing the first item
                // selected.  If a specific data item in the group was selected,
                // then show the specific data item.
                JMenuItem item;
                data = __popup_Node.getData();
                if (data is DataSetComponent)
                {
                    // Specific checks need to be done to identify the component group...

                    DataSetComponent comp = (DataSetComponent)data;
                    int comp_type         = comp.getComponentType();

                    if (comp_type == StateMod_DataSet.COMP_CONTROL_GROUP)
                    {
                        // For now display the control file information only...
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_CONTROL);
                        if (comp2.hasData())
                        {
                            item = new SimpleJMenuItem("Control Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }

                    else if (comp_type == StateMod_DataSet.COMP_STREAMGAGE_GROUP)
                    {
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMGAGE_STATIONS);
                        if ((comp2 != null) && comp2.hasData())
                        {
                            item = new SimpleJMenuItem("Stream Gage Station Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }

                    else if (comp_type == StateMod_DataSet.COMP_DELAY_TABLE_MONTHLY_GROUP)
                    {
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY);
                        if ((comp2 != null) && comp2.hasData())
                        {
                            item = new SimpleJMenuItem("Delay Table Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }

                    else if (comp_type == StateMod_DataSet.COMP_DELAY_TABLE_DAILY_GROUP)
                    {
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY);
                        if ((comp2 != null) && comp2.hasData())
                        {
                            item = new SimpleJMenuItem("Delay Table Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }

                    else if (comp_type == StateMod_DataSet.COMP_DIVERSION_GROUP)
                    {
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_DIVERSION_STATIONS);
                        if ((comp2 != null) && comp2.hasData())
                        {
                            item = new SimpleJMenuItem("Diversion Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }

                    else if ((comp_type == StateMod_DataSet.COMP_PRECIPITATION_GROUP))
                    {
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_PRECIPITATION_TS_MONTHLY);
                        if ((comp2 != null) && comp2.hasData())
                        {
                            item = new SimpleJMenuItem("Precipitation Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }

                    else if (comp_type == StateMod_DataSet.COMP_EVAPORATION_GROUP)
                    {
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_EVAPORATION_TS_MONTHLY);
                        if ((comp2 != null) && comp2.hasData())
                        {
                            item = new SimpleJMenuItem("Evaporation Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }

                    else if (comp_type == StateMod_DataSet.COMP_RESERVOIR_GROUP)
                    {
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_RESERVOIR_STATIONS);
                        if ((comp2 != null) && comp2.hasData())
                        {
                            item = new SimpleJMenuItem("Reservoir Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }

                    else if (comp_type == StateMod_DataSet.COMP_INSTREAM_GROUP)
                    {
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_INSTREAM_STATIONS);
                        if ((comp2 != null) && comp2.hasData())
                        {
                            item = new SimpleJMenuItem("Instream Flow Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }
                    else if (comp_type == StateMod_DataSet.COMP_WELL_GROUP)
                    {
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_WELL_STATIONS);
                        if ((comp2 != null) && comp2.hasData())
                        {
                            item = new SimpleJMenuItem("Well Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }
                    else if (comp_type == StateMod_DataSet.COMP_PLAN_GROUP)
                    {
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_PLANS);
                        if ((comp2 != null) && comp2.hasData())
                        {
                            item = new SimpleJMenuItem("Plan Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }
                    else if (comp_type == StateMod_DataSet.COMP_STREAMESTIMATE_GROUP)
                    {
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMESTIMATE_STATIONS);
                        if ((comp2 != null) && comp2.hasData())
                        {
                            item = new SimpleJMenuItem("Stream Estimate Station Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }
                    else if (comp_type == StateMod_DataSet.COMP_RIVER_NETWORK_GROUP)
                    {
                        // Only add if data are available...
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK);
                        if ((comp2 != null) && comp2.hasData())
                        {
                            item = new SimpleJMenuItem("River Network Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }

                    else if (comp_type == StateMod_DataSet.COMP_OPERATION_GROUP)
                    {
                        comp2 = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_OPERATION_RIGHTS);
                        if ((comp2 != null) && comp2.hasData())
                        {
                            item = new SimpleJMenuItem("Operation Rights Properties", this);
                            __popup_JPopupMenu.add(item);
                        }
                    }
                }
                // The data are a specific data instance so display the
                // properties for the specific item if a primary data item.

                // Control... nothing for now.

                else if (data is StateMod_StreamGage)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                }
                else if (data is StateMod_DelayTable)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                }
                else if (data is StateMod_Diversion)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                    __popup_JPopupMenu.add(new SimpleJMenuItem(__SUMMARIZE_HOW1 + "\"" + __popup_Node.getText() + "\"" + __SUMMARIZE_HOW2, this));
                }
                else if (data is MonthTS)
                {
                    // Precipitation or evaporation time series...
                    __popup_JPopupMenu.add(new SimpleJMenuItem(__popup_Node.getText() + __PROPERTIES, this));
                    __popup_JPopupMenu.add(new SimpleJMenuItem(__SUMMARIZE_HOW1 + "\"" + __popup_Node.getText() + "\"" + __SUMMARIZE_HOW2, this));
                }
                else if (data is StateMod_Reservoir)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                }
                else if (data is StateMod_InstreamFlow)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                }
                else if (data is StateMod_Well)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                }
                else if (data is StateMod_Plan)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                }
                else if (data is StateMod_StreamEstimate)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                }
                else if (data is StateMod_OperationalRight)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                }
                else if (data is StateMod_RiverNetworkNode)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                }
                // Others (e.g., San Juan Sediment) supported later....
                else
                {
                    Message.printWarning(2, routine, "Node data is not recognized");
                    return;
                }
            }
            // Now display the popup so that the user can select the appropriate menu item...
            Point pt = JGUIUtil.computeOptimalPosition(e.getPoint(), e.getComponent(), __popup_JPopupMenu);

            __popup_JPopupMenu.show(e.getComponent(), pt.x, pt.y);
        }
        /// <summary>
        /// Checks to see if the mouse event would trigger display of the popup menu.
        /// The popup menu does not display if it is null. </summary>
        /// <param name="e"> the MouseEvent that happened. </param>
        private void showPopupMenu(MouseEvent e)
        {
            if (!e.isPopupTrigger() || !__display_data_objects)
            {
                // Do not do anything...
                return;
            }
            // Figure out which node is selected...
            TreePath path = getPathForLocation(e.getX(), e.getY());

            if (path == null)
            {
                return;
            }
            __popup_Node = (SimpleJTree_Node)path.getLastPathComponent();
            // First remove the menu items that are currently in the menu...
            __popup_JPopupMenu.removeAll();
            object data = null;     // Data object associated with the node

            // Now reset the popup menu based on the selected node...
            if (__display_data_objects)
            {
                // Get the data for the node.  If the node is a data object,
                // the type can be checked to know what to display.
                // The tree is displaying data objects so the popup will show
                // specific JFrames for each data group.  If the group folder
                // was selected, then display the JFrame showing the first item
                // selected.  If a specific data item in the group was selected,
                // then show the specific data item.
                JMenuItem item;
                data = __popup_Node.getData();
                if (data is DataSetComponent)
                {
                    // Specific checks need to be done to identify the
                    // component...
                    DataSetComponent comp = (DataSetComponent)data;
                    int comp_type         = comp.getComponentType();
                    if (comp_type == StateCU_DataSet.COMP_CLIMATE_STATIONS_GROUP)
                    {
                        item = new SimpleJMenuItem("Climate Stations Properties", "Climate Stations Properties", this);
                        __popup_JPopupMenu.add(item);
                    }
                    else if (comp_type == StateCU_DataSet.COMP_CROP_CHARACTERISTICS_GROUP)
                    {
                        item = new SimpleJMenuItem("Crop Properties", "Crop Properties", this);
                        __popup_JPopupMenu.add(item);
                    }
                    else if (comp_type == StateCU_DataSet.COMP_DELAY_TABLES_GROUP)
                    {
                        item = new SimpleJMenuItem("Delay Tables Properties", "Delay Tables Properties", this);
                        __popup_JPopupMenu.add(item);
                    }
                    else if (comp_type == StateCU_DataSet.COMP_CU_LOCATIONS_GROUP)
                    {
                        item = new SimpleJMenuItem("CU Locations Properties", "CU Locations Properties", this);
                        __popup_JPopupMenu.add(item);
                    }
                }
                // Check specific instances of the primary data object...
                else if (data is StateCU_ClimateStation)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", __popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                }
                else if (data is StateCU_CropCharacteristics)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", __popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                }
                else if (data is StateMod_DelayTable)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", __popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                }
                else if (data is StateCU_Location)
                {
                    item = new SimpleJMenuItem(__popup_Node.getText() + " Properties", __popup_Node.getText() + " Properties", this);
                    __popup_JPopupMenu.add(item);
                }
                else
                {
                    return;
                }
            }
            // Now display the popup so that the user can select the appropriate
            // menu item...
            __popup_JPopupMenu.show(e.getComponent(), e.getX(), e.getY());
        }