/// <summary>
 /// Constructor. </summary>
 /// <param name="parent"> the parent JFrame on which this dialog appears. </param>
 /// <param name="nodes"> array of nodes, from which one will be displayed. </param>
 /// <param name="nodeNum"> the number of the node being displayed from the array. </param>
 public StateMod_Network_NodeProperties_JDialog(StateMod_Network_JFrame parent, HydrologyNode[] nodes, int nodeNum) : base(parent, "Node Properties - " + nodes[nodeNum].getCommonID(), true)
 {
     __parent  = parent;
     __nodes   = nodes;
     __nodeNum = nodeNum;
     setupGUI();
 }
コード例 #2
0
        /// <summary>
        /// Constructor. </summary>
        /// <param name="parent"> the JFrame on which this dialog will be shown. </param>
        /// <param name="ds"> the Downstream node from where the ndoe should be added. </param>
        public StateMod_Network_AddNode_JDialog(StateMod_Network_JFrame parent, HydrologyNode ds) : base(parent, "Add Node", true)
        {
            __parent = parent;
            __ds     = ds;

            setupGUI();
        }
コード例 #3
0
        /// <summary>
        /// Constructor. </summary>
        /// <param name="parent"> the JFrame on which this dialog will be shown. </param>
        /// <param name="ds"> the Downstream node from where the node should be added. </param>
        public StateMod_Network_AddLink_JDialog(StateMod_Network_JFrame parent, StateMod_Network_JComponent device, HydrologyNode[] nodes) : base(parent, "Add Link", true)
        {
            __parent = parent;
            __device = device;
            __nodes  = nodes;

            setupGUI();
        }
コード例 #4
0
 /// <summary>
 /// Constructor.  The major objects used in editing are passed in, but may not be required for all actions. </summary>
 /// <param name="editorJFrame"> the controlling editor window (e.g., to allow popup dialogs to position) </param>
 /// <param name="editorComponent"> the graphical editor component that renders the network, which does some internal
 /// optimized data management </param>
 /// <param name="network"> the network that will be manipulated, although subsets of the network may be passed in to
 /// specific methods </param>
 public StateMod_Network_EditorToolkit(StateMod_Network_JFrame editorJFrame, StateMod_Network_JComponent editorJComponent, StateMod_NodeNetwork network)
 {
     this.__editorJFrame     = editorJFrame;
     this.__editorJComponent = editorJComponent;
     this.__network          = network;
 }
コード例 #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_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);
            }
        }