/// <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_GraphNode gn = (StateMod_GraphNode)_data.get(row); string ID = gn.getID(); switch (col) { case COL_TYPE: string type = gn.getType(); if (type.Equals("")) { return(""); } else if (type.Equals("INS", StringComparison.OrdinalIgnoreCase) || type.Equals("Instream Flow", StringComparison.OrdinalIgnoreCase)) { return("Instream Flow"); } else if (type.Equals("DIV", StringComparison.OrdinalIgnoreCase) || type.Equals("Diversion", StringComparison.OrdinalIgnoreCase)) { return("Diversion"); } else if (type.Equals("RES", StringComparison.OrdinalIgnoreCase) || type.Equals("Reservoir", StringComparison.OrdinalIgnoreCase)) { return("Reservoir"); } else if (type.Equals("STR", StringComparison.OrdinalIgnoreCase) || type.Equals("Streamflow", StringComparison.OrdinalIgnoreCase)) { return("Streamflow"); } else if (type.Equals("WEL", StringComparison.OrdinalIgnoreCase) || type.Equals("Well", StringComparison.OrdinalIgnoreCase)) { return("Well"); } else { if (ID.Equals("All")) { return(""); } return("Other"); } case COL_ID: if (ID.Equals("All")) { return("All"); } else if (ID.Equals("")) { return(""); } return(findIDMatch(gn.getType(), gn.getID())); case COL_SWITCH: if (ID.Equals("All")) { return(""); } if (gn.getSwitch() == 0) { return("Off"); } else if (gn.getSwitch() == 1) { return("On"); } else { return(""); } default: return(""); } }
/// <summary> /// Creates a list of objects suitable for use in the worksheet from the data /// read from a delta plot file. </summary> /// <param name="fileData"> the fileData to process. </param> /// <returns> a list of objects suitable for use within a form. </returns> public virtual IList <StateMod_GraphNode> formLoadData(IList <StateMod_GraphNode> fileData) { int rows = fileData.Count; if (rows == 0) { return(new List <StateMod_GraphNode>()); } // gnf will be a node used to read data FROM the _F_ile nodes StateMod_GraphNode gnf = fileData[0]; string pfile = ""; string ptype = ""; string pyear = ""; string file = null; string type = null; string dtype = null; string year = null; // gnw will be a node used for creating the _W_orksheet nodes StateMod_GraphNode gnw = null; IList <StateMod_GraphNode> v = new List <StateMod_GraphNode>(); int ids = 0; for (int i = 0; i < rows; i++) { gnf = fileData[i]; ids = gnf.getIDVectorSize(); file = gnf.getFileName().Trim(); type = gnf.getType().Trim(); dtype = gnf.getDtype().Trim(); year = gnf.getYrAve().Trim(); for (int j = 0; j < ids; j++) { if (j == 0) { gnw = new StateMod_GraphNode(); if (!file.Equals(pfile)) { gnw.setFileName(file); } else { gnw.setFileName(""); } if (!type.Equals(ptype)) { gnw.setType(type); } else { gnw.setType(""); } if (!dtype.Equals(dtype)) { gnw.setDtype(dtype); } else { gnw.setDtype(""); } if (!year.Equals(pyear)) { gnw.setYrAve(year); } else { gnw.setYrAve(""); } gnw.setID(gnf.getID(0).Trim()); } else { gnw.setFileName(""); gnw.setType(""); gnw.setDtype(""); gnw.setYrAve(""); gnw.setID(gnf.getID(j).Trim()); } gnw.setSwitch(gnf.getSwitch()); v.Add(gnw); } pfile = file; ptype = type; pyear = year; } return(v); }