/// <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> /// Return the downstream data set object by searching appropriate dataset lists. </summary> /// <param name="dataset"> the full dataset from which the destination should be extracted </param> public virtual StateMod_Data lookupDownstreamDataObject(StateMod_DataSet dataset) { string downstreamID = getIfrrdn(); StateMod_OperationalRight_Metadata_SourceOrDestinationType[] downstreamTypes = new StateMod_OperationalRight_Metadata_SourceOrDestinationType[] { StateMod_OperationalRight_Metadata_SourceOrDestinationType.RIVER_NODE }; IList <StateMod_Data> smdataList = new List <StateMod_Data>(); for (int i = 0; i < downstreamTypes.Length; i++) { ((IList <StateMod_Data>)smdataList).AddRange(StateMod_Util.getDataList(downstreamTypes[i], dataset, downstreamID, true)); if (smdataList.Count > 0) { break; } } if (smdataList.Count == 1) { return(smdataList[0]); } else if (smdataList.Count == 0) { return(null); } else { throw new Exception("" + smdataList.Count + " data objects returned matching downstream \"" + downstreamID + "\" for instream flow \"" + getID() + " - one is expected."); } }
/// <param name="dataset"> StateMod dataset object. </param> /// <returns> validation results. </returns> public virtual StateMod_ComponentValidation validateComponent(StateMod_DataSet dataset) { StateMod_ComponentValidation validation = new StateMod_ComponentValidation(); string id = getID(); string name = getName(); string riverID = getCgoto(); string dailyID = getCrunidy(); // Make sure that basic information is not empty if (StateMod_Util.isMissing(id)) { validation.add(new StateMod_ComponentValidationProblem(this, "Stream estimate identifier is blank.", "Specify a station identifier.")); } if (StateMod_Util.isMissing(name)) { validation.add(new StateMod_ComponentValidationProblem(this, "Stream estimate \"" + id + "\" name is blank.", "Specify a station name to clarify data.")); } if (StateMod_Util.isMissing(riverID)) { validation.add(new StateMod_ComponentValidationProblem(this, "Stream estimate \"" + id + "\" river ID is blank.", "Specify a river ID to associate the station with a river network node.")); } else { // Verify that the river node is in the data set, if the network is available if (dataset != null) { DataSetComponent comp = 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> rinList = (java.util.List<StateMod_RiverNetworkNode>)comp.getData(); IList <StateMod_RiverNetworkNode> rinList = (IList <StateMod_RiverNetworkNode>)comp.getData(); if ((rinList != null) && (rinList.Count > 0)) { if (StateMod_Util.IndexOf(rinList, riverID) < 0) { validation.add(new StateMod_ComponentValidationProblem(this, "Stream estimate \"" + id + "\" river network ID (" + riverID + ") is not found in the list of river network nodes.", "Specify a valid river network ID to associate the station with a river network node.")); } } } } // Verify that the daily ID is in the data set if (!StateMod_Util.isMissing(dailyID)) { if (dataset != null) { DataSetComponent comp = dataset.getComponentForComponentType(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> risList = (java.util.List<StateMod_StreamGage>)comp.getData(); IList <StateMod_StreamGage> risList = (IList <StateMod_StreamGage>)comp.getData(); if ((risList != null) && (risList.Count > 0)) { if (!dailyID.Equals("0") && !dailyID.Equals("3") && !dailyID.Equals("4") && (StateMod_Util.IndexOf(risList, dailyID) < 0)) { validation.add(new StateMod_ComponentValidationProblem(this, "Stream estimate \"" + id + "\" daily ID (" + dailyID + ") is not 0, 3, or 4 and is not found in the list of stream gages.", "Specify the daily ID as 0, 3, 4, or that matches a stream gage ID.")); } } } } return(validation); }
/// <summary> /// Constructor. </summary> /// <param name="parent"> the JFrame on which to display this dialog. Must not be null. </param> /// <param name="dataset"> the dataset that is being worked with. </param> /// <param name="datasetWindowManager"> the window manager that is managing this window. </param> public StateMod_Save_JDialog(JFrame parent, StateMod_DataSet dataset, StateMod_DataSet_WindowManager datasetWindowManager) : base(parent, "Save Modified StateMod Files", true) { __dataset = dataset; __dataset_wm = datasetWindowManager; __parent = parent; setupGUI(); }
// TODO SAM 2010-12-18 Needs an editable parameter like for other data files /// <summary> /// Constructor for output control </summary> /// <param name="dataset"> the dataset containing the data </param> public StateMod_OutputControl_JFrame(StateMod_DataSet dataset) { StateMod_GUIUtil.setTitle(this, dataset, "Output Control", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __dataset = dataset; __riverNetworkComp = __dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK); setupGUI(); }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset that contains the data. </param> /// <param name="dataset_wm"> the dataset window manager or null if the data set windows /// are not being managed. </param> public StateMod_RunReport_JFrame(StateMod_DataSet dataset, StateMod_DataSet_WindowManager dataset_wm) { StateMod_GUIUtil.setTitle(this, dataset, "Run StateMod Report", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __dataset = dataset; __dataset_wm = dataset_wm; setupGUI(); }
/// <param name="dataset"> StateMod dataset object. </param> /// <returns> validation results. </returns> public virtual StateMod_ComponentValidation validateComponent(StateMod_DataSet dataset) { StateMod_ComponentValidation validation = new StateMod_ComponentValidation(); string id = getID(); string name = getName(); string cgoto = getCgoto(); string irtem = getIrtem(); double dcrifr = getDcrifr(); // Make sure that basic information is not empty if (StateMod_Util.isMissing(id)) { validation.add(new StateMod_ComponentValidationProblem(this, "Instream flow right identifier is blank.", "Specify a instream flow right identifier.")); } if (StateMod_Util.isMissing(name)) { validation.add(new StateMod_ComponentValidationProblem(this, "Instream flow right \"" + id + "\" name is blank.", "Specify an instream flow right name to clarify data.")); } if (StateMod_Util.isMissing(cgoto)) { validation.add(new StateMod_ComponentValidationProblem(this, "Instream flow right \"" + id + "\" station ID is blank.", "Specify an instream flow station to associate with the instream flow right.")); } else { // Verify that the instream flow station is in the data set, if the network is available DataSetComponent comp2 = dataset.getComponentForComponentType(StateMod_DataSet.COMP_INSTREAM_STATIONS); System.Collections.IList ifsList = (System.Collections.IList)comp2.getData(); if ((ifsList != null) && (ifsList.Count > 0)) { if (StateMod_Util.IndexOf(ifsList, cgoto) < 0) { validation.add(new StateMod_ComponentValidationProblem(this, "Instream flow right \"" + id + "\" associated instream flow (" + cgoto + ") is not found in the list of instream flow stations.", "Specify a valid instream flow station ID to associate with the instream flow right.")); } } } if (StateMod_Util.isMissing(irtem)) { validation.add(new StateMod_ComponentValidationProblem(this, "Instream flow right \"" + id + "\" administration number is blank.", "Specify an administration number NNNNN.NNNNN.")); } else if (!StringUtil.isDouble(irtem)) { validation.add(new StateMod_ComponentValidationProblem(this, "Instream flow right \"" + id + "\" administration number (" + irtem + ") is invalid.", "Specify an administration number NNNNN.NNNNN.")); } else { double irtemd = double.Parse(irtem); if (irtemd < 0) { validation.add(new StateMod_ComponentValidationProblem(this, "Instream flow right \"" + id + "\" administration number (" + irtem + ") is invalid.", "Specify an administration number NNNNN.NNNNN.")); } } if (!(dcrifr >= 0.0)) { validation.add(new StateMod_ComponentValidationProblem(this, "Instream flow right \"" + id + "\" decree (" + StringUtil.formatString(dcrifr, "%.2f") + ") is invalid.", "Specify the decree as a number >= 0.")); } return(validation); }
private IList <StateMod_Diversion> __matches_Vector = null; // The list of matching data. /// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset in which the Control data with which to populate /// this form is found. </param> /// <param name="dataset_wm"> the dataset window manager or null if the data set windows /// are not being managed. </param> /// <param name="editable"> If true, the data in the window are editable. </param> public StateMod_QueryTool_JFrame(StateMod_DataSet dataset, StateMod_DataSet_WindowManager dataset_wm) { StateMod_GUIUtil.setTitle(this, dataset, "Query Tool", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __dataset = dataset; __dataset_wm = dataset_wm; setupGUI(); }
/// <summary> /// Constructor. This builds the model for displaying the given component data. </summary> /// <param name="dataset"> StateMod_DataSet that is being displayed. If not a group /// component, the group component will be determined. </param> /// <param name="comp"> the DataSetComponent to be displayed. </param> /// <exception cref="Exception"> an invalid component is passed in. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public StateMod_DataSetComponent_TableModel(StateMod_DataSet dataset, RTi.Util.IO.DataSetComponent comp) throws Exception public StateMod_DataSetComponent_TableModel(StateMod_DataSet dataset, DataSetComponent comp) { System.Collections.IList data = null; string routine = "StateMod_DataSetComponent_TableModel"; // Make sure that the list is for a group component... if ((comp != null) && !comp.isGroup()) { __component_group = comp.getParentComponent(); //Message.printStatus ( 1, routine, //"Component is not a group. Parent is: " +__component_group); } else { __component_group = comp; } if (__component_group == null) { _rows = 0; _data = null; return; } // Figure out the data component that is actually used to get the list // of data objects. For example, if working on climate stations, there // is no list with the group so we need to use the climate stations // component list... int comptype = dataset.lookupPrimaryComponentTypeForComponentGroup(__component_group.getComponentType()); if (comptype >= 0) { __component = dataset.getComponentForComponentType(comptype); } else { comp = null; Message.printWarning(2, routine, "Unable to find primary component for group: " + __component_group.getComponentName()); } if (__component == null) { _rows = 0; } else { data = ((System.Collections.IList)__component.getData()); if (data == null) { _rows = 0; } else { _rows = data.Count; } } _data = data; }
/// <param name="dataset"> StateMod dataset object. </param> /// <returns> validation results. </returns> public virtual StateMod_ComponentValidation validateComponent(StateMod_DataSet dataset) { StateMod_ComponentValidation validation = new StateMod_ComponentValidation(); string id = getID(); string name = getName(); string riverID = getCgoto(); string dailyID = getCrunidy(); // Make sure that basic information is not empty if (StateMod_Util.isMissing(id)) { validation.add(new StateMod_ComponentValidationProblem(this, "Stream gage identifier is blank.", "Specify a station identifier.")); } if (StateMod_Util.isMissing(name)) { validation.add(new StateMod_ComponentValidationProblem(this, "Stream gage \"" + id + "\" name is blank.", "Specify a station name to clarify data.")); } if (StateMod_Util.isMissing(riverID)) { validation.add(new StateMod_ComponentValidationProblem(this, "Stream gage \"" + id + "\" river ID is blank.", "Specify a river ID to associate the station with a river network node.")); } else { // Verify that the river node is in the data set, if the network is available if (dataset != null) { DataSetComponent comp = dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK); System.Collections.IList rinList = (System.Collections.IList)comp.getData(); if ((rinList != null) && (rinList.Count > 0)) { if (StateMod_Util.IndexOf(rinList, riverID) < 0) { validation.add(new StateMod_ComponentValidationProblem(this, "Stream gage \"" + id + "\" river network ID (" + riverID + ") is not found in the list of river network nodes.", "Specify a valid river network ID to associate the station with a river network node.")); } } } } // Verify that the daily ID is in the data set if (!StateMod_Util.isMissing(dailyID)) { if (dataset != null) { DataSetComponent comp = dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMGAGE_STATIONS); System.Collections.IList risList = (System.Collections.IList)comp.getData(); if ((risList != null) && (risList.Count > 0)) { if (!dailyID.Equals("0") && !dailyID.Equals("3") && !dailyID.Equals("4") && (StateMod_Util.IndexOf(risList, dailyID) < 0)) { validation.add(new StateMod_ComponentValidationProblem(this, "Stream gage \"" + id + "\" daily ID (" + dailyID + ") is not 0, 3, or 4 and is not found in the list of stream gages.", "Specify the daily ID as 0, 3, 4, or that matches a stream gage ID.")); } } } } return(validation); }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset in which the data are contained. </param> /// <param name="div"> the diversion to display. </param> /// <param name="editable"> whether the form data can be edited or not </param> public StateMod_Diversion_Right_JFrame(StateMod_DataSet dataset, StateMod_Diversion div, bool editable) { StateMod_GUIUtil.setTitle(this, dataset, div.getName() + " - Diversion Water Rights", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __currentDiv = div; __dataset = dataset; __editable = editable; setupGUI(); }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset that is being worked with. </param> /// <param name="dataset_wm"> the dataset's window manager </param> public StateMod_Response_JFrame(StateMod_DataSet dataset, StateMod_DataSet_WindowManager dataset_wm) { StateMod_GUIUtil.setTitle(this, dataset, "Response File Contents", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __dataset = dataset; __dataset_copy = new StateMod_DataSet(dataset, false); __dataset_wm = dataset_wm; setupGUI(); }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset in which the data is contained. </param> /// <param name="insf"> the InstreamFlow right to display. </param> /// <param name="editable"> whether the gui data is editable or not </param> public StateMod_InstreamFlow_Right_JFrame(StateMod_DataSet dataset, StateMod_InstreamFlow insf, bool editable) { StateMod_GUIUtil.setTitle(this, dataset, insf.getName() + " - Instream Flow Water Rights", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __currentInstreamFlow = insf; __dataset = dataset; __editable = editable; setupGUI(); }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset in which the data is contained. </param> /// <param name="res"> the reservoir object to display in the frame. </param> /// <param name="editable"> whether the gui data is editable or not </param> public StateMod_Reservoir_AreaCap_JFrame(StateMod_DataSet dataset, StateMod_Reservoir res, bool editable) { StateMod_GUIUtil.setTitle(this, dataset, res.getName() + " - Reservoir Content/Area/Seepage", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __currentRes = res; __dataset = dataset; __editable = editable; setupGUI(); }
/// <summary> /// Displays a graph for a time series. </summary> /// <param name="ts"> the time series to graph. </param> /// <param name="title"> the title of the graph </param> /// <param name="dataset"> the dataset in which the ts data exists </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void displayGraphForTS(RTi.TS.TS ts, String title, StateMod_DataSet dataset) throws Exception public static void displayGraphForTS(TS ts, string title, StateMod_DataSet dataset) { System.Collections.IList v = new List <object>(); v.Add(ts); // add title to proplist PropList props = new PropList("displayGraphForTSProps"); props.set("titlestring", title); displayGraphForTS(v, props, dataset); }
/// <param name="dataset"> StateMod dataset object. </param> /// <returns> Validation results. </returns> public virtual StateMod_ComponentValidation validateComponent(StateMod_DataSet dataset) { StateMod_ComponentValidation validation = new StateMod_ComponentValidation(); string id = getID(); string name = getName(); string downstreamRiverID = getCstadn(); double gwmaxr = getGwmaxr(); // Make sure that basic information is not empty if (StateMod_Util.isMissing(id)) { validation.add(new StateMod_ComponentValidationProblem(this, "River node identifier is blank.", "Specify a river node identifier.")); } if (StateMod_Util.isMissing(name)) { validation.add(new StateMod_ComponentValidationProblem(this, "River node \"" + id + "\" name is blank.", "Specify a river node name to clarify data.")); } // Get the network list if available for checks below DataSetComponent comp = null; System.Collections.IList rinList = null; if (dataset != null) { comp = dataset.getComponentForComponentType(StateMod_DataSet.COMP_RIVER_NETWORK); rinList = (System.Collections.IList)comp.getData(); if ((rinList != null) && (rinList.Count == 0)) { // Set to null to simplify checks below rinList = null; } } if (StateMod_Util.isMissing(downstreamRiverID) && !name.Equals("END", StringComparison.OrdinalIgnoreCase) && !name.EndsWith("_END", StringComparison.Ordinal)) { validation.add(new StateMod_ComponentValidationProblem(this, "River node \"" + id + "\" downstream node ID is blank.", "Specify a downstream node ID.")); } else { // Verify that the downstream river node is in the data set, if the network is available - skip this // check for the end node. if ((rinList != null) && !name.Equals("END", StringComparison.OrdinalIgnoreCase) && !name.EndsWith("_END", StringComparison.Ordinal)) { if (StateMod_Util.IndexOf(rinList, downstreamRiverID) < 0) { validation.add(new StateMod_ComponentValidationProblem(this, "River node \"" + id + "\" downstream node ID (" + downstreamRiverID + ") is not found in the list of river network nodes.", "Specify a valid river network ID for the downstream node.")); } } } if (!StateMod_Util.isMissing(gwmaxr) && !(gwmaxr >= 0.0)) { validation.add(new StateMod_ComponentValidationProblem(this, "River node \"" + id + "\" maximum groundwater recharge (" + StringUtil.formatString(gwmaxr, "%.2f") + ") is invalid.", "Specify the maximum groundwater recharge as a number >= 0.")); } return(validation); }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset in which the data is contained. </param> /// <param name="res"> the reservoir for which to display data </param> /// <param name="editable"> whether the gui data is editable or not. </param> public StateMod_Reservoir_Owner_JFrame(StateMod_DataSet dataset, StateMod_Reservoir res, bool editable) { StateMod_GUIUtil.setTitle(this, dataset, res.getName() + " - Reservoir Owner Accounts", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __currentRes = res; __dataset = dataset; __editable = editable; setupGUI(); }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset in which the data is contained. </param> /// <param name="well"> the well for which to shown depletion data. </param> /// <param name="editable"> whether the gui data is editable or not </param> public StateMod_Well_Depletion_JFrame(StateMod_DataSet dataset, StateMod_Well well, bool editable) { StateMod_GUIUtil.setTitle(this, dataset, well.getName() + " - Well Depletion Information", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __currentWell = well; __dataset = dataset; __editable = editable; setupGUI(); }
/// <summary> /// Constructor. This builds the Model for displaying the return flow data. </summary> /// <param name="dataset"> the dataset for the data being displayed. The control /// information is used to determine whether return flows for daily or monthly. </param> /// <param name="data"> the data that will be displayed in the table. </param> /// <param name="editable"> whether the data can be edited or not. </param> /// <param name="is_return"> Specify true for return flows and false for depletions. </param> /// <exception cref="Exception"> if an invalid data or dmi was passed in. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public StateMod_ReturnFlow_TableModel(StateMod_DataSet dataset, java.util.List data, boolean editable, boolean is_return) throws Exception public StateMod_ReturnFlow_TableModel(StateMod_DataSet dataset, System.Collections.IList data, bool editable, bool is_return) { __dataset = dataset; if (data == null) { throw new Exception("Invalid data Vector passed to " + "StateMod_ReturnFlow_TableModel constructor."); } _rows = data.Count; _data = data; __editable = editable; __is_return = is_return; }
/// <summary> /// Constructor. This builds the table model for displaying the diversion right data. </summary> /// <param name="dataset"> the dataset for the data being displayed. </param> /// <param name="data"> the diversion right data that will be displayed in the table. </param> /// <param name="editable"> whether the data can be edited </param> public StateMod_DiversionRight_Data_TableModel(StateMod_DataSet dataset, System.Collections.IList data, bool editable) { if (data == null) { _data = new List <object>(); } else { _data = data; } _rows = _data.size(); __editable = editable; }
/// <summary> /// Construct a StateMod_DataSet_JFrame. </summary> /// <param name="parent"> JFrame from which this instance is constructed. </param> /// <param name="dataset"> StateMod_DataSet that is being displayed/managed. </param> /// <param name="dataset_wm"> the dataset window manager or null if the data set windows are not being managed. </param> /// <param name="display_data_objects"> If true, data objects are listed in the tree. If </param> /// <param name="editable"> If true, data objects can be edited. /// false, only the top-level data set components are listed. </param> public StateMod_DataSet_JTree(JFrame parent, StateMod_DataSet dataset, StateMod_DataSet_WindowManager dataset_wm, bool display_data_objects, bool editable) { __dataset = dataset; __dataset_wm = dataset_wm; __display_data_objects = display_data_objects; __editable = editable; __folderIcon = getClosedIcon(); showRootHandles(true); addMouseListener(this); setLeafIcon(null); setTreeTextEditable(false); __popup_JPopupMenu = new JPopupMenu(); }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset in which the data is contained. </param> /// <param name="plan"> the plan for which to display return information. </param> /// <param name="editable"> whether the gui data is editable or not. </param> public StateMod_Plan_Return_JFrame(StateMod_DataSet dataset, StateMod_Plan plan, bool editable) { StateMod_GUIUtil.setTitle(this, dataset, plan.getName() + " - Plan Return Flow Table Assignment", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __currentPlan = plan; IList <StateMod_ReturnFlow> allReturns = (IList <StateMod_ReturnFlow>)dataset.getComponentForComponentType(StateMod_DataSet.COMP_PLAN_RETURN).getData(); __currentPlanReturnList = (IList <StateMod_ReturnFlow>)StateMod_Util.getDataList(allReturns, plan.getID()); Message.printStatus(2, "", "Have " + __currentPlanReturnList.Count + " return records for plan \"" + __currentPlan.getID() + "\" uniquetempvar."); __dataset = dataset; // TODO SAM 2011-01-02 For now editing is disabled... editable = false; __editable = editable; setupGUI(); }
/// <summary> /// Sets the title in a uniform fashion, as determined by the values passed in. /// The general pattern of the title will be /// "AppName - DataSet Base Name - Window Name (status)" </summary> /// <param name="dialog"> the dialog on which to set the title. Cannot be null. </param> /// <param name="dataset"> the dataset from which to get the base dataset name. The /// basename can be null or "", in which case it won't be included in the title. /// The dataset can be null. </param> /// <param name="window_title"> the title of the window. Can be null or "", in which /// case it won't be included in the title. </param> /// <param name="status"> the status of the window. Can be null or "", in which case /// it won't be included in the title. </param> public static void setTitle(JDialog dialog, StateMod_DataSet dataset, string window_title, string status) { string title = ""; int count = 0; string appName = JGUIUtil.getAppNameForWindows().Trim(); if (!appName.Trim().Equals("")) { title += appName; count++; } if (dataset != null) { string basename = dataset.getBaseName(); if (!string.ReferenceEquals(basename, null) && !basename.Trim().Equals("")) { if (count > 0) { title += " - "; } title += basename.Trim(); count++; } } if (!string.ReferenceEquals(window_title, null) && !window_title.Trim().Equals("")) { if (count > 0) { title += " - "; } title += window_title.Trim(); count++; } if (!string.ReferenceEquals(status, null) && !status.Trim().Equals("")) { if (count > 0) { title += " "; } title += "(" + status + ")"; } dialog.setTitle(title); }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset for which to display data set component information. </param> /// <exception cref="Exception"> if an invalid data or dmi was passed in. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public StateMod_Response_TableModel(StateMod_DataSet dataset) throws Exception public StateMod_Response_TableModel(StateMod_DataSet dataset) { __dataset = dataset; // get the array of the ints that refer to the groups in // the data set. int[] groups = __dataset.getComponentGroupNumbers(); System.Collections.IList ints = new List <object>(); DataSetComponent dsc = null; System.Collections.IList v = null; // Go through each of the groups and get their data out. Group data // consists of the DataSetComponents the group contains. For each // of the group's DataSetComponents, if it has data, then add its // component type to the accumulation vector. for (int i = 0; i < groups.Length; i++) { dsc = __dataset.getComponentForComponentType(groups[i]); v = (System.Collections.IList)dsc.getData(); if (v == null) { v = new List <object>(); } for (int j = 0; j < v.Count; j++) { dsc = (DataSetComponent)v[j]; // the following makes sure that the response file // is not added here ... the response file is added // below because it must always be in the GUI. if (dsc.getComponentType() != StateMod_DataSet.COMP_RESPONSE && dsc.isVisible()) { ints.Add(new int?(dsc.getComponentType())); } } } // now transfer the numbers of the DataSetComponents with data into // an int array from the Vector. __data = new int[ints.Count + 1]; __data[0] = StateMod_DataSet.COMP_RESPONSE; for (int i = 0; i < ints.Count; i++) { __data[i + 1] = ((int?)ints[i]).Value; } _rows = __data.Length; }
/// <summary> /// Constructor. This builds the Model for displaying the plan data. </summary> /// <param name="dataset"> the dataset for the data being displayed. Only necessary for return flow tables. </param> /// <param name="data"> the data that will be displayed in the table. </param> /// <param name="editable"> whether the data can be edited or not </param> /// <param name="compactForm"> if true, then the compact form of the table model will be /// used. In the compact form, only the name and ID are shown. If false, all fields will be shown. </param> /// <exception cref="Exception"> if an invalid data or dmi was passed in. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public StateMod_Plan_TableModel(StateMod_DataSet dataset, java.util.List data, boolean editable, boolean compactForm) throws Exception public StateMod_Plan_TableModel(StateMod_DataSet dataset, System.Collections.IList data, bool editable, bool compactForm) { if (data == null) { throw new Exception("Invalid data Vector passed to StateMod_Plan_TableModel constructor."); } _rows = data.Count; _data = data; __editable = editable; if (compactForm) { __COLUMNS = 2; } }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset for which to display information in the worksheet. </param> /// <exception cref="Exception"> if an invalid data or dmi was passed in. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public StateMod_Save_TableModel(StateMod_DataSet dataset) throws Exception public StateMod_Save_TableModel(StateMod_DataSet dataset) { __dataset = dataset; // get the array of the ints that refer to the groups in // the data set. int[] groups = __dataset.getComponentGroupNumbers(); System.Collections.IList ints = new List <object>(); DataSetComponent dsc = null; System.Collections.IList v = null; // Go through each of the groups and get their data out. Group data // consists of the DataSetComponents the group contains. For each // of the group's DataSetComponents, if it has data, then add its // component type to the accumulation vector. for (int i = 0; i < groups.Length; i++) { dsc = __dataset.getComponentForComponentType(groups[i]); v = (System.Collections.IList)dsc.getData(); if (v == null) { v = new List <object>(); } for (int j = 0; j < v.Count; j++) { dsc = (DataSetComponent)v[j]; // get the dirty components -- they can be saved // (or not). if (dsc.isDirty()) { ints.Add(new int?(dsc.getComponentType())); } } } // now transfer the numbers of the DataSetComponents with data into // an int array from the Vector. __data = new int[ints.Count]; for (int i = 0; i < ints.Count; i++) { __data[i] = ((int?)ints[i]).Value; } _rows = __data.Length; }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset in which the data is contained. </param> /// <param name="res"> the Reservoir for which to display return information. </param> /// <param name="editable"> whether the gui data is editable or not. </param> public StateMod_Reservoir_Return_JFrame(StateMod_DataSet dataset, StateMod_Reservoir res, bool editable) { StateMod_GUIUtil.setTitle(this, dataset, res.getName() + " - Reservoir Return Flow Table Assignment", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __currentRes = res; //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_ReturnFlow> allReturns = (java.util.List<StateMod_ReturnFlow>)dataset.getComponentForComponentType(StateMod_DataSet.COMP_RESERVOIR_RETURN).getData(); IList <StateMod_ReturnFlow> allReturns = (IList <StateMod_ReturnFlow>)dataset.getComponentForComponentType(StateMod_DataSet.COMP_RESERVOIR_RETURN).getData(); __currentResReturnList = (IList <StateMod_ReturnFlow>)StateMod_Util.getDataList(allReturns, res.getID()); Message.printStatus(2, "", "Have " + __currentResReturnList.Count + " return records for reservoir \"" + __currentRes.getID() + "\" uniquetempvar."); //__dataset = dataset; // TODO SAM 2011-01-02 For now editing is disabled... editable = false; __editable = editable; setupGUI(); }
/// <summary> /// Responds to Window Activated events; does nothing. </summary> /// <param name="event"> the WindowEvent that happened. </param> public virtual void windowActivated(WindowEvent @event) { if (IOUtil.testing()) { __dataset_copy = new StateMod_DataSet(__dataset, false); try { __tableModel = new StateMod_Response_TableModel(__dataset_copy); __worksheet.setModel(__tableModel); } catch (Exception e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } } }
/// <summary> /// Constructor. </summary> /// <param name="dataset"> the dataset containing the data. </param> public StateMod_OutputFiles_JFrame(StateMod_DataSet dataset) { StateMod_GUIUtil.setTitle(this, dataset, "View/Edit Ouput Files", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __dataset = dataset; __path = __dataset.getComponentDataFilePath(StateMod_DataSet.COMP_RESPONSE); __basinName = __dataset.getBaseName(); int index = __path.LastIndexOf(File.separator); if (index > -1) { __path = __path.Substring(0, index + 1); } setupGUI(); }
/// <summary> /// Display a graph of reservoir content versus area or content versus seepage. </summary> /// <param name="dataset"> The dataset including the reservoir. </param> /// <param name="res"> StateMod_Reservoir with data to graph. </param> /// <param name="type"> "Area" or "Seepage", indicating the data to graph. </param> /// <param name="editable"> Indicate whether the data are editable or not (currently /// ignored and treated as not editable through the graph). </param> public StateMod_Reservoir_AreaCap_Graph_JFrame(StateMod_DataSet dataset, StateMod_Reservoir res, string type, bool editable) { StateMod_GUIUtil.setTitle(this, dataset, res.getName() + " - Reservoir Content/" + type + " Curve", null); JGUIUtil.setIcon(this, JGUIUtil.getIconImage()); __res = res; __type = type; DefaultTableXYDataset graph_dataset = createDataset(); JFreeChart chart = createChart(graph_dataset); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(500, 500)); getContentPane().add("Center", chartPanel); pack(); JGUIUtil.center(this); setVisible(true); }