");
- writeLine("#include \"DbmsAccess.h\"");
- writeLine("#include \"dbmserrs.h\"");
- writeLine("#include \"List.h\"");
- */
- writeNewLine();
- writeLine("EXEC SQL include sqlda;");
- writeLine("EXEC SQL include sqltypes;");
- writeLine("EXEC SQL include sql3types;");
- writeLine("EXEC SQL include pgtypes_timestamp;");
- writeLine("EXEC SQL include pgtypes_date;");
- writeLine("EXEC SQL include pgtypes_interval;");
- writeLine("EXEC SQL include pgtypes_numeric;");
- writeNewLine();
-
- }
- catch (java.io.IOException e)
- {
- logError(e);
- }
-
-
- }
-
- //---------------------------------------------------------------------------------------
- private void createStructSection(String tableName, TableDescriptor tableDesc)
- {
- try
- {
- _indenter.setLevel(0);
-
- writeLine("EXEC SQL BEGIN DECLARE SECTION;");
- writeLine("struct " + tableName + "_t");
- writeLine("{");
- _indenter.incLevel();
- createStructureContents(tableName, tableDesc, false);
- _indenter.decLevel();
- writeLine("} " + tableName + "_rec;");
- writeLine("EXEC SQL END DECLARE SECTION;");
- writeNewLine();
- }
- catch (java.io.IOException e)
- {
- logError(e);
- }
- }
- //----------------------------------------------------------------------------------------
-
-
- private void createMiscDeclarations(String tableName)
- {
- try
- {
- _indenter.setLevel(0);
-
- writeLine("#define QUERY_LEN 9999");
- writeLine("static int errorLoggingOn = 1;");
- writeNewLine();
- writeLine("static DbStatus dbStatus;");
- writeNewLine();
-
- }
- catch (java.io.IOException e)
- {
- logError(e);
- }
- }
-// ----------------------------------------------------------------------------------------
-
-
- private void createSetErrorLogging(String tableName)
- {
-
- try
- {
- _indenter.setLevel(0);
-
- writeLine("void Set" + tableName +"ErrorLogging(int value)");
-
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("errorLoggingOn = value;");
- writeLine("return;");
-
- _indenter.decLevel();
- writeLine("}");
-
-
- writeNewLine();
-
- }
- catch (java.io.IOException e)
- {
- logError(e);
- }
- }
-//----------------------------------------------------------------------------------------
-
- private void createStructureContents(String tableName,
- TableDescriptor tableDesc,
- boolean isPublicStructure)
- {
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- try
- {
- for (int i = 0; i < columnDescriptorList.size(); i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList.get(i);
-
-
- String columnName = colDesc.getName();
- int sqlTypeInt = colDesc.getSqlTypeInt();
- String cType = getCDataTypeByInt(sqlTypeInt, isPublicStructure);
-
- String firstChar = String.valueOf(columnName.charAt(0));
- // String newName = firstChar.toUpperCase()
- // + columnName.substring(1);
-
-
-
- if ((sqlTypeInt == Types.CHAR) || (sqlTypeInt == Types.VARCHAR) )
- {
- int size = colDesc.getSize() + 1;
- writeLine(cType + "\t\t" + columnName + "[" + size + "];");
- }
- else
- //non-character type
- {
- writeLine(cType + "\t\t" + columnName + ";");
- }
- } //end for each column
-
-
- if ((_usingIndicators) && (! isPublicStructure) ) // declare indicator variables
- {
- writeNewLine();
- for (int i = 0; i < columnDescriptorList.size(); i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList.get(i);
-
- if (colDesc.isNullable())
- {
- String columnName = colDesc.getName();
- writeLine("int" +"\t\t" + getIndicatorColumnName(columnName) +";");
- }
-
- } //end for each column
-
- }
- }
- catch (IOException e)
- {
- logError(e);
- }
-
- } // end of createRecordCopyConstructor method
- //-------------------------------------------------------------------------------------------
- private String getIndicatorColumnName(String columnName)
- {
- return "ind_" + columnName;
- }
- //-------------------------------------------------------------------------------------------
- private void createSelectFunction(String functionPrefix,
- String tableName,
- TableDescriptor tableDesc,
- String cursorName)
- {
-
- try
- {
- _indenter.setLevel(0);
- writeLine(tableName + " * " + functionPrefix + tableName + "(const char * where)");
- writeLine("{");
- _indenter.incLevel();
-
- writeNewLine();
- writeLine(tableName + " * listPtr = NULL;");
- writeLine(tableName + " * structPtr = NULL;");
- writeLine("char selectStatement[] = \"SELECT * FROM " + tableName + " \";");
- writeNewLine();
-
- writeLine("int rowCount = 0;");
- writeLine("int first = 1;");
- writeNewLine();
-
-
- writeLine("EXEC SQL BEGIN DECLARE SECTION;");
- writeNewLine();
- writeLine("struct " + tableName + "_t dbs;");
- writeLine("char queryBuffer[QUERY_LEN];");
- writeNewLine();
- writeLine("EXEC SQL END DECLARE SECTION;");
- writeNewLine();
-
- writeLine("setDbStatusSqlCommand(&dbStatus, SELECT);");
- writeNewLine();
-
- writeLine("strcpy(queryBuffer, selectStatement);");
- writeNewLine();
-
- writeLine("if ( ( where != NULL ) && ( * where != '\\0' ) ) ");
-
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("strcat(queryBuffer, where);");
-
- _indenter.decLevel();
- writeLine("}");
- writeNewLine();
-
- writeLine("EXEC SQL PREPARE tid FROM :queryBuffer;");
- createErrorChecking(tableName, functionPrefix, "Prepare section", "return (NULL);");
- writeNewLine();
-
- writeLine("EXEC SQL DECLARE " + cursorName + " CURSOR WITH HOLD FOR tid;");
- createErrorChecking(tableName, functionPrefix, "Declare cursor section", "return (NULL);");
- writeNewLine();
-
- writeLine("EXEC SQL OPEN " + cursorName + ";");
- createErrorChecking(tableName, functionPrefix, "Open cursor section", "return (NULL);");
- writeNewLine();
-
- writeLine("listPtr = NULL;");
- writeLine("memset(&dbs, '\\0', sizeof(dbs));");
- writeNewLine();
-
- if (_usingIndicators)
- {
- createFetch(tableDesc, cursorName);
- }
- else
- {
- writeLine("EXEC SQL FETCH " + cursorName + " INTO :dbs;");
- }
- createErrorChecking(tableName, functionPrefix, "Initial FETCH section", "return (NULL);");
- writeNewLine();
-
- writeLine("while (SQLCODE == 0) ");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("rowCount++;");
-
- writeLine("if ((structPtr = (" + tableName + " *) malloc(sizeof(" + tableName +"))) != NULL)");
- writeLine("{");
- _indenter.incLevel();
-
- writeNewLine();
- createCopyDbStructToCStruct(tableName, tableDesc);
- writeNewLine();
-
- _indenter.decLevel();
- writeLine("}");
-
- writeLine("else");
- writeLine("{");
- _indenter.incLevel();
- writeLine("break;");
- _indenter.decLevel();
- writeLine("}");
-
- writeNewLine();
-
- writeLine("if (first)");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("listPtr = structPtr;");
- writeLine("ListInit(&listPtr->list);");
- writeLine("first = 0;");
-
-
- _indenter.decLevel();
- writeLine("}"); //end of if (first)
- writeNewLine();
-
- writeLine("ListAdd(&listPtr->list, &structPtr->node);");
- writeLine("memset(&dbs, '\\0', sizeof(dbs));");
- writeNewLine();
-
- if (_usingIndicators)
- {
- createFetch(tableDesc, cursorName);
- }
- else
- {
- writeLine("EXEC SQL FETCH " + cursorName + " INTO :dbs;");
- }
- createErrorChecking(tableName, functionPrefix, "Nth fetch section", "return (NULL);");
-
-
- _indenter.decLevel();
- writeLine("}"); //end of while loop
- writeNewLine();
-
-
- writeLine("initDbStatus(&dbStatus);");
- writeLine("setDbStatusRowsAffected(&dbStatus, rowCount);");
- writeNewLine();
-
- writeLine("EXEC SQL CLOSE " + cursorName + ";");
- writeLine("return(listPtr);");
-
- _indenter.decLevel();
- writeLine("}"); //end of SelectXXX or GetXXX
-
- }
- catch (IOException e)
- {
- logError(e);
- }
-
- } // end of createSelectFunction()
-
- // ----------------------------------------------------------------------------------
- private void createSelectCountFunction(String functionPrefix,
- String tableName,
- TableDescriptor tableDesc,
- String cursorName)
- {
-
- try
- {
- String functionName = functionPrefix + "Count";
-
- _indenter.setLevel(0);
- writeLine("int " + functionPrefix + tableName + "Count(const char * where)");
- writeLine("{");
- _indenter.incLevel();
-
- writeNewLine();
- writeLine("char selectStatement[] = \"SELECT COUNT(*) FROM " + tableName + " \";");
- writeNewLine();
-
-
-
- writeLine("EXEC SQL BEGIN DECLARE SECTION;");
- writeNewLine();
- writeLine("int rowCount = 0;");
- writeLine("char queryBuffer[QUERY_LEN];");
- writeNewLine();
- writeLine("EXEC SQL END DECLARE SECTION;");
- writeNewLine();
-
- writeLine("setDbStatusSqlCommand(&dbStatus, SELECT);");
- writeNewLine();
-
- writeLine("strcpy(queryBuffer, selectStatement);");
- writeNewLine();
-
- writeLine("if ( ( where != NULL ) && ( * where != '\\0' ) ) ");
-
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("strcat(queryBuffer, where);");
-
- _indenter.decLevel();
- writeLine("}");
- writeNewLine();
-
- writeLine("EXEC SQL PREPARE tid FROM :queryBuffer;");
- createErrorChecking(tableName, functionName, "Prepare section", "return (-1);");
- writeNewLine();
-
- writeLine("EXEC SQL DECLARE " + cursorName + " CURSOR WITH HOLD FOR tid;");
- createErrorChecking(tableName, functionName, "Declare cursor section", "return (-1);");
- writeNewLine();
-
- writeLine("EXEC SQL OPEN " + cursorName + ";");
- createErrorChecking(tableName, functionName, "Open cursor section", "return (-1);");
- writeNewLine();
-
-
- writeNewLine();
-
- writeLine("EXEC SQL FETCH " + cursorName + " INTO :rowCount;");
-
- createErrorChecking(tableName, functionName, "Initial FETCH section", "return (-1);");
- writeNewLine();
-
- writeLine("initDbStatus(&dbStatus);");
- writeLine("setDbStatusRowsAffected(&dbStatus, rowCount);");
- writeNewLine();
-
- writeLine("EXEC SQL CLOSE " + cursorName + ";");
- writeLine("return(rowCount);");
-
- _indenter.decLevel();
- writeLine("}"); //end of SelectXXXCount or GetXXXCount
-
- }
- catch (IOException e)
- {
- logError(e);
- }
-
- } // end of createSelectCountFunction()
-
- // --------------------------------------------------------------------------------------
- private void createInsertOrUpdateFunction(String tableName,
- TableDescriptor tableDesc)
- {
- int dbColumnsPerLine = 3;
-
- try
- {
- _indenter.setLevel(0);
- writeLine("int InsertOrUpdate" + tableName + "(const " + tableName + " * structPtr)");
- writeLine("{");
- _indenter.incLevel();
-
-
- writeLine("Update"+ tableName + "ByRecord(structPtr, structPtr);");
- writeLine("setDbStatusSqlCommand(&dbStatus, UPDATE);");
-
- writeNewLine();
-
- writeLine("if ( (SQLCODE < 0) || (SQLCODE == 100) )");
-
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("Insert" + tableName + "(structPtr);");
- writeLine("setDbStatusSqlCommand(&dbStatus, INSERT);");
-
-
- _indenter.decLevel();
- writeLine("}");
- writeNewLine();
-
- writeLine("initDbStatus(&dbStatus);");
-
- writeLine("return(SQLCODE);");
-
- _indenter.decLevel();
- writeLine("}");
- }
- catch (IOException e)
- {
- logError(e);
- }
-
- } // end of createInsertOrUpdateFunction method
-
- // ----------------------------------------------------------------------------------
- private void createExistsFunction(String tableName,
- TableDescriptor tableDesc)
- {
- int dbColumnsPerLine = 3;
-
- try
- {
- _indenter.setLevel(0);
- writeLine("bool " + tableName +"Exists(const " + tableName + " * structPtr)");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("int result = false;");
- writeLine("int rowCount = 0;");
-
- writeLine("char whereString[QUERY_LEN];");
- writeNewLine();
-
- writeLine("Get" + tableName + "PrimaryKeyWhereString(structPtr, whereString);");
- writeLine("rowCount = Select" + tableName + "Count(whereString);");
- writeNewLine();
-
- writeLine("if (rowCount > 0)");
- writeLine("{");
- _indenter.incLevel();
- writeLine("result = true;");
- _indenter.decLevel();
- writeLine("}");
-
- writeLine("else");
- writeLine("{");
- _indenter.incLevel();
- writeLine("result = false;");
- _indenter.decLevel();
- writeLine("}");
-
- writeNewLine();
- writeLine("return(result);");
-
- _indenter.decLevel();
- writeLine("}");
- }
- catch (IOException e)
- {
- logError(e);
- }
-
- } // end of createInsertIfUniqueFunction method
-
- // ----------------------------------------------------------------------------------
- private void createInsertIfUniqueFunction(String tableName,
- TableDescriptor tableDesc)
- {
- int dbColumnsPerLine = 3;
-
- try
- {
- _indenter.setLevel(0);
- writeLine("int InsertIfUnique" + tableName + "(const " + tableName + " * structPtr, bool *isUnique)");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("int resultCode = 0;");
-
- writeLine("if (" + tableName + "Exists(structPtr))");
- writeLine("{");
- _indenter.incLevel();
- writeLine("setDbStatusSqlCommand(&dbStatus, SELECT);");
- writeLine("*isUnique = false;");
- writeLine("resultCode = dbStatus.sql_code;");
- _indenter.decLevel();
- writeLine("}");
-
- writeLine("else");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("resultCode = dbStatus.sql_code;");
-
- writeLine("if (resultCode == 0)");
- writeLine("{");
- _indenter.incLevel();
- writeLine("Insert" + tableName + "(structPtr);");
- writeLine("setDbStatusSqlCommand(&dbStatus, INSERT);");
- writeLine("*isUnique = true;");
- writeLine("resultCode = dbStatus.sql_code;");
-
- _indenter.decLevel();
- writeLine("}");
-
- writeLine("else");
- writeLine("{");
- _indenter.incLevel();
- writeLine("*isUnique = false;");
- _indenter.decLevel();
- writeLine("}");
-
-
- _indenter.decLevel();
- writeLine("}");
-
- writeLine("initDbStatus(&dbStatus);");
- writeNewLine();
- writeLine("return(resultCode);");
-
- _indenter.decLevel();
- writeLine("}");
- }
- catch (IOException e)
- {
- logError(e);
- }
-
- } // end of createInsertIfUniqueFunction method
-
- // ----------------------------------------------------------------------------------
- private void createInsertFunction(String functionPrefix,
- String tableName,
- TableDescriptor tableDesc)
- {
- int dbColumnsPerLine = 3;
-
- try
- {
- _indenter.setLevel(0);
- writeLine("int " + functionPrefix + tableName + "(const " + tableName + " * structPtr)");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("EXEC SQL BEGIN DECLARE SECTION;");
- writeNewLine();
- writeLine("struct " + tableName + "_t dbs;");
- writeNewLine();
- writeLine("EXEC SQL END DECLARE SECTION;");
- writeNewLine();
-
- writeLine("setDbStatusSqlCommand(&dbStatus, INSERT);");
- writeNewLine();
-
- writeLine("if (structPtr == NULL)");
-
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("return(ERR_BAD_ARGS);");
-
- _indenter.decLevel();
- writeLine("}");
- writeNewLine();
-
-
- writeLine("memset(&dbs, '\\0', sizeof(dbs));");
- writeNewLine();
-
- createCopyCStructToDbStruct(tableName, tableDesc);
- writeNewLine();
-
-
- if (_usingIndicators)
- {
- createInsertStatement(tableDesc, dbColumnsPerLine);
- }
- else
- {
- writeLine("EXEC SQL INSERT INTO " + tableName + " VALUES " + "(:dbs);");
- }
-
- createFreeTextColumnDbsStructFragment(tableName, tableDesc);
-
- createErrorChecking(tableName, functionPrefix, "Insert section","return (SQLCODE);");
- writeNewLine();
-
- //writeLine("EXEC SQL COMMIT WORK;");
-
- writeLine("initDbStatus(&dbStatus);");
-
- writeLine("return(ERR_OK);");
-
- _indenter.decLevel();
- writeLine("}");
-
- }
- catch (IOException e)
- {
- logError(e);
- }
-
- } // end of createInsertFunction method
-
-
- // ----------------------------------------------------------------------------------
- private void createUpdateFunction(String tableName,
- TableDescriptor tableDesc)
- {
-
- _indenter.setLevel(0);
- final int dbColumnsPerLine = 5;
-
- try
- {
- writeLine("int Update" + tableName + "(const " + tableName + " *structPtr, const char *where)");
-
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("EXEC SQL BEGIN DECLARE SECTION;");
- writeNewLine();
- writeLine("struct " + tableName + "_t dbs;");
- writeLine("char queryBuffer[QUERY_LEN];");
- writeNewLine();
- writeLine("EXEC SQL END DECLARE SECTION;");
- writeNewLine();
-
- writeLine("setDbStatusSqlCommand(&dbStatus, UPDATE);");
- writeNewLine();
-
- createCopyCStructToDbStruct(tableName, tableDesc);
- writeNewLine();
-
- writeLine("sprintf(queryBuffer, \" UPDATE " + tableName + " SET \" );");
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
- int columnCount = columnDescriptorList.size();
-
- //write out the query with ? in it
- write("strcat(queryBuffer, \"", true);
-
- //for each column, put in colName = ?,
- for (int i = 0 ; i < columnCount; i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList.get(i);
- String colName = colDesc.getName();
-
- colName = wrapInQuotesIfNeeded(colName, true);
-
- write(colName + " = ? ");
-
- if (i < columnCount -1)
- {
- write(", ");
-
- // only put a number of columns on a line at a time
- // so go to a newline and indent
- if ((i+1) % dbColumnsPerLine == 0)
- {
- writeLine("\");");
- write("strcat(queryBuffer, \"", true);
- }
- }
- }
- write("\");"); //close the strcat statement
- write("\n");
- writeNewLine();
-
- //append the where clause to the query
- writeLine("if ( (where != NULL) && (*where != '\\0'))");
- writeLine("{");
- _indenter.incLevel();
- writeLine("strcat(queryBuffer, where);");
- _indenter.decLevel();
- writeLine("}");
- writeNewLine();
-
- writeLine("EXEC SQL PREPARE uid FROM :queryBuffer;");
- createErrorChecking(tableName, "Update", "Prepare section", "return(SQLCODE);");
- writeNewLine();
-
- //create the execute statement
-
-// write out the execute statement
- createExecuteUsing(tableDesc, dbColumnsPerLine);
-
- // free any special TEXT column data
- createFreeTextColumnDbsStructFragment(tableName, tableDesc);
-
-
- createErrorChecking(tableName, "Update", "Execute section", "return(SQLCODE);");
- writeNewLine();
-
- // writeLine("/* need to verify that this works in postgresql! */");
- // writeLine("num_rows_updated = sqlca.sqlerrd[2];");
-
- // writeLine("/* why do we have both lines? */");
- // writeLine("sqlca.sqlerrd[2] = num_rows_updated;");
-
-
- // writeLine("EXEC SQL COMMIT;");
- writeLine("initDbStatus(&dbStatus);");
- writeLine("return(ERR_OK);");
-
- _indenter.decLevel();
- writeLine("}");
- }
- catch (IOException e)
- {
- logError(e);
- }
-
- }
-
-
- // ----------------------------------------------------------------------------------
-
- private void createUpdateByRecordFunction(String tableName,
- TableDescriptor tableDesc)
- {
-
- _indenter.setLevel(0);
- final int dbColumnsPerLine = 5;
-
- try
- {
- writeLine("int Update" + tableName + "ByRecord (const " + tableName +
- " * newStructPtr, const " + tableName + " * oldStructPtr)");
-
- _indenter.setLevel(0);
-
-
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("char whereClause[BUFSIZ];");
-
- writeLine("Get" + tableName + "PrimaryKeyWhereString(oldStructPtr, whereClause);");
-
- writeLine("return (Update" + tableName + "(newStructPtr, whereClause));");
-
- _indenter.decLevel();
- writeLine("}");
- }
- catch (IOException e)
- {
- logError(e);
- }
- }
- // ----------------------------------------------------------------------------------
- private void createDeleteFunction(String tableName,
- TableDescriptor tableDesc)
- {
- _indenter.setLevel(0);
-
- try
- {
- writeLine("int Delete" + tableName + "(const char *where)");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("char deleteStatement[] = \"DELETE FROM " + tableName + " \";");
-
- writeLine("EXEC SQL BEGIN DECLARE SECTION;");
- writeNewLine();
- writeLine("char queryBuffer[QUERY_LEN];");
- writeNewLine();
- writeLine("EXEC SQL END DECLARE SECTION;");
- writeNewLine();
-
- writeLine("strcpy(queryBuffer, deleteStatement);");
-
-// append the where clause to the query
- writeLine("if ( (where != NULL) && (*where != '\\0'))");
- writeLine("{");
- _indenter.incLevel();
- writeLine("strcat(queryBuffer, where);");
- _indenter.decLevel();
- writeLine("}");
-
- writeLine("EXEC SQL EXECUTE IMMEDIATE :queryBuffer;");
- createErrorChecking(tableName, "Delete", "Execute Immediate section", "return(SQLCODE);");
- writeNewLine();
-
- writeLine("initDbStatus(&dbStatus);");
- writeLine("return(ERR_OK);");
-
- _indenter.decLevel();
- writeLine("}");
-
- }
- catch (IOException e)
- {
- logError(e);
- }
- }
- // ----------------------------------------------------------------------------------
-
- private void createDeleteByRecordFunction(String tableName,
- TableDescriptor tableDesc)
- {
-
- _indenter.setLevel(0);
-
- try
- {
- writeLine("int Delete" + tableName + "ByRecord(const " + tableName + " * structPtr)");
-
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("char whereClause[BUFSIZ];");
-
- writeLine("Get" + tableName + "PrimaryKeyWhereString(structPtr, whereClause);");
-
- writeLine("return (Delete" + tableName + "(whereClause));");
-
- _indenter.decLevel();
- writeLine("}");
-
-
- }
- catch (IOException e)
- {
- logError(e);
- }
- }
- // ----------------------------------------------------------------------------------
- private void createFreeTextColumnStructFragment(String tablename, TableDescriptor tableDesc)
- {
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
-
- try
- {
-
- // do a special free for any TEXT fields
- for (int i = 0; i < columnDescriptorList.size(); i++)
- {
- ColumnDescriptor columnDesc = (ColumnDescriptor) columnDescriptorList.get(i);
-
- if (columnDesc.getSqlTypeInt() == Types.LONGVARCHAR)
- {
- writeLine("if (structPtr->" + columnDesc.getName() + " != NULL)");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("free(structPtr->" + columnDesc.getName() + ");");
-
- _indenter.decLevel();
- writeLine("}");
- }
- }
-
- }
- catch (IOException e)
- {
- logError(e);
- }
- }
-
- // ----------------------------------------------------------------------------------
-
- private void createFreeTextColumnDbsStructFragment(String tablename, TableDescriptor tableDesc)
- {
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- try
- {
- // do a special free for any TEXT fields
- for (int i = 0; i < columnDescriptorList.size(); i++)
- {
- ColumnDescriptor columnDesc = (ColumnDescriptor) columnDescriptorList.get(i);
-
- if (columnDesc.getSqlTypeInt() == Types.LONGVARCHAR)
- {
- writeLine("if (dbs." + columnDesc.getName() + " != NULL)");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("free(dbs." + columnDesc.getName() + ");");
-
- _indenter.decLevel();
- writeLine("}");
- }
- }
-
- }
- catch (IOException e)
- {
- logError(e);
- }
- }
-
- // ----------------------------------------------------------------------------------
- private void createFreeFunction(String tableName, TableDescriptor tableDesc)
- {
- _indenter.setLevel(0);
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
-
-
- try
- {
-
- writeLine("void Free" + tableName + "( " + tableName
- + " * structPtr)");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine(tableName + "* nextPtr = NULL;");
- writeNewLine();
-
- writeLine("while (structPtr != NULL)");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("nextPtr = ( " + tableName
- + " * ) ListNext ( &structPtr->node );");
-
-
-// do a special free for any TEXT fields
- createFreeTextColumnStructFragment(tableName, tableDesc);
-
- /*
- // do a special free for any TEXT fields
- for (int i = 0; i < columnDescriptorList.size(); i++)
- {
- ColumnDescriptor columnDesc = (ColumnDescriptor) columnDescriptorList.get(i);
-
- if (columnDesc.getSqlTypeInt() == Types.LONGVARCHAR)
- {
- writeLine("if (structPtr->" + columnDesc.getName() + " != NULL)");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("free (structPtr->" + columnDesc.getName() + ");");
-
- _indenter.decLevel();
- writeLine("}");
- }
- }
- */
- writeLine("free (structPtr);");
- writeLine("structPtr = nextPtr;");
-
- _indenter.decLevel();
- writeLine("}"); //close the while loop
-
- writeLine("return;");
-
- _indenter.decLevel();
- writeLine("}"); // close the function
-
- }
- catch (IOException e)
- {
- logError(e);
- }
- }
- // ----------------------------------------------------------------------------------
- private void createGetDbStatusFunction(String tableName)
- {
- _indenter.setLevel(0);
-
- try
- {
- writeLine("DbStatus * Get" + tableName + "DbStatus()");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("return &dbStatus;");
-
- _indenter.decLevel();
- writeLine("}"); // close the function
- }
-
- catch (IOException e)
- {
- logError(e);
- }
-
- }
- // ----------------------------------------------------------------------------------
- private List getKeyColumnDescriptorList(TableDescriptor tableDesc)
- {
- List keyColDescList = new ArrayList();
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
- int columnCount = columnDescriptorList.size();
-
-// for each key column, check if it is a key column, and, if so, then insert it into the list
- for (int i = 0 ; i < columnCount; i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList.get(i);
-
- if (colDesc.isKeyColumn())
- {
- keyColDescList.add(colDesc);
- }
- }
-
- return keyColDescList;
- }
- // ----------------------------------------------------------------------------------
- private int getDateColumnCount(List columnDescriptorList)
- {
-
- int dateColumnCount = 0;
- int columnCount = columnDescriptorList.size();
-
- for (int i = 0 ; i < columnCount; i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList.get(i);
-
- if (colDesc.getSqlTypeInt() == Types.DATE)
- {
- dateColumnCount++;
- }
- }
-
- return dateColumnCount;
- }
-
- // ----------------------------------------------------------------------------------
- private int getTimeColumnCount(List columnDescriptorList)
- {
-
- int timeColumnCount = 0;
- int columnCount = columnDescriptorList.size();
-
- for (int i = 0 ; i < columnCount; i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList.get(i);
-
- if (colDesc.getSqlTypeInt() == Types.TIMESTAMP)
- {
- timeColumnCount++;
- }
- }
-
- return timeColumnCount;
- }
-
- // ----------------------------------------------------------------------------------
-
-
- private void createGetPrimaryWhereString(String tableName, TableDescriptor tableDesc)
- {
- /*
- generate the following type of statement
- sprintf(returnWhereString, "WHERE lid = '%s' AND pe = '%s' AND dur = %d AND ts = '%s' AND extremum = %d AND obstime = '%s' ",
- structPtr->lid, structPtr->pe, structPtr->dur,
- structPtr->ts, structPtr->extremum, structPtr->obsTime);
-
- */
- String header = "CDbGen.createGetPrimaryWhereString(): ";
- final int dbColumnsPerLine = 5;
- _indenter.setLevel(0);
-
- int dateColumnCount = 0;
- int timeColumnCount = 0;
-
- try
- {
-
- writeLine("void Get" + tableName + "PrimaryKeyWhereString " + "(const " + tableName + " * structPtr, char returnWhereString[] )");
- writeLine("{");
- _indenter.incLevel();
-
- List keyColumnDescriptorList = tableDesc.getKeyColumnDescriptorList();
- int columnCount = keyColumnDescriptorList.size();
-
-
- dateColumnCount = getDateColumnCount(keyColumnDescriptorList);
- timeColumnCount = getTimeColumnCount(keyColumnDescriptorList);
-
- for (int i = 0; i < dateColumnCount; i++)
- {
- writeLine("char date_buffer" + i + "[40];");
- }
-
-
- for (int i = 0; i < timeColumnCount; i++)
- {
- writeLine("char time_buffer" + i + "[40];");
- }
-
- write("sprintf(returnWhereString, \"WHERE ", true);
-
-// for each key column, insert the lid = '%s' part of the sprintf statement
- for (int i = 0 ; i < columnCount; i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) keyColumnDescriptorList.get(i);
- int sqlType = colDesc.getSqlTypeInt();
-
-
- switch (sqlType)
- {
- case Types.CHAR:
- case Types.VARCHAR:
- {
- write(colDesc.getName() + " = '%s' " );
- break;
- }
- case Types.SMALLINT:
- {
- write(colDesc.getName() + " = %d ");
- break;
- }
- case Types.INTEGER:
- {
- write(colDesc.getName() + " = %ld ");
- break;
- }
-
- case Types.FLOAT:
- case Types.REAL:
- {
- write(colDesc.getName() + " = %f ");
- break;
- }
-
-
- case Types.DOUBLE:
- {
- write(colDesc.getName() + " = %lf ");
- break;
- }
-
- case Types.DATE:
- {
- //this case will have a corresponding
- //conversion to SQL string from date
-
- if (_usingNewDateCode)
- {
- write(colDesc.getName() + " = '%s' ");
- }
- else
- {
- write(colDesc.getName() + " = '%ld' ");
- }
- break;
- }
-
- case Types.TIMESTAMP:
- {
-
- //this case will have a corresponding
- //conversion to SQL string from timestamp
- write(colDesc.getName() + " = '%s' ");
-
- break;
- }
- default:
- {
- System.out.println(header + "type = " + sqlType);
- break;
- }
-
- }
-
-
- //if not the last column
- if (i < columnCount - 1)
- {
- write(" AND ");
- }
- else //last one before parameter list
- {
- write("\",\n");
- }
-
-
- }
-
-
- //indent 3 times
- write("", true);
- write("", true);
- write("", true);
-
- //for each key column, insert the ,sPtr->lid, sPtr->pe
- int dateBufferCount = 0;
- int timeBufferCount = 0;
-
- for (int i = 0 ; i < columnCount; i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) keyColumnDescriptorList.get(i);
- int sqlType = colDesc.getSqlTypeInt();
-
- switch (sqlType)
- {
- case Types.DATE:
- {
- //this case will have a corresponding
- //conversion to SQL string from timestamp
- if (_usingNewDateCode)
- {
-
- write("date_t_to_ansi_date(structPtr->" + colDesc.getName()+ ", date_buffer"+ dateBufferCount + ")");
- dateBufferCount++;
- }
- else
- {
- write("structPtr->" + colDesc.getName());
- }
- break;
- }
- case Types.TIMESTAMP:
- {
- //this case will have a corresponding
- //conversion to SQL string from timestamp
- if (_usingNewDateAndTimeCode)
- {
- write("timet_to_ansi(structPtr->" + colDesc.getName() + ", time_buffer" + timeBufferCount + ")");
- timeBufferCount++;
- }
- else
- {
- write("dtimet_to_ansi(structPtr->" + colDesc.getName() + ", time_buffer" + timeBufferCount + ")");
- timeBufferCount++;
- }
- break;
- }
- default:
- {
- write("structPtr->" + colDesc.getName());
- break;
- }
-
- }
-
-
- //if not the last column
- if (i < columnCount - 1)
- {
- write(", ");
-
- if ((i+1) % dbColumnsPerLine == 0)
- {
- write("\n");
- write("", true);
- write("", true);
- write("", true);
- }
-
- }
-
- }
-
-
- write(");\n"); //close sprintf statement
-
-
- _indenter.decLevel();
- writeLine("}");
-
-
- }
- catch (IOException e)
- {
- logError(e);
- }
-
- }
- // ----------------------------------------------------------------------------------
-
- private void createCopyDbStructToCStruct(String tableName, TableDescriptor tableDesc)
- {
-
- int columnCount = tableDesc.getColumnDescriptorList().size();
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- try
- {
- for (int i = 0; i < columnCount; i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList.get(i);
-
- String colName = colDesc.getName();
- String indName = getIndicatorColumnName(colName);
-
- int sqlType = colDesc.getSqlTypeInt();
- boolean isNullable = colDesc.isNullable();
-
- String indicatorType = getNullTypeByInt(sqlType);
-
- switch(sqlType)
- {
- case Types.CHAR:
- case Types.VARCHAR:
- {
- writeLine("strcpy(structPtr->" + colName +
- ", dbs." + colName + ");");
- break;
- }
- case Types.LONGVARCHAR:
- {
-
- //make sure I free any automatically allocated space in the dbs structure
- writeLine("if (dbs." + colName + " != NULL)");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("structPtr->" + colName +
- " = malloc(strlen(dbs." + colName + ") + 1);") ;
- writeLine("memset(structPtr->" + colName + ", '\\0', strlen(dbs." + colName + ") +1); ");
- writeLine("strcpy(structPtr->" + colName +
- ", dbs." + colName + ");");
-
- writeLine("free(dbs." + colName +");");
-
- _indenter.decLevel();
- writeLine("}");
-
-
- break;
- }
-
- case Types.DATE:
- {
- if (_usingNewDateCode)
- {
- writeLine("structPtr->" + colName +
- " = pg_date_to_date_t(dbs." + colName + ");");
- }
- else
- {
- writeLine("structPtr->" + colName +
- " = dbs." + colName + ";");
- }
- break;
- }
-
-
- case Types.TIMESTAMP:
- {
- if (_usingNewDateAndTimeCode)
- {
- writeLine("structPtr->" + colName +
- " = timestamp_to_timet(dbs." + colName + ");");
- }
- else
- {
- writeLine("structPtr->" + colName +
- " = dbs." + colName + ";");
- }
- break;
- }
-
- default:
- {
- writeLine("structPtr->" + colName +
- " = dbs." + colName + ";");
- }
-
- } //end switch
-
- if (_usingIndicators)
- {
- String reference = ""; //puts in a "&" if not a string
- if (! indicatorType.equals("CHAR"))
- {
- reference = "&";
- }
-
- if (isNullable)
- {
- writeLine("setNullIfIndicated(dbs." + indName +
- ", " + indicatorType +", " + reference + "structPtr->" + colName +");");
- }
-
- //space out the copying so that pairs of setNullIfIndicated and
- // data copying are placed together for each column
- writeNewLine();
- }
-
- } //end for
-
- } //end try
- catch (IOException e)
- {
- logError(e);
- }
- return;
- }
-
- // ----------------------------------------------------------------------------------
- private void createExecuteUsing(TableDescriptor tableDesc, int dbColumnsPerLine)
- {
- try
- {
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- int size = columnDescriptorList.size();
- write("EXEC SQL EXECUTE uid USING ", true);
-
- //for each column, substitute,
- for (int i = 0 ; i < size; i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList.get(i);
-
- String colName = colDesc.getName();
-
- String indName = getIndicatorColumnName(colName);
-
- if (_usingIndicators)
- {
- if (colDesc.isNullable())
- {
- write(" :dbs." + colName + ":dbs." + indName);
- }
- else
- {
- write(" :dbs." + colName);
-
- }
- }
- else
- {
- write(" :dbs." + colName);
- }
-
- //if not the last column
- if (i < size -1)
- {
- write(",");
-
- //only put a number of columns on a line at a time
- // so go to a newline and indent
- if ( (i+1) % dbColumnsPerLine == 0)
- {
- write("\n"); // newline
- write("", true); //indent again
- }
- }
- }
- write(";\n"); //close the strcat statement
- writeNewLine();
- }
- catch (IOException e)
- {
- logError(e);
- }
- }
-
- // ----------------------------------------------------------------------------------
- private void createInsertStatement(TableDescriptor tableDesc, int dbColumnsPerLine)
- {
- final int numColumnsPerLine = 3;
-
- try
- {
- String tableName = tableDesc.getName();
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- int size = columnDescriptorList.size();
- write("EXEC SQL INSERT INTO " + tableName + " (", true);
-
- _indenter.incLevel();
-
- for (int i = 0 ; i < size; i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList.get(i);
-
- String colName = colDesc.getName();
- String indName = getIndicatorColumnName(colName);
-
- colName = wrapInQuotesIfNeeded(colName, false);
-
- write(colName);
-
- //if not the last column
- if (i < size -1)
- {
-
- write(",");
- if ( ((i-1) % numColumnsPerLine) == 0)
- {
- // put in a new line
- writeNewLine();
-
- // indent
- write("", true);
- }
- }
- else //last column
- {
- //put in the closing parenthesis
- writeLine(")");
- }
- }
-
- writeLine("VALUES (");
-
- //for each column, substitute,
- for (int i = 0 ; i < size; i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList.get(i);
-
- String colName = colDesc.getName();
- String indName = getIndicatorColumnName(colName);
-
- if(i == 0)
- {
- write("", true); //make it indent
- }
-
- if (_usingIndicators)
- {
- if (colDesc.isNullable())
- {
- write(" :dbs." + colName + ":dbs." + indName);
- }
- else
- {
- write(" :dbs." + colName);
-
- }
- }
- else
- {
- write(" :dbs." + colName);
- }
-
- //if not the last column
- if (i < size -1)
- {
- write(",");
-
- //only put a number of columns on a line at a time
- // so go to a newline and indent
- if ( (i+1) % dbColumnsPerLine == 0)
- {
- write("\n"); // newline
- write("", true); //indent again
- }
- }
- }
- write(");\n"); //close VALUES phrase
- writeNewLine();
-
-
- _indenter.decLevel();
- }
- catch (IOException e)
- {
- logError(e);
- }
- }
- // ----------------------------------------------------------------------------------
-
- private void createFetch(TableDescriptor tableDesc, String cursorName)
- {
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- int size = columnDescriptorList.size();
-
- try
- {
-
- writeLine("EXEC SQL FETCH " + cursorName + " INTO ");
-
- for (int i = 0; i < size; i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList.get(i);
- String colName = colDesc.getName();
- String indName = getIndicatorColumnName(colName);
- boolean isNullable = colDesc.isNullable();
-
- if (i == 0)
- {
- write("", true);
- }
-
- if (isNullable)
- {
- write(":dbs." + colName + ":dbs."+indName);
- }
- else
- {
- write(":dbs." + colName);
- }
-
- //if not last column
- if (i < size - 1)
- {
- // add comma
- write(", ", false);
-
- // every 2 columns, start using a new line
- // and then indent in anticipation of next line
- if ( ( (i-1) % 2) == 0)
- {
- writeNewLine();
- write("", true);
- }
- }
- else //last column
- {
- writeLine(";");
- writeNewLine();
- }
-
- } //end for
-
- }
- catch (IOException e)
- {
- logError(e);
- }
-
- }
- // ----------------------------------------------------------------------------------
- private void createCopyCStructToDbStruct(String tableName, TableDescriptor tableDesc)
- {
-
- int columnCount = tableDesc.getColumnDescriptorList().size();
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- try
- {
-
- for (int i = 0; i < columnCount; i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList.get(i);
- int sqlType = colDesc.getSqlTypeInt();
- String colName = colDesc.getName();
- String indName = getIndicatorColumnName(colName);
- boolean isNullable = colDesc.isNullable();
-
- String indicatorType = getNullTypeByInt(sqlType);
-
- switch(sqlType)
- {
- case Types.CHAR:
- case Types.VARCHAR:
- {
- writeLine("strcpy(dbs." + colName +
- ", structPtr->" + colName + ");");
-
-
-
- break;
- }
-
- //text field
- case Types.LONGVARCHAR:
- {
-
- writeLine("dbs." + colName +
- " = malloc(strlen(structPtr->" + colName + ") + 1);") ;
- writeLine("memset(dbs." + colName + ", '\\0', strlen(structPtr->" + colName + ") +1); ");
- writeLine("strcpy(dbs." + colName +
- ", structPtr->" + colName + ");");
-
-
- break;
- }
-
- case Types.DATE:
- {
- if (_usingNewDateCode)
- {
- writeLine("dbs." + colName +
- " = date_t_to_pg_date(structPtr->" + colName + ");");
- }
- else
- {
- writeLine("dbs." + colName +
- " = structPtr->" + colName + ";");
- }
-
- break;
- }
-
-
- case Types.TIMESTAMP:
- {
- if (_usingNewDateAndTimeCode)
- {
- writeLine("dbs." + colName +
- " = timet_to_timestamp(structPtr->" + colName + ");");
- }
- else
- {
- writeLine("dbs." + colName +
- " = structPtr->" + colName + ";");
- }
-
-
- break;
- }
-
-
-
- default:
- {
- writeLine("dbs." + colName +
- " = structPtr->" + colName + ";");
- break;
- }
-
- } //end switch
-
- //add the indicator checking
- if (_usingIndicators)
- {
-
- String reference = ""; //puts in a "&" if not a string
-
- if (! indicatorType.equals("CHAR"))
- {
- reference = "&";
- }
-
- if (isNullable)
- {
- writeLine("dbs." + indName +
- " = getIndicator(" +
- indicatorType +
- ", (void *)" + reference + "structPtr->" + colName + ");");
- }
-
- //space out the copying so that pairs of setNullIfIndicated and
- // data copying are placed together for each column
- writeNewLine();
- }
-
- } //end for
-
-
-
- } //end try
-
- catch (IOException e)
- {
- logError(e);
- }
-
-
-
- return;
- }
- // ----------------------------------------------------------------------------------
- private void createErrorChecking(String tableName, String functionName, String functionSection, String returnValueString)
- {
- try
- {
- writeLine("if (SQLCODE < 0)");
- writeLine("{");
- _indenter.incLevel();
-
-
- writeLine("if (errorLoggingOn)");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("fprintf(stderr, \"" + functionName + tableName + "() in " + functionSection + " --- ERROR\\n\");");
- writeLine("fprintf(stderr, \"SQLCODE = (%ld) sql state = (%s)\\n\", SQLCODE, sqlca.sqlstate);");
- writeLine("fprintf(stderr, \"Error Message (%s)\\n\", sqlca.sqlerrm.sqlerrmc);");
- writeLine("fflush(stderr);");
-
- _indenter.decLevel();
- writeLine("}");
-
- writeLine("initDbStatus(&dbStatus);");
-
- if (returnValueString != null)
- {
- writeLine(returnValueString);
- }
-
- _indenter.decLevel();
- writeLine("}");
-
-
- }
- catch(IOException e)
- {
- logError(e);
- }
- }
- // ----------------------------------------------------------------------------------
-
-
- public void generate(String connectionURL, String preferredTableNameFilePath,
- String dbName, String targetDir, String driverName)
- {
-
-
- // define an instance of a the IHFS database class
- Database currentDatabase = new Database();
-
- if (driverName != null)
- {
- currentDatabase.setDriverClassName(driverName);
- }
-
- // call the method to connect to the database
- currentDatabase.connect(connectionURL);
-
-
- //store the path of the target directory for the generated files
- _targetDirName = targetDir;
-
- //reads a list of Preferred table names from the directory indicated by
- //schemaDirName
- Map preferredTableNameMap =
- getMapOfPreferredTableNames(preferredTableNameFilePath);
-
- // returns a list of the TableDescriptors which contain metadata about
- // the tables and columns.
- SchemaDescriber finder = new SchemaDescriber(currentDatabase);
-
-
- _tableDescriptorList = finder.getTableDescriptorList(preferredTableNameMap);
-
-
- _indenter = new CodeIndenter(_indentString);
-
- //generate all the XXXRecord.java files
- buildHeaderSrcFiles(dbName);
-
- //generate all the XXXTable.jar files
- buildEsqlCSourceFiles(dbName);
-
- // disconnect from the database
- currentDatabase.disconnect();
-
- } //end generate
-
- //---------------------------------------------------------------
- //
- //---------------------------------------------------------------
- public static void main(String args[])
- {
-
- // CodeTimer timer = new CodeTimer();
- // timer.start();
-
- String connectionURL = null;
- String preferredTableNameFilePath = null;
- // the database name is passed in as the third command line argument
- String dbName = null;
- String packageName = null;
- String targetDir = null;
- String driverName = null;
-
-
- if (args.length < 5)
- {
- System.err.println("Usage: java CDbGen connectionURL preferredTableNameFilePath dbName targetDir driverClassName");
- }
- else
- // the argument count looks good
- {
- connectionURL = args[0];
- preferredTableNameFilePath = args[1];
-
- // the database name is passed in as the third command line argument
- dbName = args[2];
-
- targetDir = args[3];
-
- driverName = args[4];
-
- // create a JDbGen object named dbgen
- CDbGen dbgen = new CDbGen();
-
- dbgen.generate(connectionURL, preferredTableNameFilePath, dbName, targetDir, driverName);
-
- System.out.println("CDBGEN completed!");
- //timer.stop("CDbGen took");
- }
-
- return;
-
- } // end of main
-
-} // end of JDbGen class
diff --git a/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/CodeIndenter.java b/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/CodeIndenter.java
deleted file mode 100755
index 47e01d97f4..0000000000
--- a/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/CodeIndenter.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Created on Oct 6, 2004
- *
- *
- */
-package ohd.hseb.dbgen;
-
-/**
- * @author Chip Gobs
- *
- * This class encapsulates the indentation of code but providing access
- * indentation levels and an indentation string based on those levels.
- */
-public class CodeIndenter
-{
-
- private int _indentLevel = 0;
- private String _indentString = null;
- private String _totalIndentString = null;
-
- // ---------------------------------------------------------------
-
- public CodeIndenter(String indentString)
- {
- _indentString = indentString;
- _indentLevel = 0;
- }
-
- // ---------------------------------------------------------------
-
- public void incLevel()
- {
- incLevel(1);
- }
-
-
- // ---------------------------------------------------------------
-
- public void incLevel(int amount)
- {
- _indentLevel += amount;
- _totalIndentString = null;
- }
-
- // ----------------------------------------------------------------
-
- public void decLevel(int amount)
- {
- _indentLevel -= amount;
-
- if (_indentLevel < 0)
- {
- _indentLevel = 0;
- }
-
- _totalIndentString = null;
- }
-
- // ----------------------------------------------------------------
-
- public void decLevel()
- {
- decLevel(1);
- }
-
- // ---------------------------------------------------------------
-
- public void setLevel(int level)
- {
- _indentLevel = level;
- _totalIndentString = null;
- }
-
- // ---------------------------------------------------------------
-
- public String getTotalIndentString()
- {
-
- if (_totalIndentString == null)
- {
- StringBuffer indentBuffer = new StringBuffer();
- for (int i = 0; i < _indentLevel; i++)
- {
- indentBuffer.append(_indentString);
- }
- _totalIndentString = indentBuffer.toString();
- }
- return _totalIndentString;
-
- }
-
- // ---------------------------------------------------------------
-
-
-}
diff --git a/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/ColumnDescriptor.java b/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/ColumnDescriptor.java
deleted file mode 100755
index d7b3dbef22..0000000000
--- a/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/ColumnDescriptor.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Created on Aug 13, 2003
- *
- *
- */
-package ohd.hseb.dbgen;
-
-/**
- * @author Chip Gobs
- *
- * This class encapsulates information about table columns, for the purpose of
- * code generation.
- */
-public class ColumnDescriptor
-{
- private String _name = null;
-
- private int _sqlTypeInt = -1;
- private String _sqlTypeString = null;
- private int _size = 0; //useful for char types
-
- private boolean _keyColumn = false;
- private boolean _nullable = true;
-
- public void setName(String name)
- {
- _name = name;
- }
-
- public String getName()
- {
- return _name;
- }
-
-
- public void setSqlTypeString(String sqlTypeString)
- {
- _sqlTypeString = sqlTypeString;
- }
- /*
-
- public String getSqlTypeString()
- {
- return _sqlTypeString;
- }
- */
-/*
- public void setResultSetType(String resultSetType)
- {
- _resultSetType = resultSetType;
- }
-
- public String getResultSetType()
- {
- return _resultSetType;
- }
-
- public void setJavaType(String javaType)
- {
- _javaType = javaType;
- }
-
- public String getJavaType()
- {
- return _javaType;
- }
-*/
- public void setKeyColumn(boolean keyColumn)
- {
- _keyColumn = keyColumn;
- }
-
- public boolean isKeyColumn()
- {
- return _keyColumn;
- }
-
- /**
- * @param sqlTypeInt The sqlTypeInt to set.
- */
- public void setSqlTypeInt(int sqlTypeInt)
- {
- _sqlTypeInt = sqlTypeInt;
- }
-
- /**
- * @return Returns the sqlTypeInt.
- */
- public int getSqlTypeInt()
- {
- return _sqlTypeInt;
- }
-
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("Name = " + _name + "\n");
- buffer.append("SQL Type (Int) = " + _sqlTypeInt + "\n");
- buffer.append("SQL Type (String) = " + _sqlTypeString + "\n");
- buffer.append("size = " + _size + "\n");
- buffer.append("Is Key Column? = " + _keyColumn + "\n");
-
-
- return buffer.toString();
- }
-
- /**
- * @param size The size to set.
- */
- public void setSize(int size)
- {
- _size = size;
- }
-
- /**
- * @return Returns the size.
- */
- public int getSize()
- {
- return _size;
- }
-
- /**
- * @param nullable The nullable to set.
- */
- public void setNullable(boolean nullable)
- {
- _nullable = nullable;
- }
-
- /**
- * @return Returns the nullable.
- */
- public boolean isNullable()
- {
- return _nullable;
- }
-
-
-
-
-} //end class ColumnDescriptor
diff --git a/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/JDbGen.java b/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/JDbGen.java
deleted file mode 100755
index c0c6d9729f..0000000000
--- a/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/JDbGen.java
+++ /dev/null
@@ -1,1546 +0,0 @@
-//
-// File: JDbGen.java
-// Orig Author: Russell Erb 12/18/2000
-// Modified by: Russell Erb 03/30/2001
-// Russell Erb 02/27/2002 - check that lastPeriod is > 0
-// Chip Gobs 08/2003 - a number of changes including:
-// using List instead of Vector
-// and subclassing from DbTable and DbRecord,
-// no-conversion-needed handling of the Timestamp data
-// The ability to be expanded for use with other
-// database types.
-// Chip Gobs 9/2004 - Modified to allow it to work with PostgreSQL or Informix.
-
-package ohd.hseb.dbgen;
-
-//import ohd.hseb.util.*;
-
-import java.io.BufferedReader;
-import java.io.DataOutputStream;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.sql.Types;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import ohd.hseb.db.Database;
-
-public class JDbGen {
- // ---------------------------------------------------------------
- // private data
- // ---------------------------------------------------------------
-
- private String _generatedPackageName = null;
-
- private String _targetDirName = null;
-
- private DataOutputStream _dos = null;
-
- private List _tableDescriptorList = null;
-
- private CodeIndenter _indenter = null;
-
- private final String _indentString = " ";
-
- // for Informix mode
- // private Map _javaDataTypeStringMap = null; //maps from sqlType String to
- // javaDataType
- // private Map _rsInterfaceTypeStringMap = null;//maps from sqlTypeString to
- // result set dataType
-
- // for PostgreSQL and other generation modes
- private Map _javaDataTypeIntegerMap = null; // maps from sqlType integer to
-
- // javaDataType String
- private Map _rsInterfaceTypeIntegerMap = null; // maps from sqlType
-
- // integer to result set
- // dataType
-
- // ---------------------------------------------------------------------------------
-
- public JDbGen() {
- initJavaDataTypeIntegerMap();
- initResultSetDataTypeIntegerMap();
- ;
- }
-
- // ---------------------------------------------------------------------------------
-
- private void addJavaDataTypeIntegerMapEntry(int sqlType, String javaType) {
- _javaDataTypeIntegerMap.put(new Integer(sqlType), javaType);
- }
-
- // -------------------------------------------------------------------------------------
- private void initJavaDataTypeIntegerMap() {
-
- _javaDataTypeIntegerMap = new HashMap();
-
- addJavaDataTypeIntegerMapEntry(Types.DATE, "long");
- addJavaDataTypeIntegerMapEntry(Types.TIMESTAMP, "long");
- addJavaDataTypeIntegerMapEntry(Types.TIME, "long");// new one
-
- addJavaDataTypeIntegerMapEntry(Types.REAL, "float");
- addJavaDataTypeIntegerMapEntry(Types.FLOAT, "float"); // changed from
- // double in
- // OB7.2
- addJavaDataTypeIntegerMapEntry(Types.DOUBLE, "double");
-
- addJavaDataTypeIntegerMapEntry(Types.NUMERIC, "double");// new one
-
- addJavaDataTypeIntegerMapEntry(Types.SMALLINT, "short");
- addJavaDataTypeIntegerMapEntry(Types.INTEGER, "int");
- addJavaDataTypeIntegerMapEntry(Types.BIGINT, "long");
-
- addJavaDataTypeIntegerMapEntry(Types.LONGVARBINARY, "byte[]");
- addJavaDataTypeIntegerMapEntry(Types.LONGVARCHAR, "String"); // ?
- // instead
- // of
- // byte[]
- addJavaDataTypeIntegerMapEntry(Types.VARCHAR, "String");
- addJavaDataTypeIntegerMapEntry(Types.CHAR, "String");
-
- addJavaDataTypeIntegerMapEntry(Types.ARRAY, "String");// new one
-
- }
-
- // -------------------------------------------------------------------------------------
- private void addResultSetTypeIntegerMapEntry(int sqlType,
- String resultSetType) {
- _rsInterfaceTypeIntegerMap.put(new Integer(sqlType), resultSetType);
- }
-
- // --------------------------STAMP-----------------------------------------------------------
- private void initResultSetDataTypeIntegerMap() {
- _rsInterfaceTypeIntegerMap = new HashMap();
-
- addResultSetTypeIntegerMapEntry(Types.DATE, "Date");
- addResultSetTypeIntegerMapEntry(Types.TIMESTAMP, "TimeStamp");
- addResultSetTypeIntegerMapEntry(Types.TIME, "Time"); // new one
-
- addResultSetTypeIntegerMapEntry(Types.REAL, "Real");
- addResultSetTypeIntegerMapEntry(Types.FLOAT, "Float");
- addResultSetTypeIntegerMapEntry(Types.DOUBLE, "Double");
- addResultSetTypeIntegerMapEntry(Types.NUMERIC, "Double"); // new one
-
- addResultSetTypeIntegerMapEntry(Types.SMALLINT, "Short");
- addResultSetTypeIntegerMapEntry(Types.INTEGER, "Int");
- addResultSetTypeIntegerMapEntry(Types.BIGINT, "Long");
-
- addResultSetTypeIntegerMapEntry(Types.LONGVARBINARY, "Bytes");
- addResultSetTypeIntegerMapEntry(Types.LONGVARCHAR, "String");
- addResultSetTypeIntegerMapEntry(Types.VARCHAR, "String");
- addResultSetTypeIntegerMapEntry(Types.CHAR, "String");
-
- addResultSetTypeIntegerMapEntry(Types.ARRAY, "String"); // new one
- }
-
- // -------------------------------------------------------------------------------------
-
- // ---------------------------------------------------------------
- // write and writeLine are used to write out nicely indented code
- // ---------------------------------------------------------------
- private void write(String line, boolean useIndentation) throws IOException {
- if (useIndentation) {
- String totalIndentString = _indenter.getTotalIndentString();
-
- _dos.writeBytes(totalIndentString + line);
- } else {
- _dos.writeBytes(line);
- }
- }
-
- // -----------------------------------------------------------------
- private void write(String line) throws IOException {
- write(line, false); // by default, do not use indentation
-
- return;
- }
-
- // -----------------------------------------------------------------
-
- private void writeLine(String line) throws IOException {
- boolean useIndentation = true;
- write(line + "\n", useIndentation);
-
- return;
- }
-
- // --------------------------------------------------------------------------
- // read the list of preferred table names from a text file with the
- // preferred name of the Tables and Views , 1 per line, no spaces in the
- // name
- // --------------------------------------------------------------------------
- private Map getMapOfPreferredTableNames(String filePath) {
- Map tableNameMap = new HashMap();
-
- try {
-
- BufferedReader reader = new BufferedReader(new FileReader(filePath));
- String line = null;
-
- line = reader.readLine();
-
- String preferredTableName = null;
- String lowercaseTableName = null;
-
- while (line != null) {
- preferredTableName = null;
- lowercaseTableName = null;
-
- // System.out.println("line = " + line + ":");
- int separatorIndex = line.indexOf('=');
-
- if (separatorIndex > -1) {
- lowercaseTableName = line.substring(0, separatorIndex)
- .trim().toLowerCase();
- preferredTableName = line.substring(separatorIndex + 1)
- .trim();
- } else // only one line item
- {
- preferredTableName = line.trim();
- lowercaseTableName = preferredTableName.toLowerCase();
- }
-
- tableNameMap.put(lowercaseTableName, preferredTableName);
-
- System.out.println("JDbGen.getMapOfPreferredTableNames(): "
- + lowercaseTableName + " -> " + preferredTableName);
-
- line = reader.readLine();
- } // end while
-
- reader.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- return tableNameMap;
- }
-
- // ---------------------------------------------------------------------------------
- private Map getMapOfPreferredTableNames_old(String filePath) {
- Map tableNameMap = new HashMap();
-
- try {
-
- BufferedReader reader = new BufferedReader(new FileReader(filePath));
- String line = null;
-
- line = reader.readLine();
-
- while (line != null) {
- // System.out.println("line = " + line + ":");
-
- String preferredTableName = line.trim();
- String lowercaseTableName = preferredTableName.toLowerCase();
-
- tableNameMap.put(lowercaseTableName, preferredTableName);
-
- System.out.println("JDbGen.getMapOfPreferredTableNames(): "
- + lowercaseTableName + " -> " + preferredTableName);
-
- line = reader.readLine();
- } // end while
-
- reader.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- return tableNameMap;
- }
-
- // ---------------------------------------------------------------------------------
-
- private String getJavaDataTypeByInt(int sqlType) {
- String javaDataType = null;
-
- javaDataType = (String) _javaDataTypeIntegerMap
- .get(new Integer(sqlType));
- if (javaDataType == null) {
- javaDataType = "UNKNOWN_SQL_TYPE_" + sqlType;
- }
-
- return javaDataType;
- }
-
- // ---------------------------------------------------------------------------------
-
- private String getRSInterfaceTypeByInt(int sqlType) {
- String resultSetDataType = null;
-
- resultSetDataType = (String) _rsInterfaceTypeIntegerMap
- .get(new Integer(sqlType));
- if (resultSetDataType == null) {
- resultSetDataType = "UNKNOWN_SQL_TYPE_" + sqlType;
- }
-
- return resultSetDataType;
-
- }
-
- // ---------------------------------------------------------------------------------
- // buildRecordSrcFiles
-
- private void buildRecordSrcFiles(String dbName) {
- try {
- // Strings to hold Table name and File name
- String tableName = null;
- String fileName = null;
-
- // loop through all the table names and build source files
- for (int ctr = 0; ctr < _tableDescriptorList.size(); ctr++) {
- TableDescriptor tableDesc = (TableDescriptor) _tableDescriptorList
- .get(ctr);
- tableName = tableDesc.getName();
-
- fileName = tableName + "Record.java";
-
- FileOutputStream fos = new FileOutputStream(_targetDirName
- + "/" + fileName);
- _dos = new DataOutputStream(fos);
-
- createRecordFileBanner(tableName, fileName, dbName, tableDesc);
- createRecordPrivateData(tableDesc);
- createRecordEmptyConstructor(tableName);
- createRecordCopyConstructor(tableName, tableDesc);
- createRecordSetGet(tableName, tableDesc);
-
- if ((!tableDesc.isView()) && (tableDesc.hasPrimaryKey())) {
- createRecordGetWhereString(tableDesc);
- }
- createRecordToString(tableDesc);
-
- _indenter.setLevel(0);
- writeLine("} // end of " + tableName + "Record class\n");
-
- _dos.close();
- // fos.close();
- }
- } catch (IOException ioe) {
- System.err
- .println("buildRecordSrcFiles(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of buildRecordSrcFiles method
-
- // -----------------------------------------------------------------
- // createRecordFileBanner
- // -----------------------------------------------------------------
- private void createRecordFileBanner(String tableName, String fileName,
- String dbName, TableDescriptor tableDesc) {
- try {
- _indenter.setLevel(0);
- // current time
- Date currentTime = new Date();
-
- System.out.println("building source code for " + fileName);
-
- if (tableDesc.isView()) {
- writeLine("// This is a view record !");
- }
-
- writeLine("// filename: " + fileName);
- writeLine("// author : DBGEN");
- writeLine("// created : " + currentTime + " using database "
- + dbName);
- writeLine("// description: This class is used to get data from and put data into a");
- writeLine("// " + tableName + " table record format");
- writeLine("//\n");
-
- if (_generatedPackageName.length() > 0) {
- writeLine("package " + _generatedPackageName + ";\n");
- }
-
- writeLine("import ohd.hseb.db.*;\n");
- writeLine("public class " + tableName + "Record extends DbRecord");
- writeLine("{");
- } catch (IOException ioe) {
- System.out
- .println("createRecordFileBanner(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createRecordFileBanner method
-
- // -----------------------------------------------------------------
- // createRecordPrivateData
- // -----------------------------------------------------------------
- private void createRecordPrivateData(TableDescriptor tableDesc) {
- try {
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- _indenter.setLevel(1);
-
- for (int i = 0; i < columnDescriptorList.size(); i++) {
- ColumnDescriptor columnDesc = (ColumnDescriptor) columnDescriptorList
- .get(i);
- String javaDataType = getJavaDataTypeByInt(columnDesc
- .getSqlTypeInt());
- String columnName = columnDesc.getName();
-
- writeLine("private " + javaDataType + " " + columnName + ";\n");
- }
-
- } catch (IOException ioe) {
- System.err
- .println("createRecordPrivateData(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createRecordPrivateData method
-
- // ---------------------------------------------------------
- // createRecordEmptyConstructor
- // --------------------------------------------------------
- private void createRecordEmptyConstructor(String tableName) {
-
- try {
- writeLine("//---------------------------------------------------------------");
- writeLine("// Empty constructor");
- writeLine("//---------------------------------------------------------------");
-
- _indenter.setLevel(1);
- writeLine("public " + tableName + "Record()");
- writeLine("{");
- writeLine("}\n");
-
- } catch (IOException ioe) {
- System.err
- .println("createRecordEmptyConstructor(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createRecordEmptyConstructor method
-
- // ---------------------------------------------------------
- // createRecordCopyConstructor
- // --------------------------------------------------------
- private void createRecordCopyConstructor(String tableName,
- TableDescriptor tableDesc) {
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- try {
- writeLine("//-----------------------------------------------------------------");
- writeLine("// Copy constructor");
- writeLine("//-----------------------------------------------------------------");
-
- _indenter.setLevel(1);
- writeLine("public " + tableName + "Record(" + tableName
- + "Record origRecord)");
- writeLine("{");
- _indenter.incLevel();
-
- for (int i = 0; i < columnDescriptorList.size(); i++) {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList
- .get(i);
-
- String columnName = colDesc.getName();
-
- String firstChar = String.valueOf(columnName.charAt(0));
- String newName = firstChar.toUpperCase()
- + columnName.substring(1);
-
- writeLine("set" + newName + "(origRecord.get" + newName
- + "());");
-
- } // end for each column
-
- _indenter.decLevel();
- writeLine("}\n");
-
- } catch (IOException ioe) {
- System.err
- .println("createRecordCopyConstructor(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createRecordCopyConstructor method
-
- // ---------------------------------------------------------------
- // createRecordSetGet
- // ---------------------------------------------------------------
- private void createRecordSetGet(String tableName, TableDescriptor tableDesc) {
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- try {
- writeLine("//-----------------------------------------------------------------");
- writeLine("// get and set methods for all data items in a "
- + tableName + " record\n");
- writeLine("//-----------------------------------------------------------------");
-
- for (int i = 0; i < columnDescriptorList.size(); i++) {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList
- .get(i);
- String javaDataType = getJavaDataTypeByInt(colDesc
- .getSqlTypeInt());
- String columnName = colDesc.getName();
-
- String firstChar = String.valueOf(columnName.charAt(0));
- String newName = firstChar.toUpperCase()
- + columnName.substring(1);
-
- // create the getter
- writeLine("public " + javaDataType + " get" + newName + "()");
-
- writeLine("{");
-
- _indenter.incLevel();
- writeLine("return " + columnName + ";");
-
- _indenter.decLevel();
- writeLine("}\n");
-
- // create the setter
- writeLine("public void set" + newName + "(" + javaDataType
- + " " + columnName + ")");
- writeLine("{");
-
- _indenter.incLevel();
- writeLine("this." + columnName + " = " + columnName + " ;");
-
- _indenter.decLevel();
- writeLine("}\n");
-
- }
-
- } catch (IOException ioe) {
- System.err
- .println("createRecordSetGet(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createRecordSetGet method
-
- // ---------------------------------------------------------------
- // createRecordGetWhereString
- // ---------------------------------------------------------------
- private void createRecordGetWhereString(TableDescriptor tableDesc) {
- try {
- _indenter.setLevel(0);
- writeLine("//-----------------------------------------------------------------");
- writeLine("// getWhereString() - this method is called with no arguments");
- writeLine("// and returns a String that contains a valid where clause containing all the");
- writeLine("// primary key fields.");
- writeLine("//-----------------------------------------------------------------");
-
- _indenter.incLevel();
- writeLine("public String getWhereString()");
- writeLine("{");
-
- _indenter.incLevel();
- writeLine("String outString = ");
-
- _indenter.incLevel();
- _indenter.incLevel();
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- write("\"WHERE ", true);
-
- int keyColumnCount = 0;
-
- for (int i = 0; i < columnDescriptorList.size(); i++) {
- ColumnDescriptor columnDesc = (ColumnDescriptor) columnDescriptorList
- .get(i);
-
- // String sqlDataType = columnDesc.getSqlTypeString();
- int sqlDataTypeInt = columnDesc.getSqlTypeInt();
-
- // String javaDataType = columnDesc.getJavaType();
- String columnName = columnDesc.getName();
-
- boolean isKeyColumn = columnDesc.isKeyColumn();
-
- // append the pieces to the WHERE clause
- if (isKeyColumn) {
- keyColumnCount++;
- if (keyColumnCount != 1) // not first one
- {
- write(" + \" AND ", true);
- }
-
- /*
- * if (sqlDataType.equalsIgnoreCase("DateTime")) {
- * write(columnName + " = '\" +
- * getDateTimeStringFromLongTime(" + columnName + ")" + " +
- * \"'\" \n"); } else if
- * (sqlDataType.equalsIgnoreCase("Date")) { write(columnName + " =
- * '\" + getDateStringFromLongTime(" + columnName + ")" + " +
- * \"'\" \n"); }
- */
- if (sqlDataTypeInt == Types.TIMESTAMP) {
- write(columnName
- + " = '\" + getDateTimeStringFromLongTime("
- + columnName + ")" + " + \"'\" \n");
- } else if (sqlDataTypeInt == Types.DATE) {
- write(columnName
- + " = '\" + getDateStringFromLongTime("
- + columnName + ")" + " + \"'\" \n");
- }
-
- else // the usual
- {
- write(columnName + " = '\" + " + columnName
- + " + \"'\" \n");
- }
-
- } // end isKeyColumn
-
- }// end for loop
-
- writeLine(";");
-
- // writeLine("\"\" ;");
-
- // get rid of extra indents
- _indenter.decLevel();
- _indenter.decLevel();
-
- writeLine("return outString;");
-
- _indenter.decLevel();
- writeLine("} // end toString()");
-
- } catch (IOException ioe) {
- System.err
- .println("createRecordGetWhereString(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of CreateRecordGetWhereString method
-
- // ---------------------------------------------------------------
- // createRecordToString
- // ---------------------------------------------------------------
- private void createRecordToString(TableDescriptor tableDesc) {
- try {
- _indenter.setLevel(0);
- writeLine("//-----------------------------------------------------------------");
- writeLine("// toString() - this method is called with no arguments");
- writeLine("// and returns a String of the internal values");
- writeLine("//-----------------------------------------------------------------");
-
- _indenter.incLevel();
- writeLine("public String toString()");
- writeLine("{");
-
- _indenter.incLevel();
- writeLine("String outString = ");
-
- _indenter.incLevel();
- _indenter.incLevel();
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- for (int i = 0; i < columnDescriptorList.size(); i++) {
- ColumnDescriptor columnDesc = (ColumnDescriptor) columnDescriptorList
- .get(i);
- // String sqlDataType = columnDesc.getSqlTypeString();
- int sqlDataTypeInt = columnDesc.getSqlTypeInt();
- // String javaDataType = columnDesc.getJavaType();
- String columnName = columnDesc.getName();
-
- String firstChar = String.valueOf(columnName.charAt(0));
- String newName = firstChar.toUpperCase()
- + columnName.substring(1);
-
- /*
- * if (sqlDataType.equalsIgnoreCase("DateTime")) {
- * writeLine("getDateTimeStringFromLongTime(get" + newName +
- * "()) + \" \" +"); } else if
- * (sqlDataType.equalsIgnoreCase("Date")) {
- * writeLine("getDateStringFromLongTime(get" + newName + "()) + \" \"
- * +"); }
- */
-
- if (sqlDataTypeInt == Types.TIMESTAMP) {
- writeLine("getDateTimeStringFromLongTime(get" + newName
- + "()) + \" \" +");
- } else if (sqlDataTypeInt == Types.DATE) {
- writeLine("getDateStringFromLongTime(get" + newName
- + "()) + \" \" +");
- } else {
- writeLine("get" + newName + "() + \" \" +");
- }
- }
-
- writeLine("\"\" ;");
-
- // get rid of extra indents
- _indenter.decLevel();
- _indenter.decLevel();
-
- writeLine("return outString;");
-
- _indenter.decLevel();
- writeLine("} // end toString()");
-
- } catch (IOException ioe) {
- System.err
- .println("createRecordToString(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of CreateRecordToString method
-
- // ---------------------------------------------------------------
- // buildTableSrcFiles
- // ---------------------------------------------------------------
- private void buildTableSrcFiles(String dbName) {
-
- try {
- // Strings to hold Table name and File name
- String tableName = null;
- String originalTableName = null;
- String fileName = null;
-
- // loop through all the table names and build source files
- for (int ctr = 0; ctr < _tableDescriptorList.size(); ctr++) {
- TableDescriptor tableDesc = (TableDescriptor) _tableDescriptorList
- .get(ctr);
- tableName = tableDesc.getName();
- originalTableName = tableDesc.getOriginalCaseTableName();
-
- if (tableDesc.isView()) {
- fileName = tableName + "View.java";
- } else {
- fileName = tableName + "Table.java";
- }
-
- FileOutputStream fos = new FileOutputStream(_targetDirName
- + "/" + fileName);
- _dos = new DataOutputStream(fos);
-
- createTableFileBanner(tableName, fileName, dbName, tableDesc);
- createTableData();
-
- createTableConstructor(tableName, tableDesc);
- createTableSelect(tableName, originalTableName, tableDesc);
- createTableSelectNRecords(tableName, originalTableName,
- tableDesc);
-
- if (!tableDesc.isView()) // is a regular table
- {
- createTableInsert(tableName, tableDesc);
-
- // all regular tables have this
- createTableDelete1(tableName, originalTableName);
- createTableUpdate1(tableName, originalTableName, tableDesc);
-
- // only regular tables with primary keys also have this
- if (tableDesc.hasPrimaryKey()) {
- createTableDelete2(tableName, originalTableName);
- createTableUpdate2(tableName, originalTableName,
- tableDesc);
- createTableInsertOrUpdate(tableName);
- }
-
- }
-
- _indenter.setLevel(0);
- writeLine("} // end of " + tableName + "Table class");
-
- _dos.close();
- // fos.close();
- }
- } catch (IOException ioe) {
- System.out
- .println("buildTableSrcFiles(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of buildTableSrcFiles method
-
- // ---------------------------------------------------------------
- // createTableFileBanner
- // ---------------------------------------------------------------
- private void createTableFileBanner(String tableName, String fileName,
- String dbName, TableDescriptor tableDesc) {
- try {
- // current time
- Date currentTime = new Date();
-
- System.out.println("building source code for " + fileName);
-
- _indenter.setLevel(0);
-
- writeLine("// filename: " + fileName);
- writeLine("// author : DBGEN");
- writeLine("// created : " + currentTime + " using database "
- + dbName);
- writeLine("// description: This class is used to get data from and put data into the");
- writeLine("// " + tableDesc.getOriginalCaseTableName()
- + " table of an IHFS database");
- writeLine("//");
-
- if (_generatedPackageName.length() > 0) {
- writeLine("package " + _generatedPackageName + ";\n");
- }
-
- writeLine("import java.sql.*;\n");
- writeLine("import java.util.*;\n");
- writeLine("import ohd.hseb.db.*;\n");
-
- if (tableDesc.isView()) {
- writeLine("public class " + tableName + "View extends DbTable");
- } else // regular table
- {
- writeLine("public class " + tableName + "Table extends DbTable");
- }
-
- writeLine("{");
- } catch (IOException ioe) {
- System.out
- .println("createTableFileBanner(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createTableFileBanner method
-
- // ---------------------------------------------------------------
- // createTableConstructors
- // ---------------------------------------------------------------
- private void createTableData() {
- try {
-
- writeLine("//-----------------------------------------------------------------");
- writeLine("// Private data");
- writeLine("//-----------------------------------------------------------------");
-
- _indenter.setLevel(1);
- writeLine("private int _recordsFound = -1;");
-
- } catch (IOException ioe) {
- System.err
- .println("createTableData(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createTableData method
-
- // ---------------------------------------------------------------
- // createTableConstructor
- // ---------------------------------------------------------------
- private void createTableConstructor(String tableName,
- TableDescriptor tableDesc) {
-
- String originalTableName = tableDesc.getOriginalCaseTableName();
-
- try {
- _indenter.setLevel(0);
- writeLine("//-----------------------------------------------------------------");
- writeLine("// "
- + tableName
- + "Table() - constructor to set statement variable and initialize");
- writeLine("//\t\tnumber of records found to zero");
- writeLine("//-----------------------------------------------------------------");
-
- _indenter.incLevel();
-
- if (tableDesc.isView()) {
- writeLine("public " + tableName + "View(Database database) ");
- } else {
- writeLine("public " + tableName + "Table(Database database) ");
- }
-
- writeLine("{");
-
- _indenter.incLevel();
- writeLine("//Constructor calls DbTable's constructor");
- writeLine("super(database);");
- writeLine("setTableName(\"" + tableDesc.getOriginalCaseTableName()
- + "\");");
-
- _indenter.decLevel();
- writeLine("}\n\n");
-
- } catch (IOException e) {
- e.printStackTrace();
- }
- } // end createTableConstructor
- // ---------------------------------------------------------------
- // createTableSelect
- // ---------------------------------------------------------------
-
- private void createTableSelect(String tableName, String originalTableName,
- TableDescriptor tableDesc) {
-
- try {
- writeLine("//-----------------------------------------------------------------");
- writeLine("// select() - this method is called with a where clause and returns");
- writeLine("//\t\ta List of " + tableName + "Record objects");
- writeLine("//-----------------------------------------------------------------");
-
- _indenter.setLevel(1);
- writeLine("public List select(String where) throws SQLException");
- writeLine("{");
-
- _indenter.incLevel();
- writeLine(tableName + "Record record = null;\n");
- writeLine("// create a List to hold " + tableName + " Records");
- writeLine("List recordList = new ArrayList();\n");
- writeLine("// set number of records found to zero");
- writeLine("_recordsFound = 0;\n");
- writeLine("// Create the SQL statement and issue it");
-
- writeLine("// construct the select statment");
- writeLine("String selectStatement = \"SELECT * FROM "
- + originalTableName + " \" + where;\n");
- writeLine("// get the result set back from the query to the database");
- writeLine("ResultSet rs = getStatement().executeQuery(selectStatement);\n");
- writeLine("// loop through the result set");
- writeLine("while (rs.next())");
- writeLine("{");
-
- _indenter.incLevel();
- writeLine("// create an instance of a " + tableName + "Record");
- writeLine("// and store its address in oneRecord");
- writeLine("record = new " + tableName + "Record();\n");
- writeLine("// increment the number of records found");
- writeLine("_recordsFound++;\n");
- writeLine("// assign the data returned to the result set for one");
- writeLine("// record in the database to a " + tableName
- + "Record object\n");
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- int index = -1;
-
- for (int i = 0; i < columnDescriptorList.size(); i++) {
- index = i + 1;
- ColumnDescriptor columnDesc = (ColumnDescriptor) columnDescriptorList
- .get(i);
- // String sqlDataType = columnDesc.getSqlTypeString();
-
- int sqlDataTypeInt = columnDesc.getSqlTypeInt();
-
- String rsInterfaceType = getRSInterfaceTypeByInt(sqlDataTypeInt);
-
- String columnName = columnDesc.getName();
- String firstChar = String.valueOf(columnName.charAt(0));
- String newName = firstChar.toUpperCase()
- + columnName.substring(1);
-
- writeLine("record.set" + newName + "(get" + rsInterfaceType
- + "(rs, " + index + "));");
-
- } // end for
-
- writeLine("");
-
- writeLine("// add this " + tableName + "Record object to the list");
- writeLine("recordList.add(record);");
-
- _indenter.decLevel();
- writeLine("}");
- writeLine("// Close the result set");
- writeLine("rs.close();\n");
-
- // create the code to return the recordList
- writeLine("// return a List which holds the " + tableName
- + "Record objects");
-
- writeLine("return recordList;\n");
-
- _indenter.decLevel();
- writeLine("} // end of select method\n");
- } catch (IOException ioe) {
- System.err
- .println("createTableSelect(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createTableSelect method
-
- // ---------------------------------------------------------------
- // createTableSelect
- // ---------------------------------------------------------------
- private void createTableSelectNRecords(String tableName,
- String originalTableName, TableDescriptor tableDesc) {
- try {
- writeLine("//-----------------------------------------------------------------");
- writeLine("// selectNRecords() - this method is called with a where clause and returns");
- writeLine("//\t\ta List filled with a maximum of maxRecordCount of "
- + tableName + "Record objects ");
- writeLine("//-----------------------------------------------------------------");
-
- _indenter.setLevel(1);
- writeLine("public List selectNRecords(String where, int maxRecordCount) throws SQLException");
- writeLine("{");
-
- _indenter.incLevel();
- writeLine(tableName + "Record record = null;\n");
- writeLine("// create a List to hold " + tableName + " Records");
- writeLine("List recordList = new ArrayList();\n");
- writeLine("// set number of records found to zero");
- writeLine("_recordsFound = 0;\n");
- writeLine("// Create the SQL statement and issue it");
-
- writeLine("// construct the select statment");
- writeLine("String selectStatement = \"SELECT * FROM "
- + originalTableName + " \" + where;\n");
- writeLine("// get the result set back from the query to the database");
- writeLine("ResultSet rs = getStatement().executeQuery(selectStatement);\n");
- writeLine("// loop through the result set");
- writeLine("while (rs.next())");
- writeLine("{");
-
- _indenter.incLevel();
- writeLine("// create an instance of a " + tableName + "Record");
- writeLine("// and store its address in oneRecord");
- writeLine("record = new " + tableName + "Record();\n");
- writeLine("// increment the number of records found");
- writeLine("_recordsFound++;\n");
- writeLine("// assign the data returned to the result set for one");
- writeLine("// record in the database to a " + tableName
- + "Record object\n");
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- int index = -1;
-
- for (int i = 0; i < columnDescriptorList.size(); i++) {
- index = i + 1;
- ColumnDescriptor columnDesc = (ColumnDescriptor) columnDescriptorList
- .get(i);
- // String sqlDataType = columnDesc.getSqlTypeString();
- int sqlDataTypeInt = columnDesc.getSqlTypeInt();
- String rsInterfaceType = getRSInterfaceTypeByInt(sqlDataTypeInt);
- // String javaDataType = columnDesc.getJavaType();
- String columnName = columnDesc.getName();
- String firstChar = String.valueOf(columnName.charAt(0));
- String newName = firstChar.toUpperCase()
- + columnName.substring(1);
-
- writeLine("record.set" + newName + "(get" + rsInterfaceType
- + "(rs, " + index + "));");
-
- } // end for
-
- writeLine("");
-
- writeLine("// add this " + tableName + "Record object to the list");
- writeLine("recordList.add(record);");
-
- writeLine("if (_recordsFound >= maxRecordCount)");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine("break;");
-
- _indenter.decLevel();
- writeLine("}");
-
- _indenter.decLevel();
- writeLine("}");
-
- writeLine("// Close the result set");
- writeLine("rs.close();\n");
-
- // create the code to return the recordList
- writeLine("// return a List which holds the " + tableName
- + "Record objects");
-
- writeLine("return recordList;\n");
-
- _indenter.decLevel();
- writeLine("} // end of selectNRecords method\n");
- } catch (IOException ioe) {
- System.err
- .println("createTableSelectNRecords(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createTableSelectNRecords method
- // ---------------------------------------------------------------
- // createTableInsert
- // ---------------------------------------------------------------
-
- private void createTableInsert(String tableName,
- TableDescriptor tableDescriptor) {
- String originalTableName = tableDescriptor.getOriginalCaseTableName();
-
- try {
- _indenter.setLevel(0);
- writeLine("//-----------------------------------------------------------------");
- writeLine("// insert() - this method is called with a "
- + tableName + "Record object and..");
- writeLine("//-----------------------------------------------------------------");
-
- _indenter.incLevel();
- writeLine("public int insert(" + tableName
- + "Record record) throws SQLException");
- writeLine("{");
-
- _indenter.incLevel();
- writeLine("int returnCode=-999;\n");
- writeLine("// Create a SQL insert statement and issue it");
-
- writeLine("// construct the insert statement");
- writeLine("PreparedStatement insertStatement = getConnection().prepareStatement(");
- write("\" INSERT INTO " + originalTableName + " VALUES (");
-
- List columnDescriptorList = tableDescriptor
- .getColumnDescriptorList();
-
- for (int i = 0; i < columnDescriptorList.size(); i++) {
- if (i == 0) {
- write("?");
- } else {
- write(", ?");
- }
- }
-
- writeLine(")\");\n");
-
- int index = -1;
- for (int i = 0; i < columnDescriptorList.size(); i++) {
- index = i + 1;
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList
- .get(i);
-
- int sqlDataTypeInt = colDesc.getSqlTypeInt();
- String rsInterfaceType = getRSInterfaceTypeByInt(sqlDataTypeInt);
- // String sqlDataType = colDesc.getSqlTypeString();
-
- String columnName = colDesc.getName();
-
- String firstChar = String.valueOf(columnName.charAt(0));
- String newName = firstChar.toUpperCase()
- + columnName.substring(1);
-
- writeLine("set" + rsInterfaceType + "(insertStatement, "
- + index + ", record.get" + newName + "());");
-
- }
-
- writeLine("");
-
- writeLine("// get the number of records processed by the insert");
- writeLine("returnCode = insertStatement.executeUpdate();\n");
- // writeLine("System.out.println(\"returnCode from putRecord = \" +
- // returnCode);");
-
- writeLine("return returnCode;\n");
-
- _indenter.decLevel();
- writeLine("} // end of insert method\n");
- } catch (IOException ioe) {
- System.err
- .println("createTableInsert(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createTableInsert method
-
- // ---------------------------------------------------------------
- // createTableDelete1
- // ---------------------------------------------------------------
- private void createTableDelete1(String tableName, String originalTableName) {
-
- try {
- _indenter.setLevel(0);
- writeLine("//-----------------------------------------------------------------");
- writeLine("// delete() - this method is called with a where clause and returns");
- writeLine("// the number of records deleted");
- writeLine("//-----------------------------------------------------------------");
-
- _indenter.incLevel();
- writeLine("public int delete(String where) throws SQLException");
- writeLine("{");
-
- _indenter.incLevel();
- writeLine("int returnCode=-999;\n");
- writeLine("// Create a SQL delete statement and issue it");
-
- writeLine("// construct the delete statement");
- writeLine("String deleteStatement = \"DELETE FROM "
- + originalTableName + " \" + where;\n");
- writeLine("// get the number of records processed by the delete");
- writeLine("returnCode = getStatement().executeUpdate(deleteStatement);\n");
-
- // writeLine("System.out.println(\"returnCode from delete = \" +
- // returnCode);");
-
- writeLine("return returnCode;");
-
- _indenter.decLevel();
- writeLine("} // end of delete method \n");
- } catch (IOException ioe) {
- System.err
- .println("createTableDelete1(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createDelete1 method
-
- // ---------------------------------------------------------------
- // createTableDelete2
- // ---------------------------------------------------------------
- private void createTableDelete2(String tableName, String originalTableName) {
-
- try {
- _indenter.setLevel(0);
- writeLine("//-----------------------------------------------------------------");
- writeLine("// delete() - this method is called with a where clause and returns");
- writeLine("// the number of records deleted");
- writeLine("//-----------------------------------------------------------------");
-
- _indenter.incLevel();
- writeLine("public int delete(" + tableName
- + "Record record) throws SQLException");
- writeLine("{");
-
- _indenter.incLevel();
- writeLine("int returnCode=-999;\n");
- writeLine("// Create a SQL delete statement and issue it");
-
- writeLine("// construct the delete statement");
- writeLine("String deleteStatement = \"DELETE FROM "
- + originalTableName + " \" + record.getWhereString();\n");
- writeLine("// get the number of records processed by the delete");
- writeLine("returnCode = getStatement().executeUpdate(deleteStatement);\n");
-
- // writeLine("System.out.println(\"returnCode from delete = \" +
- // returnCode);");
-
- writeLine("return returnCode;");
-
- _indenter.decLevel();
- writeLine("} // end of delete method \n");
- } catch (IOException ioe) {
- System.err
- .println("createTableDelete2(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createDelete2 method
-
- // ---------------------------------------------------------------
- // createTableUpdate1
- // ---------------------------------------------------------------
- private void createTableUpdate1(String tableName, String originalTableName,
- TableDescriptor tableDesc) {
-
- try {
- _indenter.setLevel(0);
-
- writeLine("//-----------------------------------------------------------------");
- writeLine("// update() - this method is called with a "
- + tableName + "Record object and a where clause..");
- writeLine("//-----------------------------------------------------------------");
-
- _indenter.incLevel();
- writeLine("public int update(" + tableName
- + "Record record, String where) throws SQLException");
- writeLine("{");
-
- _indenter.incLevel();
- writeLine("int returnCode=-999;");
- writeLine("// Create a SQL update statement and issue it");
-
- writeLine("// construct the update statement");
- writeLine("PreparedStatement updateStatement = getConnection().prepareStatement(");
- write("\" UPDATE " + originalTableName + " SET ");
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- for (int i = 0; i < columnDescriptorList.size(); i++) {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList
- .get(i);
- String columnName = colDesc.getName();
-
- if (i == 0) {
- write(columnName + " = ?");
-
- } else {
- write(", " + columnName + " = ?");
- }
-
- } // end for
-
- writeLine("\" + where );\n");
- int index = -1;
-
- for (int i = 0; i < columnDescriptorList.size(); i++) {
- index = i + 1;
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList
- .get(i);
- String columnName = colDesc.getName();
-
- // String sqlDataType = colDesc.getSqlTypeString();
- int sqlDataTypeInt = colDesc.getSqlTypeInt();
- String rsInterfaceType = getRSInterfaceTypeByInt(sqlDataTypeInt);
- String firstChar = String.valueOf(columnName.charAt(0));
-
- String newName = firstChar.toUpperCase()
- + columnName.substring(1);
-
- writeLine("set" + rsInterfaceType + "(updateStatement, "
- + index + ", record.get" + newName + "());");
-
- } // end for
-
- writeLine("// get the number of records processed by the update");
- writeLine("returnCode = updateStatement.executeUpdate();\n");
- // writeLine("System.out.println(\"returnCode from updateRecord = \"
- // + returnCode);");
-
- writeLine("return returnCode;\n");
-
- _indenter.decLevel();
- writeLine("} // end of updateRecord method\n");
- }
-
- catch (IOException ioe) {
- System.err
- .println("createTableUpdate1(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createTableUpdate1 method
-
- // ---------------------------------------------------------------
- // createTableUpdate2
- // ---------------------------------------------------------------
- private void createTableUpdate2(String tableName, String originalTableName,
- TableDescriptor tableDesc) {
-
- try {
- _indenter.setLevel(0);
-
- writeLine("//-----------------------------------------------------------------");
- writeLine("// update() - this method is called with a "
- + tableName + "Record object and a where clause..");
- writeLine("//-----------------------------------------------------------------");
-
- _indenter.incLevel();
- writeLine("public int update(" + tableName + "Record oldRecord, "
- + tableName + "Record newRecord) throws SQLException");
- writeLine("{");
-
- _indenter.incLevel();
- writeLine("int returnCode=-999;");
- writeLine("// Create a SQL update statement and issue it");
-
- writeLine("// construct the update statement");
- writeLine("PreparedStatement updateStatement = getConnection().prepareStatement(");
- write("\" UPDATE " + originalTableName + " SET ");
-
- List columnDescriptorList = tableDesc.getColumnDescriptorList();
-
- for (int i = 0; i < columnDescriptorList.size(); i++) {
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList
- .get(i);
- String columnName = colDesc.getName();
-
- if (i == 0) {
- write(columnName + " = ?");
-
- } else {
- write(", " + columnName + " = ?");
- }
-
- } // end for
-
- writeLine("\" + oldRecord.getWhereString() );\n");
- int index = -1;
-
- for (int i = 0; i < columnDescriptorList.size(); i++) {
- index = i + 1;
- ColumnDescriptor colDesc = (ColumnDescriptor) columnDescriptorList
- .get(i);
- String columnName = colDesc.getName();
- // String sqlDataType = colDesc.getSqlTypeString();
- int sqlDataTypeInt = colDesc.getSqlTypeInt();
- String rsInterfaceType = getRSInterfaceTypeByInt(sqlDataTypeInt);
- String firstChar = String.valueOf(columnName.charAt(0));
-
- String newName = firstChar.toUpperCase()
- + columnName.substring(1);
-
- writeLine("set" + rsInterfaceType + "(updateStatement, "
- + index + ", newRecord.get" + newName + "());");
-
- } // end for
-
- writeLine("// get the number of records processed by the update");
- writeLine("returnCode = updateStatement.executeUpdate();\n");
- // writeLine("System.out.println(\"returnCode from updateRecord = \"
- // + returnCode);");
-
- writeLine("return returnCode;\n");
-
- _indenter.decLevel();
- writeLine("} // end of updateRecord method\n");
- }
-
- catch (IOException ioe) {
- System.err
- .println("createTableUpdate2(): Something went wrong trying to write "
- + ioe);
- }
-
- } // end of createTableUpdate2 method
-
- private void createTableInsertOrUpdate(String tableName) {
-
- try {
- _indenter.setLevel(0);
- writeLine("//-----------------------------------------------------------------");
- writeLine("// insertOrUpdate() - this method is call with a "
- + tableName + "Record object.");
- writeLine("// the number of records inserted or updated");
- writeLine("//-----------------------------------------------------------------");
-
- _indenter.incLevel();
- writeLine("public int insertOrUpdate(" + tableName
- + "Record record) throws SQLException");
- writeLine("{");
- _indenter.incLevel();
- writeLine("int returnCode=-999;");
- writeLine("List recordList = select(record.getWhereString());\n");
-
- writeLine("if (recordList.size() < 1)");
- writeLine("{");
- _indenter.incLevel();
- writeLine("returnCode = insert(record);");
- _indenter.decLevel();
- writeLine("}");
-
- writeLine("else");
- writeLine("{");
- _indenter.incLevel();
-
- writeLine(tableName + "Record oldRecord = (" + tableName
- + "Record) recordList.get(0);");
- writeLine("returnCode = update(oldRecord, record);");
- _indenter.decLevel();
- writeLine("}");
-
- writeLine("return returnCode;");
-
- _indenter.decLevel();
- writeLine("} // end of insertOrUpdate() ");
- } catch (IOException ioe) {
- System.err
- .println("createTableInsertOrUpdate(): Something went wrong trying to write "
- + ioe);
- }
- } // end of createTableInsertOrUpdate()
-
- // ---------------------------------------------------------------
- // generate - calls all the methods to cause code to be generated
- // ---------------------------------------------------------------
-
- public void generate(String connectionURL,
- String preferredTableNameFilePath, String dbName,
- String generatedPackageName, String targetDir, String driverName) {
-
- // define an instance of a the IHFS database class
- Database currentDatabase = new Database();
-
- if (driverName != null) {
- currentDatabase.setDriverClassName(driverName);
- }
-
- // call the method to connect to the database
- currentDatabase.connect(connectionURL);
-
- // store the name of the package to which the generated classes will
- // belong
- _generatedPackageName = generatedPackageName;
-
- // store the path of the target directory for the generated files
- _targetDirName = targetDir;
-
- // reads a list of Preferred table names from the directory indicated by
- // schemaDirName
- Map preferredTableNameMap = getMapOfPreferredTableNames(preferredTableNameFilePath);
-
- // returns a list of the TableDescriptor which contains metadata about
- // the
- // tables and columns. This is the method that needs to be overridden
- // when
- // a database driver requires a custom way of extracting the metadata.
- SchemaDescriber finder = new SchemaDescriber(currentDatabase);
-
- _tableDescriptorList = finder
- .getTableDescriptorList(preferredTableNameMap);
-
- _indenter = new CodeIndenter(_indentString);
-
- // generate all the XXXRecord.java files
- buildRecordSrcFiles(dbName);
-
- // generate all the XXXTable.jar files
- buildTableSrcFiles(dbName);
-
- // disconnect from the database
- currentDatabase.disconnect();
-
- } // end generate
-
- // ---------------------------------------------------------------
-
- // ---------------------------------------------------------------
- public static void main(String args[]) {
-
- // CodeTimer timer = new CodeTimer();
- // timer.start();
-
- String connectionURL = null;
- String preferredTableNameFilePath = null;
- // the database name is passed in as the third command line argument
- String dbName = null;
- String packageName = null;
- String targetDir = null;
- String driverName = null;
-
- if (args.length < 5) {
- System.err
- .println("Usage: java JDbGen connectionURL preferredTableNameFilePath dbName packageName targetDir [driverClassName]");
- System.exit(-1);
- } else // the argument count looks good
- {
- connectionURL = args[0];
- preferredTableNameFilePath = args[1];
-
- // the database name is passed in as the third command line argument
- dbName = args[2];
-
- packageName = args[3];
- if (packageName.equals("NONE")) {
- packageName = "";
- }
-
- targetDir = args[4];
-
- if (args.length > 5) {
- driverName = args[5];
-
- }
-
- // create a JDbGen object named dbgen
- JDbGen dbgen = new JDbGen();
-
- dbgen.generate(connectionURL, preferredTableNameFilePath, dbName,
- packageName, targetDir, driverName);
-
- System.out.println("JDBGEN completed!");
- // timer.stop("JDbGen took");
- }
-
- return;
-
- } // end of main
-
-} // end of JDbGen class
diff --git a/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/SchemaDescriber.java b/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/SchemaDescriber.java
deleted file mode 100755
index d58806e1ee..0000000000
--- a/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/SchemaDescriber.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * Created on Sep 16, 2004
- *
- *
- */
-package ohd.hseb.dbgen;
-
-
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import ohd.hseb.db.Database;
-import ohd.hseb.db.DbType;
-
-/**
- * @author GobsC
- *
- * This class encapsulates the discovery of the database schema for code generation purposes.
- */
-public class SchemaDescriber
-{
-
- private Database _db;
- private DbType _dbType = null;
-
-
- // ---------------------------------------------------------------------------------
-
- public SchemaDescriber(Database database)
- {
- _db = database;
- _dbType = _db.getDbType();
- }
- //-------------------------------------------------------------------------------------
-
- public List getTableDescriptorList(Map preferredTableNameMap)
- {
- List descriptorList = null;
-
-
- if (_dbType == DbType.Informix)
- {
- descriptorList = getInformixTableDescriptorList(preferredTableNameMap);
- }
- else //use the PostgreSQL way, which we assume to be more standard
- {
- descriptorList = getPostgreSQLTableDescriptorList(preferredTableNameMap);
- }
-
- return descriptorList;
-
- }
-
-
- //-------------------------------------------------------------------------------------
-
-
- public List getPostgreSQLTableDescriptorList(Map preferredTableNameMap)
- {
- String header = "getPostgreSQLTableDescriptorList(): ";
- List tdList = new ArrayList();
-
- try
- {
-
- // Database Meta Data object
- DatabaseMetaData dbmd = _db.getConnection().getMetaData();
-
-
- //get all the info on regular tables
-
- boolean isView = false;
-
- // get the basic info on all the true tables
- // added capitalized "TABLE" for postgresql
- String[] tableTypesStringArray = { "table", "TABLE" };
- isView = false;
- addToRawTableDescriptorList(dbmd, preferredTableNameMap, isView,
- tableTypesStringArray, tdList);
-
- // get the basic info on all the views
- String[] tableTypesStringArray2 = { "view", "VIEW" };
- // added capitalized "VIEW" for postgresql
- isView = true;
- addToRawTableDescriptorList(dbmd, preferredTableNameMap, isView,
- tableTypesStringArray2, tdList);
-
-
-
- // create column descriptors for each table or view
- for (int i = 0; i < tdList.size(); i++)
- {
- TableDescriptor tableDesc = (TableDescriptor) tdList.get(i);
- String origCaseTableName = tableDesc.getOriginalCaseTableName();
-
- // get the column info for all tables and views
- // ResultSet rsForColumn = dbmd.getColumns("", "", tableName,
- // "%");
- ResultSet rsForColumn = dbmd.getColumns(null, null,
- origCaseTableName, "%");
-
- // get the primary keys for this particular table
- // and store them in a set
- // ResultSet rsForKeys = dbmd.getPrimaryKeys("", "", tableName);
- ResultSet rsForKeys = dbmd.getPrimaryKeys(null, null,
- origCaseTableName);
-
- Set keySet = new HashSet();
- while (rsForKeys.next())
- {
- String keyColumnName = rsForKeys.getString(4);
- keySet.add(keyColumnName.toLowerCase());
- }
-
- if (keySet.size() > 0)
- {
- tableDesc.setHasPrimaryKey(true);
- }
- else
- {
- tableDesc.setHasPrimaryKey(false);
- }
-
-
- // for each column, make a corresponding ColumnDescriptor and
- // add it to the list contained by the TableDescriptor
- while (rsForColumn.next())
- {
- String columnName = rsForColumn.getString(4).trim();
-
- int sqlTypeInt = rsForColumn.getInt(5);
- String sqlTypeString = rsForColumn.getString(6).trim();
-
- boolean isNullable = false;
- int nullableCode = rsForColumn.getInt(11);
- if ( (nullableCode == DatabaseMetaData.columnNullable) ||
- (nullableCode == DatabaseMetaData.columnNullableUnknown)
- )
- {
- isNullable = true;
- }
- else
- {
- isNullable = false;
-
- /*
- System.out.println("DatabaseMetaData.columnNoNulls = " +
- DatabaseMetaData.columnNoNulls);
- System.out.println("************ nullablecode = " +
- nullableCode + " for " + columnName +
- " in " + tableDesc.getName());
- */
- }
-
-
-
- //special case for PostgreSQL text field
- // needed because it comes out as Types.VARCHAR
- if (sqlTypeString.equals("text"))
- {
- sqlTypeInt = Types.LONGVARCHAR;
- }
-
- int colSize = rsForColumn.getInt(7);
-
-
- ColumnDescriptor colDesc = new ColumnDescriptor();
- colDesc.setName(columnName);
- colDesc.setSqlTypeInt(sqlTypeInt);
- colDesc.setSqlTypeString(sqlTypeString);
- colDesc.setSize(colSize);
- colDesc.setNullable(isNullable);
-
- // set the KeyColumn boolean field as appropriate
- if (keySet.contains(columnName.toLowerCase()))
- {
- colDesc.setKeyColumn(true);
- }
- else
- {
- colDesc.setKeyColumn(false);
- }
-
- // add the columnDescriptor to the tableDescriptor's list
- tableDesc.getColumnDescriptorList().add(colDesc);
-
-
- } //end while
-
- //System.out.println(header + "tableDesc = " + tableDesc);
-
-
- } //end for
-
-
-
- }
- catch (SQLException e)
- {
- System.out.println(this.getClass().getName()
- + ".getTableDescriptorList():" + " Problem with SQL "
- + e.getMessage());
- e.printStackTrace();
- }
- return tdList;
-
- } //end getPostgreSQLTableDescriptorList
-
- //-------------------------------------------------------------------------------------
- public List getInformixTableDescriptorList(Map preferredTableNameMap)
- {
- List tdList = new ArrayList();
- System.out.println("getInformixTableDescriptorList(): begin");
- try
- {
-
- // Database Meta Data object
- DatabaseMetaData dbmd = _db.getConnection().getMetaData();
-
-
- //get all the info on regular tables
-
- boolean isView = false;
-
- // get the basic info on all the true tables
- String[] tableTypesStringArray = { "table"};
- isView = false;
- addToRawTableDescriptorList(dbmd, preferredTableNameMap, isView,
- tableTypesStringArray, tdList);
-
- // get the basic info on all the views
- String[] tableTypesStringArray2 = { "view"};
- isView = true;
- addToRawTableDescriptorList(dbmd, preferredTableNameMap, isView,
- tableTypesStringArray2, tdList);
-
-
-
- // create column descriptors for each table or view
- for (int i = 0; i < tdList.size(); i++)
- {
- TableDescriptor tableDesc = (TableDescriptor) tdList.get(i);
- String origCaseTableName = tableDesc.getOriginalCaseTableName();
-
- // get the column info for all tables and views
- ResultSet rsForColumn = dbmd.getColumns("", "", origCaseTableName, "%");
-
- // get the primary keys for this particular table
- // and store them in a set
- ResultSet rsForKeys = dbmd.getPrimaryKeys("", "", origCaseTableName);
-
-
- Set keySet = new HashSet();
- while (rsForKeys.next())
- {
- String keyColumnName = rsForKeys.getString(4);
- keySet.add(keyColumnName.toLowerCase());
- }
-
- if (keySet.size() > 0)
- {
- tableDesc.setHasPrimaryKey(true);
- }
- else
- {
- tableDesc.setHasPrimaryKey(false);
- }
-
-
-
- // for each column, make a corresponding ColumnDescriptor and
- // add it to the list contained by the TableDescriptor
- while (rsForColumn.next())
- {
- String columnName = rsForColumn.getString(4).trim();
-
- String sqlTypeString = rsForColumn.getString(6).trim();
-
- int sqlTypeInt = rsForColumn.getInt(5);
-
- ColumnDescriptor colDesc = new ColumnDescriptor();
- colDesc.setName(columnName);
- colDesc.setSqlTypeInt(sqlTypeInt);
- colDesc.setSqlTypeString(sqlTypeString);
-
-
- // set the KeyColumn boolean field as appropriate
- if (keySet.contains(columnName.toLowerCase()))
- {
- colDesc.setKeyColumn(true);
- }
- else
- {
- colDesc.setKeyColumn(false);
- }
-
-
- // add the columnDescriptor to the tableDescriptor's list
- tableDesc.getColumnDescriptorList().add(colDesc);
-
- } //end while
-
-
-
- } //end for
-
- }
- catch (SQLException e)
- {
- System.out.println(this.getClass().getName()
- + ".getTableDescriptorList():" + " Problem with SQL "
- + e.getMessage());
- e.printStackTrace();
- }
- return tdList;
-
- } //getInformixTableDescriptorList
-
- //-------------------------------------------------------------------------------------
-
-
- // sub method of getTableDescriptorList
- // broken out to reduce duplicate code for tables and views
- private void addToRawTableDescriptorList(DatabaseMetaData dbmd,
- Map preferredTableNameMap,
- boolean isView,
- String[] tableTypeNameArray,
- List rawTableDescriptorList)
- throws SQLException
- {
- //ResultSet rsForTables = dbmd.getTables("", "", "%",
- // tableTypeNameArray );
- ResultSet rsForTables = dbmd.getTables(null, null, "%",
- tableTypeNameArray);
-
-
-
- while (rsForTables.next())
- {
- TableDescriptor tableDesc = new TableDescriptor();
-
- String originalCaseName = rsForTables.getString(3);
- String lowerCaseName = originalCaseName.toLowerCase();
- String mixedCaseName = (String) preferredTableNameMap.get(lowerCaseName);
- if (mixedCaseName == null)
- {
- mixedCaseName = lowerCaseName;
- }
-
- tableDesc.setOriginalCaseTableName(originalCaseName);
- tableDesc.setName(mixedCaseName);
-
- /*
- System.out.println("addToRawTableDescriptorList(): original case of table name = " +
- originalCaseName +
- " mixed case table name = " +
- mixedCaseName);
- */
-
- tableDesc.setView(isView);
- rawTableDescriptorList.add(tableDesc);
- }
-
- rsForTables.close();
-
- return;
- }
-
-
-
-
-
-
-} //end SchemaDescriber
diff --git a/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/TableDescriptor.java b/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/TableDescriptor.java
deleted file mode 100755
index 7afc15a08d..0000000000
--- a/cave/ohd.hseb.ihfsdb/src/ohd/hseb/dbgen/TableDescriptor.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Created on Aug 13, 2003
- *
- * This class encapsulates information about a table, including a list
- * of column descriptors.
- */
-package ohd.hseb.dbgen;
-
-import java.util.*;
-
-
-/**
- *
- */
-public class TableDescriptor
-{
- private String _name = null;
- private String _originalCaseTableName = null;
- private boolean _isView = false;
- private boolean _hasPrimaryKey = false;
-
-
- private List _columnDescList = new ArrayList();
- private List _keyColumnDescList = null;
-
- // ---------------------------------------------------------------------------------------------
-
- public TableDescriptor()
- {
-
- }
-
- // ---------------------------------------------------------------------------------------------
-
- public void setName(String name)
- {
- this._name = name;
- }
-
- // ---------------------------------------------------------------------------------------------
-
- public String getName()
- {
- return _name;
- }
- // ---------------------------------------------------------------------------------------------
-
- /**
- * @param originalTableName The originalTableName to set.
- */
- public void setOriginalCaseTableName(String originalTableName)
- {
- _originalCaseTableName = originalTableName;
- }
- // ---------------------------------------------------------------------------------------------
-
- /**
- * @return Returns the originalTableName.
- */
- public String getOriginalCaseTableName()
- {
- return _originalCaseTableName;
- }
-
- // ---------------------------------------------------------------------------------------------
-
- public void setView(boolean isView)
- {
- this._isView = isView;
- }
-
- // ---------------------------------------------------------------------------------------------
-
- public boolean isView()
- {
- return _isView;
- }
-
- // ---------------------------------------------------------------------------------------------
-
- public void setHasPrimaryKey(boolean hasPrimaryKey)
- {
- _hasPrimaryKey = hasPrimaryKey;
- }
-
- // ---------------------------------------------------------------------------------------------
-
- public boolean hasPrimaryKey()
- {
- return _hasPrimaryKey;
- }
-
- // ---------------------------------------------------------------------------------------------
-
-
- public List getColumnDescriptorList()
- {
- return _columnDescList;
- }
-
- // ---------------------------------------------------------------------------------------------
-
- public List getKeyColumnDescriptorList()
- {
-
- if (_keyColumnDescList == null)
- {
- _keyColumnDescList = new ArrayList();
-
- // for each key column, check if it is a key column, and, if so, then insert it into the list
- for (int i = 0 ; i < _columnDescList.size() ; i++)
- {
- ColumnDescriptor colDesc = (ColumnDescriptor) _columnDescList.get(i);
-
- if (colDesc.isKeyColumn())
- {
- _keyColumnDescList.add(colDesc);
- }
- }
- }
-
- return _keyColumnDescList;
- }
-
- // ---------------------------------------------------------------------------------------------
-
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("Name = " + _name);
-
- buffer.append(" Original Case Table name = " + _originalCaseTableName + "\n");
- buffer.append(" Mixed Case Table name = " + _name + "\n");
- buffer.append(" Is View? = " + _isView + "\n");
-
- buffer.append("Columns:\n");
- for (int i = 0; i < _columnDescList.size(); i++)
- {
- ColumnDescriptor descriptor = (ColumnDescriptor) _columnDescList
- .get(i);
-
- buffer.append("Column " + i + "\n" +
- descriptor.toString() + "\n");
-
- }
-
-
- return buffer.toString();
- }
-
- // ---------------------------------------------------------------------------------------------
-
-} //end class TableDescriptor
diff --git a/cave/ohd.hseb.monitor/.classpath b/cave/ohd.hseb.monitor/.classpath
deleted file mode 100644
index 1fa3e6803d..0000000000
--- a/cave/ohd.hseb.monitor/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/cave/ohd.hseb.monitor/.project b/cave/ohd.hseb.monitor/.project
deleted file mode 100644
index 9f5417f4bc..0000000000
--- a/cave/ohd.hseb.monitor/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- ohd.hseb.monitor
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/cave/ohd.hseb.monitor/.settings/org.eclipse.jdt.core.prefs b/cave/ohd.hseb.monitor/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index e31fb0bba0..0000000000
--- a/cave/ohd.hseb.monitor/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Thu Mar 26 11:32:22 CDT 2009
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/cave/ohd.hseb.monitor/META-INF/MANIFEST.MF b/cave/ohd.hseb.monitor/META-INF/MANIFEST.MF
deleted file mode 100644
index 0c4aacd001..0000000000
--- a/cave/ohd.hseb.monitor/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,22 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Monitor Plug-in
-Bundle-SymbolicName: ohd.hseb.monitor;singleton:=true
-Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: com.raytheon.monitor.activator.Activator
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- com.raytheon.viz.core,
- ohd.hseb.common,
- ohd.hseb.ihfsdb,
- org.postgres
-Bundle-ActivationPolicy: lazy
-Export-Package: com.raytheon.monitor.activator,
- com.raytheon.monitor.preferences,
- ohd.hseb.monitor
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Import-Package: com.raytheon.uf.common.mpe.util,
- com.raytheon.uf.common.ohd,
- com.raytheon.viz.hydrocommon,
- com.raytheon.viz.hydrocommon.util,
- com.vividsolutions.jts.geom
diff --git a/cave/ohd.hseb.monitor/build.properties b/cave/ohd.hseb.monitor/build.properties
deleted file mode 100644
index e5eb50c213..0000000000
--- a/cave/ohd.hseb.monitor/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- config.xml,\
- localization/
diff --git a/cave/ohd.hseb.monitor/config.xml b/cave/ohd.hseb.monitor/config.xml
deleted file mode 100644
index dc36aacbd4..0000000000
--- a/cave/ohd.hseb.monitor/config.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- jdbc:postgresql://localhost:5432/hd_ob83oax?user=awips&password=awips
- /home/awips/hydro/config
- /home/awips/hydro/logs
-
\ No newline at end of file
diff --git a/cave/ohd.hseb.monitor/external_jars/postgresql-8.3-603.jdbc3.jar b/cave/ohd.hseb.monitor/external_jars/postgresql-8.3-603.jdbc3.jar
deleted file mode 100644
index a9156e958b..0000000000
Binary files a/cave/ohd.hseb.monitor/external_jars/postgresql-8.3-603.jdbc3.jar and /dev/null differ
diff --git a/cave/ohd.hseb.monitor/localization/menus/monitor/baseMonitor.xml b/cave/ohd.hseb.monitor/localization/menus/monitor/baseMonitor.xml
deleted file mode 100644
index e9011e552e..0000000000
--- a/cave/ohd.hseb.monitor/localization/menus/monitor/baseMonitor.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/cave/ohd.hseb.monitor/localization/menus/monitor/index.xml b/cave/ohd.hseb.monitor/localization/menus/monitor/index.xml
deleted file mode 100644
index 33a9d4bac9..0000000000
--- a/cave/ohd.hseb.monitor/localization/menus/monitor/index.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/cave/ohd.hseb.monitor/log/RiverMonitor.1.20080822 b/cave/ohd.hseb.monitor/log/RiverMonitor.1.20080822
deleted file mode 100644
index 9c6aa9e061..0000000000
--- a/cave/ohd.hseb.monitor/log/RiverMonitor.1.20080822
+++ /dev/null
@@ -1,38 +0,0 @@
-1
-**************************************
-1
-**************************************
-16:01:32: RiverMonitor Started
-1
-**************************************
-16:01:32: RiverMonitorDataManager.readValidHeightAndDischargePE(): Where Clause:where pe like 'H%' or pe like 'Q%'
-1
-**************************************
-16:01:32: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-1
-**************************************
-16:01:33: Derived columns file doesnt exist :[/home/ebabin/workspace/ohd.hseb.river_monitor/config/DerivedColumns.txt]
-1
-**************************************
-16:01:33: Derived columns file doesnt exist :[/home/ebabin/workspace/ohd.hseb.river_monitor/config/DerivedColumns.txt]
-1
-**************************************
-16:01:33: RiverMonitorSettings.startRiverMonitor(): Trying to load from file :/home/ebabin/workspace/ohd.hseb.river_monitor/config/DefaultRiverMonitorSettings.txt
-1
-**************************************
-16:01:33: SettingsFileManager.isValidSettingsFile(): [/home/ebabin/workspace/ohd.hseb.river_monitor/config/DefaultRiverMonitorSettings.txt] doesn't exist
-1
-**************************************
-16:01:33: RiverMonitorDataManager.createRiverMonitorRowDataList(): Memory Info before creating rowdata list:Free:64159664 Max:1023934464 total:65536000
-1
-**************************************
-16:01:35: RiverMonitorDataManager.readConfigFileAndFormConfigMap(): ConfigFile [/home/ebabin/workspace/ohd.hseb.river_monitor/config/RiverMonitorPEConfig.txt] doesn't exist
-1
-**************************************
-16:01:37: RiverMonLocGroupDataManager.initRiverMonGroupMap(): Where Clause:order by ordinal
-1
-**************************************
-16:01:37: RiverMonitorLocGroupDataManager.initRiverMonLocationMap(): Where Clause:where group_id not like 'DEFAULT' order by ordinal
-1
-**************************************
-16:01:37: RiverMonitorDataManager.createRiverMonitorRowDataList(): Here 1: Free:150936656 Max:1023934464 total:158793728
diff --git a/cave/ohd.hseb.monitor/logging/PrecipMonitor.1.20080822 b/cave/ohd.hseb.monitor/logging/PrecipMonitor.1.20080822
deleted file mode 100644
index e5da802c04..0000000000
--- a/cave/ohd.hseb.monitor/logging/PrecipMonitor.1.20080822
+++ /dev/null
@@ -1,32 +0,0 @@
-1
-**************************************
-1
-**************************************
-21:10:03: PrecipMonitor Started
-1
-**************************************
-21:10:03: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-1
-**************************************
-21:10:03: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/PrecipDerivedColumns.txt]
-1
-**************************************
-21:10:03: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/PrecipDerivedColumns.txt]
-1
-**************************************
-21:10:03: PrecipMonitorSettings.startPrecipMonitor(): Trying to load from file :/awips/hydroapps/whfs/local/data/app/rivermon/DefaultPrecipMonitorSettings.txt
-1
-**************************************
-21:10:03: SettingsFileManager.isValidSettingsFile(): [/awips/hydroapps/whfs/local/data/app/rivermon/DefaultPrecipMonitorSettings.txt] doesn't exist
-1
-**************************************
-21:10:03: PrecipMonitorDataManager.createPrecipMonitorRowDataList(): Memory Info before creating rowdata list:Free:63957608 Max:1023934464 total:65536000
-1
-**************************************
-21:10:09: RiverMonLocGroupDataManager.initRiverMonGroupMap(): Where Clause:order by ordinal
-1
-**************************************
-21:10:09: RiverMonitorLocGroupDataManager.initRiverMonLocationMap(): Where Clause:where group_id not like 'DEFAULT' order by ordinal
-1
-**************************************
-21:10:09: PrecipMonitorDataManager.createPrecipMonitorRowDataList(): 1:Free:102711168 Max:1023934464 total:157351936
diff --git a/cave/ohd.hseb.monitor/logging/PrecipMonitor.2.20080822 b/cave/ohd.hseb.monitor/logging/PrecipMonitor.2.20080822
deleted file mode 100644
index 776161a197..0000000000
--- a/cave/ohd.hseb.monitor/logging/PrecipMonitor.2.20080822
+++ /dev/null
@@ -1,29 +0,0 @@
-2
-**************************************
-2
-**************************************
-21:11:15: PrecipMonitor Started
-2
-**************************************
-21:11:15: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-2
-**************************************
-21:11:15: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/PrecipDerivedColumns.txt]
-2
-**************************************
-21:11:15: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/PrecipDerivedColumns.txt]
-2
-**************************************
-21:11:15: PrecipMonitorSettings.startPrecipMonitor(): Trying to load from file :/awips/hydroapps/whfs/local/data/app/rivermon/DefaultPrecipMonitorSettings.txt
-2
-**************************************
-21:11:34: RiverMonGroupDataManager.readDataFromRiverMonGroup(): Where Clause:order by group_id
-2
-**************************************
-21:11:35: RiverMonGroupDataManager.readDataFromRiverMonGroup(): Where Clause:order by group_id
-2
-**************************************
-21:11:51: PrecipMonitor Application Exiting....
-2
-**************************************
-21:11:51: ====================================
diff --git a/cave/ohd.hseb.monitor/logging/PrecipMonitor.3.20080825 b/cave/ohd.hseb.monitor/logging/PrecipMonitor.3.20080825
deleted file mode 100644
index bcb7428167..0000000000
--- a/cave/ohd.hseb.monitor/logging/PrecipMonitor.3.20080825
+++ /dev/null
@@ -1,23 +0,0 @@
-3
-**************************************
-3
-**************************************
-14:56:59: PrecipMonitor Started
-3
-**************************************
-14:56:59: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-3
-**************************************
-14:56:59: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/PrecipDerivedColumns.txt]
-3
-**************************************
-14:56:59: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/PrecipDerivedColumns.txt]
-3
-**************************************
-14:56:59: PrecipMonitorSettings.startPrecipMonitor(): Trying to load from file :/awips/hydroapps/whfs/local/data/app/rivermon/DefaultPrecipMonitorSettings.txt
-3
-**************************************
-14:57:14: PrecipMonitor Application Exiting....
-3
-**************************************
-14:57:14: ====================================
diff --git a/cave/ohd.hseb.monitor/logging/RiverMonitor.1.20080822 b/cave/ohd.hseb.monitor/logging/RiverMonitor.1.20080822
deleted file mode 100644
index af2533587c..0000000000
--- a/cave/ohd.hseb.monitor/logging/RiverMonitor.1.20080822
+++ /dev/null
@@ -1,23 +0,0 @@
-1
-**************************************
-1
-**************************************
-20:46:21: RiverMonitor Started
-1
-**************************************
-20:46:22: RiverMonitorDataManager.readValidHeightAndDischargePE(): Where Clause:where pe like 'H%' or pe like 'Q%'
-1
-**************************************
-20:46:22: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-1
-**************************************
-20:46:22: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-1
-**************************************
-20:46:22: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-1
-**************************************
-20:46:22: RiverMonitorSettings.startRiverMonitor(): Trying to load from file :/awips/hydroapps/whfs/local/data/app/rivermon/DefaultRiverMonitorSettings.txt
-1
-**************************************
-20:46:26: Launch PRECIP Monitor [cmd:/home/ebabin/workspace/ohd.hseb.rivermonitor/src/scripts/start_rivermonitor Precip]
diff --git a/cave/ohd.hseb.monitor/logging/RiverMonitor.10.20080825 b/cave/ohd.hseb.monitor/logging/RiverMonitor.10.20080825
deleted file mode 100644
index a2dc582298..0000000000
--- a/cave/ohd.hseb.monitor/logging/RiverMonitor.10.20080825
+++ /dev/null
@@ -1,35 +0,0 @@
-10
-**************************************
-10
-**************************************
-14:55:58: RiverMonitor Started
-10
-**************************************
-14:55:59: RiverMonitorDataManager.readValidHeightAndDischargePE(): Where Clause:where pe like 'H%' or pe like 'Q%'
-10
-**************************************
-14:55:59: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-10
-**************************************
-14:55:59: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-10
-**************************************
-14:55:59: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-10
-**************************************
-14:55:59: RiverMonitorSettings.startRiverMonitor(): Trying to load from file :/awips/hydroapps/whfs/local/data/app/rivermon/DefaultRiverMonitorSettings.txt
-10
-**************************************
-14:56:12: RiverMonitorDataManager.createRiverMonitorRowDataList(): Memory Info before creating rowdata list:Free:64030096 Max:1023934464 total:65536000
-10
-**************************************
-14:56:15: RiverMonitorDataManager.readConfigFileAndFormConfigMap(): ConfigFile [awips/hydroapps/whfs/local/data/app/rivermon/RiverMonitorPEConfig.txt] doesn't exist
-10
-**************************************
-14:56:16: RiverMonLocGroupDataManager.initRiverMonGroupMap(): Where Clause:order by ordinal
-10
-**************************************
-14:56:16: RiverMonitorLocGroupDataManager.initRiverMonLocationMap(): Where Clause:where group_id not like 'DEFAULT' order by ordinal
-10
-**************************************
-14:56:16: RiverMonitorDataManager.createRiverMonitorRowDataList(): Here 1: Free:151008992 Max:1023934464 total:158990336
diff --git a/cave/ohd.hseb.monitor/logging/RiverMonitor.2.20080822 b/cave/ohd.hseb.monitor/logging/RiverMonitor.2.20080822
deleted file mode 100644
index 89d2b2ce51..0000000000
--- a/cave/ohd.hseb.monitor/logging/RiverMonitor.2.20080822
+++ /dev/null
@@ -1,26 +0,0 @@
-2
-**************************************
-2
-**************************************
-20:51:08: RiverMonitor Started
-2
-**************************************
-20:51:08: RiverMonitorDataManager.readValidHeightAndDischargePE(): Where Clause:where pe like 'H%' or pe like 'Q%'
-2
-**************************************
-20:51:09: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-2
-**************************************
-20:51:09: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-2
-**************************************
-20:51:09: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-2
-**************************************
-20:51:09: RiverMonitorSettings.startRiverMonitor(): Trying to load from file :/awips/hydroapps/whfs/local/data/app/rivermon/DefaultRiverMonitorSettings.txt
-2
-**************************************
-20:51:19: Launch PRECIP Monitor [cmd:/home/ebabin/workspace/ohd.hseb.rivermonitor/src/scripts/start_rivermonitor Precip]
-2
-**************************************
-20:52:27: Launch PRECIP Monitor [cmd:/home/ebabin/workspace/ohd.hseb.rivermonitor/src/scripts/start_rivermonitor Precip]
diff --git a/cave/ohd.hseb.monitor/logging/RiverMonitor.3.20080822 b/cave/ohd.hseb.monitor/logging/RiverMonitor.3.20080822
deleted file mode 100644
index 2cdce49372..0000000000
--- a/cave/ohd.hseb.monitor/logging/RiverMonitor.3.20080822
+++ /dev/null
@@ -1,20 +0,0 @@
-3
-**************************************
-3
-**************************************
-20:58:25: RiverMonitor Started
-3
-**************************************
-20:58:25: RiverMonitorDataManager.readValidHeightAndDischargePE(): Where Clause:where pe like 'H%' or pe like 'Q%'
-3
-**************************************
-20:58:26: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-3
-**************************************
-20:58:26: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-3
-**************************************
-20:58:26: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-3
-**************************************
-20:58:26: RiverMonitorSettings.startRiverMonitor(): Trying to load from file :/awips/hydroapps/whfs/local/data/app/rivermon/DefaultRiverMonitorSettings.txt
diff --git a/cave/ohd.hseb.monitor/logging/RiverMonitor.4.20080822 b/cave/ohd.hseb.monitor/logging/RiverMonitor.4.20080822
deleted file mode 100644
index 9bf3a0414b..0000000000
--- a/cave/ohd.hseb.monitor/logging/RiverMonitor.4.20080822
+++ /dev/null
@@ -1,20 +0,0 @@
-4
-**************************************
-4
-**************************************
-21:00:04: RiverMonitor Started
-4
-**************************************
-21:00:04: RiverMonitorDataManager.readValidHeightAndDischargePE(): Where Clause:where pe like 'H%' or pe like 'Q%'
-4
-**************************************
-21:00:05: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-4
-**************************************
-21:00:05: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-4
-**************************************
-21:00:05: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-4
-**************************************
-21:00:05: RiverMonitorSettings.startRiverMonitor(): Trying to load from file :/awips/hydroapps/whfs/local/data/app/rivermon/DefaultRiverMonitorSettings.txt
diff --git a/cave/ohd.hseb.monitor/logging/RiverMonitor.5.20080822 b/cave/ohd.hseb.monitor/logging/RiverMonitor.5.20080822
deleted file mode 100644
index 0394887d4a..0000000000
--- a/cave/ohd.hseb.monitor/logging/RiverMonitor.5.20080822
+++ /dev/null
@@ -1,20 +0,0 @@
-5
-**************************************
-5
-**************************************
-21:01:16: RiverMonitor Started
-5
-**************************************
-21:01:16: RiverMonitorDataManager.readValidHeightAndDischargePE(): Where Clause:where pe like 'H%' or pe like 'Q%'
-5
-**************************************
-21:01:16: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-5
-**************************************
-21:01:17: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-5
-**************************************
-21:01:17: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-5
-**************************************
-21:01:17: RiverMonitorSettings.startRiverMonitor(): Trying to load from file :/awips/hydroapps/whfs/local/data/app/rivermon/DefaultRiverMonitorSettings.txt
diff --git a/cave/ohd.hseb.monitor/logging/RiverMonitor.6.20080822 b/cave/ohd.hseb.monitor/logging/RiverMonitor.6.20080822
deleted file mode 100644
index c401849a56..0000000000
--- a/cave/ohd.hseb.monitor/logging/RiverMonitor.6.20080822
+++ /dev/null
@@ -1,23 +0,0 @@
-6
-**************************************
-6
-**************************************
-21:02:25: RiverMonitor Started
-6
-**************************************
-21:02:25: RiverMonitorDataManager.readValidHeightAndDischargePE(): Where Clause:where pe like 'H%' or pe like 'Q%'
-6
-**************************************
-21:02:25: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-6
-**************************************
-21:02:25: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-6
-**************************************
-21:02:25: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-6
-**************************************
-21:02:26: RiverMonitorSettings.startRiverMonitor(): Trying to load from file :/awips/hydroapps/whfs/local/data/app/rivermon/DefaultRiverMonitorSettings.txt
-6
-**************************************
-21:02:29: Launch PRECIP Monitor [cmd:/home/ebabin/workspace/ohd.hseb.rivermonitor/src/scripts/start_rivermonitor Precip]
diff --git a/cave/ohd.hseb.monitor/logging/RiverMonitor.7.20080822 b/cave/ohd.hseb.monitor/logging/RiverMonitor.7.20080822
deleted file mode 100644
index 2efccee34c..0000000000
--- a/cave/ohd.hseb.monitor/logging/RiverMonitor.7.20080822
+++ /dev/null
@@ -1,38 +0,0 @@
-7
-**************************************
-7
-**************************************
-21:03:40: RiverMonitor Started
-7
-**************************************
-21:03:40: RiverMonitorDataManager.readValidHeightAndDischargePE(): Where Clause:where pe like 'H%' or pe like 'Q%'
-7
-**************************************
-21:03:41: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-7
-**************************************
-21:03:41: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-7
-**************************************
-21:03:41: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-7
-**************************************
-21:03:41: RiverMonitorSettings.startRiverMonitor(): Trying to load from file :/awips/hydroapps/whfs/local/data/app/rivermon/DefaultRiverMonitorSettings.txt
-7
-**************************************
-21:03:55: Launch PRECIP Monitor [cmd:/home/ebabin/workspace/ohd.hseb.rivermonitor/src/scripts/start_rivermonitor Precip]
-7
-**************************************
-21:03:56: RiverMonitorDataManager.createRiverMonitorRowDataList(): Memory Info before creating rowdata list:Free:63968112 Max:1023934464 total:65536000
-7
-**************************************
-21:04:00: RiverMonitorDataManager.readConfigFileAndFormConfigMap(): ConfigFile [awips/hydroapps/whfs/local/data/app/rivermon/RiverMonitorPEConfig.txt] doesn't exist
-7
-**************************************
-21:04:01: RiverMonLocGroupDataManager.initRiverMonGroupMap(): Where Clause:order by ordinal
-7
-**************************************
-21:04:01: RiverMonitorLocGroupDataManager.initRiverMonLocationMap(): Where Clause:where group_id not like 'DEFAULT' order by ordinal
-7
-**************************************
-21:04:01: RiverMonitorDataManager.createRiverMonitorRowDataList(): Here 1: Free:150952936 Max:1023934464 total:158924800
diff --git a/cave/ohd.hseb.monitor/logging/RiverMonitor.8.20080822 b/cave/ohd.hseb.monitor/logging/RiverMonitor.8.20080822
deleted file mode 100644
index 5e8fa83759..0000000000
--- a/cave/ohd.hseb.monitor/logging/RiverMonitor.8.20080822
+++ /dev/null
@@ -1,20 +0,0 @@
-8
-**************************************
-8
-**************************************
-21:10:00: RiverMonitor Started
-8
-**************************************
-21:10:00: RiverMonitorDataManager.readValidHeightAndDischargePE(): Where Clause:where pe like 'H%' or pe like 'Q%'
-8
-**************************************
-21:10:00: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-8
-**************************************
-21:10:00: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-8
-**************************************
-21:10:00: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-8
-**************************************
-21:10:00: RiverMonitorSettings.startRiverMonitor(): Trying to load from file :/awips/hydroapps/whfs/local/data/app/rivermon/DefaultRiverMonitorSettings.txt
diff --git a/cave/ohd.hseb.monitor/logging/RiverMonitor.9.20080822 b/cave/ohd.hseb.monitor/logging/RiverMonitor.9.20080822
deleted file mode 100644
index b8fa443263..0000000000
--- a/cave/ohd.hseb.monitor/logging/RiverMonitor.9.20080822
+++ /dev/null
@@ -1,20 +0,0 @@
-9
-**************************************
-9
-**************************************
-21:11:12: RiverMonitor Started
-9
-**************************************
-21:11:12: RiverMonitorDataManager.readValidHeightAndDischargePE(): Where Clause:where pe like 'H%' or pe like 'Q%'
-9
-**************************************
-21:11:12: OfficeNotesDataManager.readDataFromOfficeNotes(): Where Clause:order by topic, id, postingtime
-9
-**************************************
-21:11:12: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-9
-**************************************
-21:11:12: Derived columns file doesnt exist :[/awips/hydroapps/whfs/local/data/app/rivermon/DerivedColumns.txt]
-9
-**************************************
-21:11:12: RiverMonitorSettings.startRiverMonitor(): Trying to load from file :/awips/hydroapps/whfs/local/data/app/rivermon/DefaultRiverMonitorSettings.txt
diff --git a/cave/ohd.hseb.monitor/ohd.hseb.monitor.ecl b/cave/ohd.hseb.monitor/ohd.hseb.monitor.ecl
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/cave/ohd.hseb.monitor/plugin.xml b/cave/ohd.hseb.monitor/plugin.xml
deleted file mode 100644
index eeaf12313a..0000000000
--- a/cave/ohd.hseb.monitor/plugin.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/cave/ohd.hseb.monitor/src/com/raytheon/monitor/action/OpenPrecipMonitorAction.java b/cave/ohd.hseb.monitor/src/com/raytheon/monitor/action/OpenPrecipMonitorAction.java
deleted file mode 100644
index b0b9b8b475..0000000000
--- a/cave/ohd.hseb.monitor/src/com/raytheon/monitor/action/OpenPrecipMonitorAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * This software was developed and / or modified by Raytheon Company,
- * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
- *
- * U.S. EXPORT CONTROLLED TECHNICAL DATA
- * This software product contains export-restricted data whose
- * export/transfer/disclosure is restricted by U.S. law. Dissemination
- * to non-U.S. persons whether in the United States or abroad requires
- * an export license or other authorization.
- *
- * Contractor Name: Raytheon Company
- * Contractor Address: 6825 Pine Street, Suite 340
- * Mail Stop B8
- * Omaha, NE 68106
- * 402.291.0100
- *
- * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
- * further licensing information.
- **/
-package com.raytheon.monitor.action;
-
-import ohd.hseb.monitor.Monitor;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPersistentPreferenceStore;
-
-import com.raytheon.monitor.activator.Activator;
-
-/**
- * TODO Add Description OpenRiverMonitor.java 11 Sept, 2008
- *
- *
- * SOFTWARE HISTORY
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * 10sept2008 #1509 dhladky Finished Monitor integration.
- *
- *
- *
- * @author dhladky
- * @version 1.0
- */
-
-public class OpenPrecipMonitorAction extends AbstractHandler {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- IPersistentPreferenceStore store = Activator.getDefault()
- .getPreferenceStore();
- String databaseConnectionString = store
- .getString(com.raytheon.monitor.preferences.PreferenceConstants.JDBC_URL);
- String missingRepresent = store
- .getString(com.raytheon.monitor.preferences.PreferenceConstants.MISSING_PRESENTATION);
- // connectionString
- // missingRepresentation.
- // PRECIP, or else, launches RiverMontior...
- if (databaseConnectionString == null
- || databaseConnectionString.equalsIgnoreCase("")) {
- MessageDialog
- .openError(
- null,
- "Error Starting Precip Monitor",
- "Database connection string not set, or incorrect, please verify River Apps settings on preference page.");
- } else {
- String[] args = { databaseConnectionString, missingRepresent,
- "Precip" };
- if (!Monitor.precipExists()) {
- Monitor.getPrecipInstance().main(args);
- } else {
- System.out.println("PrecipMonitor...Already running!");
- }
- }
- return null;
- }
-}
-
diff --git a/cave/ohd.hseb.monitor/src/com/raytheon/monitor/action/OpenRiverMonitorAction.java b/cave/ohd.hseb.monitor/src/com/raytheon/monitor/action/OpenRiverMonitorAction.java
deleted file mode 100644
index 028f376f89..0000000000
--- a/cave/ohd.hseb.monitor/src/com/raytheon/monitor/action/OpenRiverMonitorAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * This software was developed and / or modified by Raytheon Company,
- * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
- *
- * U.S. EXPORT CONTROLLED TECHNICAL DATA
- * This software product contains export-restricted data whose
- * export/transfer/disclosure is restricted by U.S. law. Dissemination
- * to non-U.S. persons whether in the United States or abroad requires
- * an export license or other authorization.
- *
- * Contractor Name: Raytheon Company
- * Contractor Address: 6825 Pine Street, Suite 340
- * Mail Stop B8
- * Omaha, NE 68106
- * 402.291.0100
- *
- * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
- * further licensing information.
- **/
-package com.raytheon.monitor.action;
-
-import ohd.hseb.monitor.Monitor;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPersistentPreferenceStore;
-
-import com.raytheon.monitor.activator.Activator;
-
-/**
- * TODO Add Description OpenRiverMonitor.java Jul 23, 2008
- *
- *
- * SOFTWARE HISTORY
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Jul 23, 2008 Eric Babin Initial Creation
- * 10sept2008 #1509 dhladky Finished integration.
- *
- *
- *
- * @author ebabin
- * @version 1.0
- */
-
-public class OpenRiverMonitorAction extends AbstractHandler {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- IPersistentPreferenceStore store = Activator.getDefault()
- .getPreferenceStore();
-
- String databaseConnectionString = store
- .getString(com.raytheon.monitor.preferences.PreferenceConstants.JDBC_URL);
- String missingRepresent = store
- .getString(com.raytheon.monitor.preferences.PreferenceConstants.MISSING_PRESENTATION);
- // connectionString
- // missingRepresentation.
- // PRECIP, or else, launches RiverMontior...
- if (databaseConnectionString == null
- || databaseConnectionString.equalsIgnoreCase("")) {
- MessageDialog
- .openError(
- null,
- "Error Starting River Monitor",
- "Database connection string not set, or incorrect, please verify River Apps settings on preference page.");
- } else {
- String[] args = { databaseConnectionString, missingRepresent,
- "River" };
- if (!Monitor.riverExists()) {
- Monitor.getRiverInstance().main(args);
- } else {
- System.out.println("RiverMonitor...Already running!");
- }
- }
- return null;
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/com/raytheon/monitor/activator/Activator.java b/cave/ohd.hseb.monitor/src/com/raytheon/monitor/activator/Activator.java
deleted file mode 100755
index 7a2f34e2e2..0000000000
--- a/cave/ohd.hseb.monitor/src/com/raytheon/monitor/activator/Activator.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package com.raytheon.monitor.activator;
-
-import org.eclipse.jface.preference.IPersistentPreferenceStore;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore;
-
-/**
- *
- * The activator class controls the plug-in life cycle
- *
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Mar 3, 2014 2861 mschenke Create preference store immediately
- *
- *
- *
- * @author unknown
- * @version 1.0
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "ohd.hseb.monitor";
-
- // The shared instance
- private static Activator plugin;
-
- private IPersistentPreferenceStore prefs = new HierarchicalPreferenceStore(
- this);
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
- * )
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
- * )
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore()
- */
- @Override
- public IPersistentPreferenceStore getPreferenceStore() {
- return prefs;
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/com/raytheon/monitor/preferences/MonitorPreferences.java b/cave/ohd.hseb.monitor/src/com/raytheon/monitor/preferences/MonitorPreferences.java
deleted file mode 100644
index 4136537085..0000000000
--- a/cave/ohd.hseb.monitor/src/com/raytheon/monitor/preferences/MonitorPreferences.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * This software was developed and / or modified by Raytheon Company,
- * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
- *
- * U.S. EXPORT CONTROLLED TECHNICAL DATA
- * This software product contains export-restricted data whose
- * export/transfer/disclosure is restricted by U.S. law. Dissemination
- * to non-U.S. persons whether in the United States or abroad requires
- * an export license or other authorization.
- *
- * Contractor Name: Raytheon Company
- * Contractor Address: 6825 Pine Street, Suite 340
- * Mail Stop B8
- * Omaha, NE 68106
- * 402.291.0100
- *
- * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
- * further licensing information.
- **/
-
-package com.raytheon.monitor.preferences;
-
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-import com.raytheon.monitor.activator.Activator;
-
-/**
- * OHD monitor preferences page
- *
- *
- * SOFTWARE HISTORY
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Aug 25, 2008 ebabin Initial creation
- * Oct, 1, 2008 randerso Fixed a babinism
- * 16Jan2009 1860 MW Fegan get defaults from plug-in.
- *
- *
- * @author randerso
- * @version 1.0
- */
-public class MonitorPreferences extends FieldEditorPreferencePage implements
- IWorkbenchPreferencePage {
-
- public MonitorPreferences() {
- super(GRID);
- setPreferenceStore(Activator.getDefault().getPreferenceStore());
- }
-
- @Override
- public void createFieldEditors() {
-
- addField(new StringFieldEditor(
- com.raytheon.monitor.preferences.PreferenceConstants.JDBC_URL,
- "&Database Connection String", getFieldEditorParent()));
- addField(new StringFieldEditor(
- com.raytheon.monitor.preferences.PreferenceConstants.RIVERMON_CONFIG_DIR,
- "&Config Directory", getFieldEditorParent()));
- addField(new StringFieldEditor(
- com.raytheon.monitor.preferences.PreferenceConstants.RIVERMON_LOG_DIR,
- "&Log Directory", getFieldEditorParent()));
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- /*
- * intentionally empty -- causes page to be populated using the
- * plug-in's config.xml
- */
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/com/raytheon/monitor/preferences/PreferenceConstants.java b/cave/ohd.hseb.monitor/src/com/raytheon/monitor/preferences/PreferenceConstants.java
deleted file mode 100644
index d2cf0c8dbd..0000000000
--- a/cave/ohd.hseb.monitor/src/com/raytheon/monitor/preferences/PreferenceConstants.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * This software was developed and / or modified by Raytheon Company,
- * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
- *
- * U.S. EXPORT CONTROLLED TECHNICAL DATA
- * This software product contains export-restricted data whose
- * export/transfer/disclosure is restricted by U.S. law. Dissemination
- * to non-U.S. persons whether in the United States or abroad requires
- * an export license or other authorization.
- *
- * Contractor Name: Raytheon Company
- * Contractor Address: 6825 Pine Street, Suite 340
- * Mail Stop B8
- * Omaha, NE 68106
- * 402.291.0100
- *
- * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
- * further licensing information.
- **/
-package com.raytheon.monitor.preferences;
-
-/**
- * TODO Add Description PreferenceConstants.java Aug 5, 2008
- *
- *
- * SOFTWARE HISTORY
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Aug 5, 2008 Eric Babin Initial Creation
- *
- *
- *
- * @author ebabin
- * @version 1.0
- */
-
-public class PreferenceConstants {
-
- public static final String UNDEFINED = "UNDEFINED";
-
- public static final String DATABASE_NAME = "databaseName";
-
- public static final String JDBC_URL = "jdbcUrl";
-
- public static final String SETTINGS_DIR = "settingsDir";
-
- public static final String SETTINGS_FILE = "settingsFile";
-
- public static final String DEFAULT_FILE = "defaultFile";
-
- public static final String PE_CONFIG_FILE = "peConfigFile";
-
- public static final String LOG_FILE = "logFile";
-
- public static final String ICONS_DIR = "iconsDir";
-
- public static final String DERIVED_COLUMNS_FILE = "derivedColumnsFile";
-
- public static final String MISSING_PRESENTATION = "missingPresentation";
-
- public static final String GAFF_MOSAIC_DIR = "gaff_mosaic_dir";
-
- public static final String GAFF_INPUT_DIR = "gaff_input_dir";
-
- public static final String PDC_PP_DIR = "pdc_pp_dir";
-
- public static final String RIVERMON_CONFIG_DIR = "rivermon_config_dir";
-
- public static final String RIVERMON_LOG_DIR = "rivermon_log_dir";
-
- public static final String SSHP_BACKGROUND_FORECAST_OUTPUT_DIR = "sshp_background_forecast_output_dir";
-
- public static final String WHFS_BIN_DIR = "whfs_bin_dir";
-
- public static final String WHFS_LOCAL_BIN_DIR = "whfs_local_bin_dir";
-
- public static final String WHFS_EDITOR = "whfs_editor";
-
- public static final String WHFS_REPORT_DIR = "whfs_report_dir";
-
- public static final String ST3_RFC = "st3_rfc";
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/alertalarm/AlertAlarmColumns.java b/cave/ohd.hseb.monitor/src/ohd/hseb/alertalarm/AlertAlarmColumns.java
deleted file mode 100755
index cb16bc457e..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/alertalarm/AlertAlarmColumns.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package ohd.hseb.alertalarm;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import ohd.hseb.util.gui.jtable.JTableColumnDescriptor;
-
-public class AlertAlarmColumns
-{
- public static String LID = "LocId";
- public static String PE = "PE";
- public static String DUR= "Dur";
- public static String TS = "TS";
- public static String EXT = "Ext";
- public static String PROB = "Prob";
- public static String VALID_TIME = "ValidTime";
- public static String BASIS_TIME = "BasisTime";
- public static String VALUE = "Value";
- public static String SUP_VALUE = "Sup Val";
- public static String SHEF_QUAL_CODE = "SQC";
- public static String QUAL_CODE = "QC";
- public static String REVISION = "Rev";
- public static String PRODUCT_ID = "ProdId";
- public static String PROD_TIME = "ProductTime";
- public static String POSTING_TIME = "PostingTime";
- public static String ACTION_TIME = "ActionTime";
- public static String DESC = "Desc";
- public static String THREAT = "Threat";
-
-
- /**
- * Creates a list of alertalarm columns each of type JTableColumnDescriptor object.
- * If the parameter passed is null then the new list is created and the alertalarm columns are added to it,
- * if not the alertalarm columns are added to the list that is passed as argument.
- * The created new list is returned.
- * @param officeNotesColumnDescriptorList
- * @return
- */
- public List getAlertAlarmColumnsList(List alertAlarmColumnDescriptorList)
- {
- if( alertAlarmColumnDescriptorList == null)
- {
- alertAlarmColumnDescriptorList = new ArrayList();
- }
-
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(LID, true, 50, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(PE, true, 25, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(DUR, true, 25, "right"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(TS, true, 25, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(EXT, true, 25, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(PROB, true, 35, "right"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(VALID_TIME, true, 90, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(BASIS_TIME, true, 90, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(VALUE, true, 50, "right"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(SUP_VALUE, true, 50, "right"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(SHEF_QUAL_CODE, true, 35, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(QUAL_CODE, true, 40, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(REVISION, true, 25, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(PRODUCT_ID, true, 100, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(PROD_TIME, true, 90, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(POSTING_TIME, true, 90, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(ACTION_TIME, true, 70, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(DESC, true, 45, "center"));
- alertAlarmColumnDescriptorList.add(new JTableColumnDescriptor(THREAT, true, 45, "center"));
-
- return alertAlarmColumnDescriptorList;
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/alertalarm/AlertAlarmDataManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/alertalarm/AlertAlarmDataManager.java
deleted file mode 100755
index 571d0f64c1..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/alertalarm/AlertAlarmDataManager.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package ohd.hseb.alertalarm;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.JOptionPane;
-
-import ohd.hseb.db.Database;
-import ohd.hseb.db.DbTable;
-import ohd.hseb.ihfsdb.generated.AlertAlarmValRecord;
-import ohd.hseb.ihfsdb.generated.AlertAlarmValTable;
-import ohd.hseb.util.SessionLogger;
-
-public class AlertAlarmDataManager
-{
- private Database _db = null;
- private SessionLogger _logger = null;
- private String _missingRepresentation;
-
- public AlertAlarmDataManager(Database dbHandler, SessionLogger logger, String missingRepresentation)
- {
- super();
- _db = dbHandler;
- _logger = logger;
- _missingRepresentation = missingRepresentation;
-
- if (_db == null)
- {
- JOptionPane.showMessageDialog(null, "Database should be provided","AlertAlarm Application", JOptionPane.PLAIN_MESSAGE);
- System.exit(0);
- }
- }
-
- public void logSQLException(SQLException exception)
- {
- _logger.log("SQL ERROR = " +
- exception.getErrorCode() + " " +
- exception.getMessage());
-
- exception.printStackTrace(_logger.getPrintWriter());
-
- _logger.log("End of stack trace");
-
- }
-
- public List readDataFromAlertAlarmVal()
- {
- List alertAlarmInfoList = null;
- List dataList = null;
- String header = "AlertAlarmDataManager.readDataFromAlertAlarmVal(): ";
- AlertAlarmValTable alertAlarmValTable = new AlertAlarmValTable(_db);
- AlertAlarmValRecord alertAlarmValRecord = null;
- String whereClause = null;
- try
- {
- whereClause = "order by lid";
- alertAlarmInfoList = alertAlarmValTable.select(whereClause);
- _logger.log(header + " Where clause:"+ whereClause);
- if(alertAlarmInfoList != null)
- {
- dataList = new ArrayList();
- for(int i=0;i < alertAlarmInfoList.size(); i++)
- {
-
- alertAlarmValRecord = (AlertAlarmValRecord) alertAlarmInfoList.get(i);
- AlertAlarmJTableRowData rowData = new AlertAlarmJTableRowData(_missingRepresentation);
- //rowData.setAlertAlarmRecord(alertAlarmValRecord);
- rowData.setLid(alertAlarmValRecord.getLid());
- rowData.setPe(alertAlarmValRecord.getPe());
- rowData.setTs(alertAlarmValRecord.getTs());
-
- rowData.setDur(alertAlarmValRecord.getDur());
-
- rowData.setExtremum(alertAlarmValRecord.getExtremum());
-
- if(alertAlarmValRecord.getProbability() == -1.0)
- {
- rowData.setProbability(DbTable.getNullFloat());
- }
- else
- {
- rowData.setProbability(alertAlarmValRecord.getProbability());
- }
-
- rowData.setValidTime(alertAlarmValRecord.getValidtime());
- rowData.setBasisTime(alertAlarmValRecord.getBasistime());
-
- rowData.setValue(alertAlarmValRecord.getValue());
-
- if(alertAlarmValRecord.getSuppl_value() == -9999.0)
- {
- rowData.setSupplValue(DbTable.getNullDouble());
- }
- else
- {
- rowData.setSupplValue(alertAlarmValRecord.getSuppl_value());
- }
-
- rowData.setShefQualCode(alertAlarmValRecord.getShef_qual_code());
-
- String result = null;
- if(alertAlarmValRecord.getQuality_code() == DbTable.getNullInt())
- result = _missingRepresentation;
- else if(alertAlarmValRecord.getQuality_code() >= 1610612736)
- result = "Good";
- else if(alertAlarmValRecord.getQuality_code() >= 1073741824)
- result = "Quest";
- else
- result = "Bad";
-
- rowData.setQualityCode(result);
-
- if(alertAlarmValRecord.getRevision() == DbTable.getNullShort())
- {
- result = _missingRepresentation;
- }
- else if(alertAlarmValRecord.getRevision() == 1)
- {
- result = "Y";
- }
- else
- {
- result = "N";
- }
- rowData.setRevision(result);
-
- rowData.setProductId(alertAlarmValRecord.getProduct_id());
-
- rowData.setProductTime(alertAlarmValRecord.getProducttime());
-
- rowData.setPostingTime(alertAlarmValRecord.getPostingtime());
-
- rowData.setActionTime(alertAlarmValRecord.getAction_time());
-
- rowData.setAaCateg(alertAlarmValRecord.getAa_categ());
- rowData.setAaCheck(alertAlarmValRecord.getAa_check());
- rowData.addAllCellsToMap();
- dataList.add(rowData);
- }
- }
- else
- {
- _logger.log(header+" AlertAlarminfo list is null");
- }
- }
- catch(SQLException e)
- {
- logSQLException(e);
- }
- return dataList;
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/alertalarm/AlertAlarmDialog.java b/cave/ohd.hseb.monitor/src/ohd/hseb/alertalarm/AlertAlarmDialog.java
deleted file mode 100755
index c60da12f47..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/alertalarm/AlertAlarmDialog.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package ohd.hseb.alertalarm;
-
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.List;
-
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-
-import ohd.hseb.util.SessionLogger;
-import ohd.hseb.util.gui.WindowResizingManager;
-import ohd.hseb.util.gui.jtable.ComplexJTableManager;
-import ohd.hseb.util.gui.jtable.JTableManager;
-
-public class AlertAlarmDialog extends JDialog
-{
- private List _alertAlarmColumnDescriptorList = null;
- private JTableManager _alertAlarmTableManager = null;
- private AlertAlarmDataManager _alertAlarmDataMgr = null;
- private List _allRowDataList = null;
- private JScrollPane _tableScrollPane = null;
- private SessionLogger _logger = null;
- private int _previousRowToHighlight = -1;
- private JFrame _mainFrame = null;
- private JMenuBar _menuBar;
- private JMenu _fileMenu;
- private JMenuItem _selectColumnsMenuItem;
-
- public AlertAlarmDialog(JFrame mainFrame, AlertAlarmDataManager alertAlarmDataMgr, SessionLogger logger)
- {
- super(mainFrame, true);
- _mainFrame = mainFrame;
- _logger = logger;
- this.setTitle("AlertAlarm");
- this.getContentPane().setLayout(new GridBagLayout());
- _alertAlarmDataMgr = alertAlarmDataMgr;
- initialize();
- Dimension dim = new Dimension(1040,560);
- new WindowResizingManager(this, dim, dim);
- this.pack();
- this.setLocation(25, 25);
- }
-
- public void showAlertAlarmDialog(String lid)
- {
- _allRowDataList = _alertAlarmDataMgr.readDataFromAlertAlarmVal();
- _alertAlarmTableManager.setChangedAllRowDataList(_allRowDataList);
- _alertAlarmTableManager.refreshDisplay();
-
- if(lid != null)
- {
- _alertAlarmTableManager.deselectRows(_previousRowToHighlight, _previousRowToHighlight);
- int rowToHighLight = _alertAlarmTableManager.getTheRowIndexToHighLightBasedOnValue(lid);
- if(rowToHighLight != -1)
- {
- System.out.println("Row to highlight:"+ rowToHighLight);
- _alertAlarmTableManager.selectRows(rowToHighLight, rowToHighLight);
- _previousRowToHighlight = rowToHighLight;
- }
- }
- this.setVisible(true);
- }
-
- private void initialize()
- {
- _alertAlarmColumnDescriptorList = new AlertAlarmColumns().getAlertAlarmColumnsList(_alertAlarmColumnDescriptorList);
- _allRowDataList = _alertAlarmDataMgr.readDataFromAlertAlarmVal();
- _alertAlarmTableManager = new ComplexJTableManager(_alertAlarmColumnDescriptorList, _allRowDataList);
- String columnsSelected[] = _alertAlarmTableManager.getColumnNamesThatAreCurrentlyDisplayed();
- _alertAlarmTableManager.setDisplayableColumns(columnsSelected, true, true);
- _alertAlarmTableManager.setPreferredSizeForJScrollPane(new Dimension(1020, 500));
- _tableScrollPane = _alertAlarmTableManager.getJScrollPane();
-
- JPanel tableScrollPanePanel = new JPanel();
- tableScrollPanePanel.add(_tableScrollPane);
- tableScrollPanePanel.setMinimumSize(new Dimension(1030,510));
- JPanel tablePanel = new JPanel();
- tablePanel.add(tableScrollPanePanel);
-
- _menuBar = new JMenuBar();
- this.setJMenuBar(_menuBar);
-
- _fileMenu = new JMenu("File");
- _selectColumnsMenuItem = new JMenuItem("Select Columns ...");
- _selectColumnsMenuItem.setMnemonic('S');
- _fileMenu.add(_selectColumnsMenuItem);
-
- _menuBar.add(_fileMenu);
-
- ChangeColumnsDisplayedMenuListener changeMenuListener = new
- ChangeColumnsDisplayedMenuListener();
- _selectColumnsMenuItem.addActionListener(changeMenuListener);
-
- Container contentPane = this.getContentPane();
- contentPane.add(tablePanel);
- }
-
- private class ChangeColumnsDisplayedMenuListener implements ActionListener
- {
- public void actionPerformed(ActionEvent e)
- {
- _alertAlarmTableManager.invokeColumnSelector(_mainFrame);
-
- }
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/alertalarm/AlertAlarmJTableRowData.java b/cave/ohd.hseb.monitor/src/ohd/hseb/alertalarm/AlertAlarmJTableRowData.java
deleted file mode 100755
index 1dce67be70..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/alertalarm/AlertAlarmJTableRowData.java
+++ /dev/null
@@ -1,221 +0,0 @@
-package ohd.hseb.alertalarm;
-
-import ohd.hseb.util.gui.jtable.AbstractJTableRowData;
-import ohd.hseb.util.gui.jtable.BaseTableCell;
-import ohd.hseb.util.gui.jtable.CellType;
-
-public class AlertAlarmJTableRowData extends AbstractJTableRowData
-{
- private String _lid;
- private String _pe;
- private short _dur;
- private String _ts;
- private String _extremum;
- private float _probability;
- private long _validTime;
- private long _basisTime;
- private double _value;
- private double _supplValue;
- private String _shefQualCode;
- private String _qualityCode;
- private String _revision;
- private String _productId;
- private long _productTime;
- private long _postingTime;
- private long _actionTime;
- private String _aaCateg;
- private String _aaCheck;
-
- public AlertAlarmJTableRowData(String missingRepresentation)
- {
- setMissingRepresentation(missingRepresentation);
- }
-
- public String getAaCateg()
- {
- return _aaCateg;
- }
- public void setAaCateg(String aaCateg)
- {
- _aaCateg = aaCateg;
- }
- public String getAaCheck()
- {
- return _aaCheck;
- }
- public void setAaCheck(String aaCheck)
- {
- _aaCheck = aaCheck;
- }
- public long getActionTime()
- {
- return _actionTime;
- }
- public void setActionTime(long actionTime)
- {
- _actionTime = actionTime;
- }
- public long getBasisTime()
- {
- return _basisTime;
- }
- public void setBasisTime(long basisTime)
- {
- _basisTime = basisTime;
- }
- public short getDur()
- {
- return _dur;
- }
- public void setDur(short dur)
- {
- this._dur = dur;
- }
- public String getExtremum()
- {
- return _extremum;
- }
- public void setExtremum(String extremum)
- {
- this._extremum = extremum;
- }
- public String getLid()
- {
- return _lid;
- }
- public void setLid(String lid)
- {
- this._lid = lid;
- }
- public String getPe()
- {
- return _pe;
- }
- public void setPe(String pe)
- {
- this._pe = pe;
- }
- public long getPostingTime()
- {
- return _postingTime;
- }
- public void setPostingTime(long postingTime)
- {
- _postingTime = postingTime;
- }
- public float getProbability()
- {
- return _probability;
- }
- public void setProbability(float probability)
- {
- this._probability = probability;
- }
- public String getProductId()
- {
- return _productId;
- }
- public void setProductId(String productId)
- {
- _productId = productId;
- }
- public long getProductTime()
- {
- return _productTime;
- }
- public void setProductTime(long productTime)
- {
- _productTime = productTime;
- }
- public String getQualityCode()
- {
- return _qualityCode;
- }
- public void setQualityCode(String qualityCode)
- {
- _qualityCode = qualityCode;
- }
- public String getRevision()
- {
- return _revision;
- }
- public void setRevision(String revision)
- {
- this._revision = revision;
- }
- public String getShefQualCode()
- {
- return _shefQualCode;
- }
- public void setShefQualCode(String shefQualCode)
- {
- _shefQualCode = shefQualCode;
- }
- public double getSupplValue()
- {
- return _supplValue;
- }
- public void setSupplValue(double supplValue)
- {
- _supplValue = supplValue;
- }
- public String getTs()
- {
- return _ts;
- }
- public void setTs(String ts)
- {
- this._ts = ts;
- }
- public long getValidTime()
- {
- return _validTime;
- }
- public void setValidTime(long validTime)
- {
- _validTime = validTime;
- }
- public double getValue()
- {
- return _value;
- }
- public void setValue(double value)
- {
- this._value = value;
- }
-
- // -----------------------------------------------------------------------------------
-
- private void addToCellMap(String columnName, CellType cellType,
- Object value)
- {
- BaseTableCell cell = new BaseTableCell (columnName, cellType, value, getMissingRepresentation(), "MM/dd - HH:mm");
- addCell(cell);
-
- }
-
- public void addAllCellsToMap()
- {
- addToCellMap(AlertAlarmColumns.LID, CellType.STRING, getLid());
- addToCellMap(AlertAlarmColumns.PE, CellType.STRING, getPe());
- addToCellMap(AlertAlarmColumns.DUR, CellType.SHORT, getDur());
- addToCellMap(AlertAlarmColumns.TS, CellType.STRING, getTs());
- addToCellMap(AlertAlarmColumns.EXT, CellType.STRING, getExtremum());
- addToCellMap(AlertAlarmColumns.PROB, CellType.FLOAT,getProbability());
- addToCellMap(AlertAlarmColumns.VALID_TIME,CellType.DATE_TIME, getValidTime());
- addToCellMap(AlertAlarmColumns.BASIS_TIME,CellType.DATE_TIME,getBasisTime());
- addToCellMap(AlertAlarmColumns.VALUE,CellType.DOUBLE, getValue());
- addToCellMap(AlertAlarmColumns.SUP_VALUE, CellType.DOUBLE, getSupplValue());
- addToCellMap(AlertAlarmColumns.SHEF_QUAL_CODE, CellType.STRING, getShefQualCode());
- addToCellMap(AlertAlarmColumns.QUAL_CODE,CellType.STRING, getQualityCode());
- addToCellMap(AlertAlarmColumns.REVISION, CellType.STRING, getRevision());
- addToCellMap(AlertAlarmColumns.PRODUCT_ID, CellType.STRING, getProductId());
- addToCellMap(AlertAlarmColumns.PROD_TIME, CellType.DATE_TIME, getProductTime());
- addToCellMap(AlertAlarmColumns.POSTING_TIME, CellType.DATE_TIME, getPostingTime());
- addToCellMap(AlertAlarmColumns.ACTION_TIME, CellType.DATE_TIME, getActionTime());
- addToCellMap(AlertAlarmColumns.DESC, CellType.STRING, getAaCateg());
- addToCellMap(AlertAlarmColumns.THREAT, CellType.STRING,getAaCheck());
-
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/DataFilter.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/DataFilter.java
deleted file mode 100755
index d3ee26865b..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/DataFilter.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package ohd.hseb.monitor;
-
-import java.util.List;
-
-import ohd.hseb.util.gui.jtable.JTableRowData;
-
-public interface DataFilter
-{
- /**
- * Returns the filtered row data list
- * @param allRowDataList
- * @return
- */
- List filter(List allRowDataList);
-
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/LocationDataFilter.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/LocationDataFilter.java
deleted file mode 100755
index 6fe4e96124..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/LocationDataFilter.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package ohd.hseb.monitor;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import ohd.hseb.util.gui.jtable.JTableRowData;
-
-public abstract class LocationDataFilter implements DataFilter
-{
- protected Map _locationDisplayMap;
-
- public LocationDataFilter(Map locationDisplayMap)
- {
- _locationDisplayMap = locationDisplayMap;
- }
-
- public LocationDataFilter()
- {
- _locationDisplayMap = new HashMap();
- }
-
- public Map getLocationDisplayMap()
- {
- return _locationDisplayMap;
- }
-
- /**
- * Set this location to be displayed / not
- * @param locationId
- * @param shouldDisplay - true / false
- */
- public void setDisplayStatus(String locationId, Boolean shouldDisplay)
- {
- _locationDisplayMap.put(locationId, shouldDisplay);
- }
-
- /**
- * Reset all locations in the location display map
- *
- */
- public void blockAllLocations()
- {
- Set locationIdSet = _locationDisplayMap.keySet();
-
- Iterator iterator = locationIdSet.iterator();
- while(iterator.hasNext())
- {
- String locationId = iterator.next().toString();
- _locationDisplayMap.put(locationId, false);
- }
- }
-
- /**
- * Filter the allRowDataList based on the locationDisplayMap
- */
- public abstract List filter(List allRowDataList);
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/LocationInfoColumns.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/LocationInfoColumns.java
deleted file mode 100755
index 4d9d1d966d..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/LocationInfoColumns.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package ohd.hseb.monitor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import ohd.hseb.util.gui.jtable.JTableColumnDescriptor;
-
-public class LocationInfoColumns
-{
- public static final String GROUP_ID = "Group Id";
- public static final String GROUP_NAME = "Group Name";
- public static final String LOCATION_ID = "Location Id";
- public static final String LOCATION_NAME = "Location Name";
- public static final String HSA = "HSA";
- public static final String GROUP_ORDINAL = "Group Ordinal";
- public static final String LOCATION_ORDINAL = "Location Ordinal";
- public static final String COUNTY = "County";
- public static final String STATE = "State";
- public static final String RIVER_BASIN = "River Basin";
-
-
- /**
- * Creates a list of location info columns each of type JTableColumnDescriptor object.
- * If the parameter passed is null then the new list is created and the location info columns are added to it,
- * if not the location info columns are added to the list that is passed as argument.
- * The created new list is returned.
- * @param locationInfoColumnDescriptorList
- * @return
- */
- public List getLocationInfoColumnsList(List locationInfoColumnDescriptorList)
- {
- String textAlignment = "center";
- String numberAlignment = "right";
-
- if( locationInfoColumnDescriptorList == null)
- {
- locationInfoColumnDescriptorList = new ArrayList();
- }
-
- locationInfoColumnDescriptorList.add(new JTableColumnDescriptor(GROUP_ID, textAlignment, "Group Identification"));
- locationInfoColumnDescriptorList.add(new JTableColumnDescriptor(GROUP_NAME, textAlignment, "Group Name"));
- locationInfoColumnDescriptorList.add(new JTableColumnDescriptor(LOCATION_ID, textAlignment, "Location Identification"));
- locationInfoColumnDescriptorList.add(new JTableColumnDescriptor(LOCATION_NAME, textAlignment, "Location Name"));
- locationInfoColumnDescriptorList.add(new JTableColumnDescriptor(HSA, textAlignment, "Hydrologic Service Area"));
- locationInfoColumnDescriptorList.add(new JTableColumnDescriptor(GROUP_ORDINAL, numberAlignment, "Group Ordinal"));
- locationInfoColumnDescriptorList.add(new JTableColumnDescriptor(LOCATION_ORDINAL, numberAlignment, "Location Ordinal"));
- locationInfoColumnDescriptorList.add(new JTableColumnDescriptor(COUNTY, textAlignment, "County Name"));
- locationInfoColumnDescriptorList.add(new JTableColumnDescriptor(STATE, textAlignment, "State Name"));
- locationInfoColumnDescriptorList.add(new JTableColumnDescriptor(RIVER_BASIN, textAlignment, "River Basin"));
-
-
- return locationInfoColumnDescriptorList;
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/Monitor.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/Monitor.java
deleted file mode 100755
index 85e9016ffa..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/Monitor.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package ohd.hseb.monitor;
-
-import ohd.hseb.db.Database;
-import ohd.hseb.monitor.precip.manager.PrecipMonitorAppManager;
-import ohd.hseb.monitor.river.manager.RiverMonitorAppManager;
-
-public class Monitor
-{
- private static Monitor precipInstance = null;
- private static Monitor riverInstance = null;
-
- public Monitor() {
-
- }
-
- /**
- * Gets the river instance.
- * @return Monitor
- */
- public static Monitor getRiverInstance() {
- if(riverInstance == null) {
- riverInstance = new Monitor();
- }
- return riverInstance;
- }
-
- /**
- * Gets the precip instance.
- * @return Monitor
- */
- public static Monitor getPrecipInstance() {
- if(precipInstance == null) {
- precipInstance = new Monitor();
- }
- return precipInstance;
- }
-
- /**
- * Check to see if river instance exists.
- * @return boolean
- */
- public static boolean riverExists() {
- boolean exists = false;
- if(riverInstance != null) {
- exists = true;
- }
- return exists;
- }
-
- /**
- * Check to see if river instance exists.
- * @return boolean
- */
- public static boolean precipExists() {
- boolean exists = false;
- if(precipInstance != null) {
- exists = true;
- }
- return exists;
- }
-
- /**
- * Get rid of river instance.
- */
- public static void disposeRiver() {
- riverInstance = null;
- }
-
- /**
- * Get rid of precip instance.
- */
- public static void disposePrecip() {
- precipInstance = null;
- }
-
- public void main(String args[])
- {
- String connectionString = args[0];
- Database db = createDatabaseConnection(connectionString);
-
- String missingRepresentation = args[1];
- String version = "OB8.3";
- String versionDate = "Mar 18, 2008";
-
- String monitorName = args[2];
-
- MonitorTimeSeriesLiteManager monitorTimeSeriesLiteManager = new MonitorTimeSeriesLiteManager(connectionString);
-
- if(monitorName.equalsIgnoreCase("PRECIP"))
- {
- new PrecipMonitorAppManager(db, missingRepresentation, version, versionDate, monitorTimeSeriesLiteManager);
- }
- else // RIVER
- {
- new RiverMonitorAppManager(db, missingRepresentation, version, versionDate, monitorTimeSeriesLiteManager);
- }
- }
-
- public static String getVersion()
- {
- return "OB8.3";
- }
-
- private static Database createDatabaseConnection(String connectionString)
- {
- Database db;
- db = new Database();
-
- if (connectionString == null)
- {
- System.out.println( "RiverMonitor Application.........Database should be provided........");
-
- }
- db.connectWithDriverSearch(connectionString);
- return db;
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorCell.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorCell.java
deleted file mode 100755
index 44d7a87c9c..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorCell.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package ohd.hseb.monitor;
-
-import java.awt.Color;
-
-import ohd.hseb.util.gui.jtable.BaseTableCell;
-import ohd.hseb.util.gui.jtable.CellType;
-import ohd.hseb.util.gui.jtable.TableCellInterface;
-
-public class MonitorCell extends BaseTableCell
-{
- private ThreatLevel _monitorThreatLevel = ThreatLevel.NO_THREAT;
-
- private static int defaultDecimalPointsForDisplay = 2;
-
- // -------------------------------------------------------------------------------------------------------
-
- public MonitorCell (String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel,
- String missingRepresentation)
- {
- super(columnName, cellType, value, missingRepresentation, defaultDecimalPointsForDisplay);
- this.setThreatLevel(threatLevel);
- }
-
- public MonitorCell (String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel, Color cellBackgroundColor,
- String missingRepresentation,
- int decimalPointsForDisplay)
- {
- super(columnName, cellType, value, cellBackgroundColor, missingRepresentation,decimalPointsForDisplay);
- this.setThreatLevel(threatLevel);
- }
-
- public MonitorCell (String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel,
- String missingRepresentation,
- int decimalPointsForDisplay)
- {
- super(columnName, cellType, value, missingRepresentation,decimalPointsForDisplay);
- this.setThreatLevel(threatLevel);
- }
-
- public MonitorCell (String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel,
- String missingRepresentation,
- String dateFormatString)
- {
- super(columnName, cellType, value, missingRepresentation, dateFormatString);
- this.setThreatLevel(threatLevel);
- }
-
- public ThreatLevel getThreatLevel()
- {
- return _monitorThreatLevel;
- }
-
- public void setThreatLevel(ThreatLevel rivermonitorThreatLevel)
- {
- _monitorThreatLevel = rivermonitorThreatLevel;
- }
-
- public Color getCellBackgroundColor()
- {
- Color color = super.getCellBackgroundColor();
-
- if( color == Color.WHITE)
- {
- ThreatLevel threatLevel = getThreatLevel();
-
- switch(threatLevel)
- {
- case MISSING_DATA:
- color = Color.gray;
- break;
-
- case AGED_DATA:
- color = Color.gray;
- break;
-
- case CAUTION:
- color = Color.yellow;
- break;
-
- case ALERT:
- color = Color.red;
- break;
-
- default:
- color = Color.white;
- }
- }
- return color;
- }
-
- public Color getCellForegroundColor()
- {
- Color color = Color.black;
-
- Color backgroundColor = getCellBackgroundColor();
-
- if (backgroundColor.equals(Color.red) || (backgroundColor.equals(Color.gray) ) )
- {
- color = Color.yellow;
- }
-
- return color;
- }
-
- public int compare(TableCellInterface otherCell)
- {
- int result = 0;
-
- if (getCellType() != CellType.EXTENSION)
- {
- result = super.compare(otherCell);
- }
- else
- {
- result = compareThreat(otherCell);
- }
- return result;
- }
-
- private int compareThreat(TableCellInterface otherCell)
- {
- MonitorCell otherThreatCell = (MonitorCell) otherCell;
- int result = 0;
- result = getThreatLevel().compareTo(otherThreatCell.getThreatLevel());
- if(result == 0)
- {
- result = compareCells((String) getValue(), (String)otherCell.getValue());
- result *= -1;
- }
-
- return result;
- }
-
- public String getDisplayString()
- {
- String displayString = null;
-
- if (getCellType() != CellType.EXTENSION)
- {
- displayString = super.getDisplayString();
- }
- else
- {
- displayString = getStringValue((String) getValue());
- }
- return displayString;
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorFrame.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorFrame.java
deleted file mode 100755
index 129fa891eb..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorFrame.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package ohd.hseb.monitor;
-
-import java.awt.Container;
-import java.awt.Cursor;
-
-import javax.swing.JFrame;
-
-public class MonitorFrame extends JFrame
-{
- /**
- *
- */
- private static final long serialVersionUID = 1145234543265432L;
-
- public MonitorFrame()
- {
- super();
- }
-
- public void setWaitCursor()
- {
- Container container = this.getContentPane(); // get the window's content pane
- container.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- }
-
- public void setDefaultCursor()
- {
- Container container = this.getContentPane(); // get the window's content pane
- container.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- }
-
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorMessage.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorMessage.java
deleted file mode 100755
index 0aae954095..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorMessage.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package ohd.hseb.monitor;
-
-import ohd.hseb.monitor.messaging.Message;
-import ohd.hseb.monitor.messaging.MessageType;
-
-public class MonitorMessage extends Message
-{
- private Object _messageData;
-
- public MonitorMessage(Object source, MessageType messageType, Object messageData)
- {
- super(source, messageType);
- _messageData = messageData;
- }
-
- public MonitorMessage(Object source, MessageType messageType)
- {
- super(source, messageType);
- _messageData = null;
- }
-
- public Object getMessageData()
- {
- return _messageData;
- }
-
- public void setMessageData(Object messageData)
- {
- _messageData = messageData;
- }
-
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorSplitPane.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorSplitPane.java
deleted file mode 100755
index 5602781217..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorSplitPane.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package ohd.hseb.monitor;
-
-import java.awt.Component;
-
-import javax.swing.JSplitPane;
-
-public class MonitorSplitPane extends JSplitPane
-{
-
- /**
- *
- */
- private static final long serialVersionUID = 125315154454l;
-
- public MonitorSplitPane (int newOrientation,
- boolean newContinuousLayout)
- {
- super(newOrientation, newContinuousLayout);
- }
-
- public void setDividerLocation(int location)
- {
- int currentDividerLocation = getDividerLocation();
- int adjustedLocation = location;
-
-
- if (location < 30 )
- {
- int difference = currentDividerLocation - location;
- if (difference > 50)
- {
- adjustedLocation = currentDividerLocation;
- }
- }
- super.setDividerLocation(adjustedLocation);
- }
-
- public void setRightComponent(Component comp)
- {
-
- int beforeDividerLocation = getDividerLocation();
-
- super.setRightComponent(comp);
-
- setDividerLocation(beforeDividerLocation);
-
- }
-
- public void setLeftComponent(Component comp)
- {
- String header = "MonitorJSplitPane.setLeftComponent() ";
-
- int beforeDividerLocation = getDividerLocation();
-
- super.setLeftComponent(comp);
-
- setDividerLocation(beforeDividerLocation);
-
- }
-
-}
-
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorTimeSeriesLiteManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorTimeSeriesLiteManager.java
deleted file mode 100755
index 2918dd34dd..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorTimeSeriesLiteManager.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package ohd.hseb.monitor;
-
-import javax.swing.JOptionPane;
-
-import ohd.hseb.model.ParamCode;
-import ohd.hseb.monitor.precip.PrecipMonitorJTableRowData;
-import ohd.hseb.monitor.river.RiverMonitorJTableRowData;
-import ohd.hseb.timeserieslite.TimeSeriesLite;
-
-public class MonitorTimeSeriesLiteManager
-{
- private String _connectionString;
-
- public MonitorTimeSeriesLiteManager(String connectionString)
- {
- _connectionString = connectionString;
- }
-
- public boolean displayTimeSeriesLite(MonitorFrame mainFrame, RiverMonitorJTableRowData rowData)
- {
- String obsTypeSource = rowData.getObsTypeSource();
- String fcstTypeSource = rowData.getFcstTypeSource();
- String primaryPe = rowData.getPrimaryRiverPe();
- String locationId = rowData.getLid();
-
- String obsParamCode = null;
- String fcstParamCode = null;
- boolean result = false;
-
- if(obsTypeSource == null && fcstTypeSource == null)
- {
- result = false;
- }
- else
- {
- if(obsTypeSource != null)
- obsParamCode = primaryPe+"I"+obsTypeSource+"Z";
- if(fcstTypeSource != null)
- fcstParamCode = primaryPe +"I"+fcstTypeSource+"Z";
-
- System.out.println("Obs:"+obsParamCode);
- System.out.println("Fcst:"+fcstParamCode);
-
- String tslArgs[]= {"ohd.hseb.timeserieslite.rivermon.RiverMonDrawingMgr",
- _connectionString, locationId, obsParamCode, fcstParamCode};
-
- TimeSeriesLite tsl = new TimeSeriesLite();
- tsl.display(tslArgs, false);
- result = true;
- }
-
- if(!result)
- {
- String textMsg = "Latestobs and/or MaxFcst is unavailable.
" +
- "Unable to display TimeSeriesLite.";
- JOptionPane.showMessageDialog(mainFrame, textMsg,"TimeSeriesLite", JOptionPane.PLAIN_MESSAGE);
- }
- return result;
- }
-
- public boolean displayTimeSeriesLite(MonitorFrame mainFrame, PrecipMonitorJTableRowData rowData, int hour)
- {
- ParamCode paramCode = null;
- switch(hour)
- {
- case 1:
- paramCode = rowData.getPrecipData().getTohPrecip1HrParamCode();
- break;
- case 3:
- paramCode = rowData.getPrecipData().getTohPrecip3HrParamCode();
- break;
- case 6:
- paramCode = rowData.getPrecipData().getTohPrecip6HrParamCode();
- break;
- case 24:
- paramCode = rowData.getPrecipData().getTohPrecip24HrParamCode();
- break;
- }
-
- String obsTypeSource = null;
-
- String pe = null;
- String dur = null;
- String extremum = null;
-
- if(paramCode != null)
- {
- obsTypeSource = paramCode.getTypeSource();
- pe = "PP";
- dur = "H";
- extremum = paramCode.getExtremum();
- }
-
- String locationId = rowData.getLid();
-
- String obsParamCode = null;
- String fcstParamCode = null;
- boolean result = false;
-
- if(paramCode == null)
- {
- result = false;
- }
- else
- {
- if(obsTypeSource != null)
- {
- obsParamCode = pe+dur+obsTypeSource+extremum;
- fcstParamCode = pe + dur + "FF"+ extremum;
- }
-
- System.out.println("Obs:"+obsParamCode);
- System.out.println("Fcst:"+fcstParamCode);
-
- String tslArgs[]= {"ohd.hseb.timeserieslite.pdc.PDCDrawingMgr",
- _connectionString, locationId, obsParamCode, fcstParamCode};
-
- TimeSeriesLite tsl = new TimeSeriesLite();
- tsl.display(tslArgs, false);
- result = true;
- }
-
- if(!result)
- {
- String textMsg = "Top-of-hour 1 hr Precip data is unavailable.
" +
- "Unable to display TimeSeriesLite.";
- JOptionPane.showMessageDialog(mainFrame, textMsg,"TimeSeriesLite", JOptionPane.PLAIN_MESSAGE);
- }
- return result;
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorToolBarManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorToolBarManager.java
deleted file mode 100755
index c1b4b9bf95..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/MonitorToolBarManager.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package ohd.hseb.monitor;
-
-import java.awt.Image;
-import java.awt.Toolkit;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JToolBar;
-
-import ohd.hseb.officenotes.OfficeNotesDataManager;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-
-public class MonitorToolBarManager {
- private AppsDefaults _appsDefaults;
-
- protected JButton _officeNotesButton;
-
- private Icon _recordedOfficeNotesIcon, _emptyOfficeNotesIcon;
-
- private JToolBar _toolBar;
-
- private OfficeNotesDataManager _officeNotesDataMgr;
-
- public MonitorToolBarManager(JToolBar toolBar, AppsDefaults appsDefaults,
- OfficeNotesDataManager officeNotesDataMgr) {
- _appsDefaults = appsDefaults;
- _toolBar = toolBar;
- _officeNotesDataMgr = officeNotesDataMgr;
-
- addToolBarComponents();
- }
-
- private void addToolBarComponents() {
- createOfficeNotesAccessButton();
-
- _toolBar.setFloatable(false);
- _toolBar.setRollover(true);
- }
-
- public JButton getOfficeNotesButton() {
- return _officeNotesButton;
- }
-
- private void createOfficeNotesAccessButton() {
- String iconsDir = _appsDefaults.getToken("rivermon_config_dir",
- "/awips/hydroapps/whfs/local/data/app/rivermon");
-
- _officeNotesButton = new JButton();
- _recordedOfficeNotesIcon = createIcon(iconsDir + "/OfficeNotes.GIF");
- _emptyOfficeNotesIcon = createIcon(iconsDir + "/EmptyOfficeNotes.GIF");
-
- _officeNotesButton.setBorderPainted(false);
- _officeNotesButton.setRolloverEnabled(true);
-
- _toolBar.add(_officeNotesButton);
-
- setOfficeNotesButtonIcon(_officeNotesDataMgr.getCountOfOfficeNotes());
- }
-
- public Icon createIcon(String fileName) {
- Icon icon = null;
- int width = 25;
- int height = 25;
- Image image = Toolkit.getDefaultToolkit().getImage(fileName);
- Image newImage = image.getScaledInstance(width, height,
- Image.SCALE_SMOOTH);
- icon = new ImageIcon(newImage);
- return icon;
- }
-
- public void setOfficeNotesButtonIcon(int numOfOfficeNotesRecs) {
- _officeNotesButton.setVisible(false);
- if (numOfOfficeNotesRecs > 0) {
- _officeNotesButton.setToolTipText("You have "
- + numOfOfficeNotesRecs + " OfficeNotes");
- _officeNotesButton.setIcon(_recordedOfficeNotesIcon);
- } else {
- _officeNotesButton.setToolTipText("OfficeNotes is Empty");
- _officeNotesButton.setIcon(_emptyOfficeNotesIcon);
- }
- _officeNotesButton.setVisible(true);
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/ThreatLevel.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/ThreatLevel.java
deleted file mode 100755
index deff13192e..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/ThreatLevel.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package ohd.hseb.monitor;
-
-public enum ThreatLevel
-{
- NO_THREAT,
- MISSING_DATA,
- AGED_DATA,
- CAUTION,
- ALERT;
-
- static boolean isDataMissingOrAged(ThreatLevel level)
- {
- boolean result = false;
-
- if ((level == ThreatLevel.AGED_DATA) || (level == ThreatLevel.MISSING_DATA) )
- {
- result = true;
- }
-
- return result;
- }
- // -------------------------------------------------------------------------------------
- public boolean isGreater( ThreatLevel otherLevel)
- {
- boolean result = false;
- if (compareTo(otherLevel) > 0)
- {
- result = true;
- }
-
- return result;
- }
-}
-
-
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/TreeDataManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/TreeDataManager.java
deleted file mode 100755
index 2ab9e2bb4a..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/TreeDataManager.java
+++ /dev/null
@@ -1,280 +0,0 @@
-package ohd.hseb.monitor;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.JTree;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreePath;
-
-public class TreeDataManager
-{
-
- private Map _nodeMap = new HashMap();
-
- public TreeDataManager()
- {
-
- }
-
- private void addNode(DefaultMutableTreeNode baseNode, TreePath nodePath)
- {
- String header = "TreeDataManager.addNode(): ";
- DefaultMutableTreeNode node = null;
- DefaultMutableTreeNode parentNode = null;
-
- if(isRootPath(baseNode, nodePath))
- {
-// is root node, so done
- _nodeMap.put(nodePath.toString(), baseNode);
- }
- else //is not root node
- {
- //find the parent first
- TreePath parentPath = nodePath.getParentPath();
- parentNode = findNode(baseNode, parentPath);
-
- if (parentNode != null) //found the node, so don't add it
- {
- //check to make sure this node does not already exist
- node = findNode(parentNode, nodePath); //just search under parentNode for the child
-
- if (node == null)
- {
- DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(nodePath.getLastPathComponent());
- parentNode.add(childNode);
-
- TreePath childNodePath = getTreePathForNode(childNode);
-
- //System.out.println(header + "Inserting " + childNodePath.toString() + ", " + childNode + " into nodeMap");
- _nodeMap.put(childNodePath.toString(), childNode);
- }
- }
- else //parentNode is null
- {
- //add the parent node
-
- // System.out.println(header + "Adding parent node " + parentPath.toString() + ", " + baseNode);
-
- addNode(baseNode, parentPath);
-
- //add the child node
-
- // System.out.println(header + "Adding childt node " + nodePath.toString() + ", " + baseNode);
-
- addNode(baseNode, nodePath);
- }
- }
- }
-
- private boolean isRootPath(DefaultMutableTreeNode node, TreePath path)
- {
- boolean result = false;
-
- if(path != null) // is valid path
- {
- int pathCount = path.getPathCount();
-
- if(pathCount == 1)
- {
- if (node.toString().equals(path.getPathComponent(0).toString()))
- {
- result = true;
- }
- }
- }
-
- return result;
- }
-
- private DefaultMutableTreeNode oldFindNode(DefaultMutableTreeNode node, TreePath targetPath)
- {
- DefaultMutableTreeNode resultNode = null;
- DefaultMutableTreeNode testNode = null;
-
- if(node != null)
- {
- if(isNodeAMatchForPath(node, targetPath))
- {
- resultNode = node;
- }
- else
- {
- if(isNodeInPath(node, targetPath))
- {
- int childCount = node.getChildCount();
- for(int i=0; i < childCount; i++)
- {
- DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) node.getChildAt(i);
-
- testNode = findNode(childNode, targetPath);
- if (testNode != null)
- {
- resultNode = testNode;
- break;
- }
- }
- }
- }
- }
- return (DefaultMutableTreeNode ) resultNode;
- }
-
- private DefaultMutableTreeNode findNode2(DefaultMutableTreeNode node, TreePath targetPath)
- {
- String header = "TreeDataManager.findNode(): ";
- DefaultMutableTreeNode resultNode = null;
- DefaultMutableTreeNode testNode = null;
-
- if(node == null)
- {
- return null;
- }
-
- if(isNodeInPath(node, targetPath))
- {
-
- if(isNodeAMatchForPath(node, targetPath))
- {
- resultNode = node;
- }
- else //not a match
- {
-
- int childCount = node.getChildCount();
- for(int i=0; i < childCount; i++)
- {
- DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) node.getChildAt(i);
-
- if(isNodeInPath(childNode, targetPath))
- {
- if(isNodeAMatchForPath(childNode, targetPath))
- {
- // System.out.println(header + " childNode = " +
- // childNode.toString() + " matches " + targetPath);
-
-
- resultNode = childNode;
- break;
- }
- else //not complete match, so keep looking from here on down
- {
- // System.out.println(header + " childNode = " +
- // childNode.toString() + " is in " + targetPath);
-
- resultNode = findNode2(childNode, targetPath);
- }
- break;
- }
-
- else //not a match and not in path
- {
- // System.out.println(header + " childNode = " +
- // childNode.toString() + " is not in " + targetPath);
- //do nothing
- }
-
- } //end for
- } //end else
-
- }
-
- return (DefaultMutableTreeNode ) resultNode;
- }
-
-
- private DefaultMutableTreeNode findNode(DefaultMutableTreeNode node, TreePath targetPath)
- {
- // String header = "TreeDataManager.findNode(): ";
- DefaultMutableTreeNode resultNode = _nodeMap.get(targetPath.toString());
-
- return resultNode;
- }
-
-
- private boolean isNodeInPath(DefaultMutableTreeNode node, TreePath targetPath)
- {
- boolean isInPath = false;
-
- TreePath nodePath = getTreePathForNode(node);
- isInPath = isPathBeginningOfTargetPath(nodePath, targetPath);
-
- return isInPath;
- }
-
- private boolean isPathBeginningOfTargetPath(TreePath nodePath, TreePath targetPath)
- {
- boolean isBeginning = false;
-
- String nodePathString = nodePath.toString();
- String targetPathString = targetPath.toString();
-
- int length = nodePathString.length();
- nodePathString = nodePathString.substring(0, length - 1);
-
- isBeginning = targetPathString.startsWith(nodePathString);
-
- return isBeginning;
- }
-
- private boolean isNodeAMatchForPath(DefaultMutableTreeNode node, TreePath targetPath)
- {
- TreePath nodePath = getTreePathForNode(node);
- boolean isTargetNode = false;
-
- if (targetPath.toString().equals(nodePath.toString()))
- {
- isTargetNode = true;
- }
-
- return isTargetNode;
- }
-
- private TreePath getTreePathForNode(DefaultMutableTreeNode node)
- {
- TreePath nodePath = new TreePath(node.getPath());
- return nodePath;
- }
-
- private List createTreePathList(List stringArrayList)
- {
- List treePathList = new ArrayList();
-
- for(int i=0; i < stringArrayList.size(); i++)
- {
- String[] stringArray = (String[]) stringArrayList.get(i);
- DefaultMutableTreeNode[] nodeArray = new DefaultMutableTreeNode[stringArray.length];
- for(int j=0; j < stringArray.length; j++)
- {
- nodeArray[j] = new DefaultMutableTreeNode(stringArray[j]);
- }
- TreePath path = new TreePath(nodeArray);
- treePathList.add(path);
- }
-
- return treePathList;
- }
-
- public JTree createFilterTreeFromList(DefaultMutableTreeNode rootNode, List stringArrayList)
- {
- String header = "TreeDataManager.createFilterTreeFromList(): ";
-
- _nodeMap.clear();
-
- List treePathList = createTreePathList(stringArrayList);
-
- for(int i=0; i < treePathList.size(); i++)
- {
- TreePath path = treePathList.get(i);
-
- addNode(rootNode, path);
- }
-
- JTree tree = new JTree(rootNode);
-
- return tree;
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/TreeFilterManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/TreeFilterManager.java
deleted file mode 100755
index 4d6639af29..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/TreeFilterManager.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package ohd.hseb.monitor;
-
-import java.util.List;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreePath;
-
-import ohd.hseb.util.SessionLogger;
-
-public class TreeFilterManager
-{
- private SessionLogger _logger;
- private LocationDataFilter _locationDataFilter;
-
- public TreeFilterManager(SessionLogger logger, LocationDataFilter locationDataFilter)
- {
- _logger = logger;
- _locationDataFilter = locationDataFilter;
- }
-
- public LocationDataFilter getLocationDataFilter()
- {
- return _locationDataFilter;
- }
-
- public List filter(List allRowDataList)
- {
- return (_locationDataFilter.filter(allRowDataList));
- }
-
- public void setDisplayStatus(String location, boolean shouldDisplay)
- {
- _locationDataFilter.setDisplayStatus(location, shouldDisplay);
- }
-
- public void traversePathsToDisplayLocationSelected(TreePath paths[])
- {
- String header = "TreeFilterManager.parsePathsToDisplayLocationSelected()";
-
- _locationDataFilter.blockAllLocations();
-
- if(paths != null)
- {
- for(int i=0; i < paths.length; i++)
- {
- if(paths[i] == null)
- {
- _logger.log(header + "Invalid path... Check ... ");
- }
- else
- {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode) paths[i].getLastPathComponent();
- setAllLocationsUnderThisNodeToBeDisplayed(node);
- }
- }
- }
- }
-
- public void setAllLocationsUnderThisNodeToBeDisplayed(DefaultMutableTreeNode node)
- {
- if(node != null)
- {
- if(node.isLeaf())
- {
- setDisplayStatus(node.toString(), true);
- }
- else
- {
- int childCount = node.getChildCount();
- for(int i=0; i < childCount; i++)
- {
- DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) node.getChildAt(i);
- setAllLocationsUnderThisNodeToBeDisplayed(childNode);
- }
- }
- }
- }
-
-}
-
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/derivedcolumns/DerivedColumn.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/derivedcolumns/DerivedColumn.java
deleted file mode 100755
index ebc031af01..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/derivedcolumns/DerivedColumn.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package ohd.hseb.monitor.derivedcolumns;
-
-import java.awt.Color;
-import java.util.HashMap;
-import java.util.Map;
-
-public class DerivedColumn
-{
- private String _columnName;
- private Color _color;
- private String _equationForCellColor;
- private String _returnType;
- private String _equationForCellValue;
- private Object _value;
- private static Map _colorMap = new HashMap();
-
- static
- {
- _colorMap.put("black", Color.BLACK);
- _colorMap.put("blue", Color.BLUE);
- _colorMap.put("cyan", Color.CYAN);
- _colorMap.put("darkgray", Color.DARK_GRAY);
- _colorMap.put("gray", Color.GRAY);
- _colorMap.put("green", Color.GREEN);
- _colorMap.put("lightgray", Color.LIGHT_GRAY);
- _colorMap.put("magenta", Color.MAGENTA);
- _colorMap.put("orange", Color.ORANGE);
- _colorMap.put("pink", Color.PINK);
- _colorMap.put("red", Color.RED);
- _colorMap.put("white", Color.WHITE);
- _colorMap.put("yellow", Color.YELLOW);
- }
-
- public String getColumnName()
- {
- return _columnName;
- }
-
- public void setColumnName(String columnName)
- {
- _columnName = columnName;
- }
-
- public String getEquationForCellValue()
- {
- return _equationForCellValue;
- }
-
- public void setEquationForCellValue(String valueEquation)
- {
- this._equationForCellValue = valueEquation;
- }
-
- public String getEquationForCellColor()
- {
- return _equationForCellColor;
- }
-
- public void setEquationForCellColor(String cellEquation)
- {
- this._equationForCellColor = cellEquation;
- }
-
- public String getReturnType()
- {
- return _returnType;
- }
-
- public void setReturnType(String returnType)
- {
- _returnType = returnType;
- }
-
- public Object getValue()
- {
- return _value;
- }
-
- public void setvalue(Object value)
- {
- _value = value;
- }
-
- public void setCellBackgroundColor(Color color)
- {
- _color = color;
- }
-
- public Color getCellBackgroundColor()
- {
- return _color;
- }
-
- public void setCellBackgroundColor(String colorName)
- {
- Color color = (Color) _colorMap.get(colorName.toLowerCase());
-
- if (color != null)
- {
- setCellBackgroundColor(color);
- }
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/derivedcolumns/DerivedColumnsFileManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/derivedcolumns/DerivedColumnsFileManager.java
deleted file mode 100755
index 73df5c8a26..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/derivedcolumns/DerivedColumnsFileManager.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package ohd.hseb.monitor.derivedcolumns;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import ohd.hseb.util.SessionLogger;
-
-public class DerivedColumnsFileManager
-{
- private String _derivedColumnsFile = null;
- private List _derivedColumnsList = null;
- private Map _derivedColumnMap = null;
- private SessionLogger _logger = null;
-
- public DerivedColumnsFileManager(String derivedColumnsFile, SessionLogger logger)
- {
- _derivedColumnsFile = derivedColumnsFile;
- _logger = logger;
- }
-
-
- private void printFileException(IOException exception)
- {
- _logger.log("RiverMonitorDerivedColumnsFileManager.printFileException(): ERROR = " + exception.getMessage());
- exception.printStackTrace();
- _logger.log("RiverMonitorDerivedColumnsFileManager.printFileException(): End of stack trace");
- }
-
- public List getDerivedColumns()
- {
- if(_derivedColumnsList == null)
- _derivedColumnsList = new ArrayList();
- else
- _derivedColumnsList.clear();
-
- if(_derivedColumnMap == null)
- _derivedColumnMap = new HashMap();
- else
- _derivedColumnMap.clear();
-
- Runtime.getRuntime().gc();
- File fileHandler = new File(_derivedColumnsFile);
-
- if(fileHandler.exists())
- {
- BufferedReader in = null;
- String line;
-
- try
- {
- in = new BufferedReader(new FileReader(fileHandler));
- while(( line = in.readLine()) != null)
- {
- String columnName;
- String returnType;
- String equationForValue;
- String equationForColor;
-
- if(line.length() != 0)
- {
- line = line.trim();
- if(line.length() != 0 && line.charAt(0) != '#')
- {
- String splitStr[] = line.split("\\|");
- columnName = splitStr[0];
- returnType = splitStr[1].trim();
- equationForValue = splitStr[2];
- equationForColor = splitStr[3];
- DerivedColumn derivedColumns = new DerivedColumn();
- derivedColumns.setColumnName(columnName);
- derivedColumns.setReturnType(returnType);
- derivedColumns.setEquationForCellValue(equationForValue);
- derivedColumns.setEquationForCellColor(equationForColor);
- _derivedColumnsList.add(derivedColumns);
- _derivedColumnMap.put(columnName, derivedColumns);
- }
- }
- }
- }
- catch(IOException exception)
- {
- printFileException(exception);
- }
- }
- else
- {
- _logger.log("Derived columns file doesnt exist :[" + fileHandler.getAbsolutePath() + "]");
- }
- return _derivedColumnsList;
- }
-
- protected Map getDerivedColumnMap()
- {
- return _derivedColumnMap;
- }
-
- public String[] getDerivedColumnNames()
- {
- String derivedColumnNames[] = null;
- getDerivedColumns();
- if(_derivedColumnsList.size() != 0)
- {
- derivedColumnNames = new String[_derivedColumnsList.size()];
- for(int i=0; i < _derivedColumnsList.size(); i++)
- {
- DerivedColumn derivedColumns = (DerivedColumn) _derivedColumnsList.get(i);
- derivedColumnNames[i] = derivedColumns.getColumnName();
- }
- }
- return derivedColumnNames;
- }
-
- public String[] getAlignmentForDerivedColumns()
- {
- String alignmentForDerivedColumns[] = null;
- if(_derivedColumnsList.size() != 0)
- {
- alignmentForDerivedColumns = new String[_derivedColumnsList.size()];
- for(int i=0; i < _derivedColumnsList.size(); i++)
- {
- DerivedColumn derivedColumns = (DerivedColumn) _derivedColumnsList.get(i);
- if(derivedColumns.getReturnType().equalsIgnoreCase("string"))
- alignmentForDerivedColumns[i] = "center";
- else
- alignmentForDerivedColumns[i] = "right";
- }
- }
- return alignmentForDerivedColumns;
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/BaseManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/BaseManager.java
deleted file mode 100755
index 8e7104549d..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/BaseManager.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package ohd.hseb.monitor.manager;
-
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.messaging.MessageType;
-import ohd.hseb.util.gui.jtable.JTableRowData;
-
-public class BaseManager implements Manager
-{
- public MessageSystemManager _msgSystemManager;
-
- public void setMessageSystemManager(MessageSystemManager msgSystemManager)
- {
- _msgSystemManager = msgSystemManager;
- }
-
- public void send(MonitorMessage message)
- {
- _msgSystemManager.send(message);
- }
-
- public void send(Manager manager, MessageType messageType)
- {
- MonitorMessage message = new MonitorMessage(manager, messageType);
- System.out.println("Sending..." + message.getMessageType());
- send(message);
- }
-
- public void send(Manager manager, MessageType messageType, JTableRowData selectedRowData)
- {
- MonitorMessage message = new MonitorMessage(manager, messageType, selectedRowData);
- System.out.println("Sending..." + message.getMessageType());
- send(message);
- }
-
- public String toString()
- {
- String className = this.getClass().toString();
- int lastIndexOfDot = className.lastIndexOf('.');
- String result = className.substring(lastIndexOfDot + 1, className.length());
-
- return result;
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/Manager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/Manager.java
deleted file mode 100755
index 393cf27e5f..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/Manager.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package ohd.hseb.monitor.manager;
-
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-
-public interface Manager
-{
- public String toString();
-
- public void send(MonitorMessage message);
-
- public void setMessageSystemManager(MessageSystemManager msgSystemManager);
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/MonitorMenuManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/MonitorMenuManager.java
deleted file mode 100755
index 7c53b7157c..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/MonitorMenuManager.java
+++ /dev/null
@@ -1,397 +0,0 @@
-package ohd.hseb.monitor.manager;
-
-import static ohd.hseb.util.TimeHelper.MILLIS_PER_MINUTE;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.IOException;
-
-import javax.swing.JButton;
-import javax.swing.JFormattedTextField;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JSpinner;
-import javax.swing.SpinnerModel;
-import javax.swing.SpinnerNumberModel;
-import javax.swing.Timer;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
-import ohd.hseb.db.DbTimeHelper;
-import ohd.hseb.monitor.MonitorFrame;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.messaging.MessageType;
-import ohd.hseb.monitor.precip.PrecipThresholdDialog;
-import ohd.hseb.monitor.precip.settings.PrecipColumnDataSettings;
-import ohd.hseb.util.SessionLogger;
-import ohd.hseb.util.gui.ComponentHelper;
-import ohd.hseb.util.gui.DialogHelper;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-import com.raytheon.uf.common.util.RunProcess;
-
-public abstract class MonitorMenuManager extends BaseManager {
- private String _version;
-
- private String _appName;
-
- private String _date;
-
- protected MonitorFrame _mainFrame;
-
- private JButton _refreshNowButton;
-
- private JLabel _currentTimeLabel;
-
- private JLabel _nextRefreshTimeLabel;
-
- protected JSpinner _refreshTimeSpinner;
-
- protected JPanel _timeDisplayPanel;
-
- protected JLabel _dataTimeLabel;
-
- protected JLabel _rowCountLabel;
-
- private Timer _refreshDisplayTimer = null;
-
- protected AppsDefaults _appsDefaults;
-
- protected SessionLogger _logger;
-
- public MonitorMenuManager(MessageSystemManager msgSystemManager,
- AppsDefaults appsDefaults, SessionLogger logger) {
- setMessageSystemManager(msgSystemManager);
- _appsDefaults = appsDefaults;
- _logger = logger;
- }
-
- protected void setAboutInfo(String version, String date, String appName) {
- _version = version;
- _date = date;
- _appName = appName;
- }
-
- public class AboutListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- String aboutText = " Application : " + _appName + "\n"
- + " Version : " + _version + "\n"
- + " Date : " + _date + "\n"
- + " Developed by: \n"
- + " National Weather Service\n"
- + " Office of Hydrologic Development\n"
- + " Hydrology Laboratory";
- DialogHelper.displayMessageDialog(_mainFrame, aboutText, _appName);
- }
- }
-
- protected boolean confirmSaveOfficeSettings(String message) {
- boolean result = false;
- int answer = JOptionPane.showConfirmDialog(_mainFrame, message,
- "Save Office Settings", JOptionPane.YES_NO_CANCEL_OPTION);
- switch (answer) {
- case JOptionPane.YES_OPTION:
- result = true;
- break;
- case JOptionPane.NO_OPTION:
- case JOptionPane.CANCEL_OPTION:
- case JOptionPane.CLOSED_OPTION:
- result = false;
- break;
- }
- return result;
- }
-
- protected void launchTextEditor(String editorTitle, String file,
- String appName) {
- String editorDir = _appsDefaults.getToken("whfs_local_bin_dir",
- "/awips/hydroapps/whfs/local/bin");
- String editor = _appsDefaults.getToken("whfs_editor", "whfs_editor");
-
- if (editorDir == null) {
- editorDir = ".";
- }
- if (editor == null) {
- editor = "whfs_editor";
- }
- String script = editorDir.concat("/").concat(editor);
-
- // DR#10955
- RunProcess rt = RunProcess.getRunProcess();
- String cmd[] = new String[3];
- cmd[0] = script;
- cmd[1] = editorTitle;
- cmd[2] = file;
- try {
- _mainFrame.setWaitCursor();
- rt.exec(cmd);
- _logger.log("Launch Text Editor [cmd:" + cmd[0] + " " + cmd[1]
- + " " + cmd[2] + "]");
- _mainFrame.setDefaultCursor();
- } catch (IOException ex) {
- _mainFrame.setDefaultCursor();
- String str = "Unable to launch text editor:[cmd" + cmd[0] + " "
- + cmd[1] + " " + cmd[2] + "] Exception:" + ex;
- JOptionPane.showMessageDialog(_mainFrame, str, appName,
- JOptionPane.PLAIN_MESSAGE);
- }
-
- }
-
- protected void createRefreshComponents(int refreshInterval,
- JPanel timeDisplayPanel) {
- _timeDisplayPanel = timeDisplayPanel;
-
- JLabel refreshLabel = new JLabel("Update(in mins)");
- int maxValueForRefreshMins = 30;
- int minValueForRefreshMins = 1;
- int incrValueForRefreshMins = 1;
- int initialValueForRefreshMins = refreshInterval;
-
- SpinnerModel spinnerModel = new SpinnerNumberModel(
- initialValueForRefreshMins, minValueForRefreshMins,
- maxValueForRefreshMins, incrValueForRefreshMins);
- _refreshTimeSpinner = new JSpinner(spinnerModel);
- _refreshTimeSpinner.setPreferredSize(new Dimension(35, 20));
- // Disable keyboard edits in the spinner
- JFormattedTextField textField = ((JSpinner.DefaultEditor) _refreshTimeSpinner
- .getEditor()).getTextField();
- textField.setEditable(false);
- _refreshTimeSpinner.addChangeListener(new RefreshTimeSpinBoxListener());
-
- _timeDisplayPanel.setLayout(new GridBagLayout());
- _currentTimeLabel = new JLabel();
- _currentTimeLabel.setBackground(Color.RED);
-
- _nextRefreshTimeLabel = new JLabel();
- _nextRefreshTimeLabel.setBackground(Color.GREEN);
- JPanel nextRefreshTimePanel = new JPanel();
- nextRefreshTimePanel.add(_nextRefreshTimeLabel);
-
- JPanel refreshPanel = new JPanel();
- _refreshNowButton = new JButton("Update Now");
- _refreshNowButton.setPreferredSize(new Dimension(110, 20));
- RefreshButtonListener refreshDisplayTimerListener = new RefreshButtonListener();
- _refreshNowButton.addActionListener(refreshDisplayTimerListener);
- refreshPanel.add(refreshLabel);
- refreshPanel.add(_refreshTimeSpinner);
- refreshPanel.add(_refreshNowButton);
-
- _dataTimeLabel = new JLabel();
- _dataTimeLabel.setText("DEFAULT TEXT");
-
- _rowCountLabel = new JLabel();
-
- JPanel dummyPanel1 = new JPanel();
- JPanel dummyPanel1_25 = new JPanel();
- JPanel dummyPanel15 = new JPanel();
- JPanel dummyPanel2 = new JPanel();
- JPanel dummyPanel3 = new JPanel();
- dummyPanel1.setPreferredSize(new Dimension(50, 20));
- dummyPanel1_25.setPreferredSize(new Dimension(50, 20));
- dummyPanel15.setPreferredSize(new Dimension(50, 20));
- dummyPanel2.setPreferredSize(new Dimension(60, 20));
- dummyPanel3.setPreferredSize(new Dimension(50, 20));
-
- // col, row, width, height, weightx, weighty, fill
- ComponentHelper.addFrameComponent(_timeDisplayPanel, dummyPanel1, 0, 0,
- 1, 1, 0, 0, 1);
- ComponentHelper.addFrameComponent(_timeDisplayPanel, _rowCountLabel, 1,
- 0, 1, 1, 0, 0, 1);
- ComponentHelper.addFrameComponent(_timeDisplayPanel, dummyPanel1_25, 2,
- 0, 1, 1, 0, 0, 1);
- ComponentHelper.addFrameComponent(_timeDisplayPanel, _dataTimeLabel, 3,
- 0, 1, 1, 0, 0, 1);
- ComponentHelper.addFrameComponent(_timeDisplayPanel, dummyPanel15, 4,
- 0, 1, 1, 0, 0, 1);
- ComponentHelper.addFrameComponent(_timeDisplayPanel, _currentTimeLabel,
- 5, 0, 1, 1, 0, 0, 1);
- ComponentHelper.addFrameComponent(_timeDisplayPanel, dummyPanel2, 6, 0,
- 1, 1, 0, 0, 1);
- ComponentHelper.addFrameComponent(_timeDisplayPanel,
- _nextRefreshTimeLabel, 7, 0, 1, 1, 0, 0, 1);
- ComponentHelper.addFrameComponent(_timeDisplayPanel, dummyPanel3, 8, 0,
- 1, 1, 0, 0, 1);
- ComponentHelper.addFrameComponent(_timeDisplayPanel, refreshPanel, 9,
- 0, 1, 1, 0, 0, 1);
-
- }
-
- public void setInitialRefreshTimeInfo() {
- setRefreshTimeSpinnerValue();
-
- String curDateTimeString = DbTimeHelper
- .getDateTimeStringFromLongTime(System.currentTimeMillis());
- _currentTimeLabel.setText(" Last Update: " + curDateTimeString);
-
- Integer value = Integer.parseInt(_refreshTimeSpinner.getValue()
- .toString());
- int refreshMilliSecs = (int) (value * MILLIS_PER_MINUTE);
- System.out.println("Interval :" + value);
-
- String nextDateTimeString = DbTimeHelper
- .getDateTimeStringFromLongTime(System.currentTimeMillis()
- + refreshMilliSecs);
- String timeString[] = nextDateTimeString.split(" ");
- _nextRefreshTimeLabel.setText(" Next Update: " + timeString[1]);
-
- // time of the PDC file read
- _dataTimeLabel.setText("Precip Data Time: N/A");
-
- updateRecordCount();
-
- }
-
- protected void updateRecordCount() {
- long recordCount = getDisplayedRecordCount();
- _rowCountLabel.setText(recordCount + " Locations");
- }
-
- private void changeTimeInformationDisplayed(long refreshMilliSecs,
- boolean changeLastUpdateTime) {
- long currentTime = System.currentTimeMillis();
-
- if (changeLastUpdateTime) {
- String curDateTimeString = DbTimeHelper
- .getTimeToSecondsStringFromLongTime(currentTime);
- _currentTimeLabel.setText(" Last Update: " + curDateTimeString);
- }
- String nextDateTimeString = DbTimeHelper
- .getTimeToSecondsStringFromLongTime(currentTime
- + refreshMilliSecs);
- // String timeString[] = nextDateTimeString.split(" ");
- _nextRefreshTimeLabel.setText(" Next Update: " + nextDateTimeString);
-
- // time of the PDC file read
-
- long dataUpdateTime = getDataUpdateTime();
- _dataTimeLabel.setText("Precip Data Time: "
- + DbTimeHelper
- .getTimeToSecondsStringFromLongTime(dataUpdateTime));
-
- // updateRecordCount();
-
- }
-
- protected abstract long getDataUpdateTime();
-
- protected abstract long getDisplayedRecordCount();
-
- public abstract void setMenuSettingsRefreshInterval(int value);
-
- // Refresh time spin box listener
- private class RefreshTimeSpinBoxListener implements ChangeListener {
- public void stateChanged(ChangeEvent e) {
- Integer value = Integer.parseInt(_refreshTimeSpinner.getValue()
- .toString());
- setMenuSettingsRefreshInterval(value);
- int refreshMilliSecs = (int) (value * MILLIS_PER_MINUTE);
- changeTimeInformationDisplayed(refreshMilliSecs, false);
- startTimer(refreshMilliSecs);
- }
- }
-
- // Is attached to the update now button
- private class RefreshButtonListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- refresh();
- }
- }
-
- protected void startTimer(int delayMilliSecs) {
- if (_refreshDisplayTimer == null) {
- RefreshButtonListener refreshDisplayTimerListener = new RefreshButtonListener();
- _refreshDisplayTimer = new Timer(delayMilliSecs,
- refreshDisplayTimerListener);
- } else {
- _refreshDisplayTimer.stop();
- // This timer doesn't repeat, hence it always uses setInitialDelay
- // and not setDelay
- // which is used only if the timer is set to repeat
- _refreshDisplayTimer.setInitialDelay(delayMilliSecs);
- }
- _refreshDisplayTimer.start();
- }
-
- public abstract void setRefreshTimeSpinnerValue();
-
- protected void refreshTimeDisplay() {
- Object obj = _refreshTimeSpinner.getValue();
- int refreshMilliSecs = (int) (Integer.parseInt(obj.toString()) * MILLIS_PER_MINUTE);
- startTimer(refreshMilliSecs);
-
- setRefreshTimeSpinnerValue();
-
- changeTimeInformationDisplayed(refreshMilliSecs, true);
- startTimer(refreshMilliSecs);
- }
-
- protected void refresh() {
- String header = "MonitorMenuManager.refresh(): ";
-
- _mainFrame.setWaitCursor();
-
- System.out.print(header);
- send(this, MessageType.RELOAD_DATA);
- refreshTimeDisplay();
-
- _mainFrame.setDefaultCursor();
- }
-
- protected void sendMissingFilterChanged() {
- String header = "MonitorMenuManager.sendMissingFilterChanged(): ";
-
- System.out.print(header);
- send(this, MessageType.REFRESH_DISPLAY);
-
- }
-
- protected void menuChange() {
- String header = "MonitorMenuManager.menuChange(): ";
-
- System.out.print(header);
- send(this, MessageType.RELOAD_DATA);
- refreshTimeDisplay();
- }
-
- protected class PrecipThresholdListener implements ActionListener {
- private PrecipColumnDataSettings _currentMenuSettings;
-
- public PrecipThresholdListener(
- PrecipColumnDataSettings currentMenuSettings) {
- String header = "PrecipThresholdListener.PrecipThresholdListener()";
- _currentMenuSettings = currentMenuSettings;
- System.out.println(header + "Current Settings: "
- + _currentMenuSettings);
- }
-
- public void actionPerformed(ActionEvent e) {
- PrecipThresholdDialog precipThresholdDialog = new PrecipThresholdDialog(
- _mainFrame, _currentMenuSettings, _logger);
-
- String header = "PrecipThresholdListener.actionPerformed()";
- // PrecipColumnDataSettings currentMenuSettings =
- // _menuSettings.getPrecipSettings();
-
- System.out.println(header + "Before show Current Settings: "
- + _currentMenuSettings);
-
- PrecipColumnDataSettings savedPrecipSettings = precipThresholdDialog
- .showPrecipThresholdDialog();
- if (savedPrecipSettings != null) {
- _currentMenuSettings.setPrecipSettings(savedPrecipSettings);
- System.out.println("Im here menu had changed");
- menuChange();
- } else {
- System.out.println("Im here menu had not changed");
- }
- System.out.println(header + "After show Current Settings: "
- + _currentMenuSettings);
- }
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/MonitorRefreshManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/MonitorRefreshManager.java
deleted file mode 100755
index e5e32447e1..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/MonitorRefreshManager.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package ohd.hseb.monitor.manager;
-
-import javax.swing.JSplitPane;
-
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.messaging.MessageType;
-import ohd.hseb.util.CodeTimer;
-import ohd.hseb.util.SessionLogger;
-
-public abstract class MonitorRefreshManager extends BaseManager
-{
- protected SessionLogger _logger;
- protected JSplitPane _splitPane;
-
- public MonitorRefreshManager(MessageSystemManager msgSystemManager, SessionLogger logger, JSplitPane splitPane)
- {
- _logger = logger;
- _splitPane = splitPane;
-
- setMessageSystemManager(msgSystemManager);
-
- MessageType outgoingMessageType = MessageType.REFRESH_DISPLAY;
- RefreshReceiver reloadDataReceiver = new RefreshReceiver(outgoingMessageType);
- _msgSystemManager.registerReceiver(reloadDataReceiver, MessageType.RELOAD_DATA);
-
- outgoingMessageType = MessageType.UPDATE_DISPLAY_WITH_SETTINGS;
- RefreshReceiver reloadDataWithNewSettingsReceiver = new RefreshReceiver(outgoingMessageType);
- _msgSystemManager.registerReceiver(reloadDataWithNewSettingsReceiver, MessageType.RELOAD_DATA_WITH_NEW_SETTINGS);
-
- }
-
- protected abstract void reloadData(MonitorMessage incomingMessage, MessageType outgoingMessageType);
-
- private void setSplitPaneDividerLocation()
- {
- String header = "MonitorRefreshManager.setSplitPaneDividerLocation(): ";
-
- int newDividerLocation = _splitPane.getDividerLocation();
- // int lastDividerLocation = _splitPane.getLastDividerLocation();
-
- //System.out.println(header + "divider location = " + newDividerLocation);
- //System.out.println(header + "last divider location = " + lastDividerLocation);
-
- _splitPane.setDividerLocation(newDividerLocation);
-
- //newDividerLocation = _splitPane.getDividerLocation();
- //lastDividerLocation = _splitPane.getLastDividerLocation();
-
- // System.out.println(header + "after reset divider location, dividerLocation = " + newDividerLocation);
- // System.out.println(header + "after reset divider location, lastDividerLocation = " + lastDividerLocation);
-
- return;
- }
-
- private class RefreshReceiver implements Receiver
- {
- private MessageType _outgoingMessageType = null;
-
- public RefreshReceiver(MessageType outgoingMessageType)
- {
- _outgoingMessageType = outgoingMessageType;
- }
-
- public void receive(MonitorMessage message)
- {
- String header = "MonitorRefreshManager.RefreshReceiver.receive(): ";
-
- //Note: setSplitPaneDividerLocation() is called to prevent the
- //inadvertent shrinking of the Filter (left side of SplitPane) when,
- //for example, the user maximizes the window while the
- //application is refreshing.
- //Why setting the divider location BEFORE actually refreshing the
- //data and the JTable works is still a mystery to us as of 1/11/08.
- //Mysteries are bad!
- //Related code is in MonitorSplitPane. In that class, the setting of
- //left and right SplitPane components occurs between calls to maintain the
- //divider location (again, to avoid having the left side of the JSplitPane shrink.)
- //That code is not a mystery.
-
- setSplitPaneDividerLocation();
-
-
- CodeTimer reloadTimer = new CodeTimer();
- reloadTimer.start();
-
- reloadData(message, _outgoingMessageType);
-
- reloadTimer.stop(header + "reloadData took: ");
- }
- }
-
-}
-
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/Receiver.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/Receiver.java
deleted file mode 100755
index 3d3a8f5c64..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/manager/Receiver.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package ohd.hseb.monitor.manager;
-
-import ohd.hseb.monitor.MonitorMessage;
-
-public interface Receiver
-{
- public void receive(MonitorMessage message);
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/messaging/Message.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/messaging/Message.java
deleted file mode 100755
index 58548c5cff..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/messaging/Message.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package ohd.hseb.monitor.messaging;
-
-public class Message
-{
- private MessageType _messageType;
- private Object _source;
-
- public Message(Object source, MessageType messageType)
- {
- _source = source;
- _messageType = messageType;
- }
-
- public MessageType getMessageType()
- {
- return _messageType;
- }
-
- public Object getMessageSource()
- {
- return _source;
- }
-
- public void setMessageType(MessageType messageType)
- {
- _messageType = messageType;
- }
-
- public void setMessageSource(Object source)
- {
- _source = source;
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/messaging/MessageSystemManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/messaging/MessageSystemManager.java
deleted file mode 100755
index 40002ffdb6..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/messaging/MessageSystemManager.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package ohd.hseb.monitor.messaging;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.manager.Receiver;
-
-public class MessageSystemManager
-{
- private Map> _messageTypeToReceiverListMap;
-
- public MessageSystemManager()
- {
-
- _messageTypeToReceiverListMap = new HashMap>();
- }
-
- public void registerReceiver(Receiver receiver, MessageType messageType)
- {
- String header = "MessageSystemManager.addMeAsListener(): ";
-
- List receiverList = getReceiverList(messageType);
-
- receiverList.add(receiver);
- }
-
- public void send(MonitorMessage message)
- {
- String header = "MessageSystemManager.send(): ";
-
- List receiverList = getReceiverList(message.getMessageType());
-
- if(receiverList != null)
- {
- for(Receiver receiver : receiverList)
- {
- receiver.receive(message);
- }
- }
- else
- {
- System.out.println(header + "ReceiverList is null");
- }
- }
-
- private List getReceiverList(MessageType messageType)
- {
- String header = "MessageSystemManager.getReceiverList(): ";
-
- List receiverList = _messageTypeToReceiverListMap.get(messageType);
-
- if(receiverList == null)
- {
- receiverList = new ArrayList();
- _messageTypeToReceiverListMap.put(messageType, receiverList);
- }
-
- return receiverList;
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/messaging/MessageType.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/messaging/MessageType.java
deleted file mode 100755
index 9ec781b75f..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/messaging/MessageType.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package ohd.hseb.monitor.messaging;
-
-public enum MessageType
-{
- RELOAD_DATA, // Read data from database. Sent by: lookback time menu filters and refresh/update now button. Received by refresh mgr.
-
- REFRESH_DISPLAY, // Read filter and menu settings and refresh display. Sent by filter mgr, when the check box is
- // clicked and by menu mgr when the missing filter is changed
-
- RELOAD_DATA_WITH_NEW_SETTINGS, // Sent by settings mgr, when new settings are loaded. Received by Refresh mgr
-
- UPDATE_DISPLAY_WITH_SETTINGS, // Sent by Refresh mgr, when new settings are loaded. Received by view,menu & filter mgr and they are updated
- // based on the settings
-
- LOAD_SETTINGS, // sent by load settings menu and received by settings mgr
-
- LOAD_OFFICE_SETTINGS, // sent by load office settings menu and received by settings mgr
-
- SAVE_SETTINGS,// sent by save settings menu and received by settings mgr
-
- SAVE_OFFICE_SETTINGS,// sent by save office settings menu and received by settings mgr
-
- FILTER_SELECT_ITEM, //sent when an location in the filter tree is highlighted; Received by view mgr to highlight the row in table
-
- VIEW_SELECT_ITEM, // sent by view mgr when a row is selected in the table along with the row data;
- // Received by menu mgr to get the corresponding row data
-
- CREATE_TEXT_FROM_VIEW, // sent by export table to text menu, received by view manager
-
- UPDATE_SETTINGS, // sent by settings mgr before saving the settings to file,
- // received by view mgr to set the current table settings in view settings
-
- CHANGE_COLUMNS, // sent by column change menu, received by view mgr
-
- APP_SORT, // sent by hsa-group-location sort menu, received by view mgr
-
- RIVER_THREAT_SORT, // sent by threat sort menu, received by view mgr
-
- PRECIP_THREAT_SORT,// sent by precip threat sort menu, received by view mgr
-
- CLEAR_SORT; // sent by clear sort menu, received by view mgr
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipColumns.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipColumns.java
deleted file mode 100755
index b91236a212..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipColumns.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package ohd.hseb.monitor.precip;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import ohd.hseb.monitor.LocationInfoColumns;
-import ohd.hseb.util.gui.jtable.JTableColumnDescriptor;
-/**
- *
- * @author rajaramv
- *
- * The purpose of this class is to provide a consistent set of column names and to provide the
- * Descriptor list of Precipitation-related required by the OHD Java Table Framework for the RiverMonitor and PrecipMonitor
- * applications. (GobsC)
- */
-public class PrecipColumns
-{
- public static final String LATEST_30MIN = "Latest 30min Precip";
- public static final String LATEST_1HR = "Latest 1hr Precip";
- public static final String LATEST_3HR = "Latest 3hr Precip";
- public static final String LATEST_6HR = "Latest 6hr Precip";
- public static final String LATEST_12HR = "Latest 12hr Precip";
- public static final String LATEST_18HR = "Latest 18hr Precip";
- public static final String LATEST_24HR = "Latest 24hr Precip";
-
- public static final String TOH_PRECIP_1HR = "1hr Precip";
-
- public static final String FFG_1HR = "FFG 1hr";
- public static final String FFG_3HR = "FFG 3hr";
- public static final String FFG_6HR = "FFG 6hr";
-
- public static final String DIFF_1HR = "Diff 1hr";
- public static final String DIFF_3HR = "Diff 3hr";
- public static final String DIFF_6HR = "Diff 6hr";
-
- public static final String RATIO_1HR = "Ratio 1hr %";
- public static final String RATIO_3HR = "Ratio 3hr %";
- public static final String RATIO_6HR = "Ratio 6hr %";
-
- public static final String PRECIP_THREAT = "Precip Threat";
-
- public static final String LATEST_PRECIP_PARAM_CODE = "Latest Precip Param Code";
-
- public static final String TOH_PRECIP_1HR_PARAM_CODE = "1hr Precip Param Code";
-
- /**
- * Creates a list of precip columns each of type JTableColumnDescriptor object.
- * If the parameter passed is null then the new list is created and the location info columns & precip data columns are added to it,
- * if not the precip data column's list is added to the list that is passed as argument.
- * The created new list is returned.
- * @param precipMonitorColumnDescriptorList
- * @return
- */
- public List getPrecipColumnsList(List precipMonitorColumnDescriptorList)
- {
- String textAlignment = "center";
- String numberAlignment = "right";
-
- if(precipMonitorColumnDescriptorList == null)
- {
- precipMonitorColumnDescriptorList = new ArrayList();
- precipMonitorColumnDescriptorList = new LocationInfoColumns().getLocationInfoColumnsList(precipMonitorColumnDescriptorList);
- }
-
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.LATEST_PRECIP_PARAM_CODE, textAlignment, "Latest Precip Param Code"));
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.TOH_PRECIP_1HR_PARAM_CODE, textAlignment, "Top-of-Hour 1hr Precip Param Code"));
-
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.LATEST_30MIN, numberAlignment, "Latest 30min Precip"));
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.LATEST_1HR, numberAlignment, "Latest 1hr Precip"));
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.LATEST_3HR, numberAlignment, "Latest 3hr Precip"));
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.LATEST_6HR, numberAlignment, "Latest 6hr Precip"));
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.LATEST_12HR, numberAlignment, "Latest 12hr Precip"));
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.LATEST_18HR, numberAlignment, "Latest 18hr Precip"));
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.LATEST_24HR, numberAlignment, "Latest 24hr Precip"));
-
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.TOH_PRECIP_1HR, numberAlignment, "Top-of-Hour 1hr Precip"));
-
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.FFG_1HR, numberAlignment, "FFG 1hr"));
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.FFG_3HR, numberAlignment, "FFG 3hr"));
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.FFG_6HR, numberAlignment, "FFG 6hr"));
-
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.DIFF_1HR, numberAlignment, "Latest Precip 1hr - FFG 1hr"));
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.DIFF_3HR, numberAlignment, "Latest Precip 3hr - FFG 3hr"));
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.DIFF_6HR, numberAlignment, "Latest Precip 6hr - FFG 6hr"));
-
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.RATIO_1HR, numberAlignment, "(Latest Precip 1hr/FFG 1hr) * 100"));
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.RATIO_3HR, numberAlignment, "(Latest Precip 3hr/FFG 3hr) * 100"));
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.RATIO_6HR, numberAlignment, "(Latest Precip 6hr/FFG 6hr) * 100"));
-
- precipMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PrecipColumns.PRECIP_THREAT, textAlignment,"Precip Threat"));
-
- return precipMonitorColumnDescriptorList;
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipData.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipData.java
deleted file mode 100755
index 3c92f72891..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipData.java
+++ /dev/null
@@ -1,523 +0,0 @@
-package ohd.hseb.monitor.precip;
-
-import ohd.hseb.db.DbTable;
-import ohd.hseb.model.ParamCode;
-
-public class PrecipData
-{
- private double _ffg1Hr;
- private double _ffg3Hr;
- private double _ffg6Hr;
-
- private double _latestPrecip30Min;
- private double _latestPrecip1Hr;
- private double _latestPrecip3Hr;
- private double _latestPrecip6Hr;
- private double _latestPrecip12Hr;
- private double _latestPrecip18Hr;
- private double _latestPrecip24Hr;
-
- private double _tohPrecip1Hr;
- //at the moment, with the synoptic time scales for the PDC preprocessor,
- //these columns do not make sense.
- // private double _tohPrecip3Hr;
- // private double _tohPrecip6Hr;
- // private double _tohPrecip24Hr;
-
- private double _diff1Hr;
- private double _diff3Hr;
- private double _diff6Hr;
-
- private int _ratio1Hr;
- private int _ratio3Hr;
- private int _ratio6Hr;
-
- private ParamCode _latestPrecipParamCode;
-
- private ParamCode _tohPrecip1HrParamCode;
- private ParamCode _tohPrecip3HrParamCode;
- private ParamCode _tohPrecip6HrParamCode;
- private ParamCode _tohPrecip24HrParamCode;
-
- public PrecipData()
- {
- _ffg1Hr = DbTable.getNullDouble();
- _ffg3Hr = DbTable.getNullDouble();
- _ffg6Hr = DbTable.getNullDouble();
-
- _latestPrecip30Min = DbTable.getNullDouble();
- _latestPrecip1Hr = DbTable.getNullDouble();
- _latestPrecip3Hr = DbTable.getNullDouble();
- _latestPrecip6Hr = DbTable.getNullDouble();
- _latestPrecip12Hr = DbTable.getNullDouble();
- _latestPrecip18Hr = DbTable.getNullDouble();
- _latestPrecip24Hr = DbTable.getNullDouble();
-
- _tohPrecip1Hr = DbTable.getNullDouble();
- // _tohPrecip3Hr = DbTable.getNullDouble();
- // _tohPrecip6Hr = DbTable.getNullDouble();
- // _tohPrecip24Hr = DbTable.getNullDouble();
-
- _diff1Hr = DbTable.getNullDouble();
- _diff3Hr = DbTable.getNullDouble();
- _diff6Hr = DbTable.getNullDouble();
-
- _ratio1Hr = DbTable.getNullInt();
- _ratio3Hr = DbTable.getNullInt();
- _ratio6Hr = DbTable.getNullInt();
- }
-
- public double getFFG1Hr()
- {
- return _ffg1Hr;
- }
-
- public void setFFG1Hr(double ffg1Hr)
- {
- _ffg1Hr = ffg1Hr;
- }
-
- public double getFFG3Hr()
- {
- return _ffg3Hr;
- }
-
- public void setFFG3Hr(double ffg3Hr)
- {
- _ffg3Hr = ffg3Hr;
- }
-
- public double getFFG6Hr()
- {
- return _ffg6Hr;
- }
-
- public void setFFG6Hr(double ffg6Hr)
- {
- _ffg6Hr = ffg6Hr;
- }
-
- public double getTohPrecip1Hr()
- {
- return _tohPrecip1Hr;
- }
-
- public void setTohPrecip1Hr(double tohPrecip1Hr)
- {
- _tohPrecip1Hr = tohPrecip1Hr;
- }
- /*
-
- public double getTohPrecip3Hr()
- {
- return _tohPrecip3Hr;
- }
-
- public void setTohPrecip3Hr(double tohPrecip3Hr)
- {
- _tohPrecip3Hr = tohPrecip3Hr;
- }
-
- public double getTohPrecip6Hr()
- {
- return _tohPrecip6Hr;
- }
-
- public void setTohPrecip6Hr(double tohPrecip6Hr)
- {
- _tohPrecip6Hr = tohPrecip6Hr;
- }
-
- public double getTohPrecip24Hr()
- {
- return _tohPrecip24Hr;
- }
-
- public void setTohPrecip24Hr(double tohPrecip24Hr)
- {
- _tohPrecip24Hr = tohPrecip24Hr;
- }
-
- */
-
-
- public double getLatestPrecip30Min()
- {
- return _latestPrecip30Min;
- }
-
- public void setLatestPrecip30Min(double latestPrecip30Min)
- {
- _latestPrecip30Min = latestPrecip30Min;
- }
-
-
- public double getLatestPrecip1Hr()
- {
- return _latestPrecip1Hr;
- }
-
- public void setLatestPrecip1Hr(double latestPrecip1Hr)
- {
- _latestPrecip1Hr = latestPrecip1Hr;
- }
-
- public double getLatestPrecip3Hr()
- {
- return _latestPrecip3Hr;
- }
-
- public void setLatestPrecip3Hr(double latestPrecip3Hr)
- {
- _latestPrecip3Hr = latestPrecip3Hr;
- }
-
- public double getLatestPrecip6Hr()
- {
- return _latestPrecip6Hr;
- }
-
- public void setLatestPrecip6Hr(double latestPrecip6Hr)
- {
- _latestPrecip6Hr = latestPrecip6Hr;
- }
-
- public double getLatestPrecip12Hr()
- {
- return _latestPrecip12Hr;
- }
-
- public void setLatestPrecip12Hr(double latestPrecip12Hr)
- {
- _latestPrecip12Hr = latestPrecip12Hr;
- }
-
- public double getLatestPrecip18Hr()
- {
- return _latestPrecip18Hr;
- }
-
- public void setLatestPrecip18Hr(double latestPrecip18Hr)
- {
- _latestPrecip18Hr = latestPrecip18Hr;
- }
-
- public double getLatestPrecip24Hr()
- {
- return _latestPrecip24Hr;
- }
-
- public void setLatestPrecip24Hr(double latestPrecip24Hr)
- {
- _latestPrecip24Hr = latestPrecip24Hr;
- }
-
- public int getRatio1Hr()
- {
- return _ratio1Hr;
- }
-
- public void setRatio1Hr(int ratio1Hr)
- {
- _ratio1Hr = ratio1Hr;
- }
- public int getRatio3Hr()
- {
- return _ratio3Hr;
- }
-
- public void setRatio3Hr(int ratio3Hr)
- {
- _ratio3Hr = ratio3Hr;
- }
- public int getRatio6Hr()
- {
- return _ratio6Hr;
- }
-
- public void setRatio6Hr(int ratio6Hr)
- {
- _ratio6Hr = ratio6Hr;
- }
- public double getDiff1Hr()
- {
- return _diff1Hr;
- }
-
- public void setDiff1Hr(double diff1Hr)
- {
- _diff1Hr = diff1Hr;
- }
- public double getDiff3Hr()
- {
- return _diff3Hr;
- }
-
- public void setDiff3Hr(double diff3Hr)
- {
- _diff3Hr = diff3Hr;
- }
-
- public double getDiff6Hr()
- {
- return _diff6Hr;
- }
-
- public void setDiff6Hr(double diff6Hr)
- {
- _diff6Hr = diff6Hr;
- }
-
- public ParamCode getLatestPrecipParamCode()
- {
- return _latestPrecipParamCode;
- }
-
- public String getLatestPrecipParamCodeString()
- {
- if(_latestPrecipParamCode != null)
- return _latestPrecipParamCode.toString();
- else
- return null;
- }
-
- public void setLatestPrecipParamCode(ParamCode latestPrecipParamCode)
- {
- _latestPrecipParamCode = latestPrecipParamCode;
- }
-
- public ParamCode getTohPrecip1HrParamCode()
- {
- return _tohPrecip1HrParamCode;
- }
-
- public String getTohPrecip1HrParamCodeString()
- {
- if(_tohPrecip1HrParamCode != null)
- return _tohPrecip1HrParamCode.toString();
- else
- return null;
- }
-
- public void setTohPrecip1HrParamCode(ParamCode tohPrecip1HrParamCode)
- {
- _tohPrecip1HrParamCode = tohPrecip1HrParamCode;
- }
-
- public ParamCode getTohPrecip3HrParamCode()
- {
- return _tohPrecip3HrParamCode;
- }
-
- public String getTohPrecip3HrParamCodeString()
- {
- if(_tohPrecip3HrParamCode != null)
- return _tohPrecip3HrParamCode.toString();
- else
- return null;
- }
-
- public void setTohPrecip3HrParamCode(ParamCode tohPrecip3HrParamCode)
- {
- _tohPrecip3HrParamCode = tohPrecip3HrParamCode;
- }
-
- public ParamCode getTohPrecip6HrParamCode()
- {
- return _tohPrecip6HrParamCode;
- }
-
- public String getTohPrecip6HrParamCodeString()
- {
- if(_tohPrecip6HrParamCode != null)
- return _tohPrecip6HrParamCode.toString();
- else
- return null;
- }
-
- public void setTohPrecip6HrParamCode(ParamCode tohPrecip6HrParamCode)
- {
- _tohPrecip6HrParamCode = tohPrecip6HrParamCode;
- }
-
- public ParamCode getTohPrecip24HrParamCode()
- {
- return _tohPrecip24HrParamCode;
- }
-
- public String getTohPrecip24HrParamCodeString()
- {
- if(_tohPrecip24HrParamCode != null)
- return _tohPrecip24HrParamCode.toString();
- else
- return null;
- }
-
- public void setTohPrecip24HrParamCode(ParamCode tohPrecip24HrParamCode)
- {
- _tohPrecip24HrParamCode = tohPrecip24HrParamCode;
- }
-
- public boolean isDataAvailable()
- {
- boolean result = true;
- if(
- DbTable.isNull(getLatestPrecip30Min()) &&
- DbTable.isNull(getLatestPrecip1Hr()) &&
- DbTable.isNull(getLatestPrecip3Hr()) &&
- DbTable.isNull(getLatestPrecip6Hr()) &&
- DbTable.isNull(getLatestPrecip12Hr()) &&
- DbTable.isNull(getLatestPrecip18Hr()) &&
- DbTable.isNull(getLatestPrecip24Hr()) &&
- DbTable.isNull(getTohPrecip1Hr())
-
- /*
- && getTohPrecip3Hr() == DbTable.getNullDouble() &&
- getTohPrecip6Hr() == DbTable.getNullDouble() &&
- getTohPrecip24Hr() == DbTable.getNullDouble()
- */
- )
- {
- result = false;
- }
-
- return result;
- }
-
- public void setTohParamCodeByHour(int hour, ParamCode paramCode)
- {
- switch(hour)
- {
- case 1:
- setTohPrecip1HrParamCode(paramCode);
- break;
- case 3:
- setTohPrecip3HrParamCode(paramCode);
- break;
- case 6:
- setTohPrecip6HrParamCode(paramCode);
- break;
- case 24:
- setTohPrecip24HrParamCode(paramCode);
- break;
- }
- }
-
- public void setTohPrecipByHour(int hour, double precipTotal)
- {
- switch(hour)
- {
- case 1:
- setTohPrecip1Hr(precipTotal);
- break;
-
- /*
- case 3:
- setTohPrecip3Hr(precipTotal);
- break;
- case 6:
- setTohPrecip6Hr(precipTotal);
- break;
- case 24:
- setTohPrecip24Hr(precipTotal);
- break;
- */
- }
- }
-
- public double getTohPrecipByHour(int hour)
- {
- double returnValue = DbTable.getNullDouble();
- switch (hour)
- {
- case 1:
- returnValue = getTohPrecip1Hr();
- break;
- /*
- case 3:
- returnValue = getTohPrecip3Hr();
- break;
- case 6:
- returnValue = getTohPrecip6Hr();
- break;
- case 24:
- returnValue = getTohPrecip24Hr();
- break;
- */
- }
- return returnValue;
- }
-
- public void setLatestPrecipByHour(float hour, double precipTotal)
- {
-
- if (hour == 0.5)
- {
- setLatestPrecip30Min(precipTotal);
- }
- else if (hour == 1)
- {
- setLatestPrecip1Hr(precipTotal);
- }
- else if (hour == 3)
- {
- setLatestPrecip3Hr(precipTotal);
- }
- else if (hour == 6)
- {
- setLatestPrecip6Hr(precipTotal);
- }
- else if (hour == 12)
- {
- setLatestPrecip12Hr(precipTotal);
- }
- else if (hour == 18)
- {
- setLatestPrecip18Hr(precipTotal);
- }
- else if (hour == 24)
- {
- setLatestPrecip24Hr(precipTotal);
- }
-
- return;
- }
-
- public double getLatestPrecipByHour(float hour)
- {
- double returnValue = DbTable.getNullDouble();
-
- if (hour == 0.5)
- {
- returnValue = getLatestPrecip30Min();
- }
- if (hour == 1)
- {
- returnValue = getLatestPrecip1Hr();
- }
- else if (hour == 3)
- {
- returnValue = getLatestPrecip3Hr();
- }
- else if (hour == 6)
- {
- returnValue = getLatestPrecip6Hr();
- }
- else if (hour == 12)
- {
- returnValue = getLatestPrecip12Hr();
- }
- else if (hour == 18)
- {
- returnValue = getLatestPrecip18Hr();
- }
- else if (hour == 24)
- {
- returnValue = getLatestPrecip24Hr();
- }
-
-
- return returnValue;
- }
-}
-
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipDataManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipDataManager.java
deleted file mode 100755
index d38a07df58..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipDataManager.java
+++ /dev/null
@@ -1,964 +0,0 @@
-package ohd.hseb.monitor.precip;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import ohd.hseb.db.Database;
-import ohd.hseb.db.DbTable;
-import ohd.hseb.db.DbTimeHelper;
-import ohd.hseb.geomap.model.HrapRowColToLatLonConverter;
-import ohd.hseb.geomap.model.LatLonPoint;
-import ohd.hseb.geomap.model.RowColumnPoint;
-import ohd.hseb.grid.XmrgGrid;
-import ohd.hseb.ihfsdb.generated.LocationRecord;
-import ohd.hseb.ihfsdb.generated.LocationTable;
-import ohd.hseb.model.ParamCode;
-import ohd.hseb.monitor.river.RiverMonitorJTableRowData;
-import ohd.hseb.pdc_pp.PDCFileReader;
-import ohd.hseb.pdc_pp.RegularObsTimeSeries;
-import ohd.hseb.pdc_pp.TimeValuePair;
-import ohd.hseb.util.MemoryLogger;
-import ohd.hseb.util.SessionLogger;
-import ucar.ma2.IndexIterator;
-import ucar.nc2.NetcdfFile;
-import ucar.nc2.Variable;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-import com.raytheon.uf.common.mpe.util.XmrgFile;
-
-
-public class PrecipDataManager {
- private AppsDefaults _appsDefaults;
-
- private double _missingDoubleValue = -9999.0;
-
- private SessionLogger _logger;
-
- private Database _db;
-
- private PDCFileReader _pdcFileReaderForPrecipInstant;
-
- private PDCFileReader _pdcFileReaderForPrecip1Hour;
-
- private PDCFileReader _pdcFileReaderForPrecip3Hour;
-
- private PDCFileReader _pdcFileReaderForPrecip6Hour;
-
- private PDCFileReader _pdcFileReaderForPrecip24Hour;
-
- private long _pdcFileUpdateLongTime = 0; // this is the time of file
- // creation
-
- private String _pdcPreprocessorFilesDir;
-
- private Map> _lidToLatestPrecipMap = null;
-
- private Map> _lidToTohPrecipMapFor1Hr = null;
-
- private Map> _lidToTohPrecipMapFor3Hr = null;
-
- private Map> _lidToTohPrecipMapFor6Hr = null;
-
- private Map> _lidToTohPrecipMapFor24Hr = null;
-
- private Map _lidToLatLonPointMap = null;
-
- private HrapRowColToLatLonConverter _hrapRowColToLatLonConverter = null;
-
- private int _baseNationalHrapRowSW;
-
- private int _baseNationalHrapColSW;
-
- private XmrgGrid _xmrgGridFor1hrFFG = null;
-
- private XmrgGrid _xmrgGridFor3hrFFG = null;
-
- private XmrgGrid _xmrgGridFor6hrFFG = null;
-
- public PrecipDataManager(Database db, AppsDefaults appsDefaults,
- String missingRepresentation, SessionLogger logger) {
- _logger = logger;
-
- _db = db;
- _appsDefaults = appsDefaults;
- _pdcPreprocessorFilesDir = _appsDefaults.getToken("pdc_pp_dir",
- "/awips2/awipsShare/hydroapps/whfs/local/data/pdc_pp");
- }
-
-
- // ---------------------------------------------------------------------------------------------------
- protected Map getLidToPrecipTotalsMapFromPreprocessorFile(
- PDCFileReader pdcFileReader, Map lidToPrecipTotalsMap) {
- String header = "PrecipDataManager.getLidToPrecipTotalsMapFromPreprocessorFile(): ";
-
- // this block of code attempts to help Garbage collection reduce the
- // amount of memory required
- if (lidToPrecipTotalsMap == null) {
- lidToPrecipTotalsMap = new HashMap();
- } else // clear out the map and its contents
- {
- Set lidSet = lidToPrecipTotalsMap.keySet();
-
- // run through each List associated with each
- // lid and clear it
- for (String lid : lidSet) {
- List regularObsTimeSeriesForAllTSList = (List) lidToPrecipTotalsMap
- .get(lid);
- regularObsTimeSeriesForAllTSList.clear();
- }
-
- lidToPrecipTotalsMap.clear();
- }
-
- checkMemoryAndGarbageCollectLog(header
- + "G.065 before pdcFileReader.read(), before GC");
-
- // read precip data from the PDC file
- List regularObsTimeSeriesList = pdcFileReader
- .read();
-
- checkMemoryAndGarbageCollectLog(header
- + "G.07 after pdcFileReader.read(), before GC");
-
- // put the list of RegularObsTimeSeries for each lid in the
- // lidToPrecipTotalsMap
- if (regularObsTimeSeriesList != null) {
- List regularObsTimeSeriesForAllTSList = null;
-
- for (RegularObsTimeSeries regularObsTimeSeries : regularObsTimeSeriesList) {
- String lid = regularObsTimeSeries.getDescriptor().getLid();
-
- regularObsTimeSeriesForAllTSList = (List) lidToPrecipTotalsMap
- .get(lid);
-
- if (regularObsTimeSeriesForAllTSList == null) {
- regularObsTimeSeriesForAllTSList = new ArrayList();
-
- lidToPrecipTotalsMap.put(lid,
- regularObsTimeSeriesForAllTSList);
- }
-
- regularObsTimeSeriesForAllTSList.add(regularObsTimeSeries);
-
- } // end for each regularObsTimeSeries
-
- checkMemoryAndGarbageCollectLog(header + "G.08, after for loop ");
-
- }
-
- checkMemoryAndGarbageCollectLog(header + "Here G.09 after if loop ");
-
- return lidToPrecipTotalsMap;
- }
-
-
- private FFGFileInfo getFFGFileInfo(int hour) {
- FFGFileInfo ffgFileInfo = null;
- String ffgFileName = null;
- File[] mosaicFileArray = getGaffMosaicFileArray(hour);
- if ((mosaicFileArray != null) && (mosaicFileArray.length > 0)) {
- ffgFileName = getNameOfLastModifiedFile(mosaicFileArray);
- ffgFileInfo = new FFGFileInfo(ffgFileName, GaffFileFormat.XMRG);
- } else // if I didn't find any GAFF output mosaic files, use GAFF input
- // files
- {
- File[] gaffInputFileArray = getGaffInputFileArray(hour);
- if ((gaffInputFileArray != null) && (gaffInputFileArray.length > 0)) {
- ffgFileName = getNameOfLastModifiedFile(gaffInputFileArray);
- ffgFileInfo = new FFGFileInfo(ffgFileName,
- GaffFileFormat.NETCDF);
- }
- }
-
- return ffgFileInfo;
- }
-
- private enum GaffFileFormat {
- NETCDF, XMRG
- }
-
- /*
- * Wrapper to store GaffFileName and
- * corresponding internal file format
- */
- private class FFGFileInfo {
- String filename=null;
-
- GaffFileFormat internalFileformat=null;
-
- FFGFileInfo(String filename, GaffFileFormat internlFileformat) {
- this.filename = filename;
- this.internalFileformat = internlFileformat;
- }
- }
-
- private String getNameOfLastModifiedFile(File[] fileArray) {
- String header = "PrecipDataManager.getNameOfLastModifiedFile(): ";
- String nameOfLastModifiedFile = null;
-
- if (fileArray != null && fileArray.length > 0
- && fileArray[0].length() > 0) {
- File lastModifiedFile = findTheLatestModifiedFile(fileArray);
- _logger.log(header + " lastmodifiedfile:" + lastModifiedFile);
- nameOfLastModifiedFile = lastModifiedFile.toString();
- } else {
- _logger.log(header + "No ffg files found.");
- }
-
- return nameOfLastModifiedFile;
- }
-
- // ------------------------------------------------------------------------------------------------------------
- private File[] getGaffMosaicFileArray(int hour) {
- String header = "PrecipDataManager.getGaffMosaicFileArray(): ";
- File filesForHour[];
- String ffgDirPathname = _appsDefaults.getToken("gaff_mosaic_dir",
- "/awips2/awipsShare/hydroapps/whfs/local/data/grid/misc") + "/";
- File ffgDir = new File(ffgDirPathname);
- FilenameFilter filter = new NetCdfFileNameFilter(hour);
- filesForHour = ffgDir.listFiles(filter);
- return filesForHour;
- }
-
- private File[] getGaffInputFileArray(int hour) {
- File filesForHour[];
- File dir = null;
- String st3RfcToken = _appsDefaults.getToken("st3_rfc");
- String gafInputDir = _appsDefaults.getToken("gaff_input_dir");
- String ffgDir = gafInputDir + "/"
- + new String(st3RfcToken.toUpperCase()) + "/" + hour + "hr"
- + "/";
- dir = new File(ffgDir);
- filesForHour = dir.listFiles();
- return filesForHour;
- }
-
- // ------------------------------------------------------------------------------------------------------------
-
- private File findTheLatestModifiedFile(File filesForHrMentioned[]) {
- File lastModifiedFile = filesForHrMentioned[0];
- for (int i = 1; i < filesForHrMentioned.length; i++) {
- if (filesForHrMentioned[i].lastModified() > lastModifiedFile
- .lastModified()) {
- lastModifiedFile = filesForHrMentioned[i];
- }
- }
- return lastModifiedFile;
- }
-
- // ------------------------------------------------------------------------------------------------------------
-
- private void readFFGInfoForMentionedHr(int hour) {
- final String header = "PrecipDataManager.readFFGInfoForMentionedHr(): ";
- FFGFileInfo ffgFileInfo = getFFGFileInfo(hour);
-
- if (ffgFileInfo != null
- && ffgFileInfo.internalFileformat.equals(GaffFileFormat.NETCDF)) {
- String ffgFileName = ffgFileInfo.filename;
- NetcdfFile netCdfFile = null;
- try {
- netCdfFile = NetcdfFile.open(ffgFileName);
- readNetCdfFileAndCreateXmargGridForMentionedHr(netCdfFile, hour);
- } catch (Exception ioe) {
- _logger.log(header + "Trying to open netcdf files "
- + ffgFileName + " " + ioe);
- } finally {
- if (null != netCdfFile) {
- try {
- netCdfFile.close();
- } catch (IOException ioe) {
- System.out.println(header
- + "Trying to close netcdf files" + ffgFileName
- + " " + ioe);
- }
- }
- }
- }
-
- if (ffgFileInfo != null
- && ffgFileInfo.internalFileformat.equals(GaffFileFormat.XMRG)) {
- String ffgFileName = ffgFileInfo.filename;
- XmrgFile xmrgFile = new XmrgFile(ffgFileName);
- try {
- xmrgFile.load();
- } catch (IOException e) {
- _logger.log(header + "-" + e);
- }
- readXmrgFileAndCreateXmrgGridForMentionedHr(xmrgFile, hour);
- }
-
- }
-
- // -----------------------------------------------------------------------------------------------
-
- private void createLidToLatLongMap() {
- if (_lidToLatLonPointMap == null) {
- String whereClause = "order by lid";
- LocationTable locationTable = new LocationTable(_db);
- LocationRecord locationRecord = new LocationRecord();
- List locationList = null;
- try {
- locationList = locationTable.select(whereClause);
- } catch (SQLException e) {
- _logger.log("Error while reading location table for lat/long values:"
- + e);
- }
-
- if (locationList != null) {
- LatLonPoint latLonPoint;
- _lidToLatLonPointMap = new HashMap();
- for (int i = 0; i < locationList.size(); i++) {
- locationRecord = (LocationRecord) locationList.get(i);
- String lid = locationRecord.getLid();
- double lat = locationRecord.getLat();
- double lon = locationRecord.getLon();
- latLonPoint = new LatLonPoint(lat, lon);
- _lidToLatLonPointMap.put(lid, latLonPoint);
- }
- }
- }
- }
-
- // -----------------------------------------------------------------------------------------------
- private void readNetCdfFileAndCreateXmargGridForMentionedHr(
- NetcdfFile netCdfFile, int hour) {
- createLidToLatLongMap();
-
- try {
- // read the netcdf file for values of x & y
- // ie., the numOfLocalHrapCols & numOfLocalHrapRows
- int numOfLocalHrapCols = netCdfFile.findDimension("x").getLength();
- int numOfLocalHrapRows = netCdfFile.findDimension("y").getLength();
- // System.out.println("[y, x] ie., [numOfLocalHrapRows ,numOfLocalHrapCols]:["+numOfLocalHrapRows+","+
- // numOfLocalHrapCols+"]");
-
- // read netcdf file for all the ffg values in an array
- // ie., read the netcdf file for values of image
- ucar.ma2.Array imageArray = (ucar.ma2.Array) netCdfFile.read(
- "image", false);
- // System.out.println("Array:["+imageArray+"]");
-
- // read netcdf file for valid time
- Variable validTimeVariable = netCdfFile.findVariable("validTime");
- ucar.ma2.Array validTimeArray = validTimeVariable.read();
-
- IndexIterator indexIterator = validTimeArray.getIndexIterator();
- long validTimeLong = indexIterator.getLongNext();
-
- // System.out.println("valid time:"+ validTimeArray +" long:"+
- // validTimeLong);
-
- // read netcdf file for latitude and longitude values of the grid
- // area.
- // this is the NW point (top left corner) point in the whole grid
- // area represented by the netcdf file
- ucar.nc2.Attribute lat = (ucar.nc2.Attribute) netCdfFile
- .findGlobalAttribute("lat00");
- ucar.nc2.Attribute lon = (ucar.nc2.Attribute) netCdfFile
- .findGlobalAttribute("lon00");
-
- double latitude = lat.getNumericValue().doubleValue();
- double longitude = lon.getNumericValue().doubleValue();
-
- // System.out.println("[latitude,longitude]:["+latitude+","+
- // longitude+"]");
-
- createHrapRowColToLatLonConverter(latitude, longitude,
- numOfLocalHrapRows);
-
- createXmrgGridAndSetGridValues(validTimeLong, numOfLocalHrapRows,
- numOfLocalHrapCols, imageArray, hour);
- } catch (Exception e) {
- System.out.println("Error while reading netcdf file:" + e);
- e.printStackTrace();
- }
- }
-
- private void readXmrgFileAndCreateXmrgGridForMentionedHr(XmrgFile xmrgFile,
- int hour) {
-
- createLidToLatLongMap();
-
- //National HRAP coordinates for the SW corner of this local xmrg grid
- _baseNationalHrapRowSW = xmrgFile.getHrapExtent().y;
- _baseNationalHrapColSW = xmrgFile.getHrapExtent().x;
-
- //extract grid data from xmrg file
- short[] data = xmrgFile.getData();
- int numOfLocalHrapRows = xmrgFile.getHrapExtent().height;
- int numOfLocalHrapCols = xmrgFile.getHrapExtent().width;
- long validTime = xmrgFile.getHeader().getValidDate().getTime();
-
- //Actually create and populate an xmrg grid object
- createXmrgGridAndSetGridValues(validTime, numOfLocalHrapRows,
- numOfLocalHrapCols, data, hour);
- }
-
- // -----------------------------------------------------------------------------------------------
-
- private void createXmrgGridAndSetGridValues(long validTime,
- int numOfLocalHrapRows, int numOfLocalHrapCols,
- ucar.ma2.Array array, int hour) {
-
- XmrgGrid xmrgGrid = new XmrgGrid(validTime, _baseNationalHrapRowSW,
- _baseNationalHrapColSW, numOfLocalHrapRows, numOfLocalHrapCols);
-
- // create a xmrggrid with the given validtime
-
- switch (hour) {
- case 1:
- _xmrgGridFor1hrFFG = xmrgGrid;
- break;
- case 3:
- _xmrgGridFor3hrFFG = xmrgGrid;
- break;
- case 6:
- _xmrgGridFor6hrFFG = xmrgGrid;
- break;
- default:
- _xmrgGridFor1hrFFG = xmrgGrid;
- }
-
- // populate the xmrggrid with values read from netcdf file
- // note: netcdf values are is read from NW and it is left to right in
- // consecutive line ( top to bottom ) ie., usual way
- // xmrggrid values are read from SW and it is also left to right in
- // consecutive line ( bottom to top) ie., not usual way
- int xmrgRowNumber = 0;
- IndexIterator indexIterator = array.getIndexIterator();
-
- for (int rowIndex = numOfLocalHrapRows - 1; rowIndex >= 0; rowIndex--) {
- for (int columnIndex = 0; columnIndex < numOfLocalHrapCols; columnIndex++) {
- if (indexIterator.hasNext()) {
-
- // double value = indexIterator.getDoubleNext();
- int value = indexIterator.getIntNext();
- double convertedValue = convertFfgValue(value);
-
- // System.out.println("Try to enter:["+ rowIndex+","+
- // columnIndex+"]" + value);
- xmrgGrid.setValue(rowIndex + _baseNationalHrapRowSW,
- columnIndex + _baseNationalHrapColSW,
- convertedValue);
- }
- }
- xmrgRowNumber++;
- }
-
- }
-
- /*
- * overloaded method for use with data array
- * read from xmrg file.
- */
- private void createXmrgGridAndSetGridValues(long validTime,
- int numOfLocalHrapRows, int numOfLocalHrapCols, short[] array,
- int hour) {
-
- XmrgGrid xmrgGrid = new XmrgGrid(validTime, _baseNationalHrapRowSW,
- _baseNationalHrapColSW, numOfLocalHrapRows, numOfLocalHrapCols);
- switch (hour) {
- case 1:
- _xmrgGridFor1hrFFG = xmrgGrid;
- break;
- case 3:
- _xmrgGridFor3hrFFG = xmrgGrid;
- break;
- case 6:
- _xmrgGridFor6hrFFG = xmrgGrid;
- break;
- default:
- _xmrgGridFor1hrFFG = xmrgGrid;
- }
-
- // populate the xmrg grid with data array read from Xmrg file
- for (int y = numOfLocalHrapRows - 1; y >= 0; y--) {
- for (int x = 0; x < numOfLocalHrapCols; x++) {
- short value = array[y * numOfLocalHrapCols + x];
- xmrgGrid.setValue(y + _baseNationalHrapRowSW, x
- + _baseNationalHrapColSW, value);
- }
- }
-
- }
-
- // -----------------------------------------------------------------------------------------------
- /*
- * This method is replicated from ffconv method in ffconv.c
- */
- private double convertFfgValue(double originalValue) {
-
- String header = "PrecipDataManage.convertFfgValue(): ";
-
- double signFixedValue = originalValue;
- double returnValue = 0.0;
- final double lowerThreshold = 201;
- final double upperThreshold = 253;
- final double mFactor = 6;
- final double inchPerMM = 0.03937;
-
- // These are values from image file and they are byte counts.
- // These are similar to an enhanced satellite image.
- // So normally the values go from 0 to 255 (256 values).
- // But, for values beyond 127, they turn negative.
- // So value 128 is really 128 - 256 = -128 in the file
- // hence you will need to add 256 for negative values to get the actual
- // positive value
- // This actual value is what is needed.
- if (signFixedValue < 0) {
- signFixedValue += 256;
- }
-
- // convert the coded value to actual precip amounts in inches
- if (signFixedValue == 0) {
- returnValue = DbTable.getNullDouble();
- } else if (signFixedValue <= lowerThreshold) {
- returnValue = signFixedValue - 1;
- returnValue *= inchPerMM;
- } else if (signFixedValue <= upperThreshold) {
- returnValue = (lowerThreshold - 1)
- + ((signFixedValue - 1) - (lowerThreshold - 1)) * mFactor;
- returnValue *= inchPerMM;
- } else if (signFixedValue >= upperThreshold) {
- returnValue = DbTable.getNullDouble();
- }
-
- return returnValue;
- }
-
- // -----------------------------------------------------------------------------------------------
- private void createHrapRowColToLatLonConverter(double latitude,
- double longitude, int numOfLocalHrapRows) {
- // with the NW(top left corner) latitude/longitude info
- // get the national hrap cordinates for the NW (top left corner)
- // TODO examine the negation of longitude - ask Bryon
-
- RowColumnPoint nationalHrapCoorinatesNW = HrapRowColToLatLonConverter
- .getNationalRowColumnPoint(latitude, -longitude);
-
- // with the national hrap coordinates for the NW (top left corner)
- // and the num of local hrap rows and num of local hrap cols info read
- // from the netcdf file
- // determine the base national hrap row and base national hrap col
- // ie., the base national SW point's row number and column number
- // which is the bottom left corner's info
- _baseNationalHrapRowSW = (int) (nationalHrapCoorinatesNW.getRow() - numOfLocalHrapRows);
- _baseNationalHrapColSW = (int) nationalHrapCoorinatesNW.getCol();
-
- if (_hrapRowColToLatLonConverter == null) {
- _hrapRowColToLatLonConverter = new HrapRowColToLatLonConverter(
- _baseNationalHrapRowSW, _baseNationalHrapColSW);
- }
- // LatLonPoint latLong =
- // _hrapRowColToLatLonConverter.getLatLonPoint(numOfLocalHrapRows -1,
- // 0);
- // System.out.println("lat long:"+ latLong);
- }
-
- // -----------------------------------------------------------------------------------------------
-
- public void setTohPrecipDataForThisLidForMentionedHour(String lid,
- PrecipData precipData, int hour) {
- Map> lidToTohPrecipTimeSeriesMap = null;
-
- switch (hour) {
- case 1:
- lidToTohPrecipTimeSeriesMap = _lidToTohPrecipMapFor1Hr;
- break;
- case 3:
- lidToTohPrecipTimeSeriesMap = _lidToTohPrecipMapFor3Hr;
- break;
- case 6:
- lidToTohPrecipTimeSeriesMap = _lidToTohPrecipMapFor6Hr;
- break;
- case 24:
- lidToTohPrecipTimeSeriesMap = _lidToTohPrecipMapFor24Hr;
- break;
- }
- if (lidToTohPrecipTimeSeriesMap.size() > 0) {
- List regularObsTimeSeriesForAllTSList = lidToTohPrecipTimeSeriesMap
- .get(lid);
-
- int count = 0;
- if (regularObsTimeSeriesForAllTSList != null) {
- for (RegularObsTimeSeries regularObsTimeSeries : regularObsTimeSeriesForAllTSList) {
- String paramCodeString = regularObsTimeSeries
- .getDescriptor().getShef_param_code();
- ParamCode paramCode = new ParamCode(paramCodeString);
-
- List timeValuePairsForParticularTSList = regularObsTimeSeries
- .getTimeValuePairList(true);
- int indexOfLastTimeValuePair = timeValuePairsForParticularTSList
- .size() - 1;
-
- // The last period is a partially-completed period.
- // The previous period the most recent complete period.
- int indexOfOfLastCompletedPeriod = indexOfLastTimeValuePair - 1;
-
- TimeValuePair timeValuePair = (TimeValuePair) timeValuePairsForParticularTSList
- .get(indexOfOfLastCompletedPeriod);
- double precipTotal = timeValuePair.getValue();
-
- boolean checkPrevValue = true;
- if (count == 0) {
- checkPrevValue = false;
- }
-
- if (precipTotal != _missingDoubleValue) {
- if (checkPrevValue) {
- if (precipTotal > precipData
- .getTohPrecipByHour(hour)) {
- precipData
- .setTohPrecipByHour(hour, precipTotal);
- precipData.setTohParamCodeByHour(hour,
- paramCode);
- }
- } else {
- precipData.setTohPrecipByHour(hour, precipTotal);
- precipData.setTohParamCodeByHour(hour, paramCode);
- }
- } else // make sure that the param code is available for
- // missing data
- {
- precipData.setTohParamCodeByHour(hour, paramCode);
- }
- count++;
- }// end of for loop
- }// end of if(regularobstimeseriesforallTSlist != null)
- }
- }
-
- // -----------------------------------------------------------------------------------------------
-
- public void setLatestPrecipDataForThisLid(String lid, PrecipData precipData) {
- if (_lidToLatestPrecipMap != null && _lidToLatestPrecipMap.size() > 0) {
- List regularObsTimeSeriesForAllTSList = _lidToLatestPrecipMap
- .get(lid);
-
- if (regularObsTimeSeriesForAllTSList != null) {
- for (int i = 0; i < regularObsTimeSeriesForAllTSList.size(); i++) {
- RegularObsTimeSeries regularObsTimeSeriesForParticularTS = regularObsTimeSeriesForAllTSList
- .get(i);
-
- String paramCodeString = regularObsTimeSeriesForParticularTS
- .getDescriptor().getShef_param_code();
- ParamCode paramCode = new ParamCode(paramCodeString);
-
- precipData.setLatestPrecipParamCode(paramCode);
-
- List timeValuePairsForParticularTSList = regularObsTimeSeriesForParticularTS
- .getTimeValuePairList(true);
-
- int indexOfLastTimeValuePair = timeValuePairsForParticularTSList
- .size() - 1;
- boolean checkPrevValue = true;
- if (i == 0) {
- checkPrevValue = false;
- }
-
- TimeValuePair timeValuePair = (TimeValuePair) timeValuePairsForParticularTSList
- .get(indexOfLastTimeValuePair);
- setLatestPrecipForHrMentioned(0.5f, timeValuePair,
- precipData, checkPrevValue);
-
- timeValuePair = (TimeValuePair) timeValuePairsForParticularTSList
- .get(indexOfLastTimeValuePair - 1);
- setLatestPrecipForHrMentioned(1, timeValuePair, precipData,
- checkPrevValue);
-
- timeValuePair = (TimeValuePair) timeValuePairsForParticularTSList
- .get(indexOfLastTimeValuePair - 3);
- setLatestPrecipForHrMentioned(3, timeValuePair, precipData,
- checkPrevValue);
-
- timeValuePair = (TimeValuePair) timeValuePairsForParticularTSList
- .get(indexOfLastTimeValuePair - 6);
- setLatestPrecipForHrMentioned(6, timeValuePair, precipData,
- checkPrevValue);
-
- timeValuePair = (TimeValuePair) timeValuePairsForParticularTSList
- .get(indexOfLastTimeValuePair - 12);
- setLatestPrecipForHrMentioned(12, timeValuePair,
- precipData, checkPrevValue);
-
- timeValuePair = (TimeValuePair) timeValuePairsForParticularTSList
- .get(indexOfLastTimeValuePair - 18);
- setLatestPrecipForHrMentioned(18, timeValuePair,
- precipData, checkPrevValue);
-
- timeValuePair = (TimeValuePair) timeValuePairsForParticularTSList
- .get(indexOfLastTimeValuePair - 24);
- setLatestPrecipForHrMentioned(24, timeValuePair,
- precipData, checkPrevValue);
-
- }
- }
- }
- }
-
- // ------------------------------------------------------------------------------------------------------------
-
- public void setFFGDataForThisLid(String lid, PrecipData precipData) {
- if (_lidToLatLonPointMap != null) {
- LatLonPoint latLon = (LatLonPoint) _lidToLatLonPointMap.get(lid);
- if (latLon != null) {
- double lat = latLon.getLat();
- double lon = latLon.getLon();
- _logger.log("For lid:"+ lid + " [lat,lon]:"+ lat +","+ lon);
-
- RowColumnPoint rowColumnPoint = HrapRowColToLatLonConverter
- .getNationalRowColumnPoint(lat, lon);
- int rowPoint = (int) rowColumnPoint.getRow();
- int colPoint = (int) rowColumnPoint.getCol();
- double value = _xmrgGridFor1hrFFG.getValue(rowPoint, colPoint);
- if (value != XmrgGrid.OFF_GRID_VALUE)
- precipData.setFFG1Hr(value);
-
- value = _xmrgGridFor3hrFFG.getValue(rowPoint, colPoint);
- if (value != XmrgGrid.OFF_GRID_VALUE)
- precipData.setFFG3Hr(value);
-
- value = _xmrgGridFor6hrFFG.getValue(rowPoint, colPoint);
- if (value != XmrgGrid.OFF_GRID_VALUE)
- precipData.setFFG6Hr(value);
-
- if (value == 0.00) {
- System.out.println("For lid:" + lid + " value is:" + value);
- }
- }
-
- }
- }
-
- // -----------------------------------------------------------------------------------------------
- public void set1Hr3Hr6HrRatio(PrecipData precipData) {
- precipData.setRatio1Hr(determinePrecipFFGRatio(
- precipData.getLatestPrecip1Hr(), precipData.getFFG1Hr()));
- precipData.setRatio3Hr(determinePrecipFFGRatio(
- precipData.getLatestPrecip3Hr(), precipData.getFFG3Hr()));
- precipData.setRatio6Hr(determinePrecipFFGRatio(
- precipData.getLatestPrecip6Hr(), precipData.getFFG6Hr()));
- return;
- }
-
- // -----------------------------------------------------------------------------------------------
-
- private int determinePrecipFFGRatio(double precip, double ffg) {
- int ratio = DbTable.getNullInt();
-
- if ((ffg != 0.00 && ffg != DbTable.getNullDouble())
- && precip != DbTable.getNullDouble()) // to avoid divide by 0
- // value
- {
- ratio = (int) ((precip / ffg) * 100);
- }
-
- return ratio;
- }
-
- // -----------------------------------------------------------------------------------------------
-
- public Map> readPrecipFile(
- String fileName, PDCFileReader pdcFileReader,
- Map> lidToLatestPrecipMap) {
- if (pdcFileReader == null) {
- pdcFileReader = new PDCFileReader(_pdcPreprocessorFilesDir
- + fileName);
- } else {
- pdcFileReader.resetObsTimeSeriesList();
- }
-
- lidToLatestPrecipMap = getLidToPrecipTotalsMapFromPreprocessorFile(
- pdcFileReader, lidToLatestPrecipMap);
-
- return lidToLatestPrecipMap;
- }
-
- public void readPDCPreprocessorPrecipFiles() {
- String header = "PrecipDataManager.readPDCPreprocessorPrecipFiles(): ";
-
- // determine the last update time for PDC Precip data
- setPdcFileUpdateLongTime(0);
- File file = new File(_pdcPreprocessorFilesDir + "/PrecipInstant.dat");
- if (file != null) {
- setPdcFileUpdateLongTime(file.lastModified());
- System.out
- .println(header
- + " the last modified file time = "
- + DbTimeHelper
- .getDateTimeStringFromLongTime(getPdcFileUpdateLongTime()));
- file = null;
- }
-
- // read the
- _lidToLatestPrecipMap = readPrecipFile("/PrecipInstant.dat",
- _pdcFileReaderForPrecipInstant, _lidToLatestPrecipMap);
- checkMemoryAndGarbageCollectLog(header
- + "Here after reading precip instant");
-
- _lidToTohPrecipMapFor1Hr = readPrecipFile("/Precip1Hour.dat",
- _pdcFileReaderForPrecip1Hour, _lidToTohPrecipMapFor1Hr);
- checkMemoryAndGarbageCollectLog(header
- + "Here after reading precip 1 hour :");
-
- _lidToTohPrecipMapFor3Hr = readPrecipFile("/Precip3Hour.dat",
- _pdcFileReaderForPrecip3Hour, _lidToTohPrecipMapFor3Hr);
- checkMemoryAndGarbageCollectLog(header
- + "Here after reading precip 3 hour :");
-
- _lidToTohPrecipMapFor6Hr = readPrecipFile("/Precip6Hour.dat",
- _pdcFileReaderForPrecip6Hour, _lidToTohPrecipMapFor6Hr);
- checkMemoryAndGarbageCollectLog(header
- + "Here after reading precip 6 hour :");
-
- _lidToTohPrecipMapFor24Hr = readPrecipFile("/Precip24Hour.dat",
- _pdcFileReaderForPrecip24Hour, _lidToTohPrecipMapFor24Hr);
- checkMemoryAndGarbageCollectLog(header
- + "Here after reading precip 24 hour :");
- }
-
- public void checkMemoryAndGarbageCollectLog(String message) {
- Runtime runtime = Runtime.getRuntime();
- String text = null;
-
- long freeMemory = runtime.freeMemory();
-
- final long SMALL_AMOUNT_OF_MEMORY = 30000000;
-
- if (freeMemory < SMALL_AMOUNT_OF_MEMORY) {
- text = message + "Free:" + freeMemory + " Max:"
- + runtime.maxMemory() + " total:" + runtime.totalMemory();
- MemoryLogger.log(text);
-
- runtime.gc();
- }
- }
-
- // ------------------------------------------------------------------------------------------------------------
-
- public void readPrecipData(List rowDataList, String tag) {
- String header = "PrecipDataManager.readLatestPrecipData(): ";
-
- System.out.println(header + "Reading precip data");
-
- readPDCPreprocessorPrecipFiles();
-
- readFFGInfoForMentionedHr(1);
- readFFGInfoForMentionedHr(3);
- readFFGInfoForMentionedHr(6);
-
- for (int i = 0; i < rowDataList.size(); i++) {
- String lid = null;
- PrecipData precipData = new PrecipData();
- if (tag.compareTo("PRECIP") == 0) {
- PrecipMonitorJTableRowData precipMonitorRowData = (PrecipMonitorJTableRowData) rowDataList
- .get(i);
- lid = (String) precipMonitorRowData.getLid();
- precipMonitorRowData.setPrecipData(precipData);
- } else {
- RiverMonitorJTableRowData riverMonitorRowData = (RiverMonitorJTableRowData) rowDataList
- .get(i);
- lid = (String) riverMonitorRowData.getLid();
- riverMonitorRowData.setPrecipData(precipData);
- }
- setLatestPrecipDataForThisLid(lid, precipData);
-
- setFFGDataForThisLid(lid, precipData);
-
- setTohPrecipDataForThisLidForMentionedHour(lid, precipData, 1);
- setTohPrecipDataForThisLidForMentionedHour(lid, precipData, 3);
- setTohPrecipDataForThisLidForMentionedHour(lid, precipData, 6);
- setTohPrecipDataForThisLidForMentionedHour(lid, precipData, 24);
-
- setFfgDifferenceValues(precipData);
-
- set1Hr3Hr6HrRatio(precipData);
-
- } // end of for loop
- checkMemoryAndGarbageCollectLog(header + "End of read precip method ");
- }
-
- // ------------------------------------------------------------------------------------------------------------
- private void setFfgDifferenceValues(PrecipData precipData) {
- precipData.setDiff1Hr(determineFfgDifferenceValue(
- precipData.getLatestPrecip1Hr(), precipData.getFFG1Hr()));
- precipData.setDiff3Hr(determineFfgDifferenceValue(
- precipData.getLatestPrecip3Hr(), precipData.getFFG3Hr()));
- precipData.setDiff6Hr(determineFfgDifferenceValue(
- precipData.getLatestPrecip6Hr(), precipData.getFFG6Hr()));
- }
-
- // ------------------------------------------------------------------------------------------------------------
-
- private double determineFfgDifferenceValue(double precipValue,
- double ffgValue) {
-
- double diffValue = DbTable.getNullDouble();
-
- if ((DbTable.isNull(precipValue)) || (DbTable.isNull(ffgValue))) {
- // no good
- } else {
- diffValue = precipValue - ffgValue;
- }
-
- return diffValue;
- }
-
- // ------------------------------------------------------------------------------------------------------------
-
- private void setLatestPrecipForHrMentioned(float hour,
- TimeValuePair timeValuePair, PrecipData precipData,
- boolean checkPrevValue) {
- double precipTotal = timeValuePair.getValue();
-
- if (precipTotal != _missingDoubleValue) // used since the pdc
- // preprocessor represents
- // missing as -9999.0
- {
- if (checkPrevValue) {
- if (precipTotal > precipData.getLatestPrecipByHour(hour))
- precipData.setLatestPrecipByHour(hour, precipTotal);
- } else
- precipData.setLatestPrecipByHour(hour, precipTotal);
- }
- }
-
- public void setPdcFileUpdateLongTime(long pdcFileUpdateLongTime) {
- _pdcFileUpdateLongTime = pdcFileUpdateLongTime;
- }
-
- public long getPdcFileUpdateLongTime() {
- return _pdcFileUpdateLongTime;
- }
-
- // --------------------------------------------------------------------------------
- class NetCdfFileNameFilter implements FilenameFilter {
-
- String pattern = "0"; // <---removed the leading underscore "_0"
-
- public NetCdfFileNameFilter(int hour) {
- pattern += hour + ".ffg";
- }
-
- public boolean accept(String name) {
- return name.contains(pattern);
- }
-
- public boolean accept(File arg0, String name) {
- return name.contains(pattern);
- }
-
- public String toString() {
- return pattern;
- }
-
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipLocationDataFilter.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipLocationDataFilter.java
deleted file mode 100755
index 9ba4df2420..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipLocationDataFilter.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package ohd.hseb.monitor.precip;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import ohd.hseb.monitor.LocationDataFilter;
-import ohd.hseb.util.BooleanHolder;
-import ohd.hseb.util.gui.jtable.JTableRowData;
-
-public class PrecipLocationDataFilter extends LocationDataFilter
-{
-
- private BooleanHolder _showMissingBooleanHolder = null;
-
- public PrecipLocationDataFilter(Map locationDisplayMap, BooleanHolder showMissingBooleanHolder)
- {
- _locationDisplayMap = locationDisplayMap;
- _showMissingBooleanHolder = showMissingBooleanHolder;
- }
-
- /**
- * Filter the allRowDataList based on the locationDisplayMap
- */
- public List filter(List allRowDataList)
- {
- boolean showMissing = _showMissingBooleanHolder.getValue();
- List filteredRowDataList = new ArrayList();
-
- if (_locationDisplayMap != null)
- {
- for (int i = 0; i < allRowDataList.size(); i++)
- {
- PrecipMonitorJTableRowData rowData = (PrecipMonitorJTableRowData) allRowDataList.get(i);
- String lid = rowData.getLid();
- Boolean shouldDisplay = _locationDisplayMap.get(lid);
- if ((shouldDisplay != null) && (shouldDisplay) ) //based on selection in the tree
- {
- if (showMissing) //based on menu selection
- {
- filteredRowDataList.add(rowData);
- }
- else //don't show missing
- {
- if (rowData.getPrecipData().isDataAvailable())
- {
- filteredRowDataList.add(rowData);
- }
- }
- } //end if shouldDisplay
- } //end for
- }
-
-
- return filteredRowDataList;
- }
-
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipMonitorDataManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipMonitorDataManager.java
deleted file mode 100755
index a3e2772aaa..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipMonitorDataManager.java
+++ /dev/null
@@ -1,639 +0,0 @@
-package ohd.hseb.monitor.precip;
-
-import java.awt.Color;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import ohd.hseb.db.Database;
-import ohd.hseb.db.DbTable;
-import ohd.hseb.ihfsdb.generated.AdminRecord;
-import ohd.hseb.ihfsdb.generated.AdminTable;
-import ohd.hseb.ihfsdb.generated.LocRiverMonRecord;
-import ohd.hseb.ihfsdb.generated.LocRiverMonView;
-import ohd.hseb.ihfsdb.generated.LocationRecord;
-import ohd.hseb.ihfsdb.generated.LocationTable;
-import ohd.hseb.monitor.LocationDataFilter;
-import ohd.hseb.monitor.TreeFilterManager;
-import ohd.hseb.monitor.derivedcolumns.DerivedColumn;
-import ohd.hseb.monitor.derivedcolumns.DerivedColumnsFileManager;
-import ohd.hseb.monitor.precip.settings.PrecipColumnDataSettings;
-import ohd.hseb.monitor.precip.settings.PrecipMonitorMenuSettings;
-import ohd.hseb.officenotes.OfficeNotesDataManager;
-import ohd.hseb.rivermonlocgroup.RiverMonLocGroupDataManager;
-import ohd.hseb.util.CodeTimer;
-import ohd.hseb.util.MathHelper;
-import ohd.hseb.util.SessionLogger;
-
-import org.apache.bsf.BSFEngine;
-import org.apache.bsf.BSFManager;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-
-
-public class PrecipMonitorDataManager {
-
- private Database _db;
-
- private AppsDefaults _appsDefaults;
-
- private SessionLogger _logger;
-
- private String _defaultHsa;
-
- private Set _precipLidSet = null;
-
- private DerivedColumnsFileManager _derivedColumnsFileManager;
-
- private List _derivedColumnsList;
-
- private BSFManager _bsfManager;
-
- private BSFEngine _beanShellEngine;
-
- private String _missingRepresentation;
-
- private List _precipMonitorRowDataList;
-
- private List _missingPrecipMonitorRowDataList = new ArrayList();
-
- private Map _lidDescDetailsMap;
-
- private Map _lidToRiverBasinMap = new HashMap();
-
- private TreeFilterManager _treeFilterManager;
-
- private String _lidOfCurrentInterest;
-
- private PrecipMonitorMenuSettings _menuSettings;
-
- private RiverMonLocGroupDataManager _riverMonLocGroupDataManager;
-
- private OfficeNotesDataManager _officeNotesDataManager;
-
- private PrecipDataManager _precipDataManager;
-
- public PrecipMonitorDataManager(Database db, AppsDefaults appsDefaults,
- String missingRepresentation, SessionLogger logger,
- PrecipMonitorMenuSettings menuSettings,
- DerivedColumnsFileManager derivedColumnsFileManager) {
- _appsDefaults = appsDefaults;
- _menuSettings = menuSettings;
-
- _db = db;
- _missingRepresentation = missingRepresentation;
- _logger = logger;
-
- _precipDataManager = new PrecipDataManager(_db, _appsDefaults,
- _missingRepresentation, _logger);
- readAdminTable();
-
- _riverMonLocGroupDataManager = new RiverMonLocGroupDataManager(db,
- _logger, missingRepresentation, getDefaultHsa());
-
- _derivedColumnsFileManager = derivedColumnsFileManager;
-
- _officeNotesDataManager = new OfficeNotesDataManager(db, _logger,
- missingRepresentation);
-
- try {
- initializeBSF();
- } catch (Exception e) {
- _logger.log("PrecipMonitorDataManager.PrecipMonitorDataManager(): Error while initialize BSF..."
- + e);
- }
- }
-
- public RiverMonLocGroupDataManager getRiverMonLocGroupDataManager() {
- return _riverMonLocGroupDataManager;
- }
-
- public OfficeNotesDataManager getOfficeNotesDataManager() {
- return _officeNotesDataManager;
- }
-
- public TreeFilterManager getTreeFilterManager() {
- if (_treeFilterManager == null) {
- _treeFilterManager = new TreeFilterManager(_logger,
- getLocationDataFilter());
- }
- return _treeFilterManager;
- }
-
- public void setLidOfCurrentInterest(String lid) {
- _lidOfCurrentInterest = lid;
- }
-
- public String getLidOfCurrentInterest() {
- return _lidOfCurrentInterest;
- }
-
- public long getPdcUpdateTime() {
- return _precipDataManager.getPdcFileUpdateLongTime();
- }
-
- public long getDisplayedRecordCount() {
- String header = "PrecipMonitorDataManager.getDisplayedRecordCount(): ";
- printLocationCounts(header + "_precipMonitorRowDataList ");
-
- // System.out.println(header + " _precipMonitorRowDataList count = " +
- // _precipMonitorRowDataList.size());
-
- List selectedRowDataList = getTreeFilterManager().filter(
- _precipMonitorRowDataList);
- long displayedCount = selectedRowDataList.size();
-
- // printLocationCounts(header + " after filter applied ");
-
- // System.out.println(header + " selectedRowDataList count = " +
- // displayedCount);
-
- return displayedCount;
-
- }
-
- public void disconnect() {
- _db.disconnect();
- }
-
- public boolean getShowMissing() {
- return _menuSettings.shouldShowMissingPrecip();
- }
-
- public PrecipColumnDataSettings getPrecipSettings() {
- return _menuSettings.getPrecipSettings();
- }
-
- private void printLocationCounts(String header) {
- System.out.println(header + "There are "
- + _precipMonitorRowDataList.size() + " displayed with "
- + _missingPrecipMonitorRowDataList.size()
- + " non-displayed missing locations.");
-
- writeLidsToFile();
-
- }
-
- private void writeLidsToFile() {
- FileWriter writer = null;
-
- try {
- // writer = new
- // FileWriter("/awips/hydroapps/ob83_fwr/whfs/bin/PrecipMonitorLocations.txt");
- String whfsBinDir =
- this._appsDefaults.getToken("whfs_bin_dir",
- "/awips2/awipsShare/hydroapps/whfs/bin");
-
- writer = new FileWriter(
- whfsBinDir + "/PrecipMonitorLocations.txt");
- for (PrecipMonitorJTableRowData row : _precipMonitorRowDataList) {
- writer.write(row.getLid() + "\n");
- }
-
- writer.close();
- }
-
- catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
- public Map getLidToCriticalColorMap() {
- String header = "PrecipMonitorDataManager.getLidToCriticalColorMap(): ";
-
- Map lidToCriticalColorMap = new HashMap();
- for (PrecipMonitorJTableRowData rowData : _precipMonitorRowDataList) {
- String lid = rowData.getLid();
- Color criticalColor = rowData.getCriticalColorForThisRow();
- lidToCriticalColorMap.put(lid, criticalColor);
- }
-
- for (PrecipMonitorJTableRowData rowData : _missingPrecipMonitorRowDataList) {
- String lid = rowData.getLid();
- Color criticalColor = rowData.getCriticalColorForThisRow();
- lidToCriticalColorMap.put(lid, criticalColor);
- }
-
- printLocationCounts(header);
-
- return lidToCriticalColorMap;
- }
-
- public List getLidList() {
- String header = "PrecipMonitorDataManager.getLidList(): ";
- List lidList = new ArrayList();
- for (PrecipMonitorJTableRowData rowData : _precipMonitorRowDataList) {
- String lid = rowData.getLid();
- lidList.add(lid);
- }
-
- System.out.println(header + "_precipMonitorRowDataList.size() = "
- + _precipMonitorRowDataList.size());
-
- return lidList;
- }
-
- private List getFullListOfLocationIds() {
- List locationIdList = new ArrayList();
-
- for (PrecipMonitorJTableRowData rowData : _precipMonitorRowDataList) {
- locationIdList.add(rowData.getLid());
- }
-
- return locationIdList;
-
- }
-
- // ---------------------------------------------------------------------------------------------------
-
- private LocationDataFilter getLocationDataFilter() {
- PrecipLocationDataFilter locationDataFilter;
- List lidList = getFullListOfLocationIds();
- Map locationDisplayMap = new HashMap();
-
- for (String lid : lidList) {
- locationDisplayMap.put(lid, false);
- }
-
- locationDataFilter = new PrecipLocationDataFilter(locationDisplayMap,
- _menuSettings.getShowMissingPrecipBooleanHolder());
- return locationDataFilter;
- }
-
- private void readAdminTable() {
- AdminTable adminTable = new AdminTable(_db);
- List adminList = null;
- try {
- adminList = adminTable.select("");
- } catch (SQLException e) {
- logSQLException(e);
- }
- _defaultHsa = ((AdminRecord) adminList.get(0)).getHsa();
- }
-
- protected void readCurrentRiverMonTableData() {
- /**
- * Delegate to the RiverMonLocGroupDataManager the initialization of the
- * location and group definitions and ordering.
- */
- _riverMonLocGroupDataManager.initializeRiverMonTableData();
-
- }
-
- /**
- * Reads the location table and creates the list of
- * PrecipMonitorJtableRowdata objects for each location and fills in its
- * name, state , county info
- *
- * @return
- */
- private List readPrecipLocationInfo() {
- if (_precipLidSet == null)
- _precipLidSet = new HashSet();
- else
- _precipLidSet.clear();
-
- if (_precipMonitorRowDataList != null) {
- for (PrecipMonitorJTableRowData precipMonitorRowData : _precipMonitorRowDataList) {
- precipMonitorRowData.resetCellMap();
- }
- _precipMonitorRowDataList.clear();
- }
-
- Runtime.getRuntime().gc();
- List precipMonitorRowDataList = new ArrayList();
-
- LocationTable locationTable = new LocationTable(_db);
-
- List locationRecordList;
-
- loadRiverBasinData();
-
- try {
- String whereClause = "where lid in (select distinct(lid) from ingestfilter where pe in('PC', 'PP') and ingest='T')";
- locationRecordList = locationTable.select(whereClause);
- if (locationRecordList != null) {
- for (LocationRecord locationRecord : locationRecordList) {
- PrecipMonitorJTableRowData precipMonitorRowData = new PrecipMonitorJTableRowData(
- _missingRepresentation, this, _logger);
-
- precipMonitorRowData.setLid(locationRecord.getLid());
- precipMonitorRowData.setName(locationRecord.getName());
- precipMonitorRowData.setCounty(locationRecord.getCounty());
- precipMonitorRowData.setState(locationRecord.getState());
-
- setRiverBasinData(precipMonitorRowData);
-
- precipMonitorRowDataList.add(precipMonitorRowData);
- _precipLidSet.add(locationRecord.getLid());
- }
- }
- } catch (SQLException e) {
- logSQLException(e);
- }
- return precipMonitorRowDataList;
- }
-
- public List getPrecipMonitorRowDataList() {
- return _precipMonitorRowDataList;
- }
-
- private void loadRiverBasinData() {
- LocationTable table = new LocationTable(_db);
- String whereClause = "order by lid";
- List recordList = null;
-
- _lidToRiverBasinMap.clear();
- try {
- recordList = (List) table.select(whereClause);
- for (LocationRecord record : recordList) {
- _lidToRiverBasinMap.put(record.getLid(), record.getRb());
- }
- } catch (SQLException e) {
-
- }
-
- }
-
- private void setRiverBasinData(PrecipMonitorJTableRowData rowData) {
- String riverBasin = _lidToRiverBasinMap.get(rowData.getLid());
-
- rowData.setRiverBasin(riverBasin);
-
- return;
- }
-
- public boolean isPrecipLocation(String lid) {
- boolean result = false;
-
- if (_precipLidSet != null) {
- if (_precipLidSet.contains(lid)) {
- result = true;
- }
- }
- return result;
- }
-
- public void alterPrecipMonitorRowDataListBasedOnMissingPrecipFilter() {
-
- _missingPrecipMonitorRowDataList.clear();
-
- // _fullPrecipMonitorRowDataList = _precipMonitorRowDataList;
-
- if (!_menuSettings.shouldShowMissingPrecip()) // show missing precip is
- // set to false(ie., skip
- // missing precip)
- {
- System.out.println("Show missing is false");
- List finalPrecipMonitorRowDataList = new ArrayList();
-
- for (PrecipMonitorJTableRowData precipMonitorRowData : _precipMonitorRowDataList) {
- PrecipData precipData = precipMonitorRowData.getPrecipData();
-
- // precip is available add this lid
- if (precipData.isDataAvailable()) {
- finalPrecipMonitorRowDataList.add(precipMonitorRowData);
- } else {
- _missingPrecipMonitorRowDataList.add(precipMonitorRowData);
- }
- }
- _precipMonitorRowDataList = finalPrecipMonitorRowDataList;
- finalPrecipMonitorRowDataList = null;
- Runtime.getRuntime().gc();
- }
- }
-
- public void createPrecipMonitorRowDataList() {
-
- CodeTimer methodTimer = new CodeTimer();
- methodTimer.start();
- CodeTimer timer = new CodeTimer();
-
- String header = "PrecipMonitorDataManager.createPrecipMonitorRowDataList(): ";
-
- _logger.log(header + " Memory Info before creating rowdata list:"
- + printMemoryInfo());
- Runtime.getRuntime().gc();
-
- timer.start();
- _precipMonitorRowDataList = readPrecipLocationInfo();
- timer.stop(header + "readPrecipLocationInfo took: ");
-
- if (_precipMonitorRowDataList != null) {
- timer.start();
- readCurrentRiverMonTableData();
- timer.stop(header + "readCurrentRiverMonTableData took: ");
-
- _logger.log(header + " 1:" + printMemoryInfo());
- Runtime.getRuntime().gc();
-
- timer.start();
- _precipDataManager.readPrecipData(_precipMonitorRowDataList,
- "PRECIP");
- timer.stop(header + "readPrecipData took: ");
-
- Runtime.getRuntime().gc();
- _logger.log(header + " 2:" + printMemoryInfo());
- _derivedColumnsList = _derivedColumnsFileManager
- .getDerivedColumns();
-
- timer.start();
-
- for (PrecipMonitorJTableRowData precipMonitorRowData : _precipMonitorRowDataList) {
- String groupId = _riverMonLocGroupDataManager
- .getGroupId(precipMonitorRowData.getLid());
- String groupName = _riverMonLocGroupDataManager
- .getGroupName(groupId);
- int groupOrdinal = _riverMonLocGroupDataManager
- .getGroupOrdinal(groupId);
- String hsa = _riverMonLocGroupDataManager.getHsa(groupId);
- int locationOrdinal = _riverMonLocGroupDataManager
- .getLocationOrdinal(precipMonitorRowData.getLid());
-
- // precipMonitorRowData.setLid(precipMonitorRowData.getLid());
- precipMonitorRowData.setLocationOrdinal(locationOrdinal);
- precipMonitorRowData.setHsa(hsa);
- precipMonitorRowData.setGroupName(groupName);
- precipMonitorRowData.setGroupId(groupId);
- precipMonitorRowData.setGroupOrdinal(groupOrdinal);
-
- /*
- * _logger.log(precipMonitorRowData.getLid() + "|" +
- * precipMonitorRowData.getName() + "|" +
- * precipMonitorRowData.getGroupId() + "|" +
- * precipMonitorRowData.getGroupName() + "|" +
- * precipMonitorRowData.getLocationOrdinal() + "|" +
- * precipMonitorRowData.getGroupOrdinal() );
- */
-
- precipMonitorRowData.addAllCellsToMap();
-
- getDerivedColumnsInfo(precipMonitorRowData);
-
- precipMonitorRowData.addDerivedDataToCellMap();
-
- }
-
- int count = _precipMonitorRowDataList.size();
-
- timer.stop(header + " for loop with " + count
- + " iterations took: ");
-
- _logger.log(header
- + "Before missing precip filter is applied, alllocationinfo list size:"
- + _precipMonitorRowDataList.size());
-
- // timer.start();
- // alterPrecipMonitorRowDataListBasedOnMissingPrecipFilter();
- // timer.stop(header +
- // "alterPrecipMonitorRowDataListBasedOnMissingPrecipFilter took: ");
-
- _logger.log(header
- + "After missing precip filter is applied, alllocationinfo list size:"
- + _precipMonitorRowDataList.size());
- }
- Runtime.getRuntime().gc();
- _logger.log(header + " Memory Info after creating rowdata list:"
- + printMemoryInfo());
-
- methodTimer.stop(header + " the whole method took: ");
-
- }
-
- // ---------------------------------------------------------------------------------------------------
-
- public String printMemoryInfo() {
- String str = "Free:" + Runtime.getRuntime().freeMemory() + " Max:"
- + Runtime.getRuntime().maxMemory() + " total:"
- + Runtime.getRuntime().totalMemory();
- return str;
- }
-
- private double roundTo2DecimalPlaces(double number) {
- double result = DbTable.getNullDouble();
- if (number != DbTable.getNullDouble())
- result = MathHelper.roundToNDecimalPlaces(number, 2);
-
- return result;
- }
-
- // ---------------------------------------------------------------------------------------------------
-
- private void initializeBSF() throws Exception {
- _bsfManager = new BSFManager();
- BSFManager.registerScriptingEngine("beanshell",
- "bsh.util.BeanShellBSFEngine", null);
- _beanShellEngine = _bsfManager.loadScriptingEngine("beanshell");
- }
-
- // ---------------------------------------------------------------------------------------------------
-
- protected void getDerivedColumnsInfo(
- PrecipMonitorJTableRowData precipMonitorRowData) {
- if (_derivedColumnsList != null) {
- try {
- _bsfManager.declareBean("row", precipMonitorRowData,
- PrecipMonitorJTableRowData.class);
- _bsfManager.declareBean("precip",
- precipMonitorRowData.getPrecipData(), PrecipData.class);
-
- for (int j = _derivedColumnsList.size() - 1; j >= 0; j--) {
- DerivedColumn derivedColumnDesc = (DerivedColumn) _derivedColumnsList
- .get(j);
- String equationForCellValue = ((String) derivedColumnDesc
- .getEquationForCellValue());
- Object returnValueForCell = _beanShellEngine.eval(
- "rowtest", 1, 1, equationForCellValue);
- if (derivedColumnDesc.getReturnType().equalsIgnoreCase(
- "double")) {
- double value = roundTo2DecimalPlaces(Double
- .parseDouble(returnValueForCell.toString()));
- derivedColumnDesc.setvalue(Double.valueOf(value));
- } else
- derivedColumnDesc.setvalue(returnValueForCell);
-
- String equationForCellColor = ((String) derivedColumnDesc
- .getEquationForCellColor());
- Object returnColorForCell = _beanShellEngine.eval(
- "rowtest", 1, 1, equationForCellColor);
- if (returnColorForCell != null)
- derivedColumnDesc
- .setCellBackgroundColor(returnColorForCell
- .toString());
- }
- _bsfManager.undeclareBean("row");
- _bsfManager.undeclareBean("precip");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- precipMonitorRowData.setDerivedColumnsDetailsList(_derivedColumnsList);
- }
-
- // ---------------------------------------------------------------------------------------------------
- public List createStringArrayListOfFilterItems() {
- String header = "PrecipMonitorDataManager.createStringArrayListOfFilterItems(): ";
-
- List locationIdList = getFullListOfLocationIds();
-
- List listOfNodePathStringArray = _riverMonLocGroupDataManager
- .createStringArrayListOfFilterItems(locationIdList);
-
- return listOfNodePathStringArray;
- }
-
- // ---------------------------------------------------------------------------------------------------
-
- public String getDefaultHsa() {
- return _defaultHsa;
- }
-
- protected void logSQLException(SQLException exception) {
- _logger.log("SQL ERROR = " + exception.getErrorCode() + " "
- + exception.getMessage());
-
- exception.printStackTrace(_logger.getPrintWriter());
-
- _logger.log("End of stack trace");
-
- }
-
- public Map getLidDescDetails() {
- if (_lidDescDetailsMap == null) {
- LocRiverMonView riverMonView = new LocRiverMonView(_db);
- try {
- List riverMonViewList = (List) riverMonView.select("");
- if (riverMonViewList != null) {
- if (riverMonViewList.size() > 0) {
- _lidDescDetailsMap = new HashMap();
- for (int i = 0; i < riverMonViewList.size(); i++) {
- LocRiverMonRecord record = (LocRiverMonRecord) riverMonViewList
- .get(i);
- String name = record.getName();
- if (name != null) {
- if (name.length() > 0) {
- if (name.length() > 50) {
- name = name.substring(0, 50);
- }
- }
- }
- String desc = name + ";" + record.getState() + ";"
- + record.getCounty();
- _lidDescDetailsMap.put(record.getLid(), desc);
- }
- }
- }
- } catch (SQLException e) {
- logSQLException(e);
- }
- }
- return _lidDescDetailsMap;
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipMonitorJTableRowData.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipMonitorJTableRowData.java
deleted file mode 100755
index be7876380f..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipMonitorJTableRowData.java
+++ /dev/null
@@ -1,821 +0,0 @@
-package ohd.hseb.monitor.precip;
-
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import ohd.hseb.db.DbTable;
-import ohd.hseb.monitor.LocationInfoColumns;
-import ohd.hseb.monitor.MonitorCell;
-import ohd.hseb.monitor.ThreatLevel;
-import ohd.hseb.monitor.derivedcolumns.DerivedColumn;
-import ohd.hseb.monitor.precip.settings.PrecipColumnDataSettings;
-import ohd.hseb.util.MathHelper;
-import ohd.hseb.util.SessionLogger;
-import ohd.hseb.util.gui.jtable.AbstractJTableRowData;
-import ohd.hseb.util.gui.jtable.CellType;
-
-public class PrecipMonitorJTableRowData extends AbstractJTableRowData
-{
- private int _defaultDecimalPoints = 2;
-
- private static Map _derivedReturnTypeToCellTypeMap = new HashMap();
-
- private String _groupName;
- private String _lid;
- private String _name;
- private String _county;
- private String _state;
- private String _hsa;
- private String _riverBasin;
- private String _groupId;
- private int _groupOrdinal;
- private int _locationOrdinal;
- private double _obsFcstMax;
- private SessionLogger _logger;
-
- protected PrecipMonitorDataManager _precipMonitorDataManager;
-
- private String _toolTipTextForPrecipThreatSummary;
- private List _derivedColumnsDetailsList;
-
- private PrecipData _precipData;
- private PrecipColumnDataSettings _precipSettings;
-
- static
- {
- _derivedReturnTypeToCellTypeMap.put("boolean", CellType.BOOLEAN);
- _derivedReturnTypeToCellTypeMap.put("double", CellType.DOUBLE);
- _derivedReturnTypeToCellTypeMap.put("float", CellType.FLOAT);
- _derivedReturnTypeToCellTypeMap.put("long", CellType.LONG);
- _derivedReturnTypeToCellTypeMap.put("int", CellType.INTEGER);
- _derivedReturnTypeToCellTypeMap.put("string", CellType.STRING);
-
- }
-
- public PrecipMonitorJTableRowData(String missingRepresentation, PrecipMonitorDataManager precipMonitorDataManager,
- SessionLogger logger)
- {
- setMissingRepresentation(missingRepresentation);
- _logger = logger;
- _precipMonitorDataManager = precipMonitorDataManager;
- }
-
- public String getLid()
- {
- return _lid;
- }
-
- public void setLid(String lid)
- {
- this._lid = lid ;
- }
-
- public String getName()
- {
- return _name;
- }
-
- public void setName(String name)
- {
- this._name = name ;
- }
-
- public String getCounty()
- {
- return _county;
- }
-
- public void setCounty(String county)
- {
- this._county = county ;
- }
-
- public String getState()
- {
- return _state;
- }
-
- public void setState(String state)
- {
- this._state = state ;
- }
-
- public String getHsa()
- {
- return _hsa;
- }
-
- public void setHsa(String hsa)
- {
- this._hsa = hsa ;
- }
-
- public String getGroupName()
- {
- return _groupName;
- }
-
- public void setGroupName(String groupName)
- {
- this._groupName = groupName ;
- }
-
- public String getGroupId()
- {
- return _groupId;
- }
-
- public void setGroupId(String groupId)
- {
- this._groupId = groupId ;
- }
-
- public int getGroupOrdinal()
- {
- return _groupOrdinal;
- }
-
- public void setGroupOrdinal(int groupOrdinal)
- {
- this._groupOrdinal = groupOrdinal ;
- }
-
- public int getLocationOrdinal()
- {
- return _locationOrdinal;
- }
-
- public void setLocationOrdinal(int locationOrdinal)
- {
- this._locationOrdinal = locationOrdinal ;
- }
-
- public void setObsFcstMax(double obsFcstMax)
- {
- this._obsFcstMax = obsFcstMax;
- }
-
- public double getObsFcstMax()
- {
- return _obsFcstMax;
- }
-
- public PrecipData getPrecipData()
- {
- return _precipData;
- }
-
- public void setPrecipData(PrecipData precipData)
- {
- _precipData = precipData;
- }
-
- public void setDerivedColumnsDetailsList(List list)
- {
- _derivedColumnsDetailsList = list;
- }
-
- public List getDerivedColumnsDetailsList()
- {
- return _derivedColumnsDetailsList;
- }
-
-
- public String getStringValue(long value, long missingValue)
- {
- String result = super.getStringValue(value, missingValue);
- if(result != super.getMissingRepresentation())
- {
- String tempStr = result.substring(5, result.length()-3);
- tempStr = tempStr.replace('-','/');
- tempStr = tempStr.replace(' ', '-');
- result = tempStr;
- }
- return result;
- }
-
- public String getToolTipTextForPrecipThreatSummary()
- {
- return _toolTipTextForPrecipThreatSummary;
- }
-
- public void setToolTipTextForPrecipThreatSummary(String toolTipText)
- {
- _toolTipTextForPrecipThreatSummary = toolTipText;
- }
-
- public void resetCellMap()
- {
- super.resetCellMap();
- }
-
- public void addAllCellsToMap()
- {
- ThreatLevel defaultThreatLevel = ThreatLevel.NO_THREAT;
- String header = "RiverMonitorJTableRowData2.addAllCellsToMap(): ";
-
- String dateTimeFormatString = "MM/dd - HH:mm";
-
- _precipSettings = _precipMonitorDataManager.getPrecipSettings();
-
- //static data
-
- addToCellMap(LocationInfoColumns.GROUP_NAME, CellType.STRING, getGroupName() );
- addToCellMap(LocationInfoColumns.GROUP_ID, CellType.STRING, getGroupId() );
- addToCellMap(LocationInfoColumns.GROUP_ORDINAL, CellType.INTEGER, getGroupOrdinal());
-
- addToCellMap(LocationInfoColumns.LOCATION_ID, CellType.STRING, getLid() );
- addToCellMap(LocationInfoColumns.LOCATION_NAME, CellType.STRING, getName() );
- addToCellMap(LocationInfoColumns.LOCATION_ORDINAL, CellType.INTEGER, getLocationOrdinal());
-
- addToCellMap(LocationInfoColumns.COUNTY, CellType.STRING, getCounty() );
- addToCellMap(LocationInfoColumns.STATE, CellType.STRING, getState() );
-
- addToCellMap(LocationInfoColumns.HSA, CellType.STRING, getHsa() );
-
- addToCellMap(LocationInfoColumns.RIVER_BASIN, CellType.STRING, getRiverBasin());
-
- addToCellMap(PrecipColumns.LATEST_PRECIP_PARAM_CODE, CellType.STRING, getPrecipData().getLatestPrecipParamCodeString() );
-
- addToCellMap(PrecipColumns.LATEST_30MIN, CellType.DOUBLE, getPrecipData().getLatestPrecip30Min());
- addToCellMap(PrecipColumns.LATEST_1HR, CellType.DOUBLE, getPrecipData().getLatestPrecip1Hr(), getThreatLevelForPrecipColumn("LATEST", 1));
- addToCellMap(PrecipColumns.LATEST_3HR, CellType.DOUBLE, getPrecipData().getLatestPrecip3Hr(), getThreatLevelForPrecipColumn("LATEST", 3));
- addToCellMap(PrecipColumns.LATEST_6HR, CellType.DOUBLE, getPrecipData().getLatestPrecip6Hr(), getThreatLevelForPrecipColumn("LATEST", 6));
- addToCellMap(PrecipColumns.LATEST_12HR, CellType.DOUBLE, getPrecipData().getLatestPrecip12Hr());
- addToCellMap(PrecipColumns.LATEST_18HR, CellType.DOUBLE, getPrecipData().getLatestPrecip18Hr());
- addToCellMap(PrecipColumns.LATEST_24HR, CellType.DOUBLE, getPrecipData().getLatestPrecip24Hr());
-
- addToCellMap(PrecipColumns.TOH_PRECIP_1HR_PARAM_CODE, CellType.STRING, getPrecipData().getTohPrecip1HrParamCodeString() );
- addToCellMap(PrecipColumns.TOH_PRECIP_1HR, CellType.DOUBLE, getPrecipData().getTohPrecip1Hr(), getThreatLevelForPrecipColumn("TOH", 1));
-
- addToCellMap(PrecipColumns.FFG_1HR, CellType.DOUBLE, getPrecipData().getFFG1Hr());
- addToCellMap(PrecipColumns.FFG_3HR, CellType.DOUBLE, getPrecipData().getFFG3Hr());
- addToCellMap(PrecipColumns.FFG_6HR, CellType.DOUBLE, getPrecipData().getFFG6Hr());
-
- addToCellMap(PrecipColumns.DIFF_1HR, CellType.DOUBLE, getPrecipData().getDiff1Hr(), getThreatLevelForPrecipColumn("DIFF", 1));
- addToCellMap(PrecipColumns.DIFF_3HR, CellType.DOUBLE, getPrecipData().getDiff3Hr(), getThreatLevelForPrecipColumn("DIFF", 3));
- addToCellMap(PrecipColumns.DIFF_6HR, CellType.DOUBLE, getPrecipData().getDiff6Hr(), getThreatLevelForPrecipColumn("DIFF", 6));
-
- addToCellMap(PrecipColumns.RATIO_1HR, CellType.INTEGER, getPrecipData().getRatio1Hr(), getThreatLevelForPrecipColumn("RATIO", 1));
- addToCellMap(PrecipColumns.RATIO_3HR, CellType.INTEGER, getPrecipData().getRatio3Hr(), getThreatLevelForPrecipColumn("RATIO", 3));
- addToCellMap(PrecipColumns.RATIO_6HR, CellType.INTEGER, getPrecipData().getRatio6Hr(), getThreatLevelForPrecipColumn("RATIO", 6));
-
- ThreatLevel threatLevel = getThreatLevelForPrecipThreatSummary();
- addToCellMap(PrecipColumns.PRECIP_THREAT, CellType.EXTENSION,
- getPrecipThreatSummary(), threatLevel,
- getMissingRepresentation());
-
- } //end addAllCellsToMap
-
- // -----------------------------------------------------------------------------------
-
- public double round(double value, int decimalPlacesToMaintain)
- {
- return MathHelper.roundToNDecimalPlaces(value, decimalPlacesToMaintain);
- }
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value)
- {
- MonitorCell cell = addToCellMap(columnName, cellType,
- value, ThreatLevel.NO_THREAT, getMissingRepresentation());
-
- return cell;
- }
- // -----------------------------------------------------------------------------------
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel)
- {
-
- MonitorCell cell = addToCellMap(columnName, cellType,
- value, threatLevel, getMissingRepresentation(), _defaultDecimalPoints);
-
- return cell;
- }
-
- // -----------------------------------------------------------------------------------
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value, Color cellBackgroundColor)
- {
-
- MonitorCell cell = addToCellMap(columnName, cellType,
- value, ThreatLevel.NO_THREAT, cellBackgroundColor, getMissingRepresentation(), _defaultDecimalPoints);
-
- return cell;
- }
-// -----------------------------------------------------------------------------------
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel,
- String missingRepresentation)
- {
-
- MonitorCell cell = addToCellMap(columnName, cellType,
- value, threatLevel, missingRepresentation, _defaultDecimalPoints);
-
- return cell;
- }
- // -----------------------------------------------------------------------------------
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel,
- String missingRepresentation,
- int decimalPointsForDisplay)
- {
- MonitorCell cell = new MonitorCell (columnName, cellType,
- value, threatLevel,
- missingRepresentation, decimalPointsForDisplay);
- addCell(cell);
-
- return cell;
- }
-
- // -----------------------------------------------------------------------------------
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel,Color cellBackgroundColor,
- String missingRepresentation,
- int decimalPointsForDisplay)
- {
- MonitorCell cell = new MonitorCell (columnName, cellType,
- value, threatLevel, cellBackgroundColor,
- missingRepresentation, decimalPointsForDisplay);
- addCell(cell);
-
- return cell;
- }
-
- // -----------------------------------------------------------------------------------
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel,
- String missingRepresentation,
- String dateFormatString)
- {
-
- MonitorCell cell = new MonitorCell (columnName, cellType, value, threatLevel,
- missingRepresentation, dateFormatString);
-
-
- // addToCellMap(cell);
- addCell(cell);
-
-
- return cell;
- }
-
- // -----------------------------------------------------------------------------------
-
- protected void addDerivedDataToCellMap()
- {
- // add all derived columns as well
- List derivedColumnsDetailsList = this.getDerivedColumnsDetailsList();
- for(int i=0 ; i < derivedColumnsDetailsList.size(); i++)
- {
- DerivedColumn desc1 = (DerivedColumn) derivedColumnsDetailsList.get(i);
-
- CellType cellType = getCellTypeFromReturnType(desc1.getReturnType());
-
- addToCellMap(desc1.getColumnName(), cellType, desc1.getValue(), desc1.getCellBackgroundColor());
- }
- }
- // -----------------------------------------------------------------------------------
-
- private CellType getCellTypeFromReturnType(String derivedColumnReturnType)
- {
- CellType cellType = null;
-
- cellType = (CellType) _derivedReturnTypeToCellTypeMap.get(derivedColumnReturnType.toLowerCase());
-
- return cellType;
- }
-
-
- public Color getCellBackgroundColor(String columnName)
- {
- Color color = Color.white;
-
- MonitorCell cell = (MonitorCell) getCell(columnName);
-
- if (cell != null)
- {
- color = cell.getCellBackgroundColor();
- }
-
- return color;
- }
-
- // -----------------------------------------------------------------------------------
-
- public Color getCellForegroundColor(String columnName)
- {
- Color color = Color.black;
-
- MonitorCell cell = (MonitorCell) getCell(columnName);
-
- if (cell != null)
- {
- color = cell.getCellForegroundColor();
- }
- return color;
- }
-
- // -----------------------------------------------------------------------------------
-
- public ThreatLevel getPrecipMonitorThreatLevel()
- {
- //Find the max threat levels for all cells in this row
- ThreatLevel maxCellThreatLevel = ThreatLevel.NO_THREAT;
-
- List cellList = new ArrayList( getCellMap().values());
- maxCellThreatLevel = getMaxRowThreatLevel(cellList);
-
- ThreatLevel rowThreatLevel = maxCellThreatLevel;
-
- //If the rowThreatLevel == missing, we want to make sure that ALL of the important columns have missing data.
- //If there is any data in these columns, then we want to use NO_THREAT
- if (rowThreatLevel == ThreatLevel.MISSING_DATA)
- {
- if (_precipData.isDataAvailable())
- {
- rowThreatLevel = ThreatLevel.NO_THREAT;
- }
- }
-
- return rowThreatLevel;
- }
- // helper methods
-
- // -----------------------------------------------------------------------------------
- public Color getCriticalColorForThisRow()
- {
- Color color = Color.WHITE;
- ThreatLevel level = getPrecipMonitorThreatLevel();
- if(level == ThreatLevel.ALERT)
- {
- color = Color.RED;
- }
- else if(level == ThreatLevel.CAUTION)
- {
- color = Color.YELLOW;
- }
- else if(level == ThreatLevel.AGED_DATA ||
- level == ThreatLevel.MISSING_DATA)
- {
- color = Color.GRAY;
- }
-
- return color;
- }
-
- // -----------------------------------------------------------------------------------
- public ThreatLevel getThreatLevelForPrecipThreatSummary()
- {
- ThreatLevel level = getPrecipThreatLevelForPrecipThreatSummary();
-
- //Threat cell should be color red/yellow/white. So skip threat aged / missing threat level
- if(level == ThreatLevel.AGED_DATA ||
- level == ThreatLevel.MISSING_DATA)
- {
- level = ThreatLevel.NO_THREAT;
- }
-
- return level;
- }
-
-// -----------------------------------------------------------------------------------
- public ThreatLevel getMaxRowThreatLevel(List cellList)
- {
- //this method assumes that the threat column has not yet been added to the cell map, when this
- // method is invoked
- ThreatLevel level = ThreatLevel.NO_THREAT;
- ThreatLevel maxLevel = ThreatLevel.ALERT;
-
- //make sure the threat cell's threat level does not get used to calculate row's threat level, so clear it to zero
- ThreatLevel cellThreatLevel = ThreatLevel.NO_THREAT;
-
- //iterate through each cell, and set the level to the max threat level found
- for (int i = 0; i < cellList.size(); i++)
- {
-
- MonitorCell cell = (MonitorCell) cellList.get(i);
-
- if (cell == null)
- {
- continue;
- }
- else
- {
- cellThreatLevel = cell.getThreatLevel();
-
- if (cellThreatLevel.isGreater(level))
- {
- level = cellThreatLevel;
- if (level == maxLevel)
- {
- break; //quit looking, because we have determined it is maxed out
- }
- }
- }
- }
- return level;
- }
- // -----------------------------------------------------------------------------------
-
-
- public List getPrecipCells()
- {
- List cellList = new ArrayList();
-
- addCell(cellList, PrecipColumns.LATEST_30MIN);
- addCell(cellList, PrecipColumns.LATEST_1HR);
- addCell(cellList, PrecipColumns.LATEST_3HR );
- addCell(cellList, PrecipColumns.LATEST_6HR );
-
- addCell(cellList, PrecipColumns.TOH_PRECIP_1HR );
-
- addCell(cellList, PrecipColumns.DIFF_1HR );
- addCell(cellList, PrecipColumns.DIFF_3HR );
- addCell(cellList, PrecipColumns.DIFF_6HR );
-
- addCell(cellList, PrecipColumns.RATIO_1HR );
- addCell(cellList, PrecipColumns.RATIO_3HR );
- addCell(cellList, PrecipColumns.RATIO_6HR );
-
- return cellList;
- }
-
- // -----------------------------------------------------------------------------------
-
- private void addCell(List cellList, String columnName )
- {
- MonitorCell cell = null;
-
- cell = (MonitorCell) getCellMap().get(columnName);
- if(cell != null)
- {
- cellList.add(cell);
- }
-
- return;
- }
-
- // -----------------------------------------------------------------------------------
-
- public ThreatLevel getPrecipThreatLevelForPrecipThreatSummary()
- {
- ThreatLevel cellThreatLevel = ThreatLevel.NO_THREAT;
-
- List cellList = getPrecipCells();
- cellThreatLevel = getMaxRowThreatLevel(cellList);
-
- return cellThreatLevel;
- }
- //--------------------------------------------------------------------------------------
- /*
- * Returns true if the data is aged, by checking the time with earliestAcceptableTime
- */
- protected boolean isDataAged(long time, long earliestAcceptableTime)
- {
- boolean result = false;
-
- if (time < earliestAcceptableTime)
- {
- result = true;
- }
-
- return result;
- }
-
- private ThreatLevel getPrecipThreatLevel(double value, double alert, double caution)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
-
- if(! DbTable.isNull(value))
- {
- if(value >= alert)
- level = ThreatLevel.ALERT;
- else if(value >= caution)
- level = ThreatLevel.CAUTION;
- }
- else //value isNull()
- {
- level = ThreatLevel.MISSING_DATA;
- }
-
- return level;
- }
-// -------------------------------------------------------------------------------------
- protected ThreatLevel getPrecipValueThreatLevelForHrMentioned(int hour, PrecipColumnDataSettings precipSettings, String type)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
- double missing = DbTable.getNullDouble();
- double value;
- switch(hour)
- {
-
- case 1:
- if(type.compareTo("LATEST") == 0)
- value = _precipData.getLatestPrecip1Hr();
- else
- value = _precipData.getTohPrecip1Hr();
-
- level = getPrecipThreatLevel( value, precipSettings.getPrecipAlert1Hr(), precipSettings.getPrecipCaution1Hr());
- break;
-
- case 3:
- if(type.compareTo("LATEST") == 0)
- value = _precipData.getLatestPrecip3Hr();
- else
- // value = _precipData.getTohPrecip3Hr();
- value = missing;
-
- level = getPrecipThreatLevel( value, precipSettings.getPrecipAlert3Hr(), precipSettings.getPrecipCaution3Hr());
- break;
- case 6:
- if(type.compareTo("LATEST") == 0)
- value = _precipData.getLatestPrecip6Hr();
- else
- //value = _precipData.getTohPrecip6Hr();
- value = missing;
-
- level = getPrecipThreatLevel( value, precipSettings.getPrecipAlert6Hr(), precipSettings.getPrecipCaution6Hr());
- break;
-
- }
- return level;
-
- }
-// -------------------------------------------------------------------------------------
- protected ThreatLevel getPrecipRatioThreatLevelForHrMentioned(int hour, PrecipColumnDataSettings precipSettings)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
- int value;
- switch(hour)
- {
-
- case 1:
- value = _precipData.getRatio1Hr();
- level = getPrecipThreatLevel( value, precipSettings.getRatioAlert1Hr(), precipSettings.getRatioCaution1Hr());
- break;
- case 3:
- value = _precipData.getRatio3Hr();
- level = getPrecipThreatLevel( value, precipSettings.getRatioAlert3Hr(), precipSettings.getRatioCaution6Hr());
- break;
- case 6:
- value = _precipData.getRatio6Hr();
- level = getPrecipThreatLevel( value, precipSettings.getRatioAlert6Hr(), precipSettings.getRatioCaution6Hr());
- break;
-
- }
- return level;
-
- }
-// -------------------------------------------------------------------------------------
- protected ThreatLevel getPrecipDiffThreatLevelForHrMentioned(int hour, PrecipColumnDataSettings precipSettings)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
- double value;
-
- switch(hour)
- {
- case 1:
- value = _precipData.getDiff1Hr();
- level = getPrecipThreatLevel( value, precipSettings.getDiffAlert1Hr(), precipSettings.getDiffCaution1Hr());
- break;
- case 3:
- value = _precipData.getDiff3Hr();
- level = getPrecipThreatLevel( value, precipSettings.getDiffAlert3Hr(), precipSettings.getDiffCaution3Hr());
- break;
- case 6:
- value = _precipData.getDiff6Hr();
- level = getPrecipThreatLevel( value, precipSettings.getDiffAlert6Hr(), precipSettings.getDiffCaution6Hr());
- break;
- }
- return level;
- }
-
-// -------------------------------------------------------------------------------------
-
- protected ThreatLevel getThreatLevelForPrecipColumn(String type, int hour)
- {
-
- ThreatLevel level = ThreatLevel.NO_THREAT;
-
- if(type.compareTo("LATEST") == 0) // LATEST precip
- {
- level = getPrecipValueThreatLevelForHrMentioned(hour, _precipSettings, "LATEST");
- }
- else if(type.compareTo("TOH") == 0) // toh precip
- {
- level = getPrecipValueThreatLevelForHrMentioned(hour, _precipSettings, "TOH");
- }
- else if(type.compareTo("RATIO") == 0)
- {
- level = getPrecipRatioThreatLevelForHrMentioned(hour, _precipSettings);
- }
- else //type is DIFF
- {
- level = getPrecipDiffThreatLevelForHrMentioned(hour, _precipSettings);
- }
- return level;
- }
-
-
-// -------------------------------------------------------------------------------------
-
- public ThreatLevel getCellThreatLevelForColumn(String columnName)
- {
- // String header = "PrecipMonitorJTableRowData.getCellThreatLevelForColumn(): ";
- ThreatLevel level;
-
- MonitorCell cell = (MonitorCell) getCellMap().get(columnName);
-
- // System.out.println(header + "columnName = " + columnName);
-
- level = cell.getThreatLevel();
-
- return level;
- }
-
-// -------------------------------------------------------------------------------------
-
-
- public String getPrecipThreatSummary()
- {
- String summary = "";
- StringBuffer summaryStringBuffer = new StringBuffer("");
- StringBuffer toolTipStringBuffer = new StringBuffer("");
-
- ThreatLevel level;
- ThreatLevel level1Hr = getCellThreatLevelForColumn(PrecipColumns.LATEST_1HR);
- ThreatLevel level3Hr = getCellThreatLevelForColumn(PrecipColumns.LATEST_3HR);
- ThreatLevel level6Hr = getCellThreatLevelForColumn(PrecipColumns.LATEST_6HR);
- if( ((level1Hr == ThreatLevel.ALERT || level1Hr == ThreatLevel.CAUTION)) ||
- ((level3Hr == ThreatLevel.ALERT || level3Hr == ThreatLevel.CAUTION)) ||
- ((level6Hr == ThreatLevel.ALERT || level6Hr == ThreatLevel.CAUTION)) )
- {
- summaryStringBuffer = summaryStringBuffer.append("L");
- toolTipStringBuffer.append("L: Latest Precip Exceeded the threshold
");
- }
-
- level1Hr = getCellThreatLevelForColumn(PrecipColumns.TOH_PRECIP_1HR);
- // level3Hr = getCellThreatLevelForColumn(PrecipColumns.TOH_PRECIP_3HR);
- // level6Hr = getCellThreatLevelForColumn(PrecipColumns.TOH_PRECIP_6HR);
- if (
- ((level1Hr == ThreatLevel.ALERT || level1Hr == ThreatLevel.CAUTION))
- /* ||
- ((level3Hr == ThreatLevel.ALERT || level3Hr == ThreatLevel.CAUTION)) ||
- ((level6Hr == ThreatLevel.ALERT || level6Hr == ThreatLevel.CAUTION))
- */
- )
- {
- summaryStringBuffer = summaryStringBuffer.append("T");
- toolTipStringBuffer.append("T: Top Of The Hour Precip Exceeded the threshold
");
- }
-
- level1Hr = getCellThreatLevelForColumn(PrecipColumns.DIFF_1HR);
- level3Hr = getCellThreatLevelForColumn(PrecipColumns.DIFF_3HR);
- level6Hr = getCellThreatLevelForColumn(PrecipColumns.DIFF_6HR);
- if( ((level1Hr == ThreatLevel.ALERT || level1Hr == ThreatLevel.CAUTION)) ||
- ((level3Hr == ThreatLevel.ALERT || level3Hr == ThreatLevel.CAUTION)) ||
- ((level6Hr == ThreatLevel.ALERT || level6Hr == ThreatLevel.CAUTION)) )
- {
- summaryStringBuffer = summaryStringBuffer.append("D");
- toolTipStringBuffer.append("D: Latest Precip - FFG Difference Exceeded the threshold
");
- }
-
- level1Hr = getCellThreatLevelForColumn(PrecipColumns.RATIO_1HR);
- level3Hr = getCellThreatLevelForColumn(PrecipColumns.RATIO_3HR);
- level6Hr = getCellThreatLevelForColumn(PrecipColumns.RATIO_6HR);
- if( ((level1Hr == ThreatLevel.ALERT || level1Hr == ThreatLevel.CAUTION)) ||
- ((level3Hr == ThreatLevel.ALERT || level3Hr == ThreatLevel.CAUTION)) ||
- ((level6Hr == ThreatLevel.ALERT || level6Hr == ThreatLevel.CAUTION)) )
- {
- summaryStringBuffer = summaryStringBuffer.append("R");
- toolTipStringBuffer.append("R: Latest Precip / FFG Ratio Exceeded the threshold
");
- }
-
- summary = summaryStringBuffer.toString();
- _toolTipTextForPrecipThreatSummary = toolTipStringBuffer.toString();
- return summary;
- }
-// -------------------------------------------------------------------------------------
-
- public void setRiverBasin(String riverBasin)
- {
- _riverBasin = riverBasin;
- }
-
- public String getRiverBasin()
- {
- return _riverBasin;
- }
-
-} //end class
-
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipThresholdDialog.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipThresholdDialog.java
deleted file mode 100755
index d980149525..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/PrecipThresholdDialog.java
+++ /dev/null
@@ -1,392 +0,0 @@
-package ohd.hseb.monitor.precip;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JSpinner;
-import javax.swing.SpinnerNumberModel;
-import javax.swing.border.TitledBorder;
-
-import ohd.hseb.db.DbTable;
-import ohd.hseb.monitor.precip.settings.PrecipColumnDataSettings;
-import ohd.hseb.util.MathHelper;
-import ohd.hseb.util.SessionLogger;
-import ohd.hseb.util.gui.ComponentHelper;
-import ohd.hseb.util.gui.WindowResizingManager;
-
-public class PrecipThresholdDialog extends JDialog
-{
- private JSpinner _precipAlert1HrSpinBox ;
- private JSpinner _precipAlert3HrSpinBox ;
- private JSpinner _precipAlert6HrSpinBox ;
-
- private JSpinner _precipCaution1HrSpinBox ;
- private JSpinner _precipCaution3HrSpinBox ;
- private JSpinner _precipCaution6HrSpinBox ;
-
- private JSpinner _ratioAlert1HrSpinBox ;
- private JSpinner _ratioAlert3HrSpinBox ;
- private JSpinner _ratioAlert6HrSpinBox ;
-
- private JSpinner _ratioCaution1HrSpinBox ;
- private JSpinner _ratioCaution3HrSpinBox ;
- private JSpinner _ratioCaution6HrSpinBox ;
-
- private JSpinner _diffAlert1HrSpinBox ;
- private JSpinner _diffAlert3HrSpinBox ;
- private JSpinner _diffAlert6HrSpinBox ;
-
- private JSpinner _diffCaution1HrSpinBox ;
- private JSpinner _diffCaution3HrSpinBox ;
- private JSpinner _diffCaution6HrSpinBox ;
-
- private JButton _applyButton;
- private JButton _closeButton;
-
- private SessionLogger _logger;
-
- private PrecipColumnDataSettings _prevMenuSettings = null;
- private PrecipColumnDataSettings _savedMenuSettings = null;
-
- public PrecipThresholdDialog( JFrame mainFrame, PrecipColumnDataSettings menuSettings, SessionLogger logger)
- {
- super(mainFrame, true);
- _logger = logger;
- _prevMenuSettings = menuSettings;
- createPrecipSettingsDialog();
- }
-
- public void setMenuSettingsForDialog(PrecipColumnDataSettings menuSettings)
- {
- _prevMenuSettings = menuSettings;
- createPrecipSettingsDialog();
- }
-
- public PrecipColumnDataSettings showPrecipThresholdDialog()
- {
- _savedMenuSettings = null;
- this.setVisible(true);
- return _savedMenuSettings;
- }
-
- public void createPrecipSettingsDialog()
- {
- JPanel precipPanel = new JPanel(new GridBagLayout());
- TitledBorder precipTitledBorder = BorderFactory.createTitledBorder("Precip Threshold");
- precipPanel.setBorder(precipTitledBorder);
- precipPanel.setToolTipText("Applied to 1hr, 3hr, 6hr Latest Precip and TOH Precip");
-
- if(_prevMenuSettings == null)
- {
- _prevMenuSettings = new PrecipColumnDataSettings();
- }
-
- JLabel precip1HrLabel = new JLabel("1 Hr");
- precip1HrLabel.setPreferredSize(new Dimension(40, 30));
- JLabel precip3HrLabel = new JLabel("3 Hr");
- precip3HrLabel.setPreferredSize(new Dimension(40, 30));
- JLabel precip6HrLabel = new JLabel("6 Hr");
- precip6HrLabel.setPreferredSize(new Dimension(40, 30));
-
- JPanel precipLabelPanel = new JPanel();
- precipLabelPanel.setPreferredSize(new Dimension(150, 40));
- precipLabelPanel.add(precip1HrLabel);
- precipLabelPanel.add(precip3HrLabel);
- precipLabelPanel.add(precip6HrLabel);
-
- //initial value, min value, max value, incr value
- _precipAlert1HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getPrecipAlert1Hr(), PrecipColumnDataSettings.DEFAULT_PRECIP_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_PRECIP_MAX_THRESHOLD_1HR, 0.01));
- _precipAlert1HrSpinBox.setPreferredSize(new Dimension(45, 30));
- _precipAlert3HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getPrecipAlert3Hr(), PrecipColumnDataSettings.DEFAULT_PRECIP_MIN_THRESHOLD_3HR,PrecipColumnDataSettings.DEFAULT_PRECIP_MAX_THRESHOLD_3HR, 0.01));
- _precipAlert3HrSpinBox.setPreferredSize(new Dimension(45, 30));
- _precipAlert6HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getPrecipAlert6Hr(), PrecipColumnDataSettings.DEFAULT_PRECIP_MIN_THRESHOLD_6HR,PrecipColumnDataSettings.DEFAULT_PRECIP_MAX_THRESHOLD_6HR, 0.01));
- _precipAlert6HrSpinBox.setPreferredSize(new Dimension(45, 30));
-
- JPanel precipAlertPanel = new JPanel();
- precipAlertPanel.setPreferredSize(new Dimension(150, 40));
- precipAlertPanel.add(_precipAlert1HrSpinBox);
- precipAlertPanel.add(_precipAlert3HrSpinBox);
- precipAlertPanel.add(_precipAlert6HrSpinBox);
-
- _precipCaution1HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getPrecipCaution1Hr(), PrecipColumnDataSettings.DEFAULT_PRECIP_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_PRECIP_MAX_THRESHOLD_1HR, 0.01));
- _precipCaution1HrSpinBox.setPreferredSize(new Dimension(45, 30));
- _precipCaution3HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getPrecipCaution3Hr(), PrecipColumnDataSettings.DEFAULT_PRECIP_MIN_THRESHOLD_3HR,PrecipColumnDataSettings.DEFAULT_PRECIP_MAX_THRESHOLD_3HR, 0.01));
- _precipCaution3HrSpinBox.setPreferredSize(new Dimension(45, 30));
- _precipCaution6HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getPrecipCaution6Hr(), PrecipColumnDataSettings.DEFAULT_PRECIP_MIN_THRESHOLD_6HR,PrecipColumnDataSettings.DEFAULT_PRECIP_MAX_THRESHOLD_6HR, 0.01));
- _precipCaution6HrSpinBox.setPreferredSize(new Dimension(45, 30));
-
- JPanel precipCautionPanel = new JPanel();
- precipCautionPanel.setPreferredSize(new Dimension(150, 40));
- precipCautionPanel.add(_precipCaution1HrSpinBox);
- precipCautionPanel.add(_precipCaution3HrSpinBox);
- precipCautionPanel.add(_precipCaution6HrSpinBox);
-
- JPanel precipDummyPanel = new JPanel();
- precipDummyPanel.setPreferredSize(new Dimension(150, 10));
- ComponentHelper.addPanelComponent(precipPanel, precipLabelPanel, 0, 0, 1, 1, 1);
- ComponentHelper.addPanelComponent(precipPanel, precipAlertPanel, 0, 1, 1, 1, 1);
- ComponentHelper.addPanelComponent(precipPanel, precipDummyPanel, 0, 2, 1, 1, 1);
- ComponentHelper.addPanelComponent(precipPanel, precipCautionPanel, 0, 3, 1, 1, 1);
-
- JPanel ratioPanel = new JPanel(new GridBagLayout());
- TitledBorder ratioTitledBorder = BorderFactory.createTitledBorder("Ratio(%) Threshold");
- ratioPanel.setBorder(ratioTitledBorder);
- ratioPanel.setToolTipText("Applied to ((Latest Precip / FFG) * 100) columns");
-
- JLabel ratio1HrLabel = new JLabel("1 Hr");
- ratio1HrLabel.setPreferredSize(new Dimension(40, 30));
- JLabel ratio3HrLabel = new JLabel("3 Hr");
- ratio3HrLabel.setPreferredSize(new Dimension(40, 30));
- JLabel ratio6HrLabel = new JLabel("6 Hr");
- ratio6HrLabel.setPreferredSize(new Dimension(40, 30));
-
- JPanel ratioLabelPanel = new JPanel();
- ratioLabelPanel.setPreferredSize(new Dimension(150, 40));
- ratioLabelPanel.add(ratio1HrLabel);
- ratioLabelPanel.add(ratio3HrLabel);
- ratioLabelPanel.add(ratio6HrLabel);
-
- // initial value, min value, max value, incr value
- _ratioAlert1HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getRatioAlert1Hr(), PrecipColumnDataSettings.DEFAULT_RATIO_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_RATIO_MAX_THRESHOLD_1HR, 1));
- _ratioAlert1HrSpinBox.setPreferredSize(new Dimension(45, 30));
- _ratioAlert3HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getRatioAlert3Hr(), PrecipColumnDataSettings.DEFAULT_RATIO_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_RATIO_MAX_THRESHOLD_1HR, 1));
- _ratioAlert3HrSpinBox.setPreferredSize(new Dimension(45, 30));
- _ratioAlert6HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getRatioAlert6Hr(), PrecipColumnDataSettings.DEFAULT_RATIO_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_RATIO_MAX_THRESHOLD_1HR, 1));
- _ratioAlert6HrSpinBox.setPreferredSize(new Dimension(45, 30));
-
- JPanel ratioAlertPanel = new JPanel();
- ratioAlertPanel.setPreferredSize(new Dimension(150, 40));
- ratioAlertPanel.add(_ratioAlert1HrSpinBox);
- ratioAlertPanel.add(_ratioAlert3HrSpinBox);
- ratioAlertPanel.add(_ratioAlert6HrSpinBox);
-
- // initial value, min value, max value, incr value
- _ratioCaution1HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getRatioCaution1Hr(), PrecipColumnDataSettings.DEFAULT_RATIO_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_RATIO_MAX_THRESHOLD_1HR, 1));
- _ratioCaution1HrSpinBox.setPreferredSize(new Dimension(45, 30));
- _ratioCaution3HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getRatioCaution3Hr(), PrecipColumnDataSettings.DEFAULT_RATIO_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_RATIO_MAX_THRESHOLD_1HR, 1));
- _ratioCaution3HrSpinBox.setPreferredSize(new Dimension(45, 30));
- _ratioCaution6HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getRatioCaution6Hr(), PrecipColumnDataSettings.DEFAULT_RATIO_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_RATIO_MAX_THRESHOLD_1HR, 1));
- _ratioCaution6HrSpinBox.setPreferredSize(new Dimension(45, 30));
-
- JPanel ratioCautionPanel = new JPanel();
- ratioCautionPanel.setPreferredSize(new Dimension(150, 40));
- ratioCautionPanel.add(_ratioCaution1HrSpinBox);
- ratioCautionPanel.add(_ratioCaution3HrSpinBox);
- ratioCautionPanel.add(_ratioCaution6HrSpinBox);
-
- JPanel ratioDummyPanel = new JPanel();
- ratioDummyPanel.setPreferredSize(new Dimension(150, 10));
- ComponentHelper.addPanelComponent(ratioPanel, ratioLabelPanel, 0, 0, 1, 1, 1);
- ComponentHelper.addPanelComponent(ratioPanel, ratioAlertPanel, 0, 1, 1, 1, 1);
- ComponentHelper.addPanelComponent(ratioPanel, ratioDummyPanel, 0, 2, 1, 1, 1);
- ComponentHelper.addPanelComponent(ratioPanel, ratioCautionPanel, 0, 3, 1, 1, 1);
-
- JPanel diffPanel = new JPanel(new GridBagLayout());
- TitledBorder diffTitledBorder = BorderFactory.createTitledBorder("Diff Threshold");
- diffPanel.setBorder(diffTitledBorder);
- diffPanel.setToolTipText("Applied to (Latest Precip - FFG) columns");
-
- JLabel diff1HrLabel = new JLabel("1 Hr");
- diff1HrLabel.setPreferredSize(new Dimension(40, 30));
- JLabel diff3HrLabel = new JLabel("3 Hr");
- diff3HrLabel.setPreferredSize(new Dimension(40, 30));
- JLabel diff6HrLabel = new JLabel("6 Hr");
- diff6HrLabel.setPreferredSize(new Dimension(40, 30));
-
- JPanel diffLabelPanel = new JPanel();
- diffLabelPanel.setPreferredSize(new Dimension(150, 40));
- diffLabelPanel.add(diff1HrLabel);
- diffLabelPanel.add(diff3HrLabel);
- diffLabelPanel.add(diff6HrLabel);
-
- // initial value, min value, max value, incr value
- _diffAlert1HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getDiffAlert1Hr(), PrecipColumnDataSettings.DEFAULT_DIFF_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_DIFF_MAX_THRESHOLD_1HR, 0.05));
- _diffAlert1HrSpinBox.setPreferredSize(new Dimension(55, 30));
- _diffAlert3HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getDiffAlert3Hr(), PrecipColumnDataSettings.DEFAULT_DIFF_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_DIFF_MAX_THRESHOLD_1HR, 0.05));
- _diffAlert3HrSpinBox.setPreferredSize(new Dimension(55, 30));
- _diffAlert6HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getDiffAlert6Hr(), PrecipColumnDataSettings.DEFAULT_DIFF_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_DIFF_MAX_THRESHOLD_1HR, 0.05));
- _diffAlert6HrSpinBox.setPreferredSize(new Dimension(55, 30));
-
- JPanel diffAlertPanel = new JPanel();
- diffAlertPanel.setPreferredSize(new Dimension(180, 40));
- diffAlertPanel.add(_diffAlert1HrSpinBox);
- diffAlertPanel.add(_diffAlert3HrSpinBox);
- diffAlertPanel.add(_diffAlert6HrSpinBox);
-
- _diffCaution1HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getDiffCaution1Hr(), PrecipColumnDataSettings.DEFAULT_DIFF_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_DIFF_MAX_THRESHOLD_1HR, 0.05));
- _diffCaution1HrSpinBox.setPreferredSize(new Dimension(55, 30));
- _diffCaution3HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getDiffCaution3Hr(), PrecipColumnDataSettings.DEFAULT_DIFF_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_DIFF_MAX_THRESHOLD_1HR, 0.05));
- _diffCaution3HrSpinBox.setPreferredSize(new Dimension(55, 30));
- _diffCaution6HrSpinBox = new JSpinner(new SpinnerNumberModel(_prevMenuSettings.getDiffCaution6Hr(), PrecipColumnDataSettings.DEFAULT_DIFF_MIN_THRESHOLD_1HR,PrecipColumnDataSettings.DEFAULT_DIFF_MAX_THRESHOLD_1HR, 0.05));
- _diffCaution6HrSpinBox.setPreferredSize(new Dimension(55, 30));
-
- JPanel diffCautionPanel = new JPanel();
- diffCautionPanel.setPreferredSize(new Dimension(180, 40));
- diffCautionPanel.add(_diffCaution1HrSpinBox);
- diffCautionPanel.add(_diffCaution3HrSpinBox);
- diffCautionPanel.add(_diffCaution6HrSpinBox);
-
- JPanel diffDummyPanel = new JPanel();
- diffDummyPanel.setPreferredSize(new Dimension(180, 10));
- ComponentHelper.addPanelComponent(diffPanel, diffLabelPanel, 0, 0, 1, 1, 1);
- ComponentHelper.addPanelComponent(diffPanel, diffAlertPanel, 0, 1, 1, 1, 1);
- ComponentHelper.addPanelComponent(diffPanel, diffDummyPanel, 0, 2, 1, 1, 1);
- ComponentHelper.addPanelComponent(diffPanel, diffCautionPanel, 0, 3, 1, 1, 1);
-
- JLabel alertLabel = new JLabel("Alert :");
- alertLabel.setOpaque(true);
- alertLabel.setBackground(Color.RED);
- JLabel cautionLabel = new JLabel("Caution :");
- cautionLabel.setOpaque(true);
- cautionLabel.setBackground(Color.YELLOW);
-
- JPanel alertCautionPanel = new JPanel(new GridBagLayout());
-
- JPanel dummyPanel1 = new JPanel();
- dummyPanel1.setPreferredSize(new Dimension(60, 40));
-
- alertLabel.setPreferredSize(new Dimension(60, 40));
-
- JPanel dummyPanel2 = new JPanel();
- dummyPanel2.setPreferredSize(new Dimension(60, 10));
-
- cautionLabel.setPreferredSize(new Dimension(60, 40));
-
- ComponentHelper.addPanelComponent(alertCautionPanel, dummyPanel1, 0, 0, 1, 1, 1);
- ComponentHelper.addPanelComponent(alertCautionPanel, alertLabel, 0, 1, 1, 1, 1);
- ComponentHelper.addPanelComponent(alertCautionPanel, dummyPanel2, 0, 2, 1, 1, 1);
- ComponentHelper.addPanelComponent(alertCautionPanel, cautionLabel, 0, 3, 1, 1, 1);
-
- JPanel thresholdPanel = new JPanel(new GridBagLayout());
- ComponentHelper.addPanelComponent(thresholdPanel, alertCautionPanel, 0, 0, 1, 1, 1);
- ComponentHelper.addPanelComponent(thresholdPanel, precipPanel, 1, 0, 1, 1, 1);
- ComponentHelper.addPanelComponent(thresholdPanel, ratioPanel, 2, 0, 1, 1, 1);
- ComponentHelper.addPanelComponent(thresholdPanel, diffPanel, 3, 0, 1, 1, 1);
-
- JPanel buttonPanel = new JPanel(new GridBagLayout());
-
- JPanel dummyPanel3 = new JPanel();
- dummyPanel3.setPreferredSize(new Dimension(20,20));
-
- _closeButton = new JButton("Close");
- _applyButton = new JButton ("Apply");
- _applyButton.addActionListener(new ApplyMenuSettingsListener());
- _closeButton.addActionListener(new ClosePrecipSettingsDialogListener());
-
- ComponentHelper.addPanelComponent(buttonPanel, _applyButton, 0, 0, 1, 1, 1);
- ComponentHelper.addPanelComponent(buttonPanel, dummyPanel3, 1, 0, 1, 1, 1);
- ComponentHelper.addPanelComponent(buttonPanel, _closeButton, 2, 0, 1, 1, 1);
-
- JPanel dummyPanel5 = new JPanel();
- dummyPanel5.setPreferredSize(new Dimension(200,40));
-
- JPanel outerPanel = new JPanel(new GridBagLayout());
- ComponentHelper.addPanelComponent(outerPanel, thresholdPanel, 0, 0, 1, 1, 1);
- ComponentHelper.addPanelComponent(outerPanel, dummyPanel5, 0, 1, 1, 1, 1);
- ComponentHelper.addPanelComponent(outerPanel, buttonPanel, 0, 2, 1, 1, 1);
-
- this.getContentPane().add(outerPanel);
- this.setLocation(25, 25);
- Dimension dim = new Dimension(600,450);
- new WindowResizingManager(this, dim, dim);
-
- this.pack();
- this.setTitle("Precip Alert/Caution Threshold Values");
- }
-
- private void closePrecipSettingsDialog()
- {
- this.setVisible(false);
- this.dispose();
- }
-
-// ---------------------------------------------------------------------------------------------------
-
- private double roundTo2DecimalPlaces(double number)
- {
- double result = DbTable.getNullDouble();
- if (number != DbTable.getNullDouble())
- result = MathHelper.roundToNDecimalPlaces(number, 2);
-
- return result;
- }
-
- private PrecipColumnDataSettings getPrecipSettingsFromDialog()
- {
- PrecipColumnDataSettings menuSettings = new PrecipColumnDataSettings();
-
- menuSettings.setPrecipAlert1Hr(roundTo2DecimalPlaces((Double)_precipAlert1HrSpinBox.getValue()));
- menuSettings.setPrecipAlert3Hr(roundTo2DecimalPlaces((Double)_precipAlert3HrSpinBox.getValue()));
- menuSettings.setPrecipAlert6Hr(roundTo2DecimalPlaces((Double)_precipAlert6HrSpinBox.getValue()));
- menuSettings.setPrecipCaution1Hr(roundTo2DecimalPlaces((Double)_precipCaution1HrSpinBox.getValue()));
- menuSettings.setPrecipCaution3Hr(roundTo2DecimalPlaces((Double)_precipCaution3HrSpinBox.getValue()));
- menuSettings.setPrecipCaution6Hr(roundTo2DecimalPlaces((Double)_precipCaution6HrSpinBox.getValue()));
-
- menuSettings.setRatioAlert1Hr((Integer)_ratioAlert1HrSpinBox.getValue());
- menuSettings.setRatioAlert3Hr((Integer)_ratioAlert3HrSpinBox.getValue());
- menuSettings.setRatioAlert6Hr((Integer)_ratioAlert6HrSpinBox.getValue());
- menuSettings.setRatioCaution1Hr((Integer)_ratioCaution1HrSpinBox.getValue());
- menuSettings.setRatioCaution3Hr((Integer)_ratioCaution3HrSpinBox.getValue());
- menuSettings.setRatioCaution6Hr((Integer)_ratioCaution6HrSpinBox.getValue());
-
- menuSettings.setDiffAlert1Hr(roundTo2DecimalPlaces((Double)_diffAlert1HrSpinBox.getValue()));
- menuSettings.setDiffAlert3Hr(roundTo2DecimalPlaces((Double)_diffAlert3HrSpinBox.getValue()));
- menuSettings.setDiffAlert6Hr(roundTo2DecimalPlaces((Double)_diffAlert6HrSpinBox.getValue()));
- menuSettings.setDiffCaution1Hr(roundTo2DecimalPlaces((Double)_diffCaution1HrSpinBox.getValue()));
- menuSettings.setDiffCaution3Hr(roundTo2DecimalPlaces((Double)_diffCaution3HrSpinBox.getValue()));
- menuSettings.setDiffCaution6Hr(roundTo2DecimalPlaces((Double)_diffCaution6HrSpinBox.getValue()));
-
- return menuSettings;
- }
-
- private class ApplyMenuSettingsListener implements ActionListener
- {
- public void actionPerformed(ActionEvent e)
- {
- PrecipColumnDataSettings currentMenuSettings = getPrecipSettingsFromDialog();
-
- if( (_prevMenuSettings.getPrecipAlert1Hr() != currentMenuSettings.getPrecipAlert1Hr()) ||
- (_prevMenuSettings.getPrecipAlert3Hr() != currentMenuSettings.getPrecipAlert3Hr()) ||
- (_prevMenuSettings.getPrecipAlert6Hr() != currentMenuSettings.getPrecipAlert6Hr()) ||
- (_prevMenuSettings.getRatioAlert1Hr() != currentMenuSettings.getRatioAlert1Hr()) ||
- (_prevMenuSettings.getRatioAlert3Hr() != currentMenuSettings.getRatioAlert3Hr()) ||
- (_prevMenuSettings.getRatioAlert6Hr() != currentMenuSettings.getRatioAlert6Hr()) ||
- (_prevMenuSettings.getDiffAlert1Hr() != currentMenuSettings.getDiffAlert1Hr()) ||
- (_prevMenuSettings.getDiffAlert3Hr() != currentMenuSettings.getDiffAlert3Hr()) ||
- (_prevMenuSettings.getDiffAlert6Hr() != currentMenuSettings.getDiffAlert6Hr()) ||
- (_prevMenuSettings.getPrecipCaution1Hr() != currentMenuSettings.getPrecipCaution1Hr()) ||
- (_prevMenuSettings.getPrecipCaution3Hr() != currentMenuSettings.getPrecipCaution3Hr()) ||
- (_prevMenuSettings.getPrecipCaution6Hr() != currentMenuSettings.getPrecipCaution6Hr()) ||
- (_prevMenuSettings.getRatioCaution1Hr() != currentMenuSettings.getRatioCaution1Hr()) ||
- (_prevMenuSettings.getRatioCaution3Hr() != currentMenuSettings.getRatioCaution3Hr()) ||
- (_prevMenuSettings.getRatioCaution6Hr() != currentMenuSettings.getRatioCaution6Hr()) ||
- (_prevMenuSettings.getDiffCaution1Hr() != currentMenuSettings.getDiffCaution1Hr()) ||
- (_prevMenuSettings.getDiffCaution3Hr() != currentMenuSettings.getDiffCaution3Hr()) ||
- (_prevMenuSettings.getDiffCaution6Hr() != currentMenuSettings.getDiffCaution6Hr()))
- {
- _prevMenuSettings = currentMenuSettings;
- _savedMenuSettings = currentMenuSettings;
- _logger.log("PrecipThresholdDialog.ApplyMenuSettingsListener : New precip settings applied");
- }
- }
- }
-
- private class ClosePrecipSettingsDialogListener implements ActionListener
- {
- public void actionPerformed(ActionEvent e)
- {
- closePrecipSettingsDialog();
- }
- }
-
-}
-
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorAppManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorAppManager.java
deleted file mode 100755
index ee02b31240..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorAppManager.java
+++ /dev/null
@@ -1,227 +0,0 @@
-package ohd.hseb.monitor.precip.manager;
-
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Graphics;
-import java.awt.GridBagLayout;
-
-import javax.swing.JPanel;
-import javax.swing.JSplitPane;
-import javax.swing.JToolBar;
-
-import ohd.hseb.alertalarm.AlertAlarmDataManager;
-import ohd.hseb.db.Database;
-import ohd.hseb.monitor.MonitorFrame;
-import ohd.hseb.monitor.MonitorSplitPane;
-import ohd.hseb.monitor.MonitorTimeSeriesLiteManager;
-import ohd.hseb.monitor.derivedcolumns.DerivedColumnsFileManager;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.precip.PrecipMonitorDataManager;
-import ohd.hseb.monitor.precip.settings.PrecipMonitorMenuSettings;
-import ohd.hseb.monitor.settings.FilterSettings;
-import ohd.hseb.monitor.settings.ViewSettings;
-import ohd.hseb.officenotes.OfficeNotesDataManager;
-import ohd.hseb.util.MemoryLogger;
-import ohd.hseb.util.SessionLogger;
-import ohd.hseb.util.gui.ComponentHelper;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-
-public class PrecipMonitorAppManager {
- private MessageSystemManager _msgSystemManager;
-
- private PrecipMonitorDataManager _precipMonitorDataManager;
-
- private AppsDefaults _appsDefaults;
-
- public static final String DEFAULT_PRECIP_SETTINGS_FILE = "DefaultPrecipMonitorSettings.txt";
-
- public static final String SITE_PRECIP_SETTINGS_FILE = "PrecipMonitorSettings.txt";
-
- private SessionLogger _logger;
-
- private MonitorFrame _mainFrame;
-
- private DerivedColumnsFileManager _derivedColumnsFileManager;
-
- private String _appName = "PrecipMonitor";
-
- public static String DERIVED_COLUMNS_FILE = "PrecipDerivedColumns.txt";
-
- public PrecipMonitorAppManager(Database db, String missingRepresentation,
- String version, String versionDate,
- MonitorTimeSeriesLiteManager monitorTimeSeriesLiteManager) {
- _appsDefaults = AppsDefaults.getInstance();
-
- createLogger();
-
- ViewSettings viewSettings = new ViewSettings();
- FilterSettings filterSettings = new FilterSettings();
- PrecipMonitorMenuSettings menuSettings = new PrecipMonitorMenuSettings();
-
- createFrame(db, version);
-
- JSplitPane splitPane = new MonitorSplitPane(
- JSplitPane.HORIZONTAL_SPLIT, true);
-
- JPanel timeDisplayPanel = new JPanel();
- JToolBar toolBar = new JToolBar();
-
- OfficeNotesDataManager officeNotesDataMgr = new OfficeNotesDataManager(
- db, _logger, missingRepresentation);
- AlertAlarmDataManager alertAlarmDataMgr = new AlertAlarmDataManager(db,
- _logger, missingRepresentation);
-
- String settingsDir = _appsDefaults.getToken("rivermon_config_dir",
- "/awips/hydroapps/whfs/local/data/app/rivermon");
-
- _derivedColumnsFileManager = new DerivedColumnsFileManager(settingsDir
- + "/" + DERIVED_COLUMNS_FILE, _logger);
-
- MemoryLogger.setLogger(_logger);
- _precipMonitorDataManager = new PrecipMonitorDataManager(db,
- _appsDefaults, missingRepresentation, _logger, menuSettings,
- _derivedColumnsFileManager);
-
- _msgSystemManager = new MessageSystemManager();
-
- // These objects remain in without a variable, because they register
- // listeners to the _msgSystemManager
- new PrecipMonitorRefreshManager(_msgSystemManager, _logger,
- _precipMonitorDataManager, splitPane);
-
- new PrecipMonitorFilterManager(_msgSystemManager, _logger, _mainFrame,
- _precipMonitorDataManager, splitPane, _appsDefaults,
- filterSettings);
-
- new PrecipMonitorMenuManager(_msgSystemManager, _logger, _mainFrame,
- version, versionDate, _appsDefaults, toolBar,
- _precipMonitorDataManager, officeNotesDataMgr,
- alertAlarmDataMgr, menuSettings, timeDisplayPanel, _appName,
- monitorTimeSeriesLiteManager);
-
- new PrecipMonitorViewManager(_mainFrame, _msgSystemManager, _logger,
- _precipMonitorDataManager, splitPane, viewSettings,
- _derivedColumnsFileManager, monitorTimeSeriesLiteManager,
- _appsDefaults);
-
- PrecipMonitorSettingsManager settingsManager = new PrecipMonitorSettingsManager(
- _msgSystemManager, _appsDefaults, _logger, _mainFrame,
- viewSettings, filterSettings, menuSettings);
-
- settingsManager.startPrecipMonitor();
-
- Container frameContentPane = _mainFrame.getContentPane();
- _mainFrame.setLayout(new GridBagLayout());
-
- // col, row, width, height, weightx, weighty, fill
- ComponentHelper.addFrameComponent(frameContentPane, toolBar, 0, 0, 1,
- 1, 1, 0, 1);
- ComponentHelper.addFrameComponent(frameContentPane, timeDisplayPanel,
- 1, 0, 1, 1, 1, 0, 1);
- ComponentHelper.addFrameComponent(frameContentPane, splitPane, 0, 1, 2,
- 1, 1, 1, 1);
-
- _mainFrame.pack();
- _mainFrame.setVisible(true);
- }
-
- private class MonitorJSplitPane extends JSplitPane {
-
- public MonitorJSplitPane(int newOrientation, boolean newContinuousLayout) {
- super(newOrientation, newContinuousLayout);
- }
-
- @Override
- public void setDividerLocation(int location) {
- int currentDividerLocation = getDividerLocation();
- int adjustedLocation = location;
-
- if (location < 30) {
- int difference = currentDividerLocation - location;
- if (difference > 50) {
- adjustedLocation = currentDividerLocation;
- }
- }
- super.setDividerLocation(adjustedLocation);
- }
-
- @Override
- public void setRightComponent(Component comp) {
- String header = "MonitorJSplitPane.setRightComponent() ";
-
- int beforeDividerLocation = getDividerLocation();
-
- // setDividerLocation(beforeDividerLocation);
- super.setRightComponent(comp);
-
- int afterDividerLocation = getDividerLocation();
-
- setDividerLocation(beforeDividerLocation);
-
- System.out.println(header + " before divider location = "
- + beforeDividerLocation);
- System.out.println(header + " after divider location = "
- + afterDividerLocation);
-
- }
-
- @Override
- public void setLeftComponent(Component comp) {
- String header = "MonitorJSplitPane.setLeftComponent() ";
-
- int beforeDividerLocation = getDividerLocation();
- setDividerLocation(beforeDividerLocation);
-
- super.setLeftComponent(comp);
-
- int afterDividerLocation = getDividerLocation();
-
- setDividerLocation(beforeDividerLocation);
-
- System.out.println(header + " before divider location = "
- + beforeDividerLocation);
- System.out.println(header + " after divider location = "
- + afterDividerLocation);
-
- }
-
- @Override
- public void paint(Graphics g) {
- String header = "MonitorJSplitPane.paint() ";
- super.paint(g);
-
- int dividerLocation = getDividerLocation();
- int lastDividerLocation = getLastDividerLocation();
-
- System.out.println(header + " divider location = "
- + dividerLocation);
- System.out.println(header + " last divider location = "
- + lastDividerLocation);
-
- // if (lastDividerLocation > dividerLocation)
- // {
- // setDividerLocation(lastDividerLocation);
- // }
- }
- }
-
- private void createLogger() {
- String logDir = _appsDefaults.getToken("rivermon_log_dir",
- "/awips/hydroapps/whfs/local/data/log/rivermon");
- String logFile = logDir + "/" + _appName;
-
- _logger = new SessionLogger(_appName, logFile, true, true, null);
- _logger.log(null);
- _logger.log(_appName + " Started");
-
- }
-
- private void createFrame(Database db, String version) {
- _mainFrame = new MonitorFrame();
- String title = _appName + " DbName : " + db.getDatabaseName()
- + " Session : " + _logger.getSessionId();
- _mainFrame.setTitle(title);
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorFilterManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorFilterManager.java
deleted file mode 100755
index e9d0881a37..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorFilterManager.java
+++ /dev/null
@@ -1,276 +0,0 @@
-package ohd.hseb.monitor.precip.manager;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.JMenuItem;
-import javax.swing.JPopupMenu;
-import javax.swing.JScrollPane;
-import javax.swing.JSplitPane;
-import javax.swing.JTree;
-import javax.swing.SwingUtilities;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreePath;
-
-import ohd.hseb.monitor.MonitorFrame;
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.TreeDataManager;
-import ohd.hseb.monitor.manager.BaseManager;
-import ohd.hseb.monitor.manager.Receiver;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.messaging.MessageType;
-import ohd.hseb.monitor.precip.PrecipMonitorDataManager;
-import ohd.hseb.monitor.settings.FilterSettings;
-import ohd.hseb.monitor.treefilter.MonitorCheckTreeManager;
-import ohd.hseb.monitor.treefilter.MonitorCheckTreeSelectionModel;
-import ohd.hseb.util.SessionLogger;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-
-public class PrecipMonitorFilterManager extends BaseManager
-{
- private SessionLogger _logger;
-
- private PrecipMonitorDataManager _precipMonitorDataManager;
- private FilterSettings _filterSettings;
-
- private JSplitPane _splitPane;
-
- private AppsDefaults _appsDefaults;
-
- private MonitorCheckTreeManager _checkTreeManager;
-
- private JScrollPane _treeScrollPane;
-
- private JPopupMenu _popupMenuForTree;
- private JMenuItem _expandTreeMenuItem;
- private JMenuItem _collapseTreeMenuItem;
-
- private MonitorFrame _mainFrame;
- private String _iconsDir;
-
- public PrecipMonitorFilterManager(MessageSystemManager msgSystemManager,SessionLogger logger,
- MonitorFrame mainFrame, PrecipMonitorDataManager precipMonitorDataManager, JSplitPane splitPane,
- AppsDefaults appsDefaults, FilterSettings filterSettings)
- {
- _precipMonitorDataManager = precipMonitorDataManager;
- _splitPane = splitPane;
- _appsDefaults = appsDefaults;
- _mainFrame = mainFrame;
- _filterSettings = filterSettings;
- _iconsDir = _appsDefaults.getToken("rivermon_config_dir", "/awips/hydroapps/whfs/local/data/app/rivermon");
-
- createPopupMenuForTree();
-
- setMessageSystemManager(msgSystemManager);
- _msgSystemManager.registerReceiver(new UpdateDisplayWithSettingsReceiver(), MessageType.UPDATE_DISPLAY_WITH_SETTINGS);
- _msgSystemManager.registerReceiver(new RefreshDisplayReceiver(), MessageType.REFRESH_DISPLAY);
- }
-
- private void createTreeAndApplySettings(MonitorMessage message)
- {
- final String header = "PrecipMonitorFilterManager.createTreeAndApplySettings(): ";
- System.out.println(header + " thread = " + Thread.currentThread().getId());
-
- _mainFrame.setWaitCursor();
- if(message.getMessageSource() != this)
- {
- System.out.println(header +" Invoked" + "...Source:" + message.getMessageSource() + " Type:" + message.getMessageType());
- List stringArrayListOfFilterItems = _precipMonitorDataManager.createStringArrayListOfFilterItems();
-
- TreeDataManager treeDataManager = new TreeDataManager();
-
- DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("HSA");
-
- JTree tree = treeDataManager.createFilterTreeFromList(rootNode, stringArrayListOfFilterItems);
-
- tree.setBackground(Color.BLACK);
-
- TreePath[] preSelectedPaths = _filterSettings.getSelectedPaths();
-
- // printTreePathArray(preSelectedPaths, "CreateTree--- preSelectedPaths :");
-
- TreePath[] preExpandedPaths = _filterSettings.getExpandedPaths();
-
- // printTreePathArray(preSelectedPaths, "CreateTree--- preExpandedPaths :");
-
- Map lidToCriticalColorMap = _precipMonitorDataManager.getLidToCriticalColorMap();
-
- _checkTreeManager = new MonitorCheckTreeManager(tree, preSelectedPaths, preExpandedPaths, lidToCriticalColorMap, _iconsDir);
- CheckTreeSelectionListener treeListener = new CheckTreeSelectionListener();
- tree.addMouseListener(treeListener);
-
- _treeScrollPane = new JScrollPane(tree);
- _treeScrollPane.setPreferredSize(new Dimension(300,645));
-
- _splitPane.setLeftComponent(_treeScrollPane);
-
- // printTreePathArray(_checkTreeManager.getSelectionModel().getSelectionPaths(), "Create Tree: ");
-
- _precipMonitorDataManager.getTreeFilterManager().traversePathsToDisplayLocationSelected(_checkTreeManager.getValidTreePaths(preSelectedPaths));
-
- }
- _mainFrame.setDefaultCursor();
- }
-
- private void highlightThisRow()
- {
- String header = "PrecipMonitorFilterManager.highlightThisRow(): ";
-
- System.out.print(header );
- send(this, MessageType.FILTER_SELECT_ITEM);
- }
-
- private void sendRefreshDisplayMessage()
- {
- String header = "PrecipMonitorFilterManager.sendRefreshDisplayMessage(): ";
-
- System.out.print(header);
- send(this, MessageType.REFRESH_DISPLAY);
- }
-
- private void setFilterSettings()
- {
- String header = "PrecipMonitorFilterManager.setFilterSettings(): ";
- System.out.println(header);
-
- TreePath[] paths = _checkTreeManager.getSelectionModel().getSelectionPaths();
- _filterSettings.setSelectedPaths(paths);
-
- // printTreePathArray(paths, header + " selected path in ");
-
- TreePath[] expandedPaths = _checkTreeManager.getAllExpandedPaths();
- _filterSettings.setExpandedPaths(expandedPaths);
-
- }
-
- private void createPopupMenuForTree()
- {
- _popupMenuForTree = new JPopupMenu();
- _expandTreeMenuItem = new JMenuItem("Expand Entire Tree");
- _expandTreeMenuItem.setMnemonic('E');
- _collapseTreeMenuItem = new JMenuItem("Collapse Entire Tree");
- _collapseTreeMenuItem.setMnemonic('C');
- _popupMenuForTree.add(_expandTreeMenuItem);
- _popupMenuForTree.add(_collapseTreeMenuItem);
-
- TreePopupMenuListener treePopupMenuListener = new TreePopupMenuListener();
- _expandTreeMenuItem.addActionListener(treePopupMenuListener);
- _collapseTreeMenuItem.addActionListener(treePopupMenuListener);
- }
-
- private void printTreePathArray(TreePath[] treePathArray, String message)
- {
- if (message != null)
- {
- System.out.println(message);
- }
-
- if (treePathArray != null)
- {
- for (TreePath treePath : treePathArray)
- {
- System.out.println(treePath);
- }
- }
-
- return;
- }
-
- private class UpdateDisplayWithSettingsReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- createTreeAndApplySettings(message);
- }
- }
-
-
- private class RefreshDisplayReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- createTreeAndApplySettings(message);
- }
- }
-
-
- private class TreePopupMenuListener implements ActionListener
- {
- public void actionPerformed(ActionEvent e)
- {
- TreePath[] allAvailablePaths = _checkTreeManager.getAllAvailablePaths();
- if(e.getSource().toString().contains("Expand Entire Tree"))
- {
- _checkTreeManager.expandThesePaths(allAvailablePaths);
- }
- else //collapse tree
- {
- _checkTreeManager.collapseEntireTree();
- }
-
- setFilterSettings();
- }
- }
-
- class CheckTreeSelectionListener implements MouseListener
- {
- public void mouseClicked(MouseEvent e)
- {
- MonitorCheckTreeSelectionModel selectionModel = (MonitorCheckTreeSelectionModel) (_checkTreeManager.getSelectionModel());
-
- selectionModel.printInstanceId();
-
- TreePath paths[] = selectionModel.getSelectionPaths();
-
- // printTreePathArray(paths, "CheckTreeSelectionListener.mouseClicked(): ");
-
- setFilterSettings();
-
- _precipMonitorDataManager.getTreeFilterManager().traversePathsToDisplayLocationSelected(paths);
- sendRefreshDisplayMessage();
-
- if(SwingUtilities.isLeftMouseButton(e))
- {
- JTree tree = (JTree) e.getSource();
- int row = tree.getRowForLocation(e.getX(), e.getY());
- TreePath path = tree.getPathForRow(row);
- String itemClickedOnJtree = null;
- if(path != null)
- {
- if(path.getPathCount() == 4)
- {
- itemClickedOnJtree = path.getLastPathComponent().toString();
- System.out.println("Item of interest:"+ itemClickedOnJtree);
- _precipMonitorDataManager.setLidOfCurrentInterest(itemClickedOnJtree);
- highlightThisRow();
- }
- }
- }
- }
- public void mousePressed(MouseEvent e)
- {
- if(e.isPopupTrigger())
- {
- _popupMenuForTree.show(_treeScrollPane, e.getX(), e.getY());
- }
- }
-
- public void mouseReleased(MouseEvent e)
- {
- if(e.isPopupTrigger())
- {
- _popupMenuForTree.show(_treeScrollPane, e.getX(), e.getY());
- }
- }
- public void mouseEntered(MouseEvent e){}
- public void mouseExited(MouseEvent e){}
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorMenuManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorMenuManager.java
deleted file mode 100755
index 1c94677f9f..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorMenuManager.java
+++ /dev/null
@@ -1,752 +0,0 @@
-package ohd.hseb.monitor.precip.manager;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JSeparator;
-import javax.swing.JToolBar;
-
-import ohd.hseb.alertalarm.AlertAlarmDataManager;
-import ohd.hseb.alertalarm.AlertAlarmDialog;
-import ohd.hseb.monitor.Monitor;
-import ohd.hseb.monitor.MonitorFrame;
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.MonitorTimeSeriesLiteManager;
-import ohd.hseb.monitor.MonitorToolBarManager;
-import ohd.hseb.monitor.manager.MonitorMenuManager;
-import ohd.hseb.monitor.manager.Receiver;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.messaging.MessageType;
-import ohd.hseb.monitor.precip.PrecipMonitorDataManager;
-import ohd.hseb.monitor.precip.PrecipMonitorJTableRowData;
-import ohd.hseb.monitor.precip.settings.PrecipMonitorMenuSettings;
-import ohd.hseb.officenotes.OfficeNotesDataManager;
-import ohd.hseb.officenotes.OfficeNotesDialog;
-import ohd.hseb.rivermonlocgroup.RiverMonGroupDialog;
-import ohd.hseb.rivermonlocgroup.RiverMonLocationDialog;
-import ohd.hseb.util.SessionLogger;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-
-public class PrecipMonitorMenuManager extends MonitorMenuManager {
- private JMenuBar _menuBar;
-
- private JMenu _fileMenu, _displayMenu, _sortMenu, _configMenu,
- _detailsMenu, _helpMenu;
-
- private JMenuItem _selectColumnsMenuItem;
-
- private JCheckBoxMenuItem _showMissingPrecipMenuItem;
-
- private JMenuItem _saveColumnSettingsMenuItem;
-
- private JMenuItem _loadSettingsMenuItem;
-
- private JMenuItem _loadOfficeSettingsMenuItem;
-
- private JMenuItem _saveOfficeSettingsMenuItem;
-
- private JMenuItem _refreshColumnMenuItem;
-
- private JMenuItem _exportTableToTextMenuItem;
-
- private JMenuItem _exitApplicationMenuItem;
-
- private JMenuItem _officeNotesMenuItem;
-
- private JMenuItem _alertAlarmMenuItem;
-
- private JMenuItem _timeSeriesLiteMenuItem;
-
- private JMenuItem _riverMonGroupMenuItem;
-
- private JMenuItem _riverMonLocationMenuItem;
-
- private JMenuItem _derivedColumnsMenuItem;
-
- private JMenuItem _hsagrplocSortMenuItem;
-
- private JMenuItem _precipThreatSortMenuItem;
-
- private JMenuItem _clearSortMenuItem;
-
- private JMenuItem _precipThresholdForThreatColorMenuItem;
-
- private JMenuItem _aboutMenuItem;
-
- private RiverMonGroupDialog _riverMonGroupDialog = null;
-
- private RiverMonLocationDialog _riverMonLocationDialog;
-
- private AlertAlarmDialog _alertAlarmDialog;
-
- private AlertAlarmDataManager _alertAlarmDataMgr;
-
- private PrecipMonitorDataManager _precipMonitorDataManager;
-
- private PrecipMonitorMenuSettings _menuSettings;
-
- private OfficeNotesDialog _officeNotesDialog;
-
- private OfficeNotesDataManager _officeNotesDataMgr;
-
- private String _settingsDir;
-
- private MonitorTimeSeriesLiteManager _monitorTimeSeriesLiteManager;
-
- private PrecipMonitorJTableRowData _selectedRowData;
-
- private MonitorToolBarManager _toolBarManager;
-
- public PrecipMonitorMenuManager(MessageSystemManager msgSystemManager,
- SessionLogger logger, MonitorFrame mainFrame, String version,
- String versionDate, AppsDefaults appsDefaults, JToolBar toolBar,
- PrecipMonitorDataManager precipMonitorDataManager,
- OfficeNotesDataManager officeNotesDataMgr,
- AlertAlarmDataManager alertAlarmDataMgr,
- PrecipMonitorMenuSettings menuSettings, JPanel timeDisplayPanel,
- String appName,
- MonitorTimeSeriesLiteManager monitorTimeSeriesLiteManager) {
- super(msgSystemManager, appsDefaults, logger);
- _appsDefaults = appsDefaults;
-
- _menuSettings = menuSettings;
-
- _precipMonitorDataManager = precipMonitorDataManager;
- _alertAlarmDataMgr = alertAlarmDataMgr;
-
- _officeNotesDataMgr = officeNotesDataMgr;
- _monitorTimeSeriesLiteManager = monitorTimeSeriesLiteManager;
-
- _settingsDir = _appsDefaults.getToken("rivermon_config_dir",
- "/awips/hydroapps/whfs/local/data/app/rivermon");
-
- int defaultRefreshInterval = 15;
- createRefreshComponents(defaultRefreshInterval, timeDisplayPanel);
-
- _toolBarManager = new MonitorToolBarManager(toolBar, _appsDefaults,
- _officeNotesDataMgr);
- _toolBarManager.getOfficeNotesButton().addActionListener(
- new OfficeNotesDialogListener());
-
- setAboutInfo(version, versionDate, appName);
- _mainFrame = mainFrame;
-
- setMessageSystemManager(msgSystemManager);
- _msgSystemManager.registerReceiver(
- new UpdateDisplayWithSettingsReceiver(),
- MessageType.UPDATE_DISPLAY_WITH_SETTINGS);
- _msgSystemManager.registerReceiver(new ViewSelectItemReceiver(),
- MessageType.VIEW_SELECT_ITEM);
-
- _msgSystemManager.registerReceiver(new UpdateDisplayReceiver(),
- MessageType.REFRESH_DISPLAY);
-
- createMenus();
-
- setFrameListener();
- }
-
- @Override
- protected long getDataUpdateTime() {
- return _precipMonitorDataManager.getPdcUpdateTime();
- }
-
- @Override
- protected long getDisplayedRecordCount() {
- return _precipMonitorDataManager.getDisplayedRecordCount();
- }
-
- @Override
- public void setMenuSettingsRefreshInterval(int value) {
- _menuSettings.setRefreshInterval(value);
- }
-
- @Override
- public void setRefreshTimeSpinnerValue() {
- _refreshTimeSpinner.setValue(_menuSettings.getRefreshInterval());
- }
-
- private void createMenus() {
- _menuBar = new JMenuBar();
- _mainFrame.setJMenuBar(_menuBar);
-
- _toolBarManager.getOfficeNotesButton().addActionListener(
- new OfficeNotesDialogListener());
-
- _fileMenu = new JMenu("File");
- _configMenu = new JMenu("Config");
- _displayMenu = new JMenu("Display");
- _sortMenu = new JMenu("Sort");
- _detailsMenu = new JMenu("Details");
- _helpMenu = new JMenu("Help");
-
- _fileMenu.setMnemonic('F');
- _configMenu.setMnemonic('C');
- _displayMenu.setMnemonic('D');
- _sortMenu.setMnemonic('S');
- _detailsMenu.setMnemonic('E');
- _helpMenu.setMnemonic('H');
-
- // File Menu
- _refreshColumnMenuItem = new JMenuItem("Refresh");
- _refreshColumnMenuItem.setMnemonic('R');
- _refreshColumnMenuItem
- .setToolTipText("Update screen with latest available data. Same as Update Now");
- _fileMenu.add(_refreshColumnMenuItem);
-
- _fileMenu.add(new JSeparator());
-
- _saveColumnSettingsMenuItem = new JMenuItem("Save Custom Settings ...");
- _saveColumnSettingsMenuItem.setMnemonic('S');
- _fileMenu.add(_saveColumnSettingsMenuItem);
-
- _saveOfficeSettingsMenuItem = new JMenuItem("Save Office Settings");
- _saveOfficeSettingsMenuItem.setMnemonic('F');
- _saveOfficeSettingsMenuItem
- .setToolTipText("Save office settings to PrecipMonitorSettings.txt");
- _fileMenu.add(_saveOfficeSettingsMenuItem);
-
- _loadSettingsMenuItem = new JMenuItem("Load Custom Settings ...");
- _loadSettingsMenuItem.setMnemonic('L');
- _fileMenu.add(_loadSettingsMenuItem);
-
- _loadOfficeSettingsMenuItem = new JMenuItem("Load Office Settings");
- _loadOfficeSettingsMenuItem.setMnemonic('O');
- _loadOfficeSettingsMenuItem
- .setToolTipText("Load office settings from PrecipMonitorSettings.txt");
- _fileMenu.add(_loadOfficeSettingsMenuItem);
-
- _fileMenu.add(new JSeparator());
-
- _exportTableToTextMenuItem = new JMenuItem(
- "Export Data To Text File ...");
- _exportTableToTextMenuItem.setMnemonic('x');
- _fileMenu.add(_exportTableToTextMenuItem);
-
- _fileMenu.add(new JSeparator());
-
- _exitApplicationMenuItem = new JMenuItem("Exit");
- _exitApplicationMenuItem.setMnemonic('E');
- _fileMenu.add(_exitApplicationMenuItem);
-
- // Display Menu
- _selectColumnsMenuItem = new JMenuItem("Select Columns ...");
- _selectColumnsMenuItem.setMnemonic('S');
- _displayMenu.add(_selectColumnsMenuItem);
-
- _displayMenu.add(new JSeparator());
-
- _precipThresholdForThreatColorMenuItem = new JMenuItem(
- "Precip Threshold ...");
- _precipThresholdForThreatColorMenuItem.setMnemonic('P');
- _displayMenu.add(_precipThresholdForThreatColorMenuItem);
-
- _showMissingPrecipMenuItem = new JCheckBoxMenuItem(
- "Show Locations with Missing Precip Data");
- _showMissingPrecipMenuItem.setMnemonic('M');
- _displayMenu.add(_showMissingPrecipMenuItem);
-
- // Config Menu
- _riverMonGroupMenuItem = new JMenuItem("Group Definitions ...");
- _riverMonGroupMenuItem.setMnemonic('G');
- _configMenu.add(_riverMonGroupMenuItem);
-
- _riverMonLocationMenuItem = new JMenuItem(
- "Location Grouping/Ordering ...");
- _riverMonLocationMenuItem.setMnemonic('L');
- _configMenu.add(_riverMonLocationMenuItem);
-
- _configMenu.add(new JSeparator());
-
- _derivedColumnsMenuItem = new JMenuItem("Derived Columns ...");
- _derivedColumnsMenuItem.setMnemonic('D');
- _configMenu.add(_derivedColumnsMenuItem);
-
- // Sort Menu
- _clearSortMenuItem = new JMenuItem("Clear Sort");
- _clearSortMenuItem.setMnemonic('C');
- _clearSortMenuItem.setToolTipText("Clear All Sorts");
- _sortMenu.add(_clearSortMenuItem);
-
- _sortMenu.add(new JSeparator());
-
- _hsagrplocSortMenuItem = new JMenuItem(
- "Sort by HSA | Group | Location Columns");
- _hsagrplocSortMenuItem.setMnemonic('O');
- _hsagrplocSortMenuItem
- .setToolTipText("Sort by HSA, group id, location id");
- _sortMenu.add(_hsagrplocSortMenuItem);
-
- _precipThreatSortMenuItem = new JMenuItem("PrecipThreat Sort");
- _precipThreatSortMenuItem.setMnemonic('P');
- _precipThreatSortMenuItem.setToolTipText("Sort by PrecipThreat");
- _sortMenu.add(_precipThreatSortMenuItem);
-
- // Details Memu
- _officeNotesMenuItem = new JMenuItem("Office Notes ...");
- _officeNotesMenuItem.setMnemonic('O');
- _detailsMenu.add(_officeNotesMenuItem);
-
- _alertAlarmMenuItem = new JMenuItem("Alert Alarm ...");
- _alertAlarmMenuItem.setMnemonic('A');
- _detailsMenu.add(_alertAlarmMenuItem);
-
- _detailsMenu.add(new JSeparator());
-
- _timeSeriesLiteMenuItem = new JMenuItem("Time Series Lite...");
- _timeSeriesLiteMenuItem.setMnemonic('T');
- _detailsMenu.add(_timeSeriesLiteMenuItem);
-
- // Help Menu
- _aboutMenuItem = new JMenuItem("About ...");
- _aboutMenuItem.setMnemonic('A');
- _helpMenu.add(_aboutMenuItem);
-
- setMenuListeners();
-
- _menuBar.add(_fileMenu);
- _menuBar.add(_displayMenu);
- _menuBar.add(_configMenu);
- _menuBar.add(_sortMenu);
- _menuBar.add(_detailsMenu);
- _menuBar.add(_helpMenu);
- }
-
- private void setMenuListeners() {
- ChangeColumnsDisplayedMenuListener changeMenuListener = new ChangeColumnsDisplayedMenuListener();
- _selectColumnsMenuItem.addActionListener(changeMenuListener);
-
- ShowMissingPrecipMenuListener showMissingPrecipMenuListener = new ShowMissingPrecipMenuListener();
- _showMissingPrecipMenuItem
- .addItemListener(showMissingPrecipMenuListener);
-
- SaveSettingsListener saveMenuListener = new SaveSettingsListener();
- _saveColumnSettingsMenuItem.addActionListener(saveMenuListener);
-
- LoadSettingsListener loadMenuListener = new LoadSettingsListener();
- _loadSettingsMenuItem.addActionListener(loadMenuListener);
-
- LoadOfficeSettingsListener loadOfficeSettingsListener = new LoadOfficeSettingsListener();
- _loadOfficeSettingsMenuItem
- .addActionListener(loadOfficeSettingsListener);
-
- SaveOfficeSettingsListener saveOfficeSettingsListener = new SaveOfficeSettingsListener();
- _saveOfficeSettingsMenuItem
- .addActionListener(saveOfficeSettingsListener);
-
- ExitApplicationListener exitApplicationListener = new ExitApplicationListener();
- _exitApplicationMenuItem.addActionListener(exitApplicationListener);
-
- RefreshMenuListener RefreshMenuListener = new RefreshMenuListener();
- _refreshColumnMenuItem.addActionListener(RefreshMenuListener);
-
- SaveTableListener saveTableListener = new SaveTableListener();
- _exportTableToTextMenuItem.addActionListener(saveTableListener);
-
- AppSortListener appSortListener = new AppSortListener();
- _hsagrplocSortMenuItem.addActionListener(appSortListener);
-
- PrecipThreatSortListener precipThreatSortListener = new PrecipThreatSortListener();
- _precipThreatSortMenuItem.addActionListener(precipThreatSortListener);
-
- ClearSortListener clearSortListener = new ClearSortListener();
- _clearSortMenuItem.addActionListener(clearSortListener);
-
- AlertAlarmDialogListener alertAlarmDialogListener = new AlertAlarmDialogListener();
- _alertAlarmMenuItem.addActionListener(alertAlarmDialogListener);
-
- OfficeNotesDialogListener officeNotesDialogListener = new OfficeNotesDialogListener();
- _officeNotesMenuItem.addActionListener(officeNotesDialogListener);
-
- TimeSeriesLiteMenuItemListener timeSeriesLiteMenuItemListener = new TimeSeriesLiteMenuItemListener();
- _timeSeriesLiteMenuItem
- .addActionListener(timeSeriesLiteMenuItemListener);
-
- RiverMonGroupDialogListener riverMonGroupDialogListener = new RiverMonGroupDialogListener();
- _riverMonGroupMenuItem.addActionListener(riverMonGroupDialogListener);
-
- RiverMonLocationDialogListener riverMonLocationDialogListener = new RiverMonLocationDialogListener();
- _riverMonLocationMenuItem
- .addActionListener(riverMonLocationDialogListener);
-
- PrecipThresholdListener precipThresholdListener = new PrecipThresholdListener(
- _menuSettings.getPrecipSettings());
- _precipThresholdForThreatColorMenuItem
- .addActionListener(precipThresholdListener);
-
- DerivedColumnsEditorListener derivedColumnsEditorListener = new DerivedColumnsEditorListener();
- _derivedColumnsMenuItem.addActionListener(derivedColumnsEditorListener);
-
- AboutListener aboutListener = new AboutListener();
- _aboutMenuItem.addActionListener(aboutListener);
-
- }
-
- private class DerivedColumnsEditorListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- String editorTitle = ("\"").concat("Derived Columns").concat("\"");
- String file = _settingsDir + "/"
- + PrecipMonitorAppManager.DERIVED_COLUMNS_FILE;
- launchTextEditor(editorTitle, file, "PrecipMonitor Application");
- }
- }
-
- private void setFrameListener() {
- FrameListener frameListener = new FrameListener();
- _mainFrame.addWindowListener(frameListener);
- }
-
- public void closeApplication() {
- _logger.log("PrecipMonitor Application Exiting....");
- _logger.log("====================================");
- _precipMonitorDataManager.disconnect();
- _mainFrame.setVisible(false);
- _mainFrame.dispose();
- Monitor.disposePrecip();
- }
-
- private void createOfficeNotesDialog() {
- List lidList = _precipMonitorDataManager.getLidList();
- String lids[] = new String[lidList.size()];
- for (int i = 0; i < lidList.size(); i++) {
- lids[i] = lidList.get(i).toString();
- }
- Arrays.sort(lids);
- System.out.println("Create officenotes lids size:" + lidList.size());
- Map lidDescDetailsMap = _precipMonitorDataManager.getLidDescDetails();
- if (_officeNotesDialog == null)
- _officeNotesDialog = new OfficeNotesDialog(_mainFrame,
- _officeNotesDataMgr, "RIVERMON", lids, lidDescDetailsMap,
- _logger);
- }
-
- public void loadSettings() {
- String header = "PrecipMonitorMenuManager.loadSettings(): ";
-
- System.out.print(header);
- send(this, MessageType.LOAD_SETTINGS);
- }
-
- private void loadOfficeSettings() {
- String header = "PrecipMonitorMenuManager.loadOfficeSettings(): ";
-
- System.out.print(header);
- send(this, MessageType.LOAD_OFFICE_SETTINGS);
- }
-
- public void viewSelectItem(MonitorMessage message) {
- String header = "PrecipMonitorMenuManager.viewSelectItem(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
- _selectedRowData = (PrecipMonitorJTableRowData) message
- .getMessageData();
- }
-
- public void updateDisplayWithSettings(MonitorMessage message) {
- String header = "PrecipMonitorMenuManager.updateDisplayWithSettings(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
- refreshTimeDisplay();
- updateMenuWithNewSettings();
- }
-
- private void updateMenuWithNewSettings() {
- if (_menuSettings.shouldShowMissingPrecip())
- _showMissingPrecipMenuItem.setSelected(true);
- else
- _showMissingPrecipMenuItem.setSelected(false);
- }
-
- public void saveSettings() {
- String header = "PrecipMonitorMenuManager.saveSettings(): ";
-
- System.out.print(header);
- send(this, MessageType.SAVE_SETTINGS);
- }
-
- private void saveOfficeSettings() {
- String header = "PrecipMonitorMenuManager.saveOfficeSettings(): ";
-
- System.out.print(header);
- send(this, MessageType.SAVE_OFFICE_SETTINGS);
- }
-
- public void loadSettings(File fileHandler) {
- if (fileHandler != null) {
- String header = "PrecipMonitorMenuManager.loadSettings(): ";
-
- System.out.print(header);
- send(this, MessageType.LOAD_SETTINGS);
- }
- }
-
- public void loadSettingsFromFile(File fileHandler) {
- String header = "PrecipMonitorMenuManager.loadSettingsFromFile(): ";
- if (fileHandler != null) {
- _logger.log(header + "Read settings from "
- + fileHandler.getAbsolutePath());
- loadSettings(fileHandler);
- }
- }
-
- private void saveTable() {
- String header = "PrecipMonitorMenuManager.saveTable(): ";
-
- System.out.print(header);
- send(this, MessageType.CREATE_TEXT_FROM_VIEW);
- }
-
- private void changeColumns() {
- String header = "PrecipMonitorMenuManager.changeColumns(): ";
-
- System.out.print(header);
- send(this, MessageType.CHANGE_COLUMNS);
- }
-
- private void precipThreatSort() {
- String header = "PrecipMonitorMenuManager.precipThreatSort(): ";
-
- System.out.print(header);
- send(this, MessageType.CLEAR_SORT);
-
- System.out.print(header);
- send(this, MessageType.PRECIP_THREAT_SORT);
- }
-
- private void appSort() {
- String header = "PrecipMonitorMenuManager.appSort(): ";
-
- System.out.print(header);
- send(this, MessageType.CLEAR_SORT);
-
- System.out.print(header);
- send(this, MessageType.APP_SORT);
- }
-
- private void clearSort() {
- String header = "PrecipMonitorMenuManager.clearSort(): ";
- System.out.print(header);
- send(this, MessageType.CLEAR_SORT);
- }
-
- private void createAlertAlarmDialog() {
- if (_alertAlarmDialog == null)
- _alertAlarmDialog = new AlertAlarmDialog(_mainFrame,
- _alertAlarmDataMgr, _logger);
- }
-
- private void createRiverMonGroupDialog() {
- String defaultHsa = _precipMonitorDataManager.getDefaultHsa();
- if (_riverMonGroupDialog == null)
- _riverMonGroupDialog = new RiverMonGroupDialog(_mainFrame,
- _precipMonitorDataManager.getRiverMonLocGroupDataManager(),
- _logger, defaultHsa);
- }
-
- private void createRiverMonLocationDialog() {
- if (_riverMonLocationDialog == null)
- _riverMonLocationDialog = new RiverMonLocationDialog(_mainFrame,
- _precipMonitorDataManager.getRiverMonLocGroupDataManager(),
- _logger);
- }
-
- private class ExitApplicationListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- closeApplication();
- }
- }
-
- public class ShowMissingPrecipMenuListener implements ItemListener {
- public void itemStateChanged(ItemEvent e) {
- String header = "PrecipMonitorMenuManager.ShowMissingPrecipMenuListener.itemStateChanged()";
-
- boolean prevValue = _menuSettings.shouldShowMissingPrecip();
- boolean newValue = false;
- if (e.getStateChange() == ItemEvent.SELECTED) {
- newValue = true;
- }
-
- _menuSettings.setShowMissingPrecip(newValue);
-
- if (prevValue != newValue) {
- sendMissingFilterChanged();
- }
- }
- }
-
- public class ChangeColumnsDisplayedMenuListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- changeColumns();
- }
- }
-
- private class ClearSortListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- clearSort();
- }
- }
-
- private class PrecipThreatSortListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- precipThreatSort();
- }
- }
-
- private class AppSortListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- appSort();
- }
- }
-
- private class RiverMonitorListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- //startMonitor("RiverMonitor Application", "RIVER");
- }
- }
-
- private class SaveTableListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- saveTable();
- }
- }
-
- private class RefreshMenuListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- refresh();
- }
- }
-
- private class AlertAlarmDialogListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- createAlertAlarmDialog();
- if (_selectedRowData != null) {
- _alertAlarmDialog.showAlertAlarmDialog(_selectedRowData
- .getLid());
- } else
- _alertAlarmDialog.showAlertAlarmDialog(null);
- }
- }
-
- private class TimeSeriesLiteMenuItemListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- if (_selectedRowData != null) {
- _monitorTimeSeriesLiteManager.displayTimeSeriesLite(_mainFrame,
- _selectedRowData, 1);
- } else {
- String textMsg = " Unable to display TimeSeriesLite
"
- + "Please highlight a row... ";
- JOptionPane.showMessageDialog(_mainFrame, textMsg,
- "TimeSeriesLite", JOptionPane.PLAIN_MESSAGE);
- }
- }
- }
-
- private class RiverMonGroupDialogListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- createRiverMonGroupDialog();
- boolean hasTableChanged = _riverMonGroupDialog
- .showRiverMonGroupDialog();
- if (hasTableChanged) {
- menuChange();
- }
- }
- }
-
- private class RiverMonLocationDialogListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- createRiverMonLocationDialog();
- boolean hasTableChanged = _riverMonLocationDialog
- .showRiverMonLocationDialog();
- System.out.println("Rivermonlocation table changed:"
- + hasTableChanged);
- if (hasTableChanged) {
- menuChange();
- }
- }
- }
-
- private class LoadOfficeSettingsListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- loadOfficeSettings();
- }
- }
-
- private class SaveOfficeSettingsListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- String message = " This will overwrite standard office settings for PrecipMonitor.
"
- + "Are you sure ?
";
- if (confirmSaveOfficeSettings(message))
- saveOfficeSettings();
- }
- }
-
- private class LoadSettingsListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- loadSettings();
- }
- }
-
- private class FrameListener extends WindowAdapter {
- @Override
- public void windowClosing(WindowEvent event) {
- closeApplication();
- }
- }
-
- private class OfficeNotesDialogListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- createOfficeNotesDialog();
- if (_selectedRowData != null) {
- _officeNotesDialog.showOfficeNotesDialog(_selectedRowData
- .getLid());
- } else
- _officeNotesDialog.showOfficeNotesDialog(null);
-
- _toolBarManager.setOfficeNotesButtonIcon(_officeNotesDataMgr
- .getCountOfOfficeNotes());
- }
- }
-
- private class SaveSettingsListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- saveSettings();
- }
- }
-
- private class UpdateDisplayReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- updateRecordCount();
- }
- }
-
- private class UpdateDisplayWithSettingsReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- setInitialRefreshTimeInfo();
- updateDisplayWithSettings(message);
- }
- }
-
- private class ViewSelectItemReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- viewSelectItem(message);
- }
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorRefreshManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorRefreshManager.java
deleted file mode 100755
index e969bebb75..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorRefreshManager.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package ohd.hseb.monitor.precip.manager;
-
-import javax.swing.JSplitPane;
-
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.manager.MonitorRefreshManager;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.messaging.MessageType;
-import ohd.hseb.monitor.precip.PrecipMonitorDataManager;
-import ohd.hseb.util.SessionLogger;
-import ohd.hseb.util.gui.DialogHelper;
-
-public class PrecipMonitorRefreshManager extends MonitorRefreshManager
-{
- private PrecipMonitorDataManager _precipMonitorDataManager;
-
- public PrecipMonitorRefreshManager(MessageSystemManager msgSystemManager, SessionLogger logger,
- PrecipMonitorDataManager precipMonitorDataManager, JSplitPane splitPane)
- {
- super(msgSystemManager, logger, splitPane);
-
- _precipMonitorDataManager = precipMonitorDataManager;
- }
-
- protected void reloadData(MonitorMessage incomingMessage, MessageType outgoingMessageType)
- {
- DialogHelper.setWaitCursor(_splitPane);
-
- String header = "MonitorRefreshManager.reloadData(): ";
- System.out.println(header +" Invoked"+ "...Source:" + incomingMessage.getMessageSource() +
- " Type:" + incomingMessage.getMessageType());
-
- Runtime.getRuntime().gc();
- _precipMonitorDataManager.createPrecipMonitorRowDataList();
- Runtime.getRuntime().gc();
-
- System.out.println(header);
- send(this, outgoingMessageType);
-
- DialogHelper.setDefaultCursor(_splitPane);
- }
-
-}
-
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorSettingsManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorSettingsManager.java
deleted file mode 100755
index 76fe9238f8..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorSettingsManager.java
+++ /dev/null
@@ -1,202 +0,0 @@
-package ohd.hseb.monitor.precip.manager;
-
-import java.io.File;
-
-import javax.swing.JFileChooser;
-
-import ohd.hseb.monitor.MonitorFrame;
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.manager.BaseManager;
-import ohd.hseb.monitor.manager.Receiver;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.messaging.MessageType;
-import ohd.hseb.monitor.precip.settings.PrecipMonitorMenuSettings;
-import ohd.hseb.monitor.precip.settings.PrecipMonitorSettingsFileManager;
-import ohd.hseb.monitor.settings.FilterSettings;
-import ohd.hseb.monitor.settings.ViewSettings;
-import ohd.hseb.util.SessionLogger;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-
-public class PrecipMonitorSettingsManager extends BaseManager {
- private String _settingsDir;
-
- private AppsDefaults _appsDefaults;
-
- private SessionLogger _logger;
-
- private JFileChooser _fileChooser;
-
- private MonitorFrame _mainFrame;
-
- private ViewSettings _viewSettings;
-
- private FilterSettings _filterSettings;
-
- private PrecipMonitorMenuSettings _menuSettings;
-
- private PrecipMonitorSettingsFileManager _precipMonitorSettingsFileManger;
-
- private String _officeSettingsFile;
-
- private String _defaultSettingsFile;
-
- public PrecipMonitorSettingsManager(MessageSystemManager msgSystemManager,
- AppsDefaults appsDefaults, SessionLogger logger,
- MonitorFrame mainFrame, ViewSettings viewSettings,
- FilterSettings filterSettings,
- PrecipMonitorMenuSettings menuSettings) {
- _appsDefaults = appsDefaults;
- _logger = logger;
- _viewSettings = viewSettings;
- _filterSettings = filterSettings;
- _menuSettings = menuSettings;
-
- _settingsDir = _appsDefaults.getToken("rivermon_config_dir",
- "/awips/hydroapps/whfs/local/data/app/rivermon");
-
- _precipMonitorSettingsFileManger = new PrecipMonitorSettingsFileManager(
- _logger, _viewSettings, _filterSettings, _menuSettings);
-
- _mainFrame = mainFrame;
-
- _officeSettingsFile = _settingsDir.concat("/").concat(
- PrecipMonitorAppManager.SITE_PRECIP_SETTINGS_FILE);
- _defaultSettingsFile = _settingsDir.concat("/").concat(
- PrecipMonitorAppManager.DEFAULT_PRECIP_SETTINGS_FILE);
-
- setMessageSystemManager(msgSystemManager);
-
- _msgSystemManager.registerReceiver(new LoadSettingsReceiver(),
- MessageType.LOAD_SETTINGS);
- _msgSystemManager.registerReceiver(new LoadOfficeSettingsReceiver(),
- MessageType.LOAD_OFFICE_SETTINGS);
- _msgSystemManager.registerReceiver(new SaveSettingsReceiver(),
- MessageType.SAVE_SETTINGS);
- _msgSystemManager.registerReceiver(new SaveOfficeSettingsReceiver(),
- MessageType.SAVE_OFFICE_SETTINGS);
- }
-
- private void saveSettings(MonitorMessage message) {
- String header = "PrecipMonitorSettingsManager.saveSettings(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- File fileHandler = null;
- _fileChooser = new JFileChooser();
-
- _fileChooser.setCurrentDirectory(new File(_settingsDir));
- _fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
-
- int result = _fileChooser.showSaveDialog(_mainFrame);
- if (result == JFileChooser.CANCEL_OPTION)
- fileHandler = null;
- else
- fileHandler = _fileChooser.getSelectedFile();
-
- System.out.print(header);
- saveSettingsToFile(fileHandler);
- }
-
- private void saveOfficeSettings(MonitorMessage message) {
- String header = "PrecipMonitorSettingsManager.saveOfficeSettings(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- File fileHandler = new File(_officeSettingsFile);
-
- System.out.print(header);
- saveSettingsToFile(fileHandler);
- }
-
- private void saveSettingsToFile(File fileHandler) {
- send(this, MessageType.UPDATE_SETTINGS);
-
- if (fileHandler != null) {
- _precipMonitorSettingsFileManger.saveSettingsToFile(fileHandler);
- }
- }
-
- private void loadSettings(MonitorMessage message) {
- String header = "PrecipMonitorSettingsManager.loadSettings(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- if (message.getMessageSource() != this) {
- File fileHandler = null;
- _fileChooser = new JFileChooser();
- _fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
-
- _fileChooser.setCurrentDirectory(new File(_settingsDir));
- int result = _fileChooser.showOpenDialog(_mainFrame);
-
- if (result == JFileChooser.CANCEL_OPTION)
- fileHandler = null;
- else
- fileHandler = _fileChooser.getSelectedFile();
-
- loadSettings(fileHandler);
- }
- }
-
- public void startPrecipMonitor() {
- String header = "PrecipMonitorSettings.startPrecipMonitor(): ";
- File fileHandler = new File(_officeSettingsFile);
- if (fileHandler == null || (!fileHandler.exists())) {
- fileHandler = new File(_defaultSettingsFile);
- }
-
- _logger.log(header + "Trying to load from file :"
- + fileHandler.getAbsolutePath());
- // loadSettings(fileHandler);
- }
-
- private void loadSettings(File fileHandler) {
- String header = "PrecipMonitorSettingsManager.loadSettings(): ";
- if (fileHandler != null) {
- _precipMonitorSettingsFileManger.setSettingsFromFile(fileHandler);
-
- System.out.print(header);
- send(this, MessageType.RELOAD_DATA_WITH_NEW_SETTINGS);
- }
- }
-
- private void loadOfficeSettings(MonitorMessage message) {
- String header = "PrecipMonitorSettingsManager.loadOfficeSettings(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- File fileHandler = new File(_officeSettingsFile);
-
- loadSettings(fileHandler);
- }
-
- private class SaveOfficeSettingsReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- saveOfficeSettings(message);
- }
- }
-
- private class LoadOfficeSettingsReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- loadOfficeSettings(message);
- }
- }
-
- private class LoadSettingsReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- loadSettings(message);
- }
- }
-
- private class SaveSettingsReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- saveSettings(message);
- }
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorViewManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorViewManager.java
deleted file mode 100755
index e6ab621960..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/manager/PrecipMonitorViewManager.java
+++ /dev/null
@@ -1,541 +0,0 @@
-package ohd.hseb.monitor.precip.manager;
-
-import java.awt.Dimension;
-import java.awt.Point;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.util.List;
-
-import javax.swing.JFileChooser;
-import javax.swing.JScrollPane;
-import javax.swing.JSplitPane;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import ohd.hseb.monitor.LocationInfoColumns;
-import ohd.hseb.monitor.MonitorFrame;
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.MonitorTimeSeriesLiteManager;
-import ohd.hseb.monitor.derivedcolumns.DerivedColumnsFileManager;
-import ohd.hseb.monitor.manager.BaseManager;
-import ohd.hseb.monitor.manager.Receiver;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.messaging.MessageType;
-import ohd.hseb.monitor.precip.PrecipColumns;
-import ohd.hseb.monitor.precip.PrecipMonitorDataManager;
-import ohd.hseb.monitor.precip.PrecipMonitorJTableRowData;
-import ohd.hseb.monitor.settings.ViewSettings;
-import ohd.hseb.util.SessionLogger;
-import ohd.hseb.util.gui.jtable.ComplexJTableManager;
-import ohd.hseb.util.gui.jtable.JTableColumnDescriptor;
-import ohd.hseb.util.gui.jtable.JTableColumnDisplaySettings;
-import ohd.hseb.util.gui.jtable.JTableManager;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-
-public class PrecipMonitorViewManager extends BaseManager
-{
- private SessionLogger _logger;
-
- private PrecipMonitorDataManager _precipMonitorDataManager;
- private JTableManager _precipMonitorTableManager;
- private ViewSettings _viewSettings;
-
- private JSplitPane _splitPane;
-
- private List _precipMonitorAllRowDataList;
-
- private String _columnNamesCurrentlyDisplayed[];
- private DerivedColumnsFileManager _derivedColumnsFileManager;
- private MonitorFrame _mainFrame;
-
- private AppsDefaults _appsDefaults;
-
- private PrecipMonitorJTableRowData _selectedRowData;
-
- private MonitorTimeSeriesLiteManager _monitorTimeSeriesLiteManager;
-
- public PrecipMonitorViewManager(MonitorFrame mainFrame, MessageSystemManager msgSystemManager, SessionLogger logger,
- PrecipMonitorDataManager precipMonitorDataManager, JSplitPane splitPane, ViewSettings viewSettings,
- DerivedColumnsFileManager derivedColumnsFileManager, MonitorTimeSeriesLiteManager monitorTimeSeriesLiteManager,
- AppsDefaults appsDefaults)
- {
- _logger = logger;
- _precipMonitorDataManager = precipMonitorDataManager;
- _splitPane = splitPane;
- _mainFrame = mainFrame;
- _viewSettings = viewSettings;
-
- _derivedColumnsFileManager = derivedColumnsFileManager;
- _monitorTimeSeriesLiteManager = monitorTimeSeriesLiteManager;
- _appsDefaults = appsDefaults;
-
- List precipColumnsList = new PrecipColumns().getPrecipColumnsList(null);
-
- _derivedColumnsFileManager.getDerivedColumns();
- String derivedColumnNames[] = _derivedColumnsFileManager.getDerivedColumnNames();
- String alignmentForDerivedColumns[] = _derivedColumnsFileManager.getAlignmentForDerivedColumns();
- if(derivedColumnNames != null)
- {
- addDerivedColumnNames(precipColumnsList, derivedColumnNames, alignmentForDerivedColumns);
- }
-
- Dimension columnHeaderPreferredSize = new Dimension(100, 50);
- _precipMonitorTableManager = new ComplexJTableManager(precipColumnsList, _precipMonitorAllRowDataList, columnHeaderPreferredSize);
-
- setMessageSystemManager(msgSystemManager);
- _msgSystemManager.registerReceiver(new SelectViewItemReceiver(), MessageType.FILTER_SELECT_ITEM);
- _msgSystemManager.registerReceiver(new ChangeColumnsReceiver(), MessageType.CHANGE_COLUMNS);
- _msgSystemManager.registerReceiver(new AppSortReceiver(), MessageType.APP_SORT);
- _msgSystemManager.registerReceiver(new PrecipThreatSortReceiver(), MessageType.PRECIP_THREAT_SORT);
- _msgSystemManager.registerReceiver(new ClearSortReceiver(), MessageType.CLEAR_SORT);
- _msgSystemManager.registerReceiver(new UpdateDisplayWithSettingsReceiver(), MessageType.UPDATE_DISPLAY_WITH_SETTINGS);
- _msgSystemManager.registerReceiver(new RefreshDisplayReceiver(), MessageType.REFRESH_DISPLAY);
- _msgSystemManager.registerReceiver(new SaveViewReceiver(), MessageType.CREATE_TEXT_FROM_VIEW);
- _msgSystemManager.registerReceiver(new UpdateSettingsReceiver(), MessageType.UPDATE_SETTINGS);
-
- }
-
- private void addDerivedColumnNames(List precipColumnsList, String derivedColumnNames[], String alignmentForDerivedColumns[])
- {
- for(int i=0; i < derivedColumnNames.length; i++)
- {
- precipColumnsList.add(new JTableColumnDescriptor(derivedColumnNames[i], alignmentForDerivedColumns[i], derivedColumnNames[i]));
- }
- }
-
- private void createTableAndApplySettings(MonitorMessage message)
- {
- String header = "PrecipMonitorViewManager.createTableAndApplySettings(): ";
- System.out.println(header +" Invoked"+ "...Source:" + message.getMessageSource() + " Type:" + message.getMessageType());
-
- _precipMonitorAllRowDataList = _precipMonitorDataManager.getPrecipMonitorRowDataList();
-
- _columnNamesCurrentlyDisplayed = null;
- String columnDisplaySettingsString = _viewSettings.getColumnDisplaySettings();
- JTableColumnDisplaySettings columnDisplaySettings = _precipMonitorTableManager.getTableSettings();
- columnDisplaySettings.setSettingsFromString(columnDisplaySettingsString);
-
- _columnNamesCurrentlyDisplayed = _precipMonitorTableManager.getColumnNamesThatAreCurrentlyDisplayed();
- if(_columnNamesCurrentlyDisplayed == null)
- {
- _columnNamesCurrentlyDisplayed = new String[] {LocationInfoColumns.LOCATION_ID, LocationInfoColumns.GROUP_NAME};
- }
-
- List selectedRowDataList = _precipMonitorDataManager.getTreeFilterManager().filter(_precipMonitorAllRowDataList);
- _precipMonitorTableManager.setChangedAllRowDataList(selectedRowDataList);
-
- _precipMonitorTableManager.setDisplayableColumns(_columnNamesCurrentlyDisplayed, true, true);
- _precipMonitorTableManager.setPreferredSizeForJScrollPane(new Dimension(690, 645));
-
- JScrollPane tableScrollPane = _precipMonitorTableManager.getJScrollPane();
- _splitPane.setRightComponent(tableScrollPane);
-
- _precipMonitorTableManager.addTableListener(new TableMouseMotionListener());
- _precipMonitorTableManager.addTableListener(new TableListSelectionListener());
- _precipMonitorTableManager.addTableListener(new TableMouseListener());
- }
-
-
- public void refreshDisplay(MonitorMessage message)
- {
- String header = "PrecipMonitorViewManager.refreshDisplay(): ";
-
- System.out.println(header +" Invoked"+ "...Source:" + message.getMessageSource() + " Type:" + message.getMessageType());
-
- _precipMonitorAllRowDataList = _precipMonitorDataManager.getPrecipMonitorRowDataList();
- List selectedRowDataList = _precipMonitorDataManager.getTreeFilterManager().filter(_precipMonitorAllRowDataList);
- _precipMonitorTableManager.setChangedAllRowDataList(selectedRowDataList);
-
- _precipMonitorTableManager.refreshDisplay();
-
- JScrollPane tableScrollPane = _precipMonitorTableManager.getJScrollPane();
-
- _splitPane.setRightComponent(tableScrollPane);
- }
-
- private void setSplitPaneDividerLocation()
- {
- String header = "PrecipMonitorViewManager.setSplitPaneDividerLocation(): ";
-
- int newDividerLocation = _splitPane.getDividerLocation();
-
- _splitPane.setDividerLocation(newDividerLocation);
-
- return;
- }
-
- private void updateSettings(MonitorMessage message)
- {
- String header = "PrecipMonitorViewManager.updateSettings(): ";
- System.out.println(header +" Invoked"+ "...Source:" + message.getMessageSource() + " Type:" + message.getMessageType());
- updateSettings();
- }
-
- private void updateSettings()
- {
- String header = "PrecipMonitorViewManager.updateSettings(): ";
- JTableColumnDisplaySettings columnDisplaySettings = _precipMonitorTableManager.getTableSettings();
- String settings = columnDisplaySettings.getSettingsString();
- _viewSettings.setColumnDisplaySettings(settings);
- }
-
- private void selectViewItem(MonitorMessage message)
- {
- String header = "PrecipMonitorViewManager.selectViewItem(): ";
- System.out.println(header +" Invoked"+ "...Source:" + message.getMessageSource() + " Type:" + message.getMessageType());
-
- String lidOfInterest = _precipMonitorDataManager.getLidOfCurrentInterest();
- int rowToHighLight = _precipMonitorTableManager.getTheRowIndexToHighLightBasedOnValue(lidOfInterest, LocationInfoColumns.LOCATION_ID);
- System.out.println("Row to highlight:" + rowToHighLight);
- if(rowToHighLight != -1)
- _precipMonitorTableManager.selectRows(rowToHighLight, rowToHighLight);
- }
-
- public void printFileException(IOException exception, String header)
- {
- header = header+".printFileException(): ";
- _logger.log(header+"ERROR = " + exception.getMessage());
- exception.printStackTrace(_logger.getPrintWriter());
- _logger.log(header+"End of stack trace");
- }
-
- private void saveTableToFile(String fileName)
- {
- File fileHandler = new File(fileName);
- String header = "PrecipMonitorViewManager.saveTableToFile(): ";
- String displayedColumns[] = _precipMonitorTableManager.getColumnNamesThatAreCurrentlyDisplayed();
- String rowData[][] = _precipMonitorTableManager.getDisplayRowDataArray();
- BufferedWriter out = null;
- int maxStringLen = 33;
- try
- {
- FileOutputStream fileOutput = new FileOutputStream(fileName, false);
- OutputStreamWriter outputStream = new OutputStreamWriter(fileOutput);
- out = new BufferedWriter(outputStream);
- }
- catch(IOException exception)
- {
- printFileException(exception, header);
- }
- if(displayedColumns != null)
- {
- try
- {
- out.newLine();
- StringBuffer columnNameStringBuffer = new StringBuffer();
- for(int i=0; i < displayedColumns.length; i++)
- {
- columnNameStringBuffer.append(getTrimmedOrPaddedString(displayedColumns[i], maxStringLen));
- columnNameStringBuffer.append(" |");
- }
- out.write(columnNameStringBuffer.toString());
- out.newLine();
- }
- catch(IOException exception)
- {
- printFileException(exception, header);
- }
- }
- try
- {
- for(int i=0; i < rowData.length; i++)
- {
- out.newLine();
- StringBuffer dataStringBuffer = new StringBuffer();
- for(int j=0; j < rowData[i].length; j++)
- {
- dataStringBuffer.append(getTrimmedOrPaddedString(rowData[i][j], maxStringLen));
- dataStringBuffer.append(" |");
- }
- out.write(dataStringBuffer.toString());
- }
- }
- catch(IOException exception)
- {
- printFileException(exception,header);
- }
-
- try
- {
- out.close();
- }
- catch(IOException exception)
- {
- _logger.log(header+ "Unable to close file["+
- fileHandler.getAbsolutePath()+"]");
- printFileException(exception, header);
- }
- }
-
- private String getTrimmedOrPaddedString(String origString, int desiredLength)
- {
- String newString = origString;
-
- String formatString = "%-"+ String.valueOf(desiredLength) +"s";
-
- newString = String.format(formatString, origString);
-
- if (newString.length() > desiredLength)
- {
- newString = newString.substring(0, desiredLength);
- }
-
- return newString;
- }
-
- private void saveView(MonitorMessage message)
- {
- String header = "PrecipMonitorViewManager.saveView(): ";
- System.out.println(header +" Invoked"+ "...Source:" + message.getMessageSource() + " Type:" + message.getMessageType());
-
- File file = null;
- JFileChooser saveFileChooser = new JFileChooser();
- String settingsDir = _appsDefaults.getToken("whfs_report_dir", "/awips/hydroapps/whfs/local/data/report");
- saveFileChooser.setDialogTitle("Export Table To Text File");
- saveFileChooser.setCurrentDirectory(new File(settingsDir));
- saveFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
-
- int result = saveFileChooser.showSaveDialog(_mainFrame);
- if(result == JFileChooser.CANCEL_OPTION)
- file = null;
- else
- file = saveFileChooser.getSelectedFile();
-
- if(file != null)
- {
- saveTableToFile(file.toString());
- }
- }
-
- private void changeColumns(MonitorMessage message)
- {
- String header = "PrecipMonitorViewManager.changeColumns(): ";
- System.out.println(header +" Invoked"+ "...Source:" + message.getMessageSource() + " Type:" + message.getMessageType());
-
- _precipMonitorTableManager.invokeColumnSelector(_mainFrame);
-
- updateSettings();
- }
-
- private void updateSort(String[] columnNamesToSort,int[] columnSortNumber,boolean[] columnSortOrder)
- {
- _precipMonitorTableManager.setSortInfoNotBasedOnUserClicks(columnNamesToSort, columnSortOrder, columnSortNumber);
- updateSettings();
- }
-
- private void precipThreatSort(MonitorMessage message)
- {
- String header = "PrecipMonitorViewManager.precipThreatSort(): ";
- System.out.println(header +" Invoked"+ "...Source:" + message.getMessageSource() + " Type:" + message.getMessageType());
-
- clearSort();
-
- String columnNamesToSort[] = {PrecipColumns.PRECIP_THREAT};
- int columnSortNumber[] = {0};
- boolean columnSortOrder[] = {false};
-
- updateSort(columnNamesToSort, columnSortNumber, columnSortOrder);
- }
-
- private void appSort(MonitorMessage message)
- {
- String header = "PrecipMonitorViewManager.appSort(): ";
- System.out.println(header +" Invoked"+ "...Source:" + message.getMessageSource() + " Type:" + message.getMessageType());
-
- clearSort();
-
- String columnNamesToSort[] = {LocationInfoColumns.HSA, LocationInfoColumns.GROUP_ORDINAL,
- LocationInfoColumns.LOCATION_ORDINAL};
- int columnSortNumber[] = {0,1,2};
- boolean columnSortOrder[] = {true, true, true};
-
- updateSort(columnNamesToSort, columnSortNumber, columnSortOrder);
- }
-
- private void clearSort()
- {
- _precipMonitorTableManager.clearSort();
- }
-
- private void clearSort(MonitorMessage message)
- {
- String header = "PrecipMonitorViewManager.clearSort(): ";
- System.out.println(header +" Invoked"+ "...Source:" + message.getMessageSource() + " Type:" + message.getMessageType());
-
- clearSort();
- updateSettings();
- }
-
- private void rowSelected(PrecipMonitorJTableRowData selectedRowData)
- {
- String header = "PrecipMonitorViewManager.rowSelected(): ";
-
- System.out.print(header);
- send(this, MessageType.VIEW_SELECT_ITEM, selectedRowData);
- }
-
-// -------------------------------------------------------------------------------------
- public String getToolTipForSelectedCell(String columnName, int rowIndex)
- {
- PrecipMonitorJTableRowData rowData = (PrecipMonitorJTableRowData)_precipMonitorTableManager.getSelectedRowData(rowIndex);
- String toolTip = "";
- if(columnName.equals(PrecipColumns.PRECIP_THREAT))
- {
- toolTip = rowData.getToolTipTextForPrecipThreatSummary();
- }
- if(toolTip.length() <= 12) // tooltip has "" only
- {
- String name = rowData.getName();
- String state = rowData.getState();
- String county = rowData.getCounty();
- String hsa = rowData.getHsa();
-
- toolTip = "Name:["+ name+"]\n
"+
- "County: ["+county+"] State: ["+state+"] HSA: ["+hsa+"]\n
";
- }
- return toolTip;
- }
-
- private class ChangeColumnsReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- changeColumns(message);
- }
- }
-
- private class ClearSortReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- clearSort(message);
- }
- }
-
- private class PrecipThreatSortReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- precipThreatSort(message);
- }
- }
-
- private class AppSortReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- appSort(message);
- }
- }
-
- private class SelectViewItemReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- selectViewItem(message);
- }
- }
-
- private class RefreshDisplayReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- refreshDisplay(message);
- }
- }
-
- private class UpdateDisplayWithSettingsReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- createTableAndApplySettings(message);
- }
- }
-
- private class UpdateSettingsReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- updateSettings(message);
- }
- }
-
- private class SaveViewReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- saveView(message);
- }
- }
-
- private class TableListSelectionListener implements ListSelectionListener
- {
- public void valueChanged(ListSelectionEvent e)
- {
- if(e.getValueIsAdjusting() == false)
- {
- List selectedRowData = _precipMonitorTableManager.getSelectedRowsData();
- for(int i=0; i < selectedRowData.size(); i++)
- {
- if(i == 0)
- {
- PrecipMonitorJTableRowData rowData = (PrecipMonitorJTableRowData) selectedRowData.get(i);
- _selectedRowData = rowData;
- rowSelected(_selectedRowData);
- }
- }
- }
- }
- }
-
- private class TableMouseListener implements MouseListener
- {
- public void mouseClicked(MouseEvent e)
- {
- //String header = "PrecipMonitorViewManager.TableMouseListener.mouseClicked(): ";
- Point p = new Point(e.getX(), e.getY());
- int rowIndex = _precipMonitorTableManager.getMousePointedRowIndex(p);
- PrecipMonitorJTableRowData rowData = (PrecipMonitorJTableRowData) _precipMonitorTableManager.getSelectedRowData(rowIndex);
-
- if(e.getClickCount() == 2)
- {
- //System.out.println(header + " starting TSL for " + rowData.getLid());
- _selectedRowData = rowData;
- rowSelected(_selectedRowData);
- _monitorTimeSeriesLiteManager.displayTimeSeriesLite(_mainFrame, _selectedRowData, 1);
- }
- }
- public void mousePressed(MouseEvent e){}
- public void mouseReleased(MouseEvent e){}
- public void mouseEntered(MouseEvent e){}
- public void mouseExited(MouseEvent e){}
- }
-
-// -------------------------------------------------------------------------------------
- class TableMouseMotionListener implements MouseMotionListener
- {
- public void mouseDragged(MouseEvent e)
- {
- }
- public void mouseMoved(MouseEvent e)
- {
- Point p = new Point(e.getX(), e.getY());
- int rowIndex = _precipMonitorTableManager.getMousePointedRowIndex(p);
- int colIndex = _precipMonitorTableManager.getMousePointedColumnIndex(p);
- String columnName = _precipMonitorTableManager.getColumnNameAtIndex(colIndex);
- String toolTip="";
- if(rowIndex != -1)
- {
- toolTip = getToolTipForSelectedCell(columnName, rowIndex);
- _precipMonitorTableManager.setRowToolTipText(toolTip);
- }
- }
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/settings/PrecipColumnDataSettings.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/settings/PrecipColumnDataSettings.java
deleted file mode 100755
index acd05c37f2..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/settings/PrecipColumnDataSettings.java
+++ /dev/null
@@ -1,355 +0,0 @@
-package ohd.hseb.monitor.precip.settings;
-
-public class PrecipColumnDataSettings
-{
- private double _precipAlert1Hr ;
- private double _precipAlert3Hr ;
- private double _precipAlert6Hr ;
-
- private double _precipCaution1Hr ;
- private double _precipCaution3Hr ;
- private double _precipCaution6Hr ;
-
- private int _ratioAlert1Hr ;
- private int _ratioAlert3Hr ;
- private int _ratioAlert6Hr ;
-
- private int _ratioCaution1Hr ;
- private int _ratioCaution3Hr ;
- private int _ratioCaution6Hr ;
-
- private double _diffAlert1Hr ;
- private double _diffAlert3Hr ;
- private double _diffAlert6Hr ;
-
- private double _diffCaution1Hr ;
- private double _diffCaution3Hr ;
- private double _diffCaution6Hr ;
-
- public static final String PRECIP_SETTINGS_BEGIN_TAG = "#Precip Settings Begin";
- public static final String PRECIP_SETTINGS_END_TAG = "#Precip Settings End";
- public static final String PRECIP_ALERT_TAG = "Precip Alert 1Hr | 3Hr | 6Hr";
- public static final String PRECIP_CAUTION_TAG = "Precip Caution 1Hr | 3Hr | 6Hr";
- public static final String RATIO_ALERT_TAG = "Ratio Alert 1Hr | 3Hr | 6Hr";
- public static final String RATIO_CAUTION_TAG = "Ratio Caution 1Hr | 3Hr | 6Hr";
- public static final String DIFF_ALERT_TAG = "Diff Alert 1Hr | 3Hr | 6Hr";
- public static final String DIFF_CAUTION_TAG = "Diff Caution 1Hr | 3Hr | 6Hr";
-
- public static double DEFAULT_PRECIP_THRESHOLD_6HR = 1;
- public static double DEFAULT_PRECIP_THRESHOLD_3HR = 1.25;
- public static double DEFAULT_PRECIP_THRESHOLD_1HR = 1.15;
-
- public static double DEFAULT_PRECIP_MIN_THRESHOLD_6HR = 0;
- public static double DEFAULT_PRECIP_MIN_THRESHOLD_3HR = 0;
- public static double DEFAULT_PRECIP_MIN_THRESHOLD_1HR = 0;
-
- public static double DEFAULT_PRECIP_MAX_THRESHOLD_6HR = 5;
- public static double DEFAULT_PRECIP_MAX_THRESHOLD_3HR = 5;
- public static double DEFAULT_PRECIP_MAX_THRESHOLD_1HR = 5;
-
- public static double DEFAULT_DIFF_THRESHOLD_6HR = -0.25;
- public static double DEFAULT_DIFF_THRESHOLD_3HR = -0.3;
- public static double DEFAULT_DIFF_THRESHOLD_1HR = -0.35;
-
- public static double DEFAULT_DIFF_MIN_THRESHOLD_6HR = -5;
- public static double DEFAULT_DIFF_MIN_THRESHOLD_3HR = -5;
- public static double DEFAULT_DIFF_MIN_THRESHOLD_1HR = -5;
-
- public static double DEFAULT_DIFF_MAX_THRESHOLD_6HR = 5;
- public static double DEFAULT_DIFF_MAX_THRESHOLD_3HR = 5;
- public static double DEFAULT_DIFF_MAX_THRESHOLD_1HR = 5;
-
- public static int DEFAULT_RATIO_THRESHOLD_6HR = 90;
- public static int DEFAULT_RATIO_THRESHOLD_3HR = 90;
- public static int DEFAULT_RATIO_THRESHOLD_1HR = 90;
-
- public static int DEFAULT_RATIO_MIN_THRESHOLD_6HR = 0;
- public static int DEFAULT_RATIO_MIN_THRESHOLD_3HR = 0;
- public static int DEFAULT_RATIO_MIN_THRESHOLD_1HR = 0;
-
- public static int DEFAULT_RATIO_MAX_THRESHOLD_6HR = 400;
- public static int DEFAULT_RATIO_MAX_THRESHOLD_3HR = 400;
- public static int DEFAULT_RATIO_MAX_THRESHOLD_1HR = 400;
-
- public PrecipColumnDataSettings()
- {
- resetSettings();
- }
-
- public PrecipColumnDataSettings(double precipAlert1Hr, double precipAlert3Hr, double precipAlert6Hr,
- double precipCaution1Hr, double precipCaution3Hr, double precipCaution6Hr,
- int ratioAlert1Hr, int ratioAlert3Hr ,int ratioAlert6Hr,
- int ratioCaution1Hr, int ratioCaution3Hr, int ratioCaution6Hr,
- double diffAlert1Hr, double diffAlert3Hr, double diffAlert6Hr,
- double diffCaution1Hr ,double diffCaution3Hr, double diffCaution6Hr)
- {
- _precipAlert1Hr = precipAlert1Hr;
- _precipAlert3Hr = precipAlert3Hr;
- _precipAlert6Hr = precipAlert6Hr;
-
- _precipCaution1Hr = precipCaution1Hr;
- _precipCaution3Hr = precipCaution3Hr;
- _precipCaution6Hr = precipCaution6Hr;
-
- _ratioAlert1Hr = ratioAlert1Hr;
- _ratioAlert3Hr = ratioAlert3Hr;
- _ratioAlert6Hr = ratioAlert6Hr;
-
- _ratioCaution1Hr = ratioCaution1Hr;
- _ratioCaution3Hr = ratioCaution3Hr;
- _ratioCaution6Hr = ratioCaution6Hr;
-
- _diffAlert1Hr = diffAlert1Hr;
- _diffAlert3Hr = diffAlert3Hr;
- _diffAlert6Hr = diffAlert6Hr;
-
- _diffCaution1Hr = diffCaution1Hr;
- _diffCaution3Hr = diffCaution3Hr;
- _diffCaution6Hr = diffCaution6Hr;
-
- }
-
- public void setPrecipSettings(double precipAlert1Hr, double precipAlert3Hr, double precipAlert6Hr,
- double precipCaution1Hr, double precipCaution3Hr, double precipCaution6Hr,
- int ratioAlert1Hr, int ratioAlert3Hr ,int ratioAlert6Hr,
- int ratioCaution1Hr, int ratioCaution3Hr, int ratioCaution6Hr,
- double diffAlert1Hr, double diffAlert3Hr, double diffAlert6Hr,
- double diffCaution1Hr ,double diffCaution3Hr, double diffCaution6Hr)
- {
- _precipAlert1Hr = precipAlert1Hr;
- _precipAlert3Hr = precipAlert3Hr;
- _precipAlert6Hr = precipAlert6Hr;
-
- _precipCaution1Hr = precipCaution1Hr;
- _precipCaution3Hr = precipCaution3Hr;
- _precipCaution6Hr = precipCaution6Hr;
-
- _ratioAlert1Hr = ratioAlert1Hr;
- _ratioAlert3Hr = ratioAlert3Hr;
- _ratioAlert6Hr = ratioAlert6Hr;
-
- _ratioCaution1Hr = ratioCaution1Hr;
- _ratioCaution3Hr = ratioCaution3Hr;
- _ratioCaution6Hr = ratioCaution6Hr;
-
- _diffAlert1Hr = diffAlert1Hr;
- _diffAlert3Hr = diffAlert3Hr;
- _diffAlert6Hr = diffAlert6Hr;
-
- _diffCaution1Hr = diffCaution1Hr;
- _diffCaution3Hr = diffCaution3Hr;
- _diffCaution6Hr = diffCaution6Hr;
-
- }
-
- public void setPrecipSettings(PrecipColumnDataSettings precipSettings)
- {
- setPrecipSettings(precipSettings.getPrecipAlert1Hr(), precipSettings.getPrecipAlert3Hr(), precipSettings.getPrecipAlert6Hr(),
- precipSettings.getPrecipCaution1Hr(), precipSettings.getPrecipCaution3Hr(), precipSettings.getPrecipCaution6Hr(),
- precipSettings.getRatioAlert1Hr(), precipSettings.getRatioAlert3Hr (),precipSettings.getRatioAlert6Hr(),
- precipSettings.getRatioCaution1Hr(), precipSettings.getRatioCaution3Hr(), precipSettings.getRatioCaution6Hr(),
- precipSettings.getDiffAlert1Hr(), precipSettings.getDiffAlert3Hr(), precipSettings.getDiffAlert6Hr(),
- precipSettings.getDiffCaution1Hr (),precipSettings.getDiffCaution3Hr(), precipSettings.getDiffCaution6Hr());
- }
-
- public void resetSettings()
- {
- _precipAlert1Hr = DEFAULT_PRECIP_THRESHOLD_1HR;
- _precipAlert3Hr = DEFAULT_PRECIP_THRESHOLD_3HR;
- _precipAlert6Hr = DEFAULT_PRECIP_THRESHOLD_6HR;
-
- _precipCaution1Hr = DEFAULT_PRECIP_THRESHOLD_1HR;
- _precipCaution3Hr = DEFAULT_PRECIP_THRESHOLD_3HR;
- _precipCaution6Hr = DEFAULT_PRECIP_THRESHOLD_6HR;
-
- _ratioAlert1Hr = DEFAULT_RATIO_THRESHOLD_1HR;
- _ratioAlert3Hr = DEFAULT_RATIO_THRESHOLD_3HR;
- _ratioAlert6Hr = DEFAULT_RATIO_THRESHOLD_6HR;
-
- _ratioCaution1Hr = DEFAULT_RATIO_THRESHOLD_1HR;
- _ratioCaution3Hr = DEFAULT_RATIO_THRESHOLD_3HR;
- _ratioCaution6Hr = DEFAULT_RATIO_THRESHOLD_6HR;
-
- _diffAlert1Hr = DEFAULT_DIFF_THRESHOLD_1HR;
- _diffAlert3Hr = DEFAULT_DIFF_THRESHOLD_3HR;
- _diffAlert6Hr = DEFAULT_DIFF_THRESHOLD_6HR;
-
- _diffCaution1Hr = DEFAULT_DIFF_THRESHOLD_1HR;
- _diffCaution3Hr = DEFAULT_DIFF_THRESHOLD_3HR;
- _diffCaution6Hr = DEFAULT_DIFF_THRESHOLD_6HR;
- }
-
- public double getDiffAlert1Hr()
- {
- return _diffAlert1Hr;
- }
- public void setDiffAlert1Hr(double diffAlert1Hr)
- {
- _diffAlert1Hr = diffAlert1Hr;
- }
- public double getDiffAlert3Hr()
- {
- return _diffAlert3Hr;
- }
- public void setDiffAlert3Hr(double diffAlert3Hr)
- {
- _diffAlert3Hr = diffAlert3Hr;
- }
- public double getDiffAlert6Hr()
- {
- return _diffAlert6Hr;
- }
- public void setDiffAlert6Hr(double diffAlert6Hr)
- {
- _diffAlert6Hr = diffAlert6Hr;
- }
- public double getDiffCaution1Hr()
- {
- return _diffCaution1Hr;
- }
- public void setDiffCaution1Hr(double diffCaution1Hr)
- {
- _diffCaution1Hr = diffCaution1Hr;
- }
- public double getDiffCaution3Hr()
- {
- return _diffCaution3Hr;
- }
- public void setDiffCaution3Hr(double diffCaution3Hr)
- {
- _diffCaution3Hr = diffCaution3Hr;
- }
- public double getDiffCaution6Hr()
- {
- return _diffCaution6Hr;
- }
- public void setDiffCaution6Hr(double diffCaution6Hr)
- {
- _diffCaution6Hr = diffCaution6Hr;
- }
- public double getPrecipAlert1Hr()
- {
- return _precipAlert1Hr;
- }
- public void setPrecipAlert1Hr(double precipAlert1Hr)
- {
- _precipAlert1Hr = precipAlert1Hr;
- }
- public double getPrecipAlert3Hr()
- {
- return _precipAlert3Hr;
- }
- public void setPrecipAlert3Hr(double precipAlert3Hr)
- {
- _precipAlert3Hr = precipAlert3Hr;
- }
- public double getPrecipAlert6Hr()
- {
- return _precipAlert6Hr;
- }
- public void setPrecipAlert6Hr(double precipAlert6Hr)
- {
- _precipAlert6Hr = precipAlert6Hr;
- }
- public double getPrecipCaution1Hr()
- {
- return _precipCaution1Hr;
- }
- public void setPrecipCaution1Hr(double precipCaution1Hr)
- {
- _precipCaution1Hr = precipCaution1Hr;
- }
- public double getPrecipCaution3Hr()
- {
- return _precipCaution3Hr;
- }
- public void setPrecipCaution3Hr(double precipCaution3Hr)
- {
- _precipCaution3Hr = precipCaution3Hr;
- }
- public double getPrecipCaution6Hr()
- {
- return _precipCaution6Hr;
- }
- public void setPrecipCaution6Hr(double precipCaution6Hr)
- {
- _precipCaution6Hr = precipCaution6Hr;
- }
- public int getRatioAlert1Hr()
- {
- return _ratioAlert1Hr;
- }
- public void setRatioAlert1Hr(int ratioAlert1Hr)
- {
- _ratioAlert1Hr = ratioAlert1Hr;
- }
- public int getRatioAlert3Hr()
- {
- return _ratioAlert3Hr;
- }
- public void setRatioAlert3Hr(int ratioAlert3Hr)
- {
- _ratioAlert3Hr = ratioAlert3Hr;
- }
- public int getRatioAlert6Hr()
- {
- return _ratioAlert6Hr;
- }
- public void setRatioAlert6Hr(int ratioAlert6Hr)
- {
- _ratioAlert6Hr = ratioAlert6Hr;
- }
- public int getRatioCaution1Hr()
- {
- return _ratioCaution1Hr;
- }
- public void setRatioCaution1Hr(int ratioCaution1Hr)
- {
- _ratioCaution1Hr = ratioCaution1Hr;
- }
- public int getRatioCaution3Hr()
- {
- return _ratioCaution3Hr;
- }
- public void setRatioCaution3Hr(int ratioCaution3Hr)
- {
- _ratioCaution3Hr = ratioCaution3Hr;
- }
- public int getRatioCaution6Hr()
- {
- return _ratioCaution6Hr;
- }
- public void setRatioCaution6Hr(int ratioCaution6Hr)
- {
- _ratioCaution6Hr = ratioCaution6Hr;
- }
-
- public PrecipColumnDataSettings getMenuSettings()
- {
- return this;
- }
-
- public String toString()
- {
- String result = _precipAlert1Hr + "|" +
- _precipAlert3Hr + "|" +
- _precipAlert6Hr + "|" +
- _precipCaution1Hr + "|" +
- _precipCaution3Hr + "|" +
- _precipCaution6Hr + "|" +
- _ratioAlert1Hr + "|" +
- _ratioAlert3Hr + "|" +
- _ratioAlert6Hr + "|" +
- _ratioCaution1Hr + "|" +
- _ratioCaution3Hr + "|" +
- _ratioCaution6Hr + "|" +
- _diffAlert1Hr + "|" +
- _diffAlert3Hr + "|" +
- _diffAlert6Hr + "|" +
- _diffCaution1Hr + "|" +
- _diffCaution3Hr + "|" +
- _diffCaution6Hr ;
-
- return result;
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/settings/PrecipMonitorMenuSettings.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/settings/PrecipMonitorMenuSettings.java
deleted file mode 100755
index 859ac66164..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/settings/PrecipMonitorMenuSettings.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package ohd.hseb.monitor.precip.settings;
-
-import ohd.hseb.util.BooleanHolder;
-
-public class PrecipMonitorMenuSettings
-{
- private int _refreshInterval;
-
- public static final String REFRESH_INTERVAL_TAG = "RefreshInterval";
-
- public static final String SHOW_MISSING_PRECIP_TAG = "ShowMissingPrecip";
-
- public static int DEFAULT_REFRESH_INTERVAL = 15;
-
- private BooleanHolder _showMissingPrecipBooleanHolder = new BooleanHolder(true);
-
- private PrecipColumnDataSettings _precipSettings;
-
- public PrecipMonitorMenuSettings()
- {
- _refreshInterval = DEFAULT_REFRESH_INTERVAL;
- setShowMissingPrecip(false);
- _precipSettings = new PrecipColumnDataSettings();
- }
-
- public void resetSettings()
- {
- _refreshInterval = DEFAULT_REFRESH_INTERVAL;
- setShowMissingPrecip(false);
- _precipSettings.resetSettings();
- }
-
- public PrecipMonitorMenuSettings(int refreshInterval, boolean showMissingPrecip)
- {
- _refreshInterval = refreshInterval;
- setShowMissingPrecip(showMissingPrecip);
- _precipSettings = new PrecipColumnDataSettings();
- }
-
- public void setPrecipSettings(PrecipColumnDataSettings precipSettings)
- {
- _precipSettings = precipSettings;
- }
-
- public PrecipColumnDataSettings getPrecipSettings()
- {
- return _precipSettings;
- }
-
- public boolean shouldShowMissingPrecip()
- {
- return _showMissingPrecipBooleanHolder.getValue();
- }
-
- public void setShowMissingPrecip(boolean showMissingPrecip)
- {
- _showMissingPrecipBooleanHolder.setValue(showMissingPrecip);
- }
-
- public void setRefreshInterval(int refreshInterval)
- {
- _refreshInterval = refreshInterval;
- }
-
- public int getRefreshInterval()
- {
- return _refreshInterval;
- }
-
- private void setShowMissingPrecipBooleanHolder(BooleanHolder showMissingPrecipBooleanHolder)
- {
- _showMissingPrecipBooleanHolder = showMissingPrecipBooleanHolder;
- }
-
- public BooleanHolder getShowMissingPrecipBooleanHolder()
- {
- return _showMissingPrecipBooleanHolder;
- }
-
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/settings/PrecipMonitorSettingsFileManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/settings/PrecipMonitorSettingsFileManager.java
deleted file mode 100755
index a51f2a1d89..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/precip/settings/PrecipMonitorSettingsFileManager.java
+++ /dev/null
@@ -1,241 +0,0 @@
-package ohd.hseb.monitor.precip.settings;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-
-import ohd.hseb.monitor.settings.FilterSettings;
-import ohd.hseb.monitor.settings.MonitorSettingsFileManager;
-import ohd.hseb.monitor.settings.ViewSettings;
-import ohd.hseb.util.SessionLogger;
-
-public class PrecipMonitorSettingsFileManager extends MonitorSettingsFileManager
-{
- private PrecipMonitorMenuSettings _menuSettings;
-
- public PrecipMonitorSettingsFileManager(SessionLogger logger, ViewSettings viewSettings,
- FilterSettings filterSettings, PrecipMonitorMenuSettings menuSettings)
- {
- super(logger, "#PrecipMonitorSettings File", viewSettings, filterSettings);
- _menuSettings = menuSettings;
- _logger = logger;
- createDisplayTokenSet();
- createMenuTokenSet();
- }
-
- public Set createMenuTokenSet()
- {
- _menuTokenSet = new HashSet();
-
- _menuTokenSet.add(PrecipColumnDataSettings.DIFF_ALERT_TAG);
- _menuTokenSet.add(PrecipColumnDataSettings.DIFF_CAUTION_TAG);
- _menuTokenSet.add(PrecipColumnDataSettings.PRECIP_ALERT_TAG);
- _menuTokenSet.add(PrecipColumnDataSettings.PRECIP_CAUTION_TAG);
- _menuTokenSet.add(PrecipColumnDataSettings.RATIO_ALERT_TAG);
- _menuTokenSet.add(PrecipColumnDataSettings.RATIO_CAUTION_TAG);
- _menuTokenSet.add(PrecipMonitorMenuSettings.REFRESH_INTERVAL_TAG);
- _menuTokenSet.add(PrecipMonitorMenuSettings.SHOW_MISSING_PRECIP_TAG);
-
- return _displayTokenSet;
- }
-
- public boolean setSettingsFromFile(File fileHandler)
- {
- String header = "PrecipMonitorSettingsFileManager.setSettingsFromFile(): ";
- boolean isReadCompleted = true;
-
- resetSettings();
-
- if(isValidSettingsFile(_logger, fileHandler, _settingsFileBeginTag ))
- {
- BufferedReader in = null;
- String line;
- try
- {
- in = new BufferedReader(new FileReader(fileHandler));
-
- while(( line = in.readLine()) != null)
- {
- line = line.trim();
- processLine(line);
- }
-
- }
- catch(IOException e)
- {
- printFileException(_logger, e,header);
- isReadCompleted = false ;
- }
- }
- else
- {
- isReadCompleted = false;
- }
-
- setViewAndFilterSettings();
- return isReadCompleted;
- }
-
- private void resetSettings()
- {
- _tableDisplaySettingsList = null;
- _expandPathTokenValuesList = null;
- _pathTokenValuesList = null;
-
- setViewAndFilterSettings();
- _menuSettings.resetSettings();
- }
-
-
- public void saveSettingsToFile(File fileHandler)
- {
- createSettingsFile(fileHandler);
-
- BufferedWriter out = null;
- String header = "PrecipMonitorSettingsFileManager.saveSettingsToFile(): ";
- try
- {
- out = new BufferedWriter(new FileWriter(fileHandler));
- }
- catch(IOException exception)
- {
- _logger.log(header+"ERROR = " + exception.getMessage());
- exception.printStackTrace(_logger.getPrintWriter());
- }
-
- saveDisplaySettings(out);
-
- saveMenuSettingsToFile(out);
- }
-
- public void processMenuToken(String tokenName, String tokenValue)
- {
- if(tokenName.compareTo(PrecipMonitorMenuSettings.REFRESH_INTERVAL_TAG) == 0)
- {
- _menuSettings.setRefreshInterval(new Integer(tokenValue));
- System.out.println("Setting in menu refresh interval:" + tokenValue);
- }
- if(tokenName.compareTo(PrecipMonitorMenuSettings.SHOW_MISSING_PRECIP_TAG) == 0)
- {
- _menuSettings.setShowMissingPrecip(new Boolean(tokenValue));
- System.out.println("Setting Show Missing Precip Flag:" + tokenValue);
- }
- else
- {
- String spiltStr[] = tokenValue.split("\\|");
- String hr1, hr3, hr6;
-
- if(spiltStr != null)
- {
- if(spiltStr.length == 3) // we have 3 values 1hr | 3hr | 6hr correctly
- {
- hr1 = null; hr3 = null; hr6 = null;
-
- hr1 = spiltStr[0].trim();
- hr3 = spiltStr[1].trim();
- hr6 = spiltStr[2].trim();
-
- if(tokenName.compareTo(PrecipColumnDataSettings.PRECIP_ALERT_TAG) == 0)
- {
- _menuSettings.getPrecipSettings().setPrecipAlert1Hr(new Double(hr1));
- _menuSettings.getPrecipSettings().setPrecipAlert3Hr(new Double(hr3));
- _menuSettings.getPrecipSettings().setPrecipAlert6Hr(new Double(hr6));
- }
- else if(tokenName.compareTo(PrecipColumnDataSettings.PRECIP_CAUTION_TAG) == 0)
- {
- _menuSettings.getPrecipSettings().setPrecipCaution1Hr(new Double(hr1));
- _menuSettings.getPrecipSettings().setPrecipCaution3Hr(new Double(hr3));
- _menuSettings.getPrecipSettings().setPrecipCaution6Hr(new Double(hr6));
- }
- else if(tokenName.compareTo(PrecipColumnDataSettings.RATIO_ALERT_TAG) == 0)
- {
- _menuSettings.getPrecipSettings().setRatioAlert1Hr(new Integer(hr1));
- _menuSettings.getPrecipSettings().setRatioAlert3Hr(new Integer(hr3));
- _menuSettings.getPrecipSettings().setRatioAlert6Hr(new Integer(hr6));
- }
- else if(tokenName.compareTo(PrecipColumnDataSettings.RATIO_CAUTION_TAG) == 0)
- {
- _menuSettings.getPrecipSettings().setRatioCaution1Hr(new Integer(hr1));
- _menuSettings.getPrecipSettings().setRatioCaution3Hr(new Integer(hr3));
- _menuSettings.getPrecipSettings().setRatioCaution6Hr(new Integer(hr6));
- }
- else if(tokenName.compareTo(PrecipColumnDataSettings.DIFF_ALERT_TAG) == 0)
- {
- _menuSettings.getPrecipSettings().setDiffAlert1Hr(new Double(hr1));
- _menuSettings.getPrecipSettings().setDiffAlert3Hr(new Double(hr3));
- _menuSettings.getPrecipSettings().setDiffAlert6Hr(new Double(hr6));
- }
- else if(tokenName.compareTo(PrecipColumnDataSettings.DIFF_CAUTION_TAG) == 0)
- {
- _menuSettings.getPrecipSettings().setDiffCaution1Hr(new Double(hr1));
- _menuSettings.getPrecipSettings().setDiffCaution3Hr(new Double(hr3));
- _menuSettings.getPrecipSettings().setDiffCaution6Hr(new Double(hr6));
- }
- }
- }
- }
- }
-
- public void saveMenuSettingsToFile(BufferedWriter writer)
- {
- String header = "PrecipMonitorSettingsFileManager.saveMenuSettingsToFile(): ";
- try
- {
- if(_menuSettings != null)
- {
- writer.newLine();
- writer.write(PrecipMonitorMenuSettings.REFRESH_INTERVAL_TAG + " : " + _menuSettings.getRefreshInterval());
- writer.newLine();
-
- writer.newLine();
- writer.write(PrecipMonitorMenuSettings.SHOW_MISSING_PRECIP_TAG + " : " + _menuSettings.shouldShowMissingPrecip());
- writer.newLine();
-
- writer.newLine();
- writer.write(PrecipColumnDataSettings.PRECIP_SETTINGS_BEGIN_TAG);
- writer.newLine();
- writer.write(PrecipColumnDataSettings.PRECIP_ALERT_TAG + " : " + _menuSettings.getPrecipSettings().getPrecipAlert1Hr() +" | " +
- _menuSettings.getPrecipSettings().getPrecipAlert3Hr() +" | " +
- _menuSettings.getPrecipSettings().getPrecipAlert6Hr() );
- writer.newLine();
- writer.write(PrecipColumnDataSettings.RATIO_ALERT_TAG + " : " + _menuSettings.getPrecipSettings().getRatioAlert1Hr() +" | " +
- _menuSettings.getPrecipSettings().getRatioAlert3Hr() +" | " +
- _menuSettings.getPrecipSettings().getRatioAlert6Hr() );
- writer.newLine();
- writer.write(PrecipColumnDataSettings.DIFF_ALERT_TAG + " : " + _menuSettings.getPrecipSettings().getDiffAlert1Hr() +" | " +
- _menuSettings.getPrecipSettings().getDiffAlert3Hr() +" | " +
- _menuSettings.getPrecipSettings().getDiffAlert6Hr() );
- writer.newLine();
-
- writer.write(PrecipColumnDataSettings.PRECIP_CAUTION_TAG + " : " + _menuSettings.getPrecipSettings().getPrecipCaution1Hr() +" | " +
- _menuSettings.getPrecipSettings().getPrecipCaution3Hr() +" | " +
- _menuSettings.getPrecipSettings().getPrecipCaution6Hr() );
- writer.newLine();
- writer.write(PrecipColumnDataSettings.RATIO_CAUTION_TAG + " : " + _menuSettings.getPrecipSettings().getRatioCaution1Hr() +" | " +
- _menuSettings.getPrecipSettings().getRatioCaution3Hr() +" | " +
- _menuSettings.getPrecipSettings().getRatioCaution6Hr() );
- writer.newLine();
- writer.write(PrecipColumnDataSettings.DIFF_CAUTION_TAG + " : " + _menuSettings.getPrecipSettings().getDiffCaution1Hr() +" | " +
- _menuSettings.getPrecipSettings().getDiffCaution3Hr() +" | " +
- _menuSettings.getPrecipSettings().getDiffCaution6Hr() );
- writer.newLine();
- writer.write(PrecipColumnDataSettings.PRECIP_SETTINGS_END_TAG);
-
- writer.close();
- }
- }
- catch(IOException exception)
- {
- printFileException(_logger, exception,header);
- }
-
- }
-
-
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/LookBackTimeDialog.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/LookBackTimeDialog.java
deleted file mode 100755
index 45f8ac64a8..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/LookBackTimeDialog.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package ohd.hseb.monitor.river;
-
-import java.awt.Dimension;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JSpinner;
-import javax.swing.SpinnerModel;
-import javax.swing.SpinnerNumberModel;
-
-import ohd.hseb.monitor.MonitorFrame;
-import ohd.hseb.monitor.river.settings.RiverColumnDataSettings;
-import ohd.hseb.util.gui.WindowResizingManager;
-
-public class LookBackTimeDialog extends JDialog
-{
- private JSpinner _timeSpinBox;
- private JLabel _validTimeLabel;
- private JButton _closeButton;
- private String _settingsTokenName;
- private RiverColumnDataSettings _riverSettings;
-
- public LookBackTimeDialog( MonitorFrame mainFrame, RiverColumnDataSettings riverSettings,
- String dialogTitle,
- JLabel label,
- String settingsTokenName,
- int maxNumOfHrs,
- int minNumOfHrs)
- {
- super(mainFrame, true);
- _settingsTokenName = settingsTokenName;
- _riverSettings = riverSettings;
- this.setTitle(dialogTitle);
- createDialogComponents(label, maxNumOfHrs, minNumOfHrs);
- this.pack();
- this.setVisible(true);
- }
-
- public void createDialogComponents(JLabel label, int maxNumOfHrs, int minNumOfHrs)
- {
- _validTimeLabel = label;
- int incrNumOfHrs = 1;
- int initialNumOfHrs = 1;
-
- if(_settingsTokenName.equals(RiverColumnDataSettings.VALID_TIME_TAG))
- initialNumOfHrs = _riverSettings.getAlertAlarmLookBack();
- else if(_settingsTokenName.equals(RiverColumnDataSettings.VTEC_EVENT_PRODUCT_TIME_TAG))
- initialNumOfHrs = _riverSettings.getVtecEventProductTimeLookBack();
- else if(_settingsTokenName.equals(RiverColumnDataSettings.VTEC_EVENT_END_TIME_TAG))
- initialNumOfHrs = _riverSettings.getVtecEventEndTimeApproach();
- else if(_settingsTokenName.equals(RiverColumnDataSettings.UGC_EXPIRE_TIME_TAG))
- initialNumOfHrs = _riverSettings.getUgcExpireTimeApproach();
- else if(_settingsTokenName.equals(RiverColumnDataSettings.LATEST_FCST_BASIS_TIME_TAG))
- initialNumOfHrs = _riverSettings.getLatestFcstBasisTimeLookBack();
- else // LatestObs_Time
- initialNumOfHrs = _riverSettings.getLatestObsLookBack();
-
- SpinnerModel spinnerModel = new SpinnerNumberModel(initialNumOfHrs,
- minNumOfHrs,
- maxNumOfHrs,
- incrNumOfHrs);
-
- _timeSpinBox = new JSpinner(spinnerModel);
- JPanel spinnerPanel = new JPanel();
- spinnerPanel.setLayout(new GridLayout(3,1));
- spinnerPanel.add(createDummyPanel());
- spinnerPanel.add(_timeSpinBox);
- spinnerPanel.add(createDummyPanel());
-
- JPanel infoPanel = new JPanel();
- infoPanel.setLayout(new GridLayout(1,3));
- infoPanel.add(_validTimeLabel);
- infoPanel.add(spinnerPanel);
- infoPanel.add(createDummyPanel());
-
- _closeButton = new JButton("Close");
- JPanel closePanel = new JPanel();
- closePanel.setLayout(new GridLayout(3,1));
- closePanel.add(createDummyPanel());
- closePanel.add(_closeButton);
- closePanel.add(createDummyPanel());
-
- JPanel actionPanel = new JPanel();
- actionPanel.setLayout(new GridLayout(1,3));
- actionPanel.add(createDummyPanel());
- actionPanel.add(closePanel);
- actionPanel.add(createDummyPanel());
-
- JPanel panel = new JPanel();
- panel.setLayout(new GridLayout(2,1));
- panel.add(infoPanel);
- panel.add(actionPanel);
-
- this.setLocation(25, 25);
- Dimension dim = new Dimension(300,200);
- new WindowResizingManager(this, dim, dim);
- this.getContentPane().add(panel);
-
- CloseButtonListener closeButtonListener = new CloseButtonListener();
- _closeButton.addActionListener(closeButtonListener);
-
- DialogListener dialogListener = new DialogListener();
- this.addWindowListener(dialogListener);
- }
-
- private JPanel createDummyPanel()
- {
- JPanel dummyPanel = new JPanel();
- return dummyPanel;
- }
-
- private void closeTimeDialog()
- {
- this.setVisible(false);
-
- if(_settingsTokenName.equals(RiverColumnDataSettings.VALID_TIME_TAG))
- _riverSettings.setAlertAlarmLookBack(Integer.parseInt(_timeSpinBox.getValue().toString()));
- else if(_settingsTokenName.equals(RiverColumnDataSettings.VTEC_EVENT_PRODUCT_TIME_TAG))
- _riverSettings.setVtecEventProductTimeLookBack(Integer.parseInt(_timeSpinBox.getValue().toString()));
- else if(_settingsTokenName.equals(RiverColumnDataSettings.VTEC_EVENT_END_TIME_TAG))
- _riverSettings.setVtecEventEndTimeApproach(Integer.parseInt(_timeSpinBox.getValue().toString()));
- else if(_settingsTokenName.equals(RiverColumnDataSettings.UGC_EXPIRE_TIME_TAG))
- _riverSettings.setUgcExpireTimeApproach(Integer.parseInt(_timeSpinBox.getValue().toString()));
- else if(_settingsTokenName.equals(RiverColumnDataSettings.LATEST_FCST_BASIS_TIME_TAG))
- _riverSettings.setLatestFcstBasisTimeLookBack(Integer.parseInt(_timeSpinBox.getValue().toString()));
- else // LatestObs_Time
- _riverSettings.setLatestObsLookBack(Integer.parseInt(_timeSpinBox.getValue().toString()));
- }
-
- class CloseButtonListener implements ActionListener
- {
- public void actionPerformed(ActionEvent e)
- {
- closeTimeDialog();
- }
- }
-
- class DialogListener extends WindowAdapter
- {
- public void windowClosing(WindowEvent e)
- {
- closeTimeDialog();
- }
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverColumns.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverColumns.java
deleted file mode 100755
index 28f9721f11..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverColumns.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package ohd.hseb.monitor.river;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import ohd.hseb.monitor.LocationInfoColumns;
-import ohd.hseb.monitor.precip.PrecipColumns;
-import ohd.hseb.util.gui.jtable.JTableColumnDescriptor;
-
-public class RiverColumns
-{
- public static final String GROUP_ID = "Group Id";
- public static final String GROUP_NAME = "Group Name";
- public static final String LOCATION_ID = "Location Id";
- public static final String LOCATION_NAME = "Location Name";
- public static final String HSA = "HSA";
- public static final String GROUP_ORDINAL = "Group Ordinal";
- public static final String LOCATION_ORDINAL = "Location Ordinal";
- public static final String COUNTY = "County";
- public static final String STATE = "State";
- public static final String STREAM = "Stream";
- public static final String RIVER_BASIN = "River Basin";
- public static final String BANK_FULL = "Bank Full";
-
- public static final String PRIMARY_RIVER_PE = "Primary River PE";
-
- public static final String FLD_STG = "Flood Stage";
- public static final String ACT_STG = "Action Stage";
- public static final String FLD_FLOW = "Flood Flow";
- public static final String ACT_FLOW = "Action Flow";
- public static final String MIN_STG = "Minor Stage";
- public static final String MAJ_STG = "Major Stage";
- public static final String MOD_STG = "Moderate Stage";
- public static final String LAT_OBS_VALUE = "LatestObs Value";
- public static final String LAT_OBS_TIME = "LatestObs Time";
- public static final String MAX_FCST_VALUE = "MaxFcst Value";
- public static final String MAX_FCST_VALID_TIME = "MaxFcst ValidTime";
- public static final String MAX_FCST_BASIS_TIME = "MaxFcst BasisTime";
- public static final String OBSFCST_MAX = "ObsFcstMax";
- public static final String LAT_STG_VALUE = "Latest StgValue";
- public static final String LAT_STG_TIME = "Latest StgTime";;
- public static final String LAT_FLOW_VALUE = "Latest FlowValue";
- public static final String LAT_FLOW_TIME = "Latest FlowTime";
- public static final String FLD_STG_DEP = "FldStg Departure";
- public static final String ACT_STG_DEP = "ActStg Departure";
- public static final String THREAT = "Threat";
- public static final String ALERT_ALARM = "AlertAlarm";
- public static final String VTEC_SUMMARY = "VTEC Summary";
- public static final String EVENT_END_TIME = "Event EndTime";
- public static final String UGC_EXPIRE_TIME = "UGCExpire Time";
- public static final String SSHP_MAX_FCST_VALUE = "SSHP MaxFcstValue";
- public static final String SSHP_MAX_FCST_VALID_TIME = "SSHP MaxFcstValidTime";
- public static final String SSHP_FCST_BASIS_TIME = "SSHP FcstBasisTime";
- public static final String SSHP_FCST_FLD_TIME = "SSHP FcstFloodTime";
-
-
- public List getRiverColumnsList(List riverMonitorColumnDescriptorList)
- {
- String textAlignment = "center";
- String numberAlignment = "right";
- String timeAlignment = "center";
-
- if(riverMonitorColumnDescriptorList == null)
- {
- riverMonitorColumnDescriptorList = new ArrayList();
- riverMonitorColumnDescriptorList = new LocationInfoColumns().getLocationInfoColumnsList(riverMonitorColumnDescriptorList);
- riverMonitorColumnDescriptorList = new PrecipColumns().getPrecipColumnsList(riverMonitorColumnDescriptorList);
- }
-
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(PRIMARY_RIVER_PE, textAlignment, "Primary River PE"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(STREAM, textAlignment, "Stream Name"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(BANK_FULL, numberAlignment, "Bank Full Stage"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(FLD_STG, numberAlignment, "Flood Stage"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(ACT_STG, numberAlignment, "Warning Stage"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(FLD_FLOW, numberAlignment, "Flood Flow"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(ACT_FLOW, numberAlignment, "Action Flow"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(MIN_STG, numberAlignment, "Minor Stage"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(MAJ_STG, numberAlignment, "Major Stage"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(MOD_STG, numberAlignment, "Moderate Stage"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(LAT_OBS_VALUE, numberAlignment, "Latest Observed Value"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(LAT_OBS_TIME, timeAlignment, "Latest Observed Time"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(MAX_FCST_VALUE, numberAlignment, "MaxFcst Value"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(MAX_FCST_VALID_TIME, timeAlignment, "MaxFcst ValidTime"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(MAX_FCST_BASIS_TIME, timeAlignment, "MaxFcst BasisTime"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(OBSFCST_MAX, numberAlignment, "ObsFcstMax"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(LAT_STG_VALUE, numberAlignment, "Latest StgValue"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(LAT_STG_TIME, timeAlignment, "Latest StgTime"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(LAT_FLOW_VALUE, numberAlignment, "Latest FlowValue"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(LAT_FLOW_TIME, timeAlignment, "Latest FlowTime"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(FLD_STG_DEP, numberAlignment, "FldStg Departure"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(ACT_STG_DEP, numberAlignment, "ActStg Departure"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(THREAT, textAlignment,"Threat"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(ALERT_ALARM, textAlignment, "AlertAlarm"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(VTEC_SUMMARY, textAlignment, "VTEC Summary"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(EVENT_END_TIME, timeAlignment, "Event EndTime"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(UGC_EXPIRE_TIME, timeAlignment, "UGCExpire Time"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(SSHP_MAX_FCST_VALUE, numberAlignment, "SSHP MaxFcstValue"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(SSHP_MAX_FCST_VALID_TIME, timeAlignment, "SSHP MaxFcstValidTime"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(SSHP_FCST_BASIS_TIME, timeAlignment, "SSHP FcstBasisTime"));
- riverMonitorColumnDescriptorList.add(new JTableColumnDescriptor(SSHP_FCST_FLD_TIME, timeAlignment, "SSHP FcstFloodTime"));
-
- return riverMonitorColumnDescriptorList;
- }
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverLocationDataFilter.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverLocationDataFilter.java
deleted file mode 100755
index d5ba53ac51..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverLocationDataFilter.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package ohd.hseb.monitor.river;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import ohd.hseb.db.DbTable;
-import ohd.hseb.monitor.LocationDataFilter;
-import ohd.hseb.util.BooleanHolder;
-import ohd.hseb.util.gui.jtable.JTableRowData;
-
-public class RiverLocationDataFilter extends LocationDataFilter
-{
-
- private BooleanHolder _showMissingBooleanHolder = null;
-
- public RiverLocationDataFilter(Map locationDisplayMap, BooleanHolder showMissingBooleanHolder)
- {
- _locationDisplayMap = locationDisplayMap;
- _showMissingBooleanHolder = showMissingBooleanHolder;
- }
-
-
- public List filter(List allRowDataList)
- {
- boolean showMissing = _showMissingBooleanHolder.getValue();
- List filteredRowDataList = new ArrayList();
-
- if (_locationDisplayMap != null)
- {
- for (int i = 0; i < allRowDataList.size(); i++)
- {
- RiverMonitorJTableRowData rowData = (RiverMonitorJTableRowData) allRowDataList.get(i);
- String lid = rowData.getLid();
- Boolean shouldDisplay = _locationDisplayMap.get(lid);
- if ((shouldDisplay != null) && (shouldDisplay) ) //based on selection in the tree
- {
- // String header = "RiverLocationDataFilter.filter(): ";
- // System.out.println(header + " lid = " + lid + "hsa = " + rowData.getHsa() + " groupId = " + rowData.getGroupId());
-
- if (showMissing) //based on menu selection
- {
- filteredRowDataList.add(rowData);
- }
- else //don't show missing
- {
- if (isDataAvailable(rowData))
- {
- filteredRowDataList.add(rowData);
- }
- }
- } //end if shouldDisplay
- } //end for
-
- } //end if (_locationDisplayMap != null)
- return filteredRowDataList;
- }
-
- private boolean isDataAvailable(RiverMonitorJTableRowData rowData)
- {
- boolean result = false;
-
- if (rowData.getLatestObsValue() != DbTable.getNullDouble() ||
- rowData.getMaxFcstValue() != DbTable.getNullDouble())
- {
- result = true;
- }
-
- return result;
- }
-
-
-}
-
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverMonitorDataManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverMonitorDataManager.java
deleted file mode 100755
index e38f7d2c6b..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverMonitorDataManager.java
+++ /dev/null
@@ -1,1691 +0,0 @@
-package ohd.hseb.monitor.river;
-
-import static ohd.hseb.util.TimeHelper.MILLIS_PER_HOUR;
-
-import java.awt.Color;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import ohd.hseb.db.Database;
-import ohd.hseb.db.DbTable;
-import ohd.hseb.db.DbTimeHelper;
-import ohd.hseb.ihfsdb.generated.AdminRecord;
-import ohd.hseb.ihfsdb.generated.AdminTable;
-import ohd.hseb.ihfsdb.generated.AlertAlarmValRecord;
-import ohd.hseb.ihfsdb.generated.AlertAlarmValTable;
-import ohd.hseb.ihfsdb.generated.IngestFilterRecord;
-import ohd.hseb.ihfsdb.generated.IngestFilterTable;
-import ohd.hseb.ihfsdb.generated.LocRiverMonRecord;
-import ohd.hseb.ihfsdb.generated.LocRiverMonView;
-import ohd.hseb.ihfsdb.generated.LocationRecord;
-import ohd.hseb.ihfsdb.generated.LocationTable;
-import ohd.hseb.ihfsdb.generated.RiverStatusRecord;
-import ohd.hseb.ihfsdb.generated.RiverStatusTable;
-import ohd.hseb.ihfsdb.generated.ShefPeRecord;
-import ohd.hseb.ihfsdb.generated.ShefPeTable;
-import ohd.hseb.ihfsdb.generated.VTECeventRecord;
-import ohd.hseb.ihfsdb.generated.VTECeventTable;
-import ohd.hseb.measurement.AbsTimeMeasurement;
-import ohd.hseb.measurement.MeasuringUnit;
-import ohd.hseb.measurement.RegularTimeSeries;
-import ohd.hseb.monitor.LocationDataFilter;
-import ohd.hseb.monitor.TreeFilterManager;
-import ohd.hseb.monitor.derivedcolumns.DerivedColumn;
-import ohd.hseb.monitor.derivedcolumns.DerivedColumnsFileManager;
-import ohd.hseb.monitor.precip.PrecipData;
-import ohd.hseb.monitor.precip.PrecipDataManager;
-import ohd.hseb.monitor.precip.settings.PrecipColumnDataSettings;
-import ohd.hseb.monitor.river.settings.RiverMonitorMenuSettings;
-import ohd.hseb.officenotes.OfficeNotesDataManager;
-import ohd.hseb.rivermonlocgroup.RiverMonLocGroupDataManager;
-import ohd.hseb.util.CodeTimer;
-import ohd.hseb.util.MathHelper;
-import ohd.hseb.util.SessionLogger;
-import ohd.hseb.util.TimeHelper;
-import ohd.hseb.util.TimeSeriesFileManager;
-
-import org.apache.bsf.BSFEngine;
-import org.apache.bsf.BSFManager;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-
-
-public class RiverMonitorDataManager {
- private Database _db;
-
- private AppsDefaults _appsDefaults;
-
- private SessionLogger _logger;
-
- private String _defaultHsa;
-
- private Set _riverLidSet = null;
-
- private String _peConfigFileName;
-
- private List _validHeightAndDischargePEList;
-
- private DerivedColumnsFileManager _derivedColumnsFileManager;
-
- private List _derivedColumnsList;
-
- private BSFManager _bsfManager;
-
- private BSFEngine _beanShellEngine;
-
- private String _missingRepresentation;
-
- private List _riverMonitorRowDataList;
-
- private List _missingRiverMonitorRowDataList = new ArrayList();
-
- private Map _lidToRiverBasinMap = new HashMap();
-
- private Map _lidDescDetailsMap;
-
- private TreeFilterManager _treeFilterManager;
-
- private String _lidOfCurrentInterest;
-
- private RiverMonitorMenuSettings _menuSettings;
-
- private RiverMonLocGroupDataManager _riverMonLocGroupDataManager;
-
- private OfficeNotesDataManager _officeNotesDataManager;
-
- private Map _sshpLidFcstMap;
-
- private String _sshpFcstDataDir;
-
- private PrecipDataManager _precipDataManager;
-
- private Map _lidHeightPEMap = null;
-
- private Map _lidDischargePEMap = null;
-
- public RiverMonitorDataManager(Database db, AppsDefaults appsDefaults,
- String missingRepresentation, SessionLogger logger,
- RiverMonitorMenuSettings menuSettings,
- DerivedColumnsFileManager derivedColumnsFileManager) {
- _appsDefaults = appsDefaults;
- _menuSettings = menuSettings;
- _db = db;
- _missingRepresentation = missingRepresentation;
- _logger = logger;
-
- readValidHeightAndDischargePE();
- _precipDataManager = new PrecipDataManager(_db, _appsDefaults,
- _missingRepresentation, _logger);
-
- _sshpFcstDataDir = _appsDefaults
- .getToken("sshp_background_forecast_output_dir",
- "/awips2/awipsShare/hydroapps/whfs/local/data/sshp/forecast");
- String settingsDir = _appsDefaults
- .getToken("rivermon_config_dir",
- "/awips2/awipsShare/hydroapps/whfs/local/data/app/rivermon");
-
- _peConfigFileName = settingsDir + "/" + "RiverMonitorPEConfig.txt";
-
- readAdminTable();
- _derivedColumnsFileManager = derivedColumnsFileManager;
-
- _riverMonLocGroupDataManager = new RiverMonLocGroupDataManager(db,
- _logger, missingRepresentation, getDefaultHsa());
-
- _officeNotesDataManager = new OfficeNotesDataManager(db, _logger,
- missingRepresentation);
-
- try {
- initializeBSF();
- } catch (Exception e) {
- _logger.log("PrecipMonitorDataManager.PrecipMonitorDataManager(): Error while initialize BSF..."
- + e);
- }
- }
-
- public RiverMonLocGroupDataManager getRiverMonLocGroupDataManager() {
- return _riverMonLocGroupDataManager;
- }
-
- public OfficeNotesDataManager getOfficeNotesDataManager() {
- return _officeNotesDataManager;
- }
-
- public TreeFilterManager getTreeFilterManager() {
- if (_treeFilterManager == null) {
- _treeFilterManager = new TreeFilterManager(_logger,
- getLocationDataFilter());
- }
- return _treeFilterManager;
- }
-
- public void setLidOfCurrentInterest(String lid) {
- _lidOfCurrentInterest = lid;
- }
-
- public String getLidOfCurrentInterest() {
- return _lidOfCurrentInterest;
- }
-
- public long getPdcUpdateTime() {
- return _precipDataManager.getPdcFileUpdateLongTime();
- }
-
- public long getDisplayedRecordCount() {
-
- List selectedRowDataList = getTreeFilterManager().filter(
- _riverMonitorRowDataList);
- long displayedCount = selectedRowDataList.size();
-
- return displayedCount;
- }
-
- public void disconnect() {
- _db.disconnect();
- }
-
- private void printLocationCounts(String header) {
- System.out.println(header + "There are "
- + _riverMonitorRowDataList.size() + " displayed with "
- + _missingRiverMonitorRowDataList.size()
- + " non-displayed missing locations.");
-
- }
-
- public Map getLidToCriticalColorMap() {
- String header = "RiverMonitorDataManager.getLidToCriticalColorMap(): ";
-
- Map lidToCriticalColorMap = new HashMap();
-
- for (RiverMonitorJTableRowData rowData : _riverMonitorRowDataList) {
- String lid = rowData.getLid();
- Color criticalColor = rowData.getCriticalColorForThisRow();
- lidToCriticalColorMap.put(lid, criticalColor);
- }
-
- for (RiverMonitorJTableRowData rowData : _missingRiverMonitorRowDataList) {
- String lid = rowData.getLid();
- Color criticalColor = rowData.getCriticalColorForThisRow();
- lidToCriticalColorMap.put(lid, criticalColor);
- }
-
- return lidToCriticalColorMap;
- }
-
- private void readAdminTable() {
- AdminTable adminTable = new AdminTable(_db);
- List adminList = null;
- try {
- adminList = adminTable.select("");
- } catch (SQLException e) {
- logSQLException(e);
- }
- _defaultHsa = ((AdminRecord) adminList.get(0)).getHsa();
- }
-
- protected void logSQLException(SQLException exception) {
- _logger.log("SQL ERROR = " + exception.getErrorCode() + " "
- + exception.getMessage());
-
- exception.printStackTrace(_logger.getPrintWriter());
-
- _logger.log("End of stack trace");
-
- }
-
- private LocationDataFilter getLocationDataFilter() {
- RiverLocationDataFilter locationDataFilter;
- List lidList = getLidList();
- Map locationDisplayMap = new HashMap();
-
- for (String lid : lidList) {
- locationDisplayMap.put(lid, false);
- }
-
- locationDataFilter = new RiverLocationDataFilter(locationDisplayMap,
- _menuSettings.getShowMissingDataBooleanHolder());
- return locationDataFilter;
- }
-
- public List getLidList() {
- List lidList = new ArrayList();
- for (RiverMonitorJTableRowData rowData : _riverMonitorRowDataList) {
- String lid = rowData.getLid();
- lidList.add(lid);
- }
- return lidList;
- }
-
- // ---------------------------------------------------------------------------------------------------
-
- private void initializeBSF() throws Exception {
- _bsfManager = new BSFManager();
- BSFManager.registerScriptingEngine("beanshell",
- "bsh.util.BeanShellBSFEngine", null);
- _beanShellEngine = _bsfManager.loadScriptingEngine("beanshell");
- }
-
- // ---------------------------------------------------------------------------------------------------
-
- protected void getDerivedColumnsInfo(
- RiverMonitorJTableRowData riverMonitorRowData) {
- if (_derivedColumnsList != null) {
- try {
- _bsfManager.declareBean("row", riverMonitorRowData,
- RiverMonitorJTableRowData.class);
- _bsfManager.declareBean("precip",
- riverMonitorRowData.getPrecipData(), PrecipData.class);
- for (int j = _derivedColumnsList.size() - 1; j >= 0; j--) {
- DerivedColumn derivedColumnDesc = (DerivedColumn) _derivedColumnsList
- .get(j);
- String equationForCellValue = ((String) derivedColumnDesc
- .getEquationForCellValue());
-
- Object returnValueForCell = _beanShellEngine.eval(
- "rowtest", 1, 1, equationForCellValue);
- if (derivedColumnDesc.getReturnType().equalsIgnoreCase(
- "double")) {
- double value = roundTo2DecimalPlaces(Double
- .parseDouble(returnValueForCell.toString()));
- derivedColumnDesc.setvalue(Double.valueOf(value));
- } else
- derivedColumnDesc.setvalue(returnValueForCell);
-
- String equationForCellColor = ((String) derivedColumnDesc
- .getEquationForCellColor());
- Object returnColorForCell = _beanShellEngine.eval(
- "rowtest", 1, 1, equationForCellColor);
- if (returnColorForCell != null)
- derivedColumnDesc
- .setCellBackgroundColor(returnColorForCell
- .toString());
- }
- _bsfManager.undeclareBean("row");
- _bsfManager.undeclareBean("precip");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- riverMonitorRowData.setDerivedColumnsDetailsList(_derivedColumnsList);
- }
-
- public void alterRiverMonitorRowDataListBasedOnMissingPrecipFilter() {
- _missingRiverMonitorRowDataList.clear();
-
- if (!_menuSettings.shouldShowMissingRiver()) // show missing river is
- // set to false(ie., skip
- // missing river)
- {
- List finalRiverMonitorRowDataList = new ArrayList();
-
- // for each point, check to see if it has some data, if so, then add
- // it to the list.
- // at the end, replace the _riverMonitorRowDataList with the
- // filtered list.
- for (RiverMonitorJTableRowData riverMonitorRowData : _riverMonitorRowDataList) {
- if (riverMonitorRowData.getLatestObsValue() != DbTable
- .getNullDouble()
- || riverMonitorRowData.getMaxFcstValue() != DbTable
- .getNullDouble()) {
- finalRiverMonitorRowDataList.add(riverMonitorRowData);
- } else {
- // add to the missing list so that the
- // RiverMonitorDataManager.getLidToCriticalColorMap() method
- // can
- // give a complete list
- _missingRiverMonitorRowDataList.add(riverMonitorRowData);
- }
- }
- _riverMonitorRowDataList = finalRiverMonitorRowDataList;
- finalRiverMonitorRowDataList = null;
- Runtime.getRuntime().gc();
- }
- }
-
- /**
- * Reads the locrivermon view and creates the list of
- * RiverMonitorJtableRowdata objects for each location and fills in its
- * name, state , county info
- *
- * @return
- */
- public List readRiverLocationInfo() {
- if (_riverLidSet == null)
- _riverLidSet = new HashSet();
- else
- _riverLidSet.clear();
-
- if (_riverMonitorRowDataList != null) {
- for (RiverMonitorJTableRowData riverMonitorRowData : _riverMonitorRowDataList) {
- riverMonitorRowData.resetCellMap();
- }
- _riverMonitorRowDataList.clear();
- }
-
- Runtime.getRuntime().gc();
- List riverMonitorRowDataList = new ArrayList();
-
- LocRiverMonView locRivermonView = new LocRiverMonView(_db);
- List locRiverMonRecordList;
-
- loadRiverBasinData();
-
- try {
- String whereClause = "order by lid";
- locRiverMonRecordList = locRivermonView.select(whereClause);
- if (locRiverMonRecordList != null) {
- for (LocRiverMonRecord locRiverMonRecord : locRiverMonRecordList) {
- RiverMonitorJTableRowData riverMonitorRowData = new RiverMonitorJTableRowData(
- _missingRepresentation, this, _logger,
- _menuSettings);
- riverMonitorRowData.setLid(locRiverMonRecord.getLid());
-
- riverMonitorRowData.setName(locRiverMonRecord.getName());
- riverMonitorRowData
- .setCounty(locRiverMonRecord.getCounty());
- riverMonitorRowData.setState(locRiverMonRecord.getState());
- riverMonitorRowData
- .setStream(locRiverMonRecord.getStream());
-
- String primaryRiverPe = locRiverMonRecord.getPrimary_pe();
- if (primaryRiverPe == null || primaryRiverPe.length() < 2) {
- primaryRiverPe = "HG";
- }
- riverMonitorRowData.setPrimaryRiverPe(primaryRiverPe);
-
- riverMonitorRowData
- .setBankFull(roundTo2DecimalPlaces(locRiverMonRecord
- .getBankfull()));
-
- if (locRiverMonRecord.getFlood_stage() == 0.0) {
- riverMonitorRowData.setFloodStage(DbTable
- .getNullDouble());
- } else {
- riverMonitorRowData
- .setFloodStage(roundTo2DecimalPlaces(locRiverMonRecord
- .getFlood_stage()));
- }
-
- if (locRiverMonRecord.getAction_stage() == 0.0) {
- riverMonitorRowData.setActionStage(DbTable
- .getNullDouble());
- } else {
- riverMonitorRowData
- .setActionStage(roundTo2DecimalPlaces(locRiverMonRecord
- .getAction_stage()));
- }
-
- if (locRiverMonRecord.getAction_flow() == 0.0) {
- riverMonitorRowData.setActionFlow(DbTable
- .getNullDouble());
- } else {
- riverMonitorRowData
- .setActionFlow(roundTo2DecimalPlaces(locRiverMonRecord
- .getAction_flow()));
- }
-
- if (locRiverMonRecord.getFlood_flow() == 0.0) {
- riverMonitorRowData.setFloodFlow(DbTable
- .getNullDouble());
- } else {
- riverMonitorRowData
- .setFloodFlow(roundTo2DecimalPlaces(locRiverMonRecord
- .getFlood_flow()));
- }
-
- riverMonitorRowData
- .setMinorStage(roundTo2DecimalPlaces(locRiverMonRecord
- .getMinor()));
- riverMonitorRowData
- .setMajorStage(roundTo2DecimalPlaces(locRiverMonRecord
- .getMajor()));
- riverMonitorRowData
- .setModerateStage(roundTo2DecimalPlaces(locRiverMonRecord
- .getModerate()));
-
- setRiverBasinData(riverMonitorRowData);
-
- riverMonitorRowDataList.add(riverMonitorRowData);
-
- _riverLidSet.add(locRiverMonRecord.getLid());
- }
- }
-
- } catch (SQLException e) {
- logSQLException(e);
- }
- return riverMonitorRowDataList;
- }
-
- private void setRiverBasinData(RiverMonitorJTableRowData rowData) {
- String riverBasin = _lidToRiverBasinMap.get(rowData.getLid());
-
- rowData.setRiverBasin(riverBasin);
-
- return;
- }
-
- private void loadRiverBasinData() {
- LocationTable table = new LocationTable(_db);
- String whereClause = "order by lid";
- List recordList = null;
-
- _lidToRiverBasinMap.clear();
- try {
- recordList = (List) table.select(whereClause);
- for (LocationRecord record : recordList) {
- _lidToRiverBasinMap.put(record.getLid(), record.getRb());
- }
- } catch (SQLException e) {
-
- }
-
- }
-
- public boolean isRiverLocation(String lid) {
- boolean result = false;
-
- if (_riverLidSet != null) {
- if (_riverLidSet.contains(lid)) {
- result = true;
- }
- }
- return result;
- }
-
- protected void readCurrentRiverMonTableData() {
- /*
- * String header =
- * "RiverMonitorDataManager.readCurrentRiverMonTableData(): ";
- * _riverMonLocGroupDataManager.readLocationHsaMap();
- * _riverMonLocGroupDataManager.readGroupInfo();
- * _riverMonLocGroupDataManager.readLocationInfo();
- * _riverMonLocGroupDataManager.readGroupHsaMap();
- * _riverMonLocGroupDataManager
- * .updateRiverMonitorGroupWithAppropriateHsa();
- */
- _riverMonLocGroupDataManager.initializeRiverMonTableData();
- }
-
- public List getRiverMonitorRowDataList() {
- return _riverMonitorRowDataList;
- }
-
- public void createRiverMonitorRowDataList() {
- String header = "RiverMonitorDataManager.createRiverMonitorRowDataList(): ";
-
- _logger.log(header + " Memory Info before creating rowdata list:"
- + printMemoryInfo());
- Runtime.getRuntime().gc();
- _riverMonitorRowDataList = readRiverLocationInfo();
-
- String fcstTs = _menuSettings.getRiverSettings().getFcstTypeSource();
-
- readConfigFileToFormLidHeightPEAndLidDischargePEMap();
-
- Map lidRowDataMap = new HashMap();
- if (_riverMonitorRowDataList != null) {
- String dischargePE = null;
- String heightPE = null;
-
- readCurrentRiverMonTableData();
-
- Runtime.getRuntime().gc();
- _logger.log(header + " Here 1: " + printMemoryInfo());
- _precipDataManager
- .readPrecipData(_riverMonitorRowDataList, "RIVER");
- Runtime.getRuntime().gc();
- _logger.log(header + " Here 2: " + printMemoryInfo());
-
- Map vtecMap = createGeoIdToVtecEventListMap();
- Map alertAlarmMap = createAlertAlarmInfoToLidMap();
- determineLidToSshpFcstMap();
-
- _derivedColumnsList = _derivedColumnsFileManager
- .getDerivedColumns();
-
- for (RiverMonitorJTableRowData riverMonitorRowData : _riverMonitorRowDataList) {
- String lid = riverMonitorRowData.getLid();
- String groupId = _riverMonLocGroupDataManager.getGroupId(lid);
- String groupName = _riverMonLocGroupDataManager
- .getGroupName(groupId);
- int groupOrdinal = _riverMonLocGroupDataManager
- .getGroupOrdinal(groupId);
- String hsa = _riverMonLocGroupDataManager.getHsa(groupId);
- int locationOrdinal = _riverMonLocGroupDataManager
- .getLocationOrdinal(lid);
-
- riverMonitorRowData.setLid(riverMonitorRowData.getLid());
- riverMonitorRowData.setLocationOrdinal(locationOrdinal);
- riverMonitorRowData.setHsa(hsa);
- riverMonitorRowData.setGroupName(groupName);
- riverMonitorRowData.setGroupId(groupId);
- riverMonitorRowData.setGroupOrdinal(groupOrdinal);
-
- // Read the latest obs from riverstatus for this lid
- RiverStatusRecord riverStatusRecordForObs = null;
- riverStatusRecordForObs = determineObsOrFcstRecordFromRiverStatus(
- lid, riverMonitorRowData.getPrimaryRiverPe(), "OBS",
- null);
-
- if (riverStatusRecordForObs == null) {
- riverMonitorRowData.setLatestObsValue(DbTable
- .getNullDouble());
- riverMonitorRowData.setLatestObsTime(DbTable.getNullLong());
- riverMonitorRowData.setObsTypeSource(null);
- } else {
- riverMonitorRowData
- .setLatestObsValue(roundTo2DecimalPlaces(riverStatusRecordForObs
- .getValue()));
- riverMonitorRowData
- .setLatestObsTime(riverStatusRecordForObs
- .getValidtime());
- riverMonitorRowData
- .setObsTypeSource(riverStatusRecordForObs.getTs());
- }
-
- // Read the max future forecast from riverstatus for this
- // lid
- RiverStatusRecord riverStatusRecordForFcst = determineObsOrFcstRecordFromRiverStatus(
- lid, riverMonitorRowData.getPrimaryRiverPe(), "FCST",
- fcstTs);
- if (riverStatusRecordForFcst == null) {
- riverMonitorRowData.setMaxFcstValidTime(DbTable
- .getNullLong());
- riverMonitorRowData.setMaxFcstBasisTime(DbTable
- .getNullLong());
- riverMonitorRowData
- .setMaxFcstValue(DbTable.getNullDouble());
- if (!fcstTs.equalsIgnoreCase("IngestFilter"))
- riverMonitorRowData.setFcstTypeSource(fcstTs);
- else
- riverMonitorRowData.setFcstTypeSource(null);
- } else {
- riverMonitorRowData
- .setMaxFcstValue(roundTo2DecimalPlaces(riverStatusRecordForFcst
- .getValue()));
- riverMonitorRowData
- .setMaxFcstValidTime(riverStatusRecordForFcst
- .getValidtime());
- riverMonitorRowData
- .setMaxFcstBasisTime(riverStatusRecordForFcst
- .getBasistime());
- riverMonitorRowData
- .setFcstTypeSource(riverStatusRecordForFcst.getTs());
- }
-
- dischargePE = null;
- heightPE = null;
-
- // heightPE = ""; dischargePE = "";
- if (_lidHeightPEMap != null && _lidDischargePEMap != null) {
- if (_lidHeightPEMap.size() > 0
- && _lidDischargePEMap.size() > 0) {
- heightPE = (String) _lidHeightPEMap.get(lid);
- dischargePE = (String) _lidDischargePEMap.get(lid);
- }
- }
- if (heightPE == null || dischargePE == null) // No entry
- // found in
- // file
- {
- char firstLetterInPrimaryPE = riverMonitorRowData
- .getPrimaryRiverPe().charAt(0);
-
- if (firstLetterInPrimaryPE == 'H') {
- heightPE = riverMonitorRowData.getPrimaryRiverPe();
- dischargePE = getEquivalentDischargePE(riverMonitorRowData
- .getPrimaryRiverPe());
- } else
- // firstLetterInPrimaryPE is 'Q'
- {
- dischargePE = riverMonitorRowData.getPrimaryRiverPe();
- heightPE = getEquivalentHeightPE(riverMonitorRowData
- .getPrimaryRiverPe());
- }
- }
-
- riverStatusRecordForObs = null;
- if (heightPE != null) // could be null if the user hasn't
- // configured and if the primary pe
- // is not QR, QT
- riverStatusRecordForObs = determineObsOrFcstRecordFromRiverStatus(
- lid, heightPE, "OBS", null);
-
- if (riverStatusRecordForObs == null) {
- riverMonitorRowData.setLatestStgValue(DbTable
- .getNullDouble());
- riverMonitorRowData.setLatestStgTime(DbTable.getNullLong());
- } else {
- riverMonitorRowData
- .setLatestStgValue(roundTo2DecimalPlaces(riverStatusRecordForObs
- .getValue()));
- riverMonitorRowData
- .setLatestStgTime(riverStatusRecordForObs
- .getValidtime());
- }
-
- riverStatusRecordForObs = null;
- if (dischargePE != null) // could be null if the user
- // hasn't configured and if the
- // primary pe is not HG, HT
- riverStatusRecordForObs = determineObsOrFcstRecordFromRiverStatus(
- lid, dischargePE, "OBS", null);
-
- if (riverStatusRecordForObs == null) {
- riverMonitorRowData.setLatestFlowValue(DbTable
- .getNullDouble());
- riverMonitorRowData
- .setLatestFlowTime(DbTable.getNullLong());
- } else {
- riverMonitorRowData
- .setLatestFlowValue(roundTo2DecimalPlaces(riverStatusRecordForObs
- .getValue()));
- riverMonitorRowData
- .setLatestFlowTime(riverStatusRecordForObs
- .getValidtime());
- }
-
- SshpFcstDetails sshpFcstDetails = getSshpFcstDetailsForLid(
- riverMonitorRowData.getLid(),
- riverMonitorRowData.getFloodStage());
- riverMonitorRowData.setSshpFcstDetails(sshpFcstDetails);
-
- int numOfHrsForObsLookBack = _menuSettings.getRiverSettings()
- .getLatestObsLookBack();
- long earliestAcceptableTimeForObs = System.currentTimeMillis()
- - TimeHelper.MILLIS_PER_HOUR * numOfHrsForObsLookBack;
-
- if (riverMonitorRowData.getLatestObsTime() > earliestAcceptableTimeForObs) {
- riverMonitorRowData
- .setObsFcstMax(roundTo2DecimalPlaces(Math.max(
- riverMonitorRowData.getLatestObsValue(),
- riverMonitorRowData.getMaxFcstValue())));
- } else {
- riverMonitorRowData
- .setObsFcstMax(roundTo2DecimalPlaces(riverMonitorRowData
- .getMaxFcstValue()));
- }
-
- if ((riverMonitorRowData.getObsFcstMax() != DbTable
- .getNullDouble())
- && (riverMonitorRowData.getFloodStage() != DbTable
- .getNullDouble())) {
- riverMonitorRowData
- .setFldStgDeparture(roundTo2DecimalPlaces(riverMonitorRowData
- .getObsFcstMax()
- - riverMonitorRowData.getFloodStage()));
- } else {
- riverMonitorRowData
- .setFldStgDeparture(roundTo2DecimalPlaces(DbTable
- .getNullDouble()));
- }
-
- if ((riverMonitorRowData.getObsFcstMax() != DbTable
- .getNullDouble())
- && (riverMonitorRowData.getActionStage() != DbTable
- .getNullDouble()))
- riverMonitorRowData
- .setActStgDeparture(roundTo2DecimalPlaces(riverMonitorRowData
- .getObsFcstMax()
- - riverMonitorRowData.getActionStage()));
- else
- riverMonitorRowData
- .setActStgDeparture(roundTo2DecimalPlaces(DbTable
- .getNullDouble()));
-
- riverMonitorRowData.setVtecEventList(getVtecEventList(lid,
- vtecMap));
-
- setAlertAlarmDetails(riverMonitorRowData, alertAlarmMap);
-
- riverMonitorRowData.addAllCellsToMap();
- /*
- * _logger.log(riverMonitorRowData.getLid() + "|" +
- * riverMonitorRowData.getName() + "|" +
- * riverMonitorRowData.getGroupId() + "|" +
- * riverMonitorRowData.getGroupName() + "|" +
- * riverMonitorRowData.getLocationOrdinal() + "|" +
- * riverMonitorRowData.getGroupOrdinal() + "|" +
- * riverMonitorRowData.getPrecipData().getFFG1Hr() + "|" +
- * riverMonitorRowData.getPrecipData().getFFG3Hr() + "|" +
- * riverMonitorRowData.getPrecipData().getFFG6Hr());
- */
-
- getDerivedColumnsInfo(riverMonitorRowData);
- riverMonitorRowData.addDerivedDataToCellMap();
-
- lidRowDataMap.put(riverMonitorRowData.getLid(),
- riverMonitorRowData);
-
- }
-
- /*
- * _logger.log(header +
- * "Before missing precip filter is applied, alllocationinfo list size:"
- * + _riverMonitorRowDataList.size());
- *
- * alterRiverMonitorRowDataListBasedOnMissingPrecipFilter();
- *
- * _logger.log(header +
- * "After missing precip filter is applied, alllocationinfo list size:"
- * + _riverMonitorRowDataList.size());
- */
- }
-
- Runtime.getRuntime().gc();
- _logger.log(header + " Memory Info after creating rowdata list:"
- + printMemoryInfo());
-
- }
-
- // ---------------------------------------------------------------------------------------------------
-
- public String printMemoryInfo() {
- String str = "Free:" + Runtime.getRuntime().freeMemory() + " Max:"
- + Runtime.getRuntime().maxMemory() + " total:"
- + Runtime.getRuntime().totalMemory();
- return str;
- }
-
- public PrecipColumnDataSettings getPrecipSettings() {
- return _menuSettings.getPrecipSettings();
- }
-
- // ---------------------------------------------------------------------------------------------------
-
- private List getListOfLocationIds() {
- List locationIdList = new ArrayList();
-
- for (RiverMonitorJTableRowData rowData : _riverMonitorRowDataList) {
- locationIdList.add(rowData.getLid());
- }
-
- return locationIdList;
-
- }
-
- // ---------------------------------------------------------------------------------------------------
-
- public List createStringArrayListOfFilterItems() {
- String header = "RiverMonitorDataManager.createStringArrayListOfFilterItems(): ";
-
- List locationIdList = getListOfLocationIds();
-
- List listOfNodePathStringArray = _riverMonLocGroupDataManager
- .createStringArrayListOfFilterItems(locationIdList);
-
- return listOfNodePathStringArray;
- }
-
- // ---------------------------------------------------------------------------------------------------
- /*
- * private List createStringArrayListOfFilterItemsOld() { List
- * listOfStringArray = new ArrayList();
- *
- * List locationIdList = getListOfLocationIds();
- *
- *
- * String rootItem = "HSA"; String firstLevelFilterItems[] =
- * _riverMonLocGroupDataManager.getAllHsa(); String[] currentStringArray;
- *
- * if(firstLevelFilterItems != null && firstLevelFilterItems.length > 0) {
- * String currentFirstLevelFilterItem = null; for(int i=0; i <
- * firstLevelFilterItems.length; i++) { currentFirstLevelFilterItem =
- * firstLevelFilterItems[i]; String secondLevelFilterItems[] =
- * _riverMonLocGroupDataManager.getGroupsForHsa(firstLevelFilterItems[i]);
- * if(secondLevelFilterItems != null && secondLevelFilterItems.length > 0) {
- * String currentSecondLevelFilterItem = null; for(int j=0; j <
- * secondLevelFilterItems.length; j++) { currentSecondLevelFilterItem =
- * _riverMonLocGroupDataManager.getGroupName(secondLevelFilterItems[j]);
- * String thirdLevelFilterItems[] =
- * _riverMonLocGroupDataManager.getAllLocationsForGroup
- * (secondLevelFilterItems[j], locationIdList); if(thirdLevelFilterItems !=
- * null && thirdLevelFilterItems.length > 0) { for(int k=0; k <
- * thirdLevelFilterItems.length; k++) {
- * if(isRiverLocation(thirdLevelFilterItems[k])) { currentStringArray = new
- * String[4]; currentStringArray[0] = rootItem; currentStringArray[1] =
- * currentFirstLevelFilterItem; currentStringArray[2] =
- * currentSecondLevelFilterItem; currentStringArray[3] =
- * thirdLevelFilterItems[k]; listOfStringArray.add(currentStringArray); } }
- * } else { currentStringArray = new String[3]; currentStringArray[0] =
- * rootItem; currentStringArray[1] = currentFirstLevelFilterItem;
- * currentStringArray[2] = currentSecondLevelFilterItem;
- * listOfStringArray.add(currentStringArray); } } } else {
- * currentStringArray = new String[2]; currentStringArray[0] = rootItem;
- * currentStringArray[1] = currentFirstLevelFilterItem;
- * listOfStringArray.add(currentStringArray); } } } else {
- * currentStringArray = new String[1]; currentStringArray[0] = rootItem;
- * listOfStringArray.add(currentStringArray); }
- *
- * return listOfStringArray; }
- */
-
- private Map createGeoIdToVtecEventListMap() {
- String header = "RiverMonitorDataManager.createGeoIdToVtecEventListMap():";
- Map vtecMap = new HashMap();
- VTECeventTable vtecEventTable = new VTECeventTable(_db);
- String whereClause = null;
- CodeTimer timer = new CodeTimer();
- try {
- timer.start();
-
- // retrieve data for VTEC events which are not statements and the
- // end time has been set
- whereClause = " where signif != 'S' and endtime is not null order by geoid, endtime asc";
- _logger.log(header + " where clause:" + whereClause);
- List tempVtecEventWhichArentStatementAndEndTimeIsNotNull = vtecEventTable
- .select(whereClause);
-
- // retrieve data for VTEC events which are not statements and the
- // end time has NOT been set
- whereClause = " where signif != 'S' and endtime is null order by geoid ";
- _logger.log(header + " where clause:" + whereClause);
- List tempVtecEventWhichArentStatementAndEndTimeIsNull = vtecEventTable
- .select(whereClause);
-
- // merge the two lists
- List allVtecEventWhichArentStatementsList = new ArrayList();
- allVtecEventWhichArentStatementsList
- .addAll(tempVtecEventWhichArentStatementAndEndTimeIsNotNull);
- allVtecEventWhichArentStatementsList
- .addAll(tempVtecEventWhichArentStatementAndEndTimeIsNull);
-
- timer.stop("Rivermonitor data mgr- read vtec event time elapsed:");
-
- // assign each record to the map
- for (int i = 0; i < allVtecEventWhichArentStatementsList.size(); i++) {
- VTECeventRecord record = (VTECeventRecord) allVtecEventWhichArentStatementsList
- .get(i);
- String geoId = record.getGeoid();
-
- List eventList = (List) vtecMap.get(geoId);
- if (eventList == null) {
- eventList = new ArrayList();
- vtecMap.put(geoId, eventList);
- }
- eventList.add(record);
- }
- } catch (SQLException e) {
- _logger.log(header);
- logSQLException(e);
- }
-
- return vtecMap;
- }
-
- private List getVtecEventList(String lid, Map vtecMap) {
- List finalVtecEventList = null;
-
- if (vtecMap != null) {
- if (vtecMap.size() > 0) {
- finalVtecEventList = (List) vtecMap.get(lid);
- }
- }
- return finalVtecEventList;
- }
-
- protected String getEquivalentHeightPE(String pe) {
- String heightPE = null;
- if (pe.equalsIgnoreCase("QR"))
- heightPE = "HG";
- else if (pe.equalsIgnoreCase("QT"))
- heightPE = "HT";
- return heightPE;
- }
-
- protected String getEquivalentDischargePE(String pe) {
- String dischargePE = null;
- if (pe.equalsIgnoreCase("HG"))
- dischargePE = "QR";
- else if (pe.equalsIgnoreCase("HT"))
- dischargePE = "QT";
- return dischargePE;
- }
-
- private void readValidHeightAndDischargePE() {
- List shefPEInfoList = null;
-
- ShefPeTable shefPeTable = new ShefPeTable(_db);
- String whereClause = null;
- String header = "RiverMonitorDataManager.readValidHeightAndDischargePE(): ";
-
- CodeTimer timer = new CodeTimer();
- try {
- whereClause = "where pe like 'H%' or pe like 'Q%'";
- timer.start();
- shefPEInfoList = shefPeTable.select(whereClause);
- timer.stop("Read from shefpe time elapsed:");
- _logger.log(header + " Where Clause:" + whereClause);
- if (shefPEInfoList == null) {
- _logger.log(header + " height and discharge pe list is null");
- } else {
- _logger.log(header
- + " height and discharge pe list is NOT null");
- if (shefPEInfoList.size() > 0) {
- _logger.log(header +
- " height and discharge pe list SIZE IS > 0");
- _validHeightAndDischargePEList = new ArrayList();
- for (int i = 0; i < shefPEInfoList.size(); i++) {
-
- ShefPeRecord record = (ShefPeRecord) shefPEInfoList
- .get(i);
- _validHeightAndDischargePEList.add(record.getPe());
- }
- }
- }
- } catch (SQLException e) {
- logSQLException(e);
- }
- }
-
- private boolean validatePE(String pe) {
- boolean result = false;
-
- if (_validHeightAndDischargePEList != null) {
- for (int i = 0; i < _validHeightAndDischargePEList.size(); i++) {
- String tempStr = (String) _validHeightAndDischargePEList.get(i);
- if (pe.equals(tempStr)) {
- result = true;
- break;
- }
- }
- }
- return result;
- }
-
- private void readConfigFileToFormLidHeightPEAndLidDischargePEMap() {
- Map lidHeightPEMap = null;
- Map lidDischargePEMap = null;
-
- String header = "RiverMonitorDataManager.readConfigFileAndFormConfigMap(): ";
- File fileHandler = new File(_peConfigFileName);
-
- if (fileHandler.exists()) {
- BufferedReader in = null;
- String str;
- List stringList = new ArrayList();
-
- try {
- in = new BufferedReader(new FileReader(fileHandler));
- while ((str = in.readLine()) != null) {
- stringList.add(str);
- }
- } catch (IOException exception) {
- printFileException(exception, header);
- }
- if (stringList.size() > 0) {
- for (int i = 0; i < stringList.size(); i++) {
- String tempString = (String) stringList.get(i);
- if (tempString.length() == 0)
- continue;
- if (tempString.charAt(0) == '#')
- continue;
- String splitStr[] = null;
- splitStr = tempString.split("\\|");
- if (splitStr == null)
- continue;
- String lid, heightPE, dischargePE;
- if (splitStr.length == 3) {
- splitStr[0] = splitStr[0].trim();
- splitStr[1] = splitStr[1].trim();
- splitStr[2] = splitStr[2].trim();
- if (splitStr[0].length() > 0
- && splitStr[1].length() == 2
- && splitStr[2].length() == 2) {
- lid = splitStr[0];
- heightPE = splitStr[1];
- dischargePE = splitStr[2];
- if (heightPE.charAt(0) != 'H'
- || dischargePE.charAt(0) != 'Q') {
- _logger.log(header
- + "Invalid height and discharge PE ["
- + heightPE + "|" + dischargePE + "]");
- continue;
- }
- if ((!validatePE(heightPE))
- || (!validatePE(dischargePE))) {
- _logger.log(header
- + "Invalid height and discharge PE ["
- + heightPE + "|" + dischargePE + "]");
- continue;
- } else {
- if (lidHeightPEMap == null) {
- lidHeightPEMap = new HashMap();
- }
- lidHeightPEMap.put(lid, heightPE);
- if (lidDischargePEMap == null) {
- lidDischargePEMap = new HashMap();
- }
- lidDischargePEMap.put(lid, dischargePE);
- }
-
- } else
- // invalid entry
- {
- _logger.log(header + "1. Invalid entry["
- + tempString + "] in ConfigFile ");
- continue;
- }
-
- } else
- // line not having the format lid|PETS|PETS
- {
- _logger.log(header + "2. Invalid entry[" + tempString
- + "] in ConfigFile ");
- continue;
- }
- }
- }
- } else {
- _logger.log(header + "ConfigFile [" + _peConfigFileName
- + "] doesn't exist");
- }
-
- _lidHeightPEMap = lidHeightPEMap;
- _lidDischargePEMap = lidDischargePEMap;
- }
-
- protected void printFileException(IOException exception, String header) {
- header = header + ".printFileException(): ";
- _logger.log(header + "ERROR = " + exception.getMessage());
- exception.printStackTrace(_logger.getPrintWriter());
- _logger.log(header + "End of stack trace");
- }
-
- // ---------------------------------------------------------------------------------------------------
-
- private double roundTo2DecimalPlaces(double number) {
- double result = DbTable.getNullDouble();
- if (number != DbTable.getNullDouble())
- result = MathHelper.roundToNDecimalPlaces(number, 2);
-
- return result;
- }
-
- public String getDefaultHsa() {
- return _defaultHsa;
- }
-
- public Map getLidDescDetails() {
- if (_lidDescDetailsMap == null) {
- LocRiverMonView riverMonView = new LocRiverMonView(_db);
- try {
- List riverMonViewList = (List) riverMonView.select("");
- if (riverMonViewList != null) {
- if (riverMonViewList.size() > 0) {
- _lidDescDetailsMap = new HashMap();
- for (int i = 0; i < riverMonViewList.size(); i++) {
- LocRiverMonRecord record = (LocRiverMonRecord) riverMonViewList
- .get(i);
- String name = record.getName();
- if (name != null) {
- if (name.length() > 0) {
- if (name.length() > 50) {
- name = name.substring(0, 50);
- }
- }
- }
- String desc = name + ";" + record.getState() + ";"
- + record.getCounty();
- _lidDescDetailsMap.put(record.getLid(), desc);
- }
- }
- }
- } catch (SQLException e) {
- logSQLException(e);
- }
- }
- return _lidDescDetailsMap;
- }
-
- private void setAlertAlarmDetails(RiverMonitorJTableRowData rowData,
- Map alertAlarmMap) {
- String lid = rowData.getLid();
- AlertAlarmValRecord alertAlarmValRecord = (AlertAlarmValRecord) alertAlarmMap
- .get(lid);
- if (alertAlarmValRecord != null) {
- if (alertAlarmValRecord.getPe().equals(rowData.getPrimaryRiverPe())
- && alertAlarmValRecord.getLid().equals(rowData.getLid())) {
- String categ = alertAlarmValRecord.getAa_categ();
- String check = alertAlarmValRecord.getAa_check();
-
- if ((check.equalsIgnoreCase("Upper"))
- && categ.equalsIgnoreCase("alert")) {
- rowData.setAlertUpperLimit(true);
- } else if ((check.equalsIgnoreCase("Upper"))
- && categ.equalsIgnoreCase("alarm")) {
- rowData.setAlarmUpperLimit(true);
- } else if ((check.equalsIgnoreCase("Lower"))
- && categ.equalsIgnoreCase("alert")) {
- rowData.setAlertLowerLimit(true);
- } else if ((check.equalsIgnoreCase("Lower"))
- && categ.equalsIgnoreCase("alarm")) {
- rowData.setAlarmLowerLimit(true);
- } else if ((check.equalsIgnoreCase("Diff"))
- && categ.equalsIgnoreCase("alert")) {
- rowData.setAlertDiffLimit(true);
- } else if ((check.equalsIgnoreCase("Diff"))
- && categ.equalsIgnoreCase("alarm")) {
- rowData.setAlarmDiffLimit(true);
- } else if ((check.equalsIgnoreCase("Roc"))
- && categ.equalsIgnoreCase("alert")) {
- rowData.setAlertRocLimit(true);
- } else if ((check.equalsIgnoreCase("Roc"))
- && categ.equalsIgnoreCase("alarm")) {
- rowData.setAlarmRocLimit(true);
- }
- }
- }
- }
-
- private Map createAlertAlarmInfoToLidMap() {
- String header = "RiverMonitorDataManager.addAlertAlarmInfoToRowDataList(): ";
- List alertAlarmList;
- Map alertAlarmMap = new HashMap();
- AlertAlarmValTable alertAlarmValTable = new AlertAlarmValTable(_db);
- int numOfHrsForAlertAlarmValidTimeLookBack = 1;
- numOfHrsForAlertAlarmValidTimeLookBack = _menuSettings
- .getRiverSettings().getAlertAlarmLookBack();
-
- _logger.log(header + "numOfHrsForValidTimeLookBack:"
- + numOfHrsForAlertAlarmValidTimeLookBack);
-
- String whereClause = null;
- long tempTime = System.currentTimeMillis() - MILLIS_PER_HOUR
- * numOfHrsForAlertAlarmValidTimeLookBack;
- String validTime = DbTimeHelper.getDateTimeStringFromLongTime(tempTime);
-
- try {
- whereClause = " where validtime >" + "'" + validTime + "'"
- + " order by lid, pe";
- _logger.log(header + "Where clause:" + whereClause);
-
- alertAlarmList = alertAlarmValTable.select(whereClause);
-
- for (int i = 0; i < alertAlarmList.size(); i++) {
- AlertAlarmValRecord alertAlarmValRecord = (AlertAlarmValRecord) alertAlarmList
- .get(i);
- alertAlarmMap.put(alertAlarmValRecord.getLid(),
- alertAlarmValRecord);
- }
- } catch (SQLException e) {
- logSQLException(e);
- }
-
- return alertAlarmMap;
- }
-
- // -----------------------------------------------------------------------------------------------------------------------
-
- private SshpFcstDetails getSshpFcstDetailsForLid(String lid,
- double floodStage) {
-
- if (_sshpLidFcstMap == null)
- determineLidToSshpFcstMap();
- SshpFcstDetails sshpFcstDetails = new SshpFcstDetails();
- RegularTimeSeries fcstRegularTimeSeries = (RegularTimeSeries) _sshpLidFcstMap
- .get(lid);
- if (fcstRegularTimeSeries != null) {
- AbsTimeMeasurement maxMeasurement = (AbsTimeMeasurement) fcstRegularTimeSeries
- .getMaxMeasurement();
- if (maxMeasurement != null) {
- sshpFcstDetails
- .setCrestValue(roundTo2DecimalPlaces(maxMeasurement
- .getValue()));
- sshpFcstDetails.setCrestTime(maxMeasurement.getTime());
-
- for (int index = 0; index < fcstRegularTimeSeries
- .getMeasurementCount(); index++) {
- AbsTimeMeasurement forecastMeasurement = fcstRegularTimeSeries
- .getAbsTimeMeasurementByIndex(index);
-
- if (forecastMeasurement.getValue() >= floodStage) {
- sshpFcstDetails
- .setTimeAboveFldStg(fcstRegularTimeSeries
- .getMeasurementTimeByIndex(index));
- break;
- }
- }
- // basis time will be the last modified time of the file
- // basinid_fcst_stage.dat
- sshpFcstDetails.setBasisTime(new File(_sshpFcstDataDir + "/"
- + lid + "_fcst_stage.dat").lastModified());
- }
-
- }
- return sshpFcstDetails;
- }
-
- // ---------------------------------------------------------------------------------------------------------------
- private RegularTimeSeries loadForecastFileMapTimeSeries(String filePath) {
- TimeSeriesFileManager reader = new TimeSeriesFileManager();
-
- RegularTimeSeries timeSeries = null;
-
- timeSeries = reader.readRegularTimeSeries(filePath,
- MeasuringUnit.inches);
-
- return timeSeries;
- }
-
- // -----------------------------------------------------------------------------------------------------------------------
-
- private void determineLidToSshpFcstMap() {
- _sshpLidFcstMap = new HashMap();
-
- File sshpFcstDataPath = new File(_sshpFcstDataDir);
-
- if (!sshpFcstDataPath.exists()) {
- _logger.log("Sshp fcst data dir:["
- + _sshpFcstDataDir
- + "] doesn't exist...Check the token value for sshp_background_forecast_output_dir");
- } else {
- File[] fcstFilesArray = sshpFcstDataPath.listFiles();
-
- if (fcstFilesArray != null) {
- if (fcstFilesArray.length > 0) {
- // basis time look back window filter value
- int numOfHrsForLatestFcstLookBack = _menuSettings
- .getRiverSettings()
- .getLatestFcstBasisTimeLookBack();
- long lookBackWindowTimeLong = System.currentTimeMillis()
- - MILLIS_PER_HOUR * numOfHrsForLatestFcstLookBack;
-
- for (int i = 0; i < fcstFilesArray.length; i++) {
- // if file's last modified time is within the basis time
- // look back window
- if (fcstFilesArray[i].lastModified() >= lookBackWindowTimeLong) {
- String fileName = fcstFilesArray[i].getName();
- if (fileName.endsWith(".dat")) {
- RegularTimeSeries fcstRegularTimeSeries = loadForecastFileMapTimeSeries(fcstFilesArray[i]
- .getAbsolutePath());
-
- if (fcstRegularTimeSeries == null)
- continue;
-
- int indexOfUnderScore = fileName.indexOf('_');
- String lid = fileName.substring(0,
- indexOfUnderScore);
- _sshpLidFcstMap.put(lid, fcstRegularTimeSeries);
-
- // System.out.println("Read the sshp forecast
- // file["+ fcstFilesArray[i].getAbsolutePath()
- // +"] and added the time series to the map");
- }
- }
- }
- } else {
- _logger.log("Sshp fcst files are not available in the sshpfcst dir:["
- + _sshpFcstDataDir + "]");
- }
- }
- }
- }
-
- // -----------------------------------------------------------------------------------------------------------------------
-
- private RiverStatusRecord determineObsOrFcstRecordFromRiverStatus(
- String lid, String primaryPe, String tag, String fcstTs) {
- List riverStatusRecordList = new ArrayList();
- RiverStatusTable riverStatusTable = new RiverStatusTable(_db);
- RiverStatusRecord riverStatusRecord = null;
- Map tsRankMap = null;
- List tsDurExtValTimeList = new ArrayList();
- String whereClause = null;
-
- if (tag.compareTo("OBS") == 0) {
- whereClause = " where lid = " + "'" + lid + "'" + " and pe='"
- + primaryPe + "' and (ts like 'R%')"
- + " order by validtime desc";
- } else
- // Tag is FCST
- {
- int numOfHrsForBasisTimeLookBack = 1;
- numOfHrsForBasisTimeLookBack = _menuSettings.getRiverSettings()
- .getLatestFcstBasisTimeLookBack();
-
- long allowedBasisTime = System.currentTimeMillis()
- - (MILLIS_PER_HOUR * numOfHrsForBasisTimeLookBack);
-
- String allowedBasisTimeString = DbTimeHelper
- .getDateTimeStringFromLongTime(allowedBasisTime);
-
- if (fcstTs.compareTo("IngestFilter") == 0) {
- whereClause = " where lid = " + "'" + lid + "'" + " and pe='"
- + primaryPe + "' and (ts like 'F%')"
- + " and basistime >= '" + allowedBasisTimeString
- + "' order by value desc";
- } else
- // TS for fcst recs is chosen to be 'FF' or 'FZ'
- {
- whereClause = " where lid = " + "'" + lid + "'" + " and pe='"
- + primaryPe + "' and ts='" + fcstTs + "'"
- + " and basistime >= '" + allowedBasisTimeString + "'";
- }
- }
-
- // ("Tag:"+tag +" clause:"+ whereClause);
- try {
- riverStatusRecordList = riverStatusTable.select(whereClause);
- } catch (SQLException e) {
- logSQLException(e);
- }
-
- if (riverStatusRecordList.size() == 0)
- return riverStatusRecord;
-
- // Key for riverstatus table are lid, pe, ts. So we will get only one
- // record if
- // fcstTs is either FF or FZ .Hence the list size will be 1. So move to
- // else part
- // The below If logic will be used only if fcsTs has value IngestFilter.
- // If more than one rec is found then use ingest filter decide based on
- // ts rank
- // Else return the single record in the list.
- if (riverStatusRecordList.size() > 1) {
- for (int loopcnt = 0; loopcnt < riverStatusRecordList.size(); loopcnt++) {
- riverStatusRecord = (RiverStatusRecord) riverStatusRecordList
- .get(loopcnt);
- TsDurExtValTime tsDurExtValTime = new TsDurExtValTime();
-
- /*
- * System.out.println("statusrec
- * has:"+riverStatusRecord.getTs()+"|"+
- * riverStatusRecord.getDur()+"|"+
- * riverStatusRecord.getExtremum()+"|"+
- * riverStatusRecord.getValidtime()+"|"+
- * riverStatusRecord.getValue());
- */
-
- tsDurExtValTime.setTs(riverStatusRecord.getTs());
- tsDurExtValTime.setDuration(riverStatusRecord.getDur());
- tsDurExtValTime.setExtremum(riverStatusRecord.getExtremum());
- tsDurExtValTime.setTime(riverStatusRecord.getValidtime());
- tsDurExtValTime.setValue(riverStatusRecord.getValue());
- tsDurExtValTimeList.add(tsDurExtValTime);
-
- tsDurExtValTime = (TsDurExtValTime) tsDurExtValTimeList
- .get(loopcnt);
- /*
- * System.out.println("After add In list
- * loopcnt:"+loopcnt+"|"+tsDurExtValTime.getTs()+"
- * |"+tsDurExtValTime.getDuration()+"|"+
- * tsDurExtValTime.getExtremum());
- */
-
- }
- tsRankMap = createIngestFilterTsRankMap(lid, tsDurExtValTimeList,
- primaryPe);
- riverStatusRecord = compareTsRankAndRiverStatusInfo(tsRankMap,
- riverStatusRecordList, tsDurExtValTimeList);
-
- } else {
- riverStatusRecord = null;
- riverStatusRecord = (RiverStatusRecord) riverStatusRecordList
- .get(0);
- }
- /*
- * System.out.println("Rec is:"+ riverStatusRecord.getLid()+"|"+
- * riverStatusRecord.getPe()+"|"+riverStatusRecord.getTs()+"|"+
- * riverStatusRecord.getValue());
- */
-
- return riverStatusRecord;
- }
-
- private Map createIngestFilterTsRankMap(String lid,
- List tsDurExtValTimeList, String pe) {
- Map tsRankMap = new HashMap();
- IngestFilterTable ingestFilterTable = new IngestFilterTable(_db);
- IngestFilterRecord ingestFilterRecord = null;
- List ingestFilterRecordList = new ArrayList();
- String whereClause = null;
- String ts = null;
- int duration = 0;
- String extremum = null;
- TsDurExtValTime tsDurExt = null;
- Integer curTsRank = null;
-
- for (int loopcnt = 0; loopcnt < tsDurExtValTimeList.size(); loopcnt++) {
- tsDurExt = (TsDurExtValTime) tsDurExtValTimeList.get(loopcnt);
- ts = tsDurExt.getTs();
- duration = tsDurExt.getDuration();
- extremum = tsDurExt.getExtremum();
- // System.out.println("For:ts|dur|ext:"+ts+"|"+duration+"|"+extremum);
- try {
- whereClause = " where lid='" + lid + "' and pe='" + pe
- + "' and ts='" + ts + "' and dur=" + duration
- + " and extremum='" + extremum + "'";
-
- // System.out.println("ingestfilter whereclause:"+whereClause);
- ingestFilterRecordList = ingestFilterTable.select(whereClause);
- // System.out.println("after ingestfilter
- // whereclause:"+whereClause);
- if (ingestFilterRecordList.size() > 0) {
- ingestFilterRecord = (IngestFilterRecord) ingestFilterRecordList
- .get(0);
- curTsRank = new Integer(ingestFilterRecord.getTs_rank());
- } else {
- curTsRank = new Integer(-1);
- }
- /*
- * System.out.println("Before add to map ts|dur|ext|curtsrank: "+
- * ts+"|"+duration+"|"+extremum+"|"+ curTsRank);
- */
-
- tsRankMap.put(new Integer(loopcnt), curTsRank);
-
- // System.out.println("After Add to rankmap");
- } catch (SQLException e) {
- logSQLException(e);
- }
- }
-
- return tsRankMap;
- }
-
- private RiverStatusRecord compareTsRankAndRiverStatusInfo(Map tsRankMap,
- List riverStatusRecordList, List tsDurExtValTimeList) {
- RiverStatusRecord matchRiverStatusRecord = null;
- int prevTsRank = -1;
- int bestTsRank = -1;
- int matchIndex = -1;
- int cntOfSameTsRank = 0;
- List indexOfSameTsRankList = new ArrayList();
-
- // System.out.println("In compare function");
- for (int loopcnt = 0; loopcnt < riverStatusRecordList.size(); loopcnt++) {
- int curTsRank = new Integer(tsRankMap.get(new Integer(loopcnt))
- .toString()).intValue();
- if (curTsRank == -1)
- continue;
- if (bestTsRank == -1) {
- prevTsRank = curTsRank;
- bestTsRank = curTsRank;
- matchIndex = loopcnt;
- // System.out.println("loop:[ "+ loopcnt+"]:"+ bestTsRank+ " "+
- // matchIndex);
- } else {
- // System.out.println("Comparing curTsRank < bestTsRank" +
- // curTsRank + bestTsRank);
- if (curTsRank < bestTsRank) {
- prevTsRank = curTsRank;
- bestTsRank = curTsRank;
- matchIndex = loopcnt;
- // System.out.println("loop:[ "+ loopcnt+"]:"+ bestTsRank+ "
- // "+ matchIndex);
- } else {
- bestTsRank = prevTsRank;
- prevTsRank = curTsRank;
- // System.out.print("False");
- // System.out.println("loop:[ "+ loopcnt+"]:"+ bestTsRank+ "
- // "+ matchIndex);
- }
- }
- }
-
- // Match is found for highest ts_rank. Now check if there are multiple
- // ts with same ts rank.
- // If so consider all the recs in riverstatus that have the same ts rank
- // and decide as below.
- // For obs data consider the rec that has latest valid time.
- // For fcst data consider the rec that has max value.
- if (matchIndex != -1) {
- int highestTsRank = bestTsRank;
- int curTsRank;
-
- // System.out.println("riverstatsrecscnt:"+riverStatusRecordList.size());
- // System.out.println("tsranksize:"+tsRankMap.size());
- for (int loopcnt = 0; loopcnt < tsRankMap.size(); loopcnt++) {
- // System.out.println("here3:"+Integer.valueOf(tsRankMap.get(Integer.valueOf(loopcnt)).toString()).intValue());
- curTsRank = new Integer(tsRankMap.get(new Integer(loopcnt))
- .toString()).intValue();
-
- if (curTsRank == highestTsRank) {
- cntOfSameTsRank++;
- indexOfSameTsRankList.add(new Integer(loopcnt));
- }
- }
- if (cntOfSameTsRank == 1)
- matchRiverStatusRecord = (RiverStatusRecord) riverStatusRecordList
- .get(matchIndex);
- }
-
- // At this point more than 1 rec is got from riverstatus and
- // either no match is found in ingestfilter and since
- // Or multiple ts having same ts rank then do the following
- if (matchIndex == -1 || cntOfSameTsRank > 1) {
- // since we query the riverstatus with valid time desc/ value desc
- // for fcst/obs
- // respectively we will use the
- // first rec that match the highest rank ts amongst the recs
- // obtained
- int index = new Integer(indexOfSameTsRankList.get(0).toString())
- .intValue();
- matchRiverStatusRecord = (RiverStatusRecord) riverStatusRecordList
- .get(index);
- }
-
- /*
- * System.out.println("Final best match:"+
- * matchRiverStatusRecord.getLid()+"|"+
- * matchRiverStatusRecord.getPe()+"|"+ matchRiverStatusRecord.getTs()+
- * "|"+ matchRiverStatusRecord.getExtremum()+
- * "|"+matchRiverStatusRecord.getDur()+
- * "|"+matchRiverStatusRecord.getValue()+"|"+ "Rank: "+bestTsRank);
- */
- return matchRiverStatusRecord;
- }
-
- private class TsDurExtValTime {
- private String ts = null;
-
- private int duration = 0;
-
- private String extremum = null;
-
- private long time;
-
- private double value;
-
- protected void setTs(String ts) {
- this.ts = ts;
- }
-
- protected String getTs() {
- return this.ts;
- }
-
- protected void setDuration(int dur) {
- this.duration = dur;
- }
-
- protected int getDuration() {
- return this.duration;
- }
-
- protected void setExtremum(String ext) {
- this.extremum = ext;
- }
-
- protected String getExtremum() {
- return this.extremum;
- }
-
- protected long getTime() {
- return time;
- }
-
- protected void setTime(long time) {
- this.time = time;
- }
-
- protected double getValue() {
- return value;
- }
-
- protected void setValue(double value) {
- this.value = value;
- }
- }
-
- public class SshpFcstDetails {
- private double _crestValue;
-
- private long _crestTime;
-
- private long _timeAboveFldStg;
-
- private long _basisTime;
-
- public SshpFcstDetails() {
- _crestValue = DbTable.getNullDouble();
- _crestTime = DbTable.getNullLong();
- _timeAboveFldStg = DbTable.getNullLong();
- _basisTime = DbTable.getNullLong();
- }
-
- public long getBasisTime() {
- return _basisTime;
- }
-
- public void setBasisTime(long basisTime) {
- this._basisTime = basisTime;
- }
-
- public long getCrestTime() {
- return _crestTime;
- }
-
- public void setCrestTime(long crestTime) {
- this._crestTime = crestTime;
- }
-
- public double getCrestValue() {
- return _crestValue;
- }
-
- public void setCrestValue(double crestValue) {
- this._crestValue = crestValue;
- }
-
- public long getTimeAboveFldStg() {
- return _timeAboveFldStg;
- }
-
- public void setTimeAboveFldStg(long timeAboveFldStg) {
- this._timeAboveFldStg = timeAboveFldStg;
- }
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverMonitorJTableRowData.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverMonitorJTableRowData.java
deleted file mode 100755
index cd0cd3e3c1..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverMonitorJTableRowData.java
+++ /dev/null
@@ -1,1947 +0,0 @@
-package ohd.hseb.monitor.river;
-
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import ohd.hseb.db.DbTable;
-import ohd.hseb.ihfsdb.generated.VTECeventRecord;
-import ohd.hseb.monitor.MonitorCell;
-import ohd.hseb.monitor.ThreatLevel;
-import ohd.hseb.monitor.derivedcolumns.DerivedColumn;
-import ohd.hseb.monitor.precip.PrecipColumns;
-import ohd.hseb.monitor.precip.PrecipData;
-import ohd.hseb.monitor.precip.settings.PrecipColumnDataSettings;
-import ohd.hseb.monitor.river.RiverMonitorDataManager.SshpFcstDetails;
-import ohd.hseb.monitor.river.settings.RiverMonitorMenuSettings;
-import ohd.hseb.util.MathHelper;
-import ohd.hseb.util.SessionLogger;
-import ohd.hseb.util.TimeHelper;
-import ohd.hseb.util.gui.jtable.AbstractJTableRowData;
-import ohd.hseb.util.gui.jtable.CellType;
-
-public class RiverMonitorJTableRowData extends AbstractJTableRowData /*implements JTableRowData */
-{
- private int _defaultDecimalPoints = 2;
-
- private static Map _derivedReturnTypeToCellTypeMap = new HashMap();
-
- private String _groupName;
- private String _lid;
- private String _name;
- private String _county;
- private String _state;
- private String _hsa;
- private String _stream;
- private String _riverBasin;
- private double _bankFull;
- private double _actionStage;
- private double _floodStage;
- private double _foodFlow;
- private double _actionFlow;
- private String _groupId;
- private double _latestObsValue;
- private long _latestObsTime;
- private double _latestStgValue;
- private long _latestStgTime;
- private double _latestFlowValue;
- private long _latestFlowTime;
- private double _maxFcstValue;
- private long _maxFcstValidTime;
- private long _maxFcstBasisTime;
- private double _sshpMaxFcstValue;
- private long _sshpMaxFcstTime;
- private long _sshpFcstBasisTime;
- private long _sshpFcstFloodTime;
- private int _groupOrdinal;
- private int _locationOrdinal;
- private double _obsFcstMax;
- private double _fldStgDeparture;
- private double _actStgDeparture;
- private double _minorStage;
- private double _majorStage;
- private double _moderateStage;
- private List _derivedColumnsDetailsList;
- private List _vtecEventList;
- private boolean _alertUpperLimit = false;
- private boolean _alarmUpperLimit = false;
- private boolean _alertLowerLimit = false;
- private boolean _alarmLowerLimit = false;
- private boolean _alertRocLimit = false;
- private boolean _alarmRocLimit = false;
- private boolean _alertDiffLimit = false;
- private boolean _alarmDiffLimit = false;
- private String _primaryRiverPe;
- private String _obsTypeSource;
- private String _fcstTypeSource;
- protected RiverMonitorDataManager _riverMonitorDataManager;
- protected RiverMonitorVtecEventDataManager _riverMonitorVtecEventDataManager;
- private String _toolTipTextForAlertAlarmSummary;
- private String _toolTipTextForThreatSummary;
- private String _toolTipTextForPrecipThreatSummary;
- private SshpFcstDetails _sshpFcstDetails;
-
- private PrecipData _precipData;
- private SessionLogger _logger;
-
- private static Set _ignoreColumnNameForThreatSet = new HashSet();
-
- private RiverMonitorMenuSettings _menuSettings;
-
- static
- {
- _derivedReturnTypeToCellTypeMap.put("boolean", CellType.BOOLEAN);
- _derivedReturnTypeToCellTypeMap.put("double", CellType.DOUBLE);
- _derivedReturnTypeToCellTypeMap.put("float", CellType.FLOAT);
- _derivedReturnTypeToCellTypeMap.put("long", CellType.LONG);
- _derivedReturnTypeToCellTypeMap.put("int", CellType.INTEGER);
- _derivedReturnTypeToCellTypeMap.put("string", CellType.STRING);
-
- _ignoreColumnNameForThreatSet.add(RiverColumns.LAT_FLOW_TIME);
- _ignoreColumnNameForThreatSet.add(RiverColumns.LAT_FLOW_VALUE);
- _ignoreColumnNameForThreatSet.add(RiverColumns.LAT_STG_TIME);
- _ignoreColumnNameForThreatSet.add(RiverColumns.LAT_STG_VALUE);
-
- }
-
- public RiverMonitorJTableRowData()
- {
-
- }
-
- public RiverMonitorJTableRowData(String missingRepresentation, RiverMonitorDataManager riverMonitorDataManager,
- SessionLogger logger, RiverMonitorMenuSettings menuSettings)
- {
- setMissingRepresentation(missingRepresentation);
- _riverMonitorDataManager = riverMonitorDataManager;
- _logger = logger;
-
- _menuSettings = menuSettings;
- }
-
- //-----------------------------------------------------------------
- // Copy constructor
- //-----------------------------------------------------------------
- public RiverMonitorJTableRowData(RiverMonitorJTableRowData origRecord)
- {
- setLid(origRecord.getLid());
- setName(origRecord.getName());
- setCounty(origRecord.getCounty());
- setState(origRecord.getState());
- setHsa(origRecord.getHsa());
- setStream(origRecord.getStream());
- setRiverBasin(origRecord.getRiverBasin());
- setBankFull(origRecord.getBankFull());
- setActionStage(origRecord.getActionStage());
- setFloodStage(origRecord.getFloodStage());
- setFloodFlow(origRecord.getFloodFlow());
- setActionFlow(origRecord.getActionFlow());
- setGroupId(origRecord.getGroupId());
- setGroupName(origRecord.getGroupName());
- }
-
- public String getLid()
- {
- return _lid;
- }
-
- public void setLid(String lid)
- {
- this._lid = lid ;
- }
-
- public String getName()
- {
- return _name;
- }
-
- public void setName(String name)
- {
- this._name = name ;
- }
-
- public String getCounty()
- {
- return _county;
- }
-
- public void setCounty(String county)
- {
- this._county = county ;
- }
-
- public String getState()
- {
- return _state;
- }
-
- public void setState(String state)
- {
- this._state = state ;
- }
-
- public String getHsa()
- {
- return _hsa;
- }
-
- public void setHsa(String hsa)
- {
- this._hsa = hsa ;
- }
-
- public String getStream()
- {
- return _stream;
- }
-
- public void setStream(String stream)
- {
- this._stream = stream ;
- }
-
- public double getBankFull()
- {
- return _bankFull;
- }
-
- public void setBankFull(double bankFull)
- {
- this._bankFull = bankFull ;
- }
-
- public double getActionStage()
- {
- return _actionStage;
- }
-
- public void setActionStage(double actionStage)
- {
- this._actionStage = actionStage ;
- }
-
- public double getFloodStage()
- {
- return _floodStage;
- }
-
- public void setFloodStage(double floodStage)
- {
- this._floodStage = floodStage ;
- }
-
- public double getFloodFlow()
- {
- return _foodFlow;
- }
-
- public void setFloodFlow(double floodFlow)
- {
- this._foodFlow = floodFlow ;
- }
-
- public double getActionFlow()
- {
- return _actionFlow;
- }
-
- public void setActionFlow(double actionFlow)
- {
- this._actionFlow = actionFlow ;
- }
-
- public String getGroupName()
- {
- return _groupName;
- }
-
- public void setGroupName(String groupName)
- {
- this._groupName = groupName ;
- }
-
- public String getGroupId()
- {
- return _groupId;
- }
-
- public void setGroupId(String groupId)
- {
- this._groupId = groupId ;
- }
-
- public double getLatestObsValue()
- {
- return _latestObsValue;
- }
-
- public void setLatestObsValue(double latestObsValue)
- {
- this._latestObsValue = latestObsValue ;
- }
-
- public long getLatestObsTime()
- {
- return _latestObsTime;
- }
-
- public void setLatestObsTime(long latestObsTime)
- {
- this._latestObsTime = latestObsTime ;
- }
-
- public double getLatestStgValue()
- {
- return _latestStgValue;
- }
-
- public void setLatestStgValue(double latestStgValue)
- {
- this._latestStgValue = latestStgValue ;
- }
-
- public long getLatestStgTime()
- {
- return _latestStgTime;
- }
-
- public void setLatestStgTime(long latestStgTime)
- {
- this._latestStgTime = latestStgTime ;
- }
-
- public double getLatestFlowValue()
- {
- return _latestFlowValue;
- }
-
- public void setLatestFlowValue(double latestFlowValue)
- {
- this._latestFlowValue = latestFlowValue ;
- }
-
- public long getLatestFlowTime()
- {
- return _latestFlowTime;
- }
-
- public void setLatestFlowTime(long latestFlowTime)
- {
- this._latestFlowTime = latestFlowTime ;
- }
-
- public double getMaxFcstValue()
- {
- return _maxFcstValue;
- }
-
- public void setMaxFcstValue(double maxFcstValue)
- {
- this._maxFcstValue = maxFcstValue ;
- }
-
- public long getMaxFcstValidTime()
- {
- return _maxFcstValidTime;
- }
-
- public void setMaxFcstValidTime(long maxFcstValidTime)
- {
- this._maxFcstValidTime = maxFcstValidTime;
- }
-
- public long getMaxFcstBasisTime()
- {
- return _maxFcstBasisTime;
- }
-
- public void setMaxFcstBasisTime(long maxFcstBasisTime)
- {
- this._maxFcstBasisTime = maxFcstBasisTime;
- }
-
- public long getSshpFcstBasisTime()
- {
- if(_sshpFcstDetails != null)
- _sshpFcstBasisTime = _sshpFcstDetails.getBasisTime();
- else
- _sshpFcstBasisTime = DbTable.getNullLong();
- return _sshpFcstBasisTime;
- }
-
- public void setSshpFcstBasisTime(long sshpFcstBasisTime)
- {
- this._sshpFcstBasisTime = sshpFcstBasisTime;
- }
-
- public long getSshpFcstFloodTime()
- {
- if(_sshpFcstDetails != null)
- _sshpFcstFloodTime = _sshpFcstDetails.getTimeAboveFldStg();
- else
- _sshpFcstFloodTime = DbTable.getNullLong();
- return _sshpFcstFloodTime;
- }
-
- public void setSshpFcstFloodTime(long sshpFcstFloodTime)
- {
- this._sshpFcstFloodTime = sshpFcstFloodTime;
- }
-
- public long getSshpMaxFcstValidTime()
- {
- if(_sshpFcstDetails != null)
- _sshpMaxFcstTime = _sshpFcstDetails.getCrestTime();
- else
- _sshpMaxFcstTime = DbTable.getNullLong();
- return _sshpMaxFcstTime;
- }
-
- public void setSshpMaxFcstValidTime(long sshpMaxFcstTime)
- {
- this._sshpMaxFcstTime = sshpMaxFcstTime;
- }
-
- public double getSshpMaxFcstValue()
- {
- if(_sshpFcstDetails != null)
- _sshpMaxFcstValue = _sshpFcstDetails.getCrestValue();
- else
- _sshpMaxFcstValue = DbTable.getNullDouble();
- return _sshpMaxFcstValue;
- }
-
- public void setSshpMaxFcstValue(double sshpMaxFcstValue)
- {
- this._sshpMaxFcstValue = sshpMaxFcstValue;
- }
-
- public int getGroupOrdinal()
- {
- return _groupOrdinal;
- }
-
- public void setGroupOrdinal(int groupOrdinal)
- {
- this._groupOrdinal = groupOrdinal ;
- }
-
- public int getLocationOrdinal()
- {
- return _locationOrdinal;
- }
-
- public void setLocationOrdinal(int locationOrdinal)
- {
- this._locationOrdinal = locationOrdinal ;
- }
-
- public void setObsFcstMax(double obsFcstMax)
- {
- this._obsFcstMax = obsFcstMax;
- }
-
- public double getObsFcstMax()
- {
- return _obsFcstMax;
- }
-
- public void setFldStgDeparture(double fldStgDeparture)
- {
- this._fldStgDeparture = fldStgDeparture;
- }
-
- public double getFldStgDeparture()
- {
- return _fldStgDeparture;
- }
-
- public void setActStgDeparture(double actStgDeparture)
- {
- this._actStgDeparture = actStgDeparture;
- }
-
- public double getActStgDeparture()
- {
- return _actStgDeparture;
- }
-
- public void setMinorStage(double minorStage)
- {
- this._minorStage = minorStage;
- }
-
- public double getMinorStage()
- {
- return _minorStage;
- }
-
- public void setMajorStage(double majorStage)
- {
- this._majorStage = majorStage;
- }
-
- public double getMajorStage()
- {
- return _majorStage;
- }
-
- public void setModerateStage(double moderateStage)
- {
- this._moderateStage = moderateStage;
- }
-
- public double getModerateStage()
- {
- return _moderateStage;
- }
-
- public void setDerivedColumnsDetailsList(List list)
- {
- _derivedColumnsDetailsList = list;
- }
-
- public List getDerivedColumnsDetailsList()
- {
- return _derivedColumnsDetailsList;
- }
-
- private List getVtecEventList()
- {
- return _vtecEventList;
- }
-
- public void setVtecEventList(List list)
- {
- _vtecEventList = list;
- _riverMonitorVtecEventDataManager = new RiverMonitorVtecEventDataManager(_vtecEventList);
- }
-
- public RiverMonitorVtecEventDataManager getVtecEventDataManager()
- {
- return _riverMonitorVtecEventDataManager;
- }
-
- public boolean getAlertUpperLimit()
- {
- return _alertUpperLimit;
- }
-
- public void setAlertUpperLimit(boolean alertUpperLimit)
- {
- _alertUpperLimit = alertUpperLimit;
- }
-
- public boolean getAlarmUpperLimit()
- {
- return _alarmUpperLimit;
- }
-
- public void setAlarmUpperLimit(boolean alarmUpperLimit)
- {
- _alarmUpperLimit = alarmUpperLimit;
- }
-
- public boolean getAlertLowerLimit()
- {
- return _alertLowerLimit;
- }
-
- public void setAlertLowerLimit(boolean alertLowerLimit)
- {
- _alertLowerLimit = alertLowerLimit;
- }
-
- public boolean getAlarmLowerLimit()
- {
- return _alarmLowerLimit;
- }
-
- public void setAlarmLowerLimit(boolean alarmLowerLimit)
- {
- _alarmLowerLimit = alarmLowerLimit;
- }
-
- public boolean getAlertRocLimit()
- {
- return _alertRocLimit;
- }
-
- public void setAlertRocLimit(boolean alertRocLimit)
- {
- _alertRocLimit = alertRocLimit;
- }
-
- public boolean getAlarmRocLimit()
- {
- return _alarmRocLimit;
- }
-
- public void setAlarmRocLimit(boolean alarmRocLimit)
- {
- _alarmRocLimit = alarmRocLimit;
- }
-
- public boolean getAlertDiffLimit()
- {
- return _alertDiffLimit;
- }
-
- public void setAlertDiffLimit(boolean alertDiffLimit)
- {
- _alertDiffLimit = alertDiffLimit;
- }
-
- public boolean getAlarmDiffLimit()
- {
- return _alarmDiffLimit;
- }
-
- public void setAlarmDiffLimit(boolean alarmDiffLimit)
- {
- _alarmDiffLimit = alarmDiffLimit;
- }
-
- public String getPrimaryRiverPe()
- {
- return _primaryRiverPe;
- }
-
- public void setPrimaryRiverPe(String pe)
- {
- _primaryRiverPe = pe;
- }
-
- public PrecipData getPrecipData()
- {
- return _precipData;
- }
-
- public void setPrecipData(PrecipData precipData)
- {
- _precipData = precipData;
- }
-
- public String getToolTipTextForAlertAlarmSummary()
- {
- return _toolTipTextForAlertAlarmSummary;
- }
-
- public void setToolTipTextForAlertAlarmSummary(String toolTipText)
- {
- _toolTipTextForAlertAlarmSummary = toolTipText;
- }
-
- public String getObsTypeSource()
- {
- return _obsTypeSource;
- }
-
- public void setObsTypeSource(String obsTypeSource)
- {
- _obsTypeSource = obsTypeSource;
- }
-
- public String getFcstTypeSource()
- {
- return _fcstTypeSource;
- }
-
- public void setFcstTypeSource(String fcstTypeSource)
- {
- _fcstTypeSource = fcstTypeSource;
- }
-
- public VTECeventRecord getVtecEventRecordForEndTime()
- {
- return _riverMonitorVtecEventDataManager.getVtecEventRecordForEndTime();
- }
-
- public VTECeventRecord getVtecEventRecordForExpireTime()
- {
- return _riverMonitorVtecEventDataManager.getVtecEventRecordForExpireTime();
- }
-
- public SshpFcstDetails getSshpFcstDetails()
- {
- return _sshpFcstDetails;
- }
-
- public void setSshpFcstDetails(SshpFcstDetails sshpFcstDetails)
- {
- this._sshpFcstDetails = sshpFcstDetails;
- }
-
- public String getStringValue(long value, long missingValue)
- {
- String result = super.getStringValue(value, missingValue);
- if(result != super.getMissingRepresentation())
- {
- String tempStr = result.substring(5, result.length()-3);
- tempStr = tempStr.replace('-','/');
- tempStr = tempStr.replace(' ', '-');
- result = tempStr;
- }
- return result;
- }
-
- // If primary pe is null assume it to be stage.
- protected boolean isPrimaryPeStage()
- {
- boolean result = true;
- if(_primaryRiverPe != null)
- {
- if(_primaryRiverPe.length() != 2)
- {
- System.out.println("Primarype:["+ _primaryRiverPe+"]"+ "lid:"+getLid()+ "len:"+ _primaryRiverPe.length());
- }
- if(_primaryRiverPe.charAt(0) != 'H')
- result = false;
- }
- return result;
- }
-
- public String getVtecSummary()
- {
- return (_riverMonitorVtecEventDataManager.getVtecSummary());
- }
-
- public long getEventEndTime()
- {
- int numOfHrsForVtecEventProductTimeLookBack = _menuSettings.getRiverSettings().getVtecEventProductTimeLookBack();
- long earliestAcceptableTimeForVtecEventProductTimeLookBack = System.currentTimeMillis() - TimeHelper.MILLIS_PER_HOUR * numOfHrsForVtecEventProductTimeLookBack;
-
- return (_riverMonitorVtecEventDataManager.getEventEndTime(earliestAcceptableTimeForVtecEventProductTimeLookBack));
- }
-
- public long getUGCExpireTime()
- {
- int numOfHrsForVtecEventProductTimeLookBack = _menuSettings.getRiverSettings().getVtecEventProductTimeLookBack();
- long earliestAcceptableTimeForVtecEventProductTimeLookBack = System.currentTimeMillis() - TimeHelper.MILLIS_PER_HOUR * numOfHrsForVtecEventProductTimeLookBack;
-
- return (_riverMonitorVtecEventDataManager.getUGCExpireTime(earliestAcceptableTimeForVtecEventProductTimeLookBack));
- }
-
- public String getAlertAlarmSummary()
- {
- String summary = "";
- StringBuffer summaryStringBufffer = new StringBuffer("");
- StringBuffer toolTipStringBuffer = new StringBuffer("");
- if(_alertUpperLimit || _alarmUpperLimit || _alertLowerLimit || _alarmLowerLimit|| _alertRocLimit ||
- _alarmRocLimit || _alertDiffLimit || _alarmDiffLimit)
- {
- toolTipStringBuffer.append("");
- }
- _toolTipTextForAlertAlarmSummary = "";
- if(_alertUpperLimit)
- {
- summaryStringBufffer = summaryStringBufffer.append("u");
- toolTipStringBuffer.append("u: Value Exceeded Alert Upper Limit\n
");
- }
- else if(_alarmUpperLimit)
- {
- summaryStringBufffer = summaryStringBufffer.append("U");
- toolTipStringBuffer.append("U: Value Exceeded Alarm Upper Limit\n
");
- }
- if(_alertLowerLimit)
- {
- summaryStringBufffer = summaryStringBufffer.append("l");
- toolTipStringBuffer.append("l: Value Exceeded Alert Lower Limit\n
");
- }
- else if(_alarmLowerLimit)
- {
- summaryStringBufffer = summaryStringBufffer.append("L");
- toolTipStringBuffer.append("L: Value Exceeded Alarm Lower Limit\n
");
- }
- if(_alertRocLimit)
- {
- summaryStringBufffer = summaryStringBufffer.append("c");
- toolTipStringBuffer.append("c: Value Exceeded Alert ROC Limit
");
- }
- else if(_alarmRocLimit)
- {
- summaryStringBufffer = summaryStringBufffer.append("C");
- toolTipStringBuffer.append("C: Value Exceeded Alarm ROC Limit
");
- }
- if(_alertDiffLimit)
- {
- summaryStringBufffer = summaryStringBufffer.append("d");
- toolTipStringBuffer.append("d: Value Exceeded Alert Diff Limit\n
");
- }
- else if(_alarmDiffLimit)
- {
- summaryStringBufffer = summaryStringBufffer.append("D");
- toolTipStringBuffer.append("D: Value Exceeded Alarm Diff Limit\n
");
- }
-
- summary = summaryStringBufffer.toString();
- _toolTipTextForAlertAlarmSummary = toolTipStringBuffer.toString();
- return summary;
- }
-
- public String getToolTipTextForThreatSummary()
- {
- return _toolTipTextForThreatSummary;
- }
-
- public void setToolTipTextForThreatSummary(String toolTipText)
- {
- _toolTipTextForThreatSummary = toolTipText;
- }
-
- public String getToolTipTextForPrecipThreatSummary()
- {
- return _toolTipTextForPrecipThreatSummary;
- }
-
- public void setToolTipTextForPrecipThreatSummary(String toolTipText)
- {
- _toolTipTextForPrecipThreatSummary = toolTipText;
- }
-
-
- public void addAllCellsToMap()
- {
- ThreatLevel defaultThreatLevel = ThreatLevel.NO_THREAT;
- MonitorCell cell = null;
- String header = "RiverMonitorJTableRowData2.addAllCellsToMap(): ";
-
- String dateTimeFormatString = "MM/dd - HH:mm";
-
- //static data
-
- addToCellMap(RiverColumns.PRIMARY_RIVER_PE, CellType.STRING, getPrimaryRiverPe() );
-
- addToCellMap(RiverColumns.GROUP_NAME, CellType.STRING, getGroupName() );
- addToCellMap(RiverColumns.GROUP_ID, CellType.STRING, getGroupId() );
- addToCellMap(RiverColumns.GROUP_ORDINAL, CellType.INTEGER, getGroupOrdinal());
-
- addToCellMap(RiverColumns.LOCATION_ID, CellType.STRING, getLid() );
- addToCellMap(RiverColumns.LOCATION_NAME, CellType.STRING, getName() );
- addToCellMap(RiverColumns.LOCATION_ORDINAL, CellType.INTEGER, getLocationOrdinal());
-
- addToCellMap(RiverColumns.COUNTY, CellType.STRING, getCounty() );
-
- addToCellMap(RiverColumns.STATE, CellType.STRING, getState() );
- addToCellMap(RiverColumns.STREAM, CellType.STRING, getStream() );
- addToCellMap(RiverColumns.RIVER_BASIN, CellType.STRING, getRiverBasin() );
- addToCellMap(RiverColumns.HSA, CellType.STRING, getHsa() );
- addToCellMap(RiverColumns.BANK_FULL, CellType.DOUBLE, getBankFull() );
- addToCellMap(RiverColumns.FLD_STG, CellType.DOUBLE, getFloodStage() );
- addToCellMap(RiverColumns.ACT_STG, CellType.DOUBLE, getActionStage() );
-
- addToCellMap(RiverColumns.FLD_FLOW, CellType.DOUBLE, getFloodFlow(), defaultThreatLevel, getMissingRepresentation(), 0);
- addToCellMap(RiverColumns.ACT_FLOW, CellType.DOUBLE, getActionFlow(), defaultThreatLevel, getMissingRepresentation(), 0);
-
- addToCellMap(RiverColumns.MIN_STG, CellType.DOUBLE, getMinorStage());
- addToCellMap(RiverColumns.MAJ_STG, CellType.DOUBLE, getMajorStage());
- addToCellMap(RiverColumns.MOD_STG, CellType.DOUBLE, getModerateStage());
-
- //dynamic data
- int numOfHrsForObsLookBack = _menuSettings.getRiverSettings().getLatestObsLookBack();
- long earliestAcceptableTimeForObs = System.currentTimeMillis() - TimeHelper.MILLIS_PER_HOUR * numOfHrsForObsLookBack;
-
- // latest obs value and time
- ThreatLevel latestObsValueThreatLevel = getThreatLevelForLatestObsValue(earliestAcceptableTimeForObs);
- addToCellMap(RiverColumns.LAT_OBS_VALUE, CellType.DOUBLE,
- getLatestObsValue(), latestObsValueThreatLevel,
- getMissingRepresentation());
-
- ThreatLevel latestObsTimeThreatLevel = getThreatLevelForThisTime(getLatestObsTime(), earliestAcceptableTimeForObs);
- addToCellMap(RiverColumns.LAT_OBS_TIME, CellType.DATE_TIME,
- getLatestObsTime(), latestObsTimeThreatLevel,
- getMissingRepresentation(), dateTimeFormatString );
-
-
- // latest stage value and time
- ThreatLevel latestStageValueThreatLevel = getThreatLevelForStage(getLatestStgValue(),getLatestStgTime(), earliestAcceptableTimeForObs);
- addToCellMap(RiverColumns.LAT_STG_VALUE, CellType.DOUBLE, getLatestStgValue(), latestStageValueThreatLevel, getMissingRepresentation(), 2);
-
- ThreatLevel latestStageTimeThreatLevel = getThreatLevelForThisTime(getLatestStgTime(), earliestAcceptableTimeForObs);
- addToCellMap(RiverColumns.LAT_STG_TIME, CellType.DATE_TIME, getLatestStgTime(), latestStageTimeThreatLevel, getMissingRepresentation(), dateTimeFormatString);
-
-
- // latest flow value and time
- ThreatLevel latestFlowValueThreatLevel = getThreatLevelForFlow(getLatestFlowValue(), getLatestFlowTime(), earliestAcceptableTimeForObs );
- addToCellMap(RiverColumns.LAT_FLOW_VALUE, CellType.DOUBLE, getLatestFlowValue(), latestFlowValueThreatLevel);
-
- ThreatLevel latestFlowTimeThreatLevel = getThreatLevelForThisTime(getLatestFlowTime(), earliestAcceptableTimeForObs);
- addToCellMap(RiverColumns.LAT_FLOW_TIME, CellType.DATE_TIME, getLatestFlowTime(), latestFlowTimeThreatLevel, getMissingRepresentation(), dateTimeFormatString);
-
-
- int numOfHrsForFcstLookBack = _menuSettings.getRiverSettings().getLatestFcstBasisTimeLookBack();
- long earliestAcceptableTimeForFcst = System.currentTimeMillis() - TimeHelper.MILLIS_PER_HOUR * numOfHrsForFcstLookBack;
-
- //max forecast
- ThreatLevel maxForecastThreatLevel = getThreatLevelForMaxFcstValue(earliestAcceptableTimeForFcst);
- addToCellMap(RiverColumns.MAX_FCST_VALUE, CellType.DOUBLE, getMaxFcstValue(), maxForecastThreatLevel);
-
- addToCellMap(RiverColumns.MAX_FCST_VALID_TIME, CellType.DATE_TIME, getMaxFcstValidTime(), defaultThreatLevel, getMissingRepresentation(), dateTimeFormatString);
- addToCellMap(RiverColumns.MAX_FCST_BASIS_TIME, CellType.DATE_TIME, getMaxFcstBasisTime(), defaultThreatLevel, getMissingRepresentation(), dateTimeFormatString);
-
- //sshp forecast
- addToCellMap(RiverColumns.SSHP_MAX_FCST_VALID_TIME, CellType.DATE_TIME, getSshpMaxFcstValidTime(), defaultThreatLevel, getMissingRepresentation(), dateTimeFormatString);
- addToCellMap(RiverColumns.SSHP_FCST_BASIS_TIME, CellType.DATE_TIME, getSshpFcstBasisTime(), defaultThreatLevel, getMissingRepresentation(), dateTimeFormatString);
-
- ThreatLevel maxSshpForecastThreatLevel = getThreatLevelForSshpFcstValue(earliestAcceptableTimeForFcst);
- addToCellMap(RiverColumns.SSHP_MAX_FCST_VALUE, CellType.DOUBLE, getSshpMaxFcstValue(), maxSshpForecastThreatLevel);
-
- ThreatLevel maxSshpFcstFloodTimeThreatLevel = getThreatLevelForSshpTimeAboveFloodLevel(earliestAcceptableTimeForFcst);
- addToCellMap(RiverColumns.SSHP_FCST_FLD_TIME, CellType.DATE_TIME, getSshpFcstFloodTime(), maxSshpFcstFloodTimeThreatLevel, getMissingRepresentation(), dateTimeFormatString);
-
- ThreatLevel obsFcstMaxThreatLevel = getThreatLevelForObsFcstMax();
- addToCellMap(RiverColumns.OBSFCST_MAX, CellType.DOUBLE, getObsFcstMax(), obsFcstMaxThreatLevel, getMissingRepresentation(), 2);
-
- //stg departures
- addToCellMap(RiverColumns.FLD_STG_DEP, CellType.DOUBLE, getFldStgDeparture());
- addToCellMap(RiverColumns.ACT_STG_DEP, CellType.DOUBLE, getActStgDeparture());
-
- addToCellMap(PrecipColumns.LATEST_PRECIP_PARAM_CODE, CellType.STRING, getPrecipData().getLatestPrecipParamCodeString() );
-
- addToCellMap(PrecipColumns.LATEST_30MIN, CellType.DOUBLE, getPrecipData().getLatestPrecip30Min());
- addToCellMap(PrecipColumns.LATEST_1HR, CellType.DOUBLE, getPrecipData().getLatestPrecip1Hr(), getThreatLevelForPrecipColumn("INSTANT", 1));
- addToCellMap(PrecipColumns.LATEST_3HR, CellType.DOUBLE, getPrecipData().getLatestPrecip3Hr(), getThreatLevelForPrecipColumn("INSTANT", 3));
- addToCellMap(PrecipColumns.LATEST_6HR, CellType.DOUBLE, getPrecipData().getLatestPrecip6Hr(), getThreatLevelForPrecipColumn("INSTANT", 6));
-
- addToCellMap(PrecipColumns.LATEST_12HR, CellType.DOUBLE, getPrecipData().getLatestPrecip12Hr());
- addToCellMap(PrecipColumns.LATEST_18HR, CellType.DOUBLE, getPrecipData().getLatestPrecip18Hr());
- addToCellMap(PrecipColumns.LATEST_24HR, CellType.DOUBLE, getPrecipData().getLatestPrecip24Hr());
-
- addToCellMap(PrecipColumns.TOH_PRECIP_1HR_PARAM_CODE, CellType.STRING, getPrecipData().getTohPrecip1HrParamCodeString() );
-
- addToCellMap(PrecipColumns.TOH_PRECIP_1HR, CellType.DOUBLE, getPrecipData().getTohPrecip1Hr(), getThreatLevelForPrecipColumn("PRECIP", 1));
-
- addToCellMap(PrecipColumns.FFG_1HR, CellType.DOUBLE, getPrecipData().getFFG1Hr());
- addToCellMap(PrecipColumns.FFG_3HR, CellType.DOUBLE, getPrecipData().getFFG3Hr());
- addToCellMap(PrecipColumns.FFG_6HR, CellType.DOUBLE, getPrecipData().getFFG6Hr());
-
- addToCellMap(PrecipColumns.DIFF_1HR, CellType.DOUBLE, getPrecipData().getDiff1Hr(), getThreatLevelForPrecipColumn("DIFF", 1));
- addToCellMap(PrecipColumns.DIFF_3HR, CellType.DOUBLE, getPrecipData().getDiff3Hr(), getThreatLevelForPrecipColumn("DIFF", 3));
- addToCellMap(PrecipColumns.DIFF_6HR, CellType.DOUBLE, getPrecipData().getDiff6Hr(), getThreatLevelForPrecipColumn("DIFF", 6));
-
- addToCellMap(PrecipColumns.RATIO_1HR, CellType.INTEGER, getPrecipData().getRatio1Hr(), getThreatLevelForPrecipColumn("RATIO", 1));
- addToCellMap(PrecipColumns.RATIO_3HR, CellType.INTEGER, getPrecipData().getRatio3Hr(), getThreatLevelForPrecipColumn("RATIO", 3));
- addToCellMap(PrecipColumns.RATIO_6HR, CellType.INTEGER, getPrecipData().getRatio6Hr(), getThreatLevelForPrecipColumn("RATIO", 6));
-
- addToCellMap(RiverColumns.ALERT_ALARM, CellType.STRING, getAlertAlarmSummary(), getThreatLevelForAlertAlarmSummary());
-
- int numOfHrsForVtecEventEndTimeLookAhead = 1;
- numOfHrsForVtecEventEndTimeLookAhead = _menuSettings.getRiverSettings().getVtecEventEndTimeApproach();
- ThreatLevel vtecEventTimeThreatLevel = getThreatLevelForVtecTimeCell(getEventEndTime(), numOfHrsForVtecEventEndTimeLookAhead);
-
- addToCellMap(RiverColumns.VTEC_SUMMARY, CellType.STRING, getVtecSummary(),vtecEventTimeThreatLevel) ;
-
- // use a different missing representation
- String vtecTimeMissingRepresentation = getEventEndTimeOrUgcExpireTimeMissingRepresentation(getMissingRepresentation());
- addToCellMap(RiverColumns.EVENT_END_TIME, CellType.DATE_TIME, getEventEndTime(), vtecEventTimeThreatLevel, vtecTimeMissingRepresentation, dateTimeFormatString );
-
- int numOfHrsForExpireTimeLookAhead = 1;
- numOfHrsForExpireTimeLookAhead = _menuSettings.getRiverSettings().getUgcExpireTimeApproach();
- ThreatLevel vtecUgcExpireTimeThreatLevel = getThreatLevelForVtecTimeCell(getUGCExpireTime(), numOfHrsForExpireTimeLookAhead);
-
- addToCellMap(RiverColumns.UGC_EXPIRE_TIME, CellType.DATE_TIME, getUGCExpireTime(), vtecUgcExpireTimeThreatLevel, vtecTimeMissingRepresentation, dateTimeFormatString);
-
- ThreatLevel threatLevel = getThreatLevelForPrecipThreatSummary();
- cell = addToCellMap(PrecipColumns.PRECIP_THREAT, CellType.EXTENSION,
- getPrecipThreatSummary(), threatLevel,
- getMissingRepresentation());
-
- threatLevel = getThreatLevelForThreatSummary();
- cell = addToCellMap(RiverColumns.THREAT, CellType.EXTENSION,
- getThreatSummary(), threatLevel,
- getMissingRepresentation());
-
-
- // addCell(cell);
-
- } //end addAllCellsToMap
-
- // -----------------------------------------------------------------------------------
- public double round(double value, int decimalPlacesToMaintain)
- {
- return MathHelper.roundToNDecimalPlaces(value, decimalPlacesToMaintain);
- }
-
- // -----------------------------------------------------------------------------------
-
- public String getEventEndTimeOrUgcExpireTimeMissingRepresentation(String standardMissingRepresentation)
- {
- String missingRepresentationString = standardMissingRepresentation;
-
- if(_riverMonitorVtecEventDataManager.thereAreAnyActiveEventsForThisLocation())
- {
- missingRepresentationString = "TBD";
- }
-
- return missingRepresentationString;
- }
-
- // -----------------------------------------------------------------------------------
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel,Color cellBackgroundColor,
- String missingRepresentation,
- int decimalPointsForDisplay)
- {
- MonitorCell cell = new MonitorCell (columnName, cellType,
- value, threatLevel, cellBackgroundColor,
- missingRepresentation, decimalPointsForDisplay);
- addCell(cell);
-
- return cell;
- }
-
- // -----------------------------------------------------------------------------------
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value, Color cellBackgroundColor)
- {
-
- MonitorCell cell = addToCellMap(columnName, cellType,
- value, ThreatLevel.NO_THREAT, cellBackgroundColor, getMissingRepresentation(), _defaultDecimalPoints);
-
- return cell;
- }
-
- // -----------------------------------------------------------------------------------
-
- protected void addDerivedDataToCellMap()
- {
- // add all derived columns as well
- List derivedColumnsDetailsList = this.getDerivedColumnsDetailsList();
- for(int i=0 ; i < derivedColumnsDetailsList.size(); i++)
- {
- DerivedColumn desc1 = (DerivedColumn) derivedColumnsDetailsList.get(i);
-
- CellType cellType = getCellTypeFromReturnType(desc1.getReturnType());
-
- addToCellMap(desc1.getColumnName(), cellType, desc1.getValue(), desc1.getCellBackgroundColor());
- }
- }
- // -----------------------------------------------------------------------------------
-
- public Color getCellBackgroundColorForThreatSummary()
- {
- return getCellBackgroundColor("Threat");
- }
-
- private CellType getCellTypeFromReturnType(String derivedColumnReturnType)
- {
- CellType cellType = null;
-
- cellType = (CellType) _derivedReturnTypeToCellTypeMap.get(derivedColumnReturnType.toLowerCase());
-
- return cellType;
- }
-
- // -----------------------------------------------------------------------------------
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value)
- {
- MonitorCell cell = addToCellMap(columnName, cellType,
- value, ThreatLevel.NO_THREAT, getMissingRepresentation());
-
- return cell;
- }
- // -----------------------------------------------------------------------------------
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel)
- {
-
- MonitorCell cell = addToCellMap(columnName, cellType,
- value, threatLevel, getMissingRepresentation(), _defaultDecimalPoints);
-
- return cell;
- }
-// -----------------------------------------------------------------------------------
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel,
- String missingRepresentation)
- {
-
- MonitorCell cell = addToCellMap(columnName, cellType,
- value, threatLevel, missingRepresentation, _defaultDecimalPoints);
-
- return cell;
- }
- // -----------------------------------------------------------------------------------
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel,
- String missingRepresentation,
- int decimalPointsForDisplay)
- {
- MonitorCell cell = new MonitorCell (columnName, cellType,
- value, threatLevel,
- missingRepresentation, decimalPointsForDisplay);
- addCell(cell);
-
- return cell;
- }
-
- // -----------------------------------------------------------------------------------
-
- private MonitorCell addToCellMap(String columnName, CellType cellType,
- Object value, ThreatLevel threatLevel,
- String missingRepresentation,
- String dateFormatString)
- {
-
- MonitorCell cell = new MonitorCell (columnName, cellType, value, threatLevel,
- missingRepresentation, dateFormatString);
-
-
- // addToCellMap(cell);
- addCell(cell);
-
-
- return cell;
- }
-
-
- // -----------------------------------------------------------------------------------
-
- public Color getCellBackgroundColor(String columnName)
- {
- Color color = Color.white;
-
- MonitorCell cell = (MonitorCell) getCell(columnName);
-
- if (cell != null)
- {
- color = cell.getCellBackgroundColor();
- }
-
- return color;
- }
-
- // -----------------------------------------------------------------------------------
-
- public Color getCellForegroundColor(String columnName)
- {
- Color color = Color.black;
-
- MonitorCell cell = (MonitorCell) getCell(columnName);
-
- if (cell != null)
- {
- color = cell.getCellForegroundColor();
- }
- return color;
- }
-
-
- // helper methods
-
- // -----------------------------------------------------------------------------------
- public Color getCriticalColorForThisRow()
- {
- Color color = Color.WHITE;
- ThreatLevel level = getRiverMonitorThreatLevel();
- if(level == ThreatLevel.ALERT)
- {
- color = Color.RED;
- }
- else if(level == ThreatLevel.CAUTION)
- {
- color = Color.YELLOW;
- }
- else if(level == ThreatLevel.AGED_DATA ||
- level == ThreatLevel.MISSING_DATA)
- {
- color = Color.GRAY;
- }
- else
- {
- boolean flowLevelIsPresent = false;
- boolean stageLevelIsPresent = false;
-
- if( ! DbTable.isNull(getFloodFlow()) && ! DbTable.isNull(getActionFlow()) )
- {
- flowLevelIsPresent = true;
- }
- if( ! DbTable.isNull(getFloodStage()) && ! DbTable.isNull(getActionStage()) )
- {
- stageLevelIsPresent = true;
- }
- if(flowLevelIsPresent || stageLevelIsPresent)
- {
- color = new Color(0, 153, 0); // Dark green
- }
- }
-
- return color;
- }
-
- // -----------------------------------------------------------------------------------
- public ThreatLevel getThreatLevelForThreatSummary()
- {
- ThreatLevel level = getRiverMonitorThreatLevel();
-
- //Threat cell should be color red/yellow/white. So skip threat aged / missing threat level
- if(level == ThreatLevel.AGED_DATA ||
- level == ThreatLevel.MISSING_DATA)
- {
- level = ThreatLevel.NO_THREAT;
- }
-
- return level;
- }
-
- // -----------------------------------------------------------------------------------
- public ThreatLevel getThreatLevelForPrecipThreatSummary()
- {
- ThreatLevel level = getPrecipThreatLevelForPrecipThreatSummary();
-
- //Threat cell should be color red/yellow/white. So skip threat aged / missing threat level
- if(level == ThreatLevel.AGED_DATA ||
- level == ThreatLevel.MISSING_DATA)
- {
- level = ThreatLevel.NO_THREAT;
- }
-
- return level;
- }
-
- // -----------------------------------------------------------------------------------
-
- public ThreatLevel getRiverMonitorThreatLevel()
- {
- ThreatLevel cellThreatLevel = ThreatLevel.NO_THREAT;
-
- List cellList = new ArrayList( getCellMap().values());
- cellThreatLevel = getMaxRowThreatLevel(cellList);
-
- return cellThreatLevel;
- }
-// -----------------------------------------------------------------------------------
- public ThreatLevel getMaxRowThreatLevel(List cellList)
- {
- String header = "RiverMonitorJTableRowData.getMaxRowThreatLevel(): ";
- //this method assumes that the threat column has not yet been added to the cell map, when this
- // method is invoked
- ThreatLevel level = ThreatLevel.NO_THREAT;
- ThreatLevel maxLevel = ThreatLevel.ALERT;
-
- //make sure the threat cell's threat level does not get used to calculate row's threat level, so clear it to zero
- ThreatLevel cellThreatLevel = ThreatLevel.NO_THREAT;
-
- //iterate through each cell, and set the level to the max threat level found
- for (int i = 0; i < cellList.size(); i++)
- {
-
- MonitorCell cell = (MonitorCell) cellList.get(i);
-
- if (cell == null)
- {
- continue;
- }
- else
- {
- cellThreatLevel = cell.getThreatLevel();
-
-
- if ( _ignoreColumnNameForThreatSet.contains(cell.getColumnName()) )
- {
- //ignore this column
- }
-
- else if (cellThreatLevel.isGreater(level))
- {
- //System.out.println(header + "Cell " + cell.getColumnName() + " cellThreatLevel = " + cellThreatLevel);
- level = cellThreatLevel;
- if (level == maxLevel)
- {
- break; //quit looking, because we have determined it is maxed out
- }
- }
- }
- }
- return level;
- }
-
- // -----------------------------------------------------------------------------------
-
- public List getPrecipCells()
- {
- List cellList = new ArrayList();
-
- addCell(cellList, PrecipColumns.LATEST_30MIN);
- addCell(cellList, PrecipColumns.LATEST_1HR);
- addCell(cellList, PrecipColumns.LATEST_3HR );
- addCell(cellList, PrecipColumns.LATEST_6HR );
-
- addCell(cellList, PrecipColumns.TOH_PRECIP_1HR );
-
- addCell(cellList, PrecipColumns.DIFF_1HR );
- addCell(cellList, PrecipColumns.DIFF_3HR );
- addCell(cellList, PrecipColumns.DIFF_6HR );
-
- addCell(cellList, PrecipColumns.RATIO_1HR );
- addCell(cellList, PrecipColumns.RATIO_3HR );
- addCell(cellList, PrecipColumns.RATIO_6HR );
-
- return cellList;
- }
-
- // -----------------------------------------------------------------------------------
-
- private void addCell(List cellList, String columnName )
- {
- MonitorCell cell = null;
-
- cell = (MonitorCell) getCellMap().get(columnName);
- if(cell != null)
- {
- cellList.add(cell);
- }
-
- return;
- }
-
- // -----------------------------------------------------------------------------------
-
- public ThreatLevel getPrecipThreatLevelForPrecipThreatSummary()
- {
- ThreatLevel cellThreatLevel = ThreatLevel.NO_THREAT;
-
- List cellList = getPrecipCells();
- cellThreatLevel = getMaxRowThreatLevel(cellList);
-
- return cellThreatLevel;
- }
-
- //----------------------------------------------------------------------------------
-
- public ThreatLevel getThreatLevelForValueAtThisTime(double value, long time, long earliestAcceptableTime,
- double actionValue, double floodValue)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
-
- if (DbTable.isNull(value))
- {
- level = ThreatLevel.MISSING_DATA;
- //level = ThreatLevel.NO_THREAT;
- }
- else if(isDataAged(time, earliestAcceptableTime))
- {
- level = ThreatLevel.AGED_DATA;
- //level = ThreatLevel.NO_THREAT;
- }
- else if( ( ! DbTable.isNull(floodValue)) && value >= floodValue)
- {
- level = ThreatLevel.ALERT;
- }
- else if(( ! DbTable.isNull(actionValue)) && value >= actionValue)
- {
- level = ThreatLevel.CAUTION;
- }
-
- return level;
- }
- // -------------------------------------------------------------------------------------
-
- public ThreatLevel getThreatLevelForThisTime(long time, long earliestAcceptableTime)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
- if (DbTable.isNull(time))
- {
- level = ThreatLevel.MISSING_DATA;
- }
- else if(isDataAged(time, earliestAcceptableTime))
- {
- level = ThreatLevel.AGED_DATA;
- }
- return level;
- }
- // -------------------------------------------------------------------------------------
- /*
- * The sshp time above flood level cell is colored red if there is any value in it,
- * or it is colored white if it is blank or if the basis time is outside the window
- */
- public ThreatLevel getThreatLevelForSshpTimeAboveFloodLevel(long earliestAcceptableTime)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
- if(isDataAged(getSshpFcstBasisTime(), earliestAcceptableTime))
- {
- level = ThreatLevel.NO_THREAT;
- }
- else if (! DbTable.isNull(getSshpFcstFloodTime()))
- {
- level = ThreatLevel.ALERT;
- }
- return level;
- }
-
- //--------------------------------------------------------------------------------------
- /*
- * Returns true if the data is aged, by checking the time with earliestAcceptableTime
- */
- protected boolean isDataAged(long time, long earliestAcceptableTime)
- {
- boolean result = false;
-
- if (time < earliestAcceptableTime)
- {
- result = true;
- }
-
- return result;
- }
-
- // -------------------------------------------------------------------------------------
- protected ThreatLevel getThreatLevelBasedOnPrimaryPe(double value, long time, long earliestAcceptableTime)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
- if(isPrimaryPeStage())
- {
- level = getThreatLevelForStage( value, time, earliestAcceptableTime);
- }
- else // 'Q'-- flow
- {
- level = getThreatLevelForFlow( value, time, earliestAcceptableTime);
-
- }
- return level;
- }
- // -------------------------------------------------------------------------------------
- protected ThreatLevel getThreatLevelForLatestObsValue(long earliestAcceptableTime)
- {
- ThreatLevel level = getThreatLevelBasedOnPrimaryPe(getLatestObsValue(), getLatestObsTime(), earliestAcceptableTime);
- return level;
- }
-
- // -------------------------------------------------------------------------------------
-
- protected ThreatLevel getThreatLevelForStage(double value, long time, long earliestAcceptableTime)
- {
- ThreatLevel level = getThreatLevelForValueAtThisTime(value, time, earliestAcceptableTime,
- getActionStage(), getFloodStage());
-
- return level;
- }
-// -------------------------------------------------------------------------------------
- protected ThreatLevel getThreatLevelForFlow(double value, long time, long earliestAcceptableTime)
- {
- ThreatLevel level = getThreatLevelForValueAtThisTime(value, time, earliestAcceptableTime,
- getActionFlow(), getFloodFlow());
- return level;
- }
- // -------------------------------------------------------------------------------------
-
- protected ThreatLevel getThreatLevelForMaxFcstValue(long earliestAcceptableTime)
- {
- ThreatLevel level = getThreatLevelBasedOnPrimaryPe(getMaxFcstValue(), getMaxFcstBasisTime(), earliestAcceptableTime);
- if(level == ThreatLevel.MISSING_DATA)
- {
- level = ThreatLevel.NO_THREAT;
- }
- return level;
- }
-
-// -------------------------------------------------------------------------------------
-
- protected ThreatLevel getThreatLevelForSshpFcstValue(long earliestAcceptableTime)
- {
- ThreatLevel level = getThreatLevelForStage(getSshpMaxFcstValue(), getSshpFcstBasisTime(), earliestAcceptableTime);
- if(level == ThreatLevel.MISSING_DATA || level == ThreatLevel.AGED_DATA)
- {
- level = ThreatLevel.NO_THREAT;
- }
- return level;
- }
-// -------------------------------------------------------------------------------------
-
- protected ThreatLevel getThreatLevelBasedOnValue(double value, double floodLevel, double actionLevel)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
-
- if(DbTable.isNull(value))
- {
- level = ThreatLevel.MISSING_DATA;
- }
- else if(floodLevel != DbTable.getNullDouble() && value > floodLevel)
- {
- level = ThreatLevel.ALERT;
- }
- else if( actionLevel != DbTable.getNullDouble() && value > actionLevel)
- {
- level = ThreatLevel.CAUTION;
- }
- return level;
- }
-
-
-// -------------------------------------------------------------------------------------
- protected ThreatLevel getThreatLevelForObsFcstMax()
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
- int numOfHrsToLookBack ;
- long earliestAcceptableTime ;
-
- if(getMaxFcstValue() == getLatestObsValue())
- {
- numOfHrsToLookBack = _menuSettings.getRiverSettings().getLatestObsLookBack();
- earliestAcceptableTime = System.currentTimeMillis() - TimeHelper.MILLIS_PER_HOUR * numOfHrsToLookBack;
- ThreatLevel obslevel = getThreatLevelForLatestObsValue(earliestAcceptableTime);
-
- numOfHrsToLookBack = _menuSettings.getRiverSettings().getLatestFcstBasisTimeLookBack();
- earliestAcceptableTime = System.currentTimeMillis() - TimeHelper.MILLIS_PER_HOUR * numOfHrsToLookBack;
- ThreatLevel fcstlevel = getThreatLevelForMaxFcstValue(earliestAcceptableTime);
-
- if(obslevel == fcstlevel && obslevel == ThreatLevel.AGED_DATA)
- {
- level = obslevel;
- }
- else if(obslevel.isGreater(fcstlevel))
- {
- if(obslevel != ThreatLevel.AGED_DATA)
- level = obslevel;
- }
- else
- {
- if(fcstlevel != ThreatLevel.AGED_DATA)
- level = fcstlevel;
- }
- }
- else if(getObsFcstMax() == getMaxFcstValue()) // Fcst data
- {
- numOfHrsToLookBack = _menuSettings.getRiverSettings().getLatestFcstBasisTimeLookBack();
- earliestAcceptableTime = System.currentTimeMillis() - TimeHelper.MILLIS_PER_HOUR * numOfHrsToLookBack;
- level = getThreatLevelForMaxFcstValue(earliestAcceptableTime);
- }
- else // obs data
- {
- numOfHrsToLookBack = _menuSettings.getRiverSettings().getLatestObsLookBack();
- earliestAcceptableTime = System.currentTimeMillis() - TimeHelper.MILLIS_PER_HOUR * numOfHrsToLookBack;
- level = getThreatLevelForLatestObsValue(earliestAcceptableTime);
- }
- return level;
- }
-// -------------------------------------------------------------------------------------
- protected ThreatLevel getThreatLevelForAlertAlarmSummary()
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
-
- String summary = getAlertAlarmSummary();
-
- int indexOfL, indexOfU, indexOfC, indexOfR, indexOfD;
- indexOfL = -1; indexOfU = -1; indexOfC = -1; indexOfD = -1; indexOfR = -1;
-
- if(summary.length() > 0)
- {
- indexOfL = summary.indexOf('L');
- indexOfU = summary.indexOf('U');
- indexOfC = summary.indexOf('C');
- indexOfD = summary.indexOf('D');
- indexOfR = summary.indexOf('R');
- if(indexOfL != -1 || indexOfU != -1 || indexOfC != -1 || indexOfD != -1 || indexOfR != -1 )
- {
- level = ThreatLevel.ALERT;
- }
- else
- {
- level = ThreatLevel.CAUTION;
- }
- }
-
- return level;
- }
-// -------------------------------------------------------------------------------------
- private ThreatLevel getPrecipThreatLevel(double value, double alert, double caution)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
-
- if(! DbTable.isNull(value))
- {
- if(value >= alert)
- level = ThreatLevel.ALERT;
- else if(value >= caution)
- level = ThreatLevel.CAUTION;
- }
-
- return level;
- }
-// -------------------------------------------------------------------------------------
- protected ThreatLevel getPrecipValueThreatLevelForHrMentioned(int hour, PrecipColumnDataSettings precipSettings, String type)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
- double missing = DbTable.getNullDouble();
- double value;
- switch(hour)
- {
-
- case 1:
- if(type.compareTo("LATEST") == 0)
- value = _precipData.getLatestPrecip1Hr();
- else
- value = _precipData.getTohPrecip1Hr();
-
- level = getPrecipThreatLevel( value, precipSettings.getPrecipAlert1Hr(), precipSettings.getPrecipCaution1Hr());
- break;
-
- case 3:
- if(type.compareTo("LATEST") == 0)
- value = _precipData.getLatestPrecip3Hr();
- else
- // value = _precipData.getTohPrecip3Hr();
- value = missing;
-
- level = getPrecipThreatLevel( value, precipSettings.getPrecipAlert3Hr(), precipSettings.getPrecipCaution3Hr());
- break;
- case 6:
- if(type.compareTo("LATEST") == 0)
- value = _precipData.getLatestPrecip6Hr();
- else
- //value = _precipData.getTohPrecip6Hr();
- value = missing;
-
- level = getPrecipThreatLevel( value, precipSettings.getPrecipAlert6Hr(), precipSettings.getPrecipCaution6Hr());
- break;
-
- }
- return level;
-
- }
-// -------------------------------------------------------------------------------------
- protected ThreatLevel getPrecipRatioThreatLevelForHrMentioned(int hour, PrecipColumnDataSettings precipSettings)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
- int value;
- switch(hour)
- {
-
- case 1:
- value = _precipData.getRatio1Hr();
- level = getPrecipThreatLevel( value, precipSettings.getRatioAlert1Hr(), precipSettings.getRatioCaution1Hr());
- break;
- case 3:
- value = _precipData.getRatio3Hr();
- level = getPrecipThreatLevel( value, precipSettings.getRatioAlert3Hr(), precipSettings.getRatioCaution6Hr());
- break;
- case 6:
- value = _precipData.getRatio6Hr();
- level = getPrecipThreatLevel( value, precipSettings.getRatioAlert6Hr(), precipSettings.getRatioCaution6Hr());
- break;
-
- }
- return level;
-
- }
-// -------------------------------------------------------------------------------------
- protected ThreatLevel getPrecipDiffThreatLevelForHrMentioned(int hour, PrecipColumnDataSettings precipSettings)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
- double value;
-
- switch(hour)
- {
- case 1:
- value = _precipData.getDiff1Hr();
- level = getPrecipThreatLevel( value, precipSettings.getDiffAlert1Hr(), precipSettings.getDiffCaution1Hr());
- break;
- case 3:
- value = _precipData.getDiff3Hr();
- level = getPrecipThreatLevel( value, precipSettings.getDiffAlert3Hr(), precipSettings.getDiffCaution3Hr());
- break;
- case 6:
- value = _precipData.getDiff6Hr();
- level = getPrecipThreatLevel( value, precipSettings.getDiffAlert6Hr(), precipSettings.getDiffCaution6Hr());
- break;
- }
- return level;
- }
-
-// -------------------------------------------------------------------------------------
-
- protected ThreatLevel getThreatLevelForPrecipColumn(String type, int hour)
- {
-
- ThreatLevel level = ThreatLevel.NO_THREAT;
-
- if(type.compareTo("INSTANT") == 0) // instant precip
- {
- level = getPrecipValueThreatLevelForHrMentioned(hour, _menuSettings.getPrecipSettings(), "INSTANT");
- }
- else if(type.compareTo("TOH") == 0) // toh precip
- {
- level = getPrecipValueThreatLevelForHrMentioned(hour, _menuSettings.getPrecipSettings(), "TOH");
- }
- else if(type.compareTo("RATIO") == 0)
- {
- level = getPrecipRatioThreatLevelForHrMentioned(hour, _menuSettings.getPrecipSettings());
- }
- else //type is DIFF
- {
- level = getPrecipDiffThreatLevelForHrMentioned(hour, _menuSettings.getPrecipSettings());
- }
- return level;
- }
-
-// -------------------------------------------------------------------------------------
-
- protected ThreatLevel getThreatLevelForVtecTimeCell(long time, long lookAheadHrs)
- {
- ThreatLevel level = ThreatLevel.NO_THREAT;
-
- long curTime = System.currentTimeMillis();
- String summary = getVtecSummary();
-
- if(summary.length() > 0)
- {
- if(time != DbTable.getNullLong())
- {
- if((curTime + (TimeHelper.MILLIS_PER_HOUR*lookAheadHrs)) >= time)
- {
- level = ThreatLevel.ALERT;
- }
- else
- {
- level = ThreatLevel.CAUTION;
- }
- }
- else
- {
- level = ThreatLevel.CAUTION;
- }
- }
- return level;
- }
-
-// -------------------------------------------------------------------------------------
-
- public ThreatLevel getCellThreatLevelForColumn(String columnName)
- {
- ThreatLevel level;
-
- MonitorCell cell = (MonitorCell) getCellMap().get(columnName);
-
- level = cell.getThreatLevel();
-
- return level;
- }
-
-// -------------------------------------------------------------------------------------
-
-
- public String getThreatSummary()
- {
- String summary = "";
- StringBuffer summaryStringBuffer = new StringBuffer("");
- StringBuffer toolTipStringBuffer = new StringBuffer("");
-
- ThreatLevel level;
- level = getCellThreatLevelForColumn(RiverColumns.ALERT_ALARM);
- if(level == ThreatLevel.ALERT || level == ThreatLevel.CAUTION)
- {
- summaryStringBuffer = summaryStringBuffer.append("A");
- toolTipStringBuffer.append(_toolTipTextForAlertAlarmSummary);
- }
-
- level = getThreatLevelForPrecipThreatSummary();
- if(level == ThreatLevel.ALERT || level == ThreatLevel.CAUTION)
- {
- summaryStringBuffer = summaryStringBuffer.append("P");
- String precipThreatSummary = getPrecipThreatSummary();
- if(precipThreatSummary.contains("L"))
- {
- toolTipStringBuffer.append("P: Latest Precip has exceeded threat level
");
- }
- if(precipThreatSummary.contains("T"))
- {
- toolTipStringBuffer.append("P: Top of the Hour Precip has exceeded threat level
");
- }
- if(precipThreatSummary.contains("D"))
- {
- toolTipStringBuffer.append("P: TOH Precip - FFG diff has exceeded threat level
");
- }
- if(precipThreatSummary.contains("R"))
- {
- toolTipStringBuffer.append("P: TOH Precip / FFG ratio has exceeded threat level
");
- }
- }
-
- level = getCellThreatLevelForColumn(RiverColumns.VTEC_SUMMARY);
- if( level == ThreatLevel.ALERT || level == ThreatLevel.CAUTION)
- {
- summaryStringBuffer = summaryStringBuffer.append("V");
- int lookBackHours = _menuSettings.getRiverSettings().getVtecEventEndTimeApproach();
- String tempStr;
- String eventEndTimeString = getDataValue(RiverColumns.EVENT_END_TIME);
- if(level == ThreatLevel.ALERT)
- {
- tempStr = "V: VTEC EndTime["+ eventEndTimeString +"] is within " + lookBackHours+ "hrs
";
- }
- else
- {
- tempStr = "V: VTEC EndTime["+ eventEndTimeString +"] is not within " + lookBackHours+ "hrs
";
- }
- toolTipStringBuffer.append(tempStr);
- }
-
- level = getCellThreatLevelForColumn(RiverColumns.UGC_EXPIRE_TIME);
- if( level == ThreatLevel.ALERT || level == ThreatLevel.CAUTION )
- {
- summaryStringBuffer = summaryStringBuffer.append("X");
- int lookBackHours = _menuSettings.getRiverSettings().getUgcExpireTimeApproach();
- String tempStr ;
- String ugcExpireTimeString = getDataValue(RiverColumns.UGC_EXPIRE_TIME);
- if(level == ThreatLevel.ALERT)
- {
- tempStr = "X: UGC ExpireTime["+ ugcExpireTimeString +"] is within " + lookBackHours + "hrs or in the past
";
- }
- else
- {
- tempStr = "X: UGC ExpireTime["+ ugcExpireTimeString +"] is not within " + lookBackHours+ "hrs
";
- }
- toolTipStringBuffer.append(tempStr);
- }
-
-
- level = getCellThreatLevelForColumn(RiverColumns.MAX_FCST_VALUE);
- if( level == ThreatLevel.ALERT || level == ThreatLevel.CAUTION)
- {
- summaryStringBuffer = summaryStringBuffer.append("F");
- if(level == ThreatLevel.ALERT)
- {
- toolTipStringBuffer.append("F: FcstValue exceeded the flood level
");
- }
- else
- {
- toolTipStringBuffer.append("F: FcstValue exceeded the action level
");
- }
-
- }
-
- level = getCellThreatLevelForColumn(RiverColumns.SSHP_MAX_FCST_VALUE);
- if( level == ThreatLevel.ALERT || level == ThreatLevel.CAUTION)
- {
- summaryStringBuffer = summaryStringBuffer.append("S");
- if(level == ThreatLevel.ALERT)
- {
- toolTipStringBuffer.append("S: Sshp FcstValue exceeded the flood level
");
- }
- else
- {
- toolTipStringBuffer.append("S: Sshp FcstValue exceeded the action level
");
- }
-
- }
-
- level = ThreatLevel.NO_THREAT; // reset the threat level
-
- //check if any of the obs column are in alert threat
- if((getCellThreatLevelForColumn(RiverColumns.LAT_OBS_VALUE) == ThreatLevel.ALERT)
- || (getCellThreatLevelForColumn(RiverColumns.LAT_STG_VALUE) == ThreatLevel.ALERT)
- || (getCellThreatLevelForColumn(RiverColumns.LAT_FLOW_VALUE) == ThreatLevel.ALERT))
- {
- summaryStringBuffer = summaryStringBuffer.append("O");
- level = ThreatLevel.ALERT;
- }
- //check if any of the obs column are in caution threat
- else if((getCellThreatLevelForColumn(RiverColumns.LAT_OBS_VALUE) == ThreatLevel.CAUTION)
- || (getCellThreatLevelForColumn(RiverColumns.LAT_STG_VALUE) == ThreatLevel.CAUTION)
- || (getCellThreatLevelForColumn(RiverColumns.LAT_FLOW_VALUE) == ThreatLevel.CAUTION))
- {
- summaryStringBuffer = summaryStringBuffer.append("O");
- level = ThreatLevel.CAUTION;
- }
-
- if(level == ThreatLevel.ALERT )
- {
- toolTipStringBuffer.append("O: ObsValue exceeded the flood level
");
- }
- else if(level == ThreatLevel.CAUTION)
- {
- toolTipStringBuffer.append("O: ObsValue exceeded the action level
");
- }
-
- summary = summaryStringBuffer.toString();
- _toolTipTextForThreatSummary = toolTipStringBuffer.toString();
- return summary;
- }
-
-
-// -------------------------------------------------------------------------------------
-
-
- public String getPrecipThreatSummary()
- {
- String summary = "";
- StringBuffer summaryStringBuffer = new StringBuffer("");
- StringBuffer toolTipStringBuffer = new StringBuffer("");
-
- ThreatLevel level;
- ThreatLevel level1Hr = getCellThreatLevelForColumn(PrecipColumns.LATEST_1HR);
- ThreatLevel level3Hr = getCellThreatLevelForColumn(PrecipColumns.LATEST_3HR);
- ThreatLevel level6Hr = getCellThreatLevelForColumn(PrecipColumns.LATEST_6HR);
- if( ((level1Hr == ThreatLevel.ALERT || level1Hr == ThreatLevel.CAUTION)) ||
- ((level3Hr == ThreatLevel.ALERT || level3Hr == ThreatLevel.CAUTION)) ||
- ((level6Hr == ThreatLevel.ALERT || level6Hr == ThreatLevel.CAUTION)) )
- {
- summaryStringBuffer = summaryStringBuffer.append("L");
- toolTipStringBuffer.append("L: Latest Precip Exceeded the threshold
");
- }
-
- level1Hr = getCellThreatLevelForColumn(PrecipColumns.TOH_PRECIP_1HR);
- // level3Hr = getCellThreatLevelForColumn(PrecipColumns.TOH_PRECIP_3HR);
- // level6Hr = getCellThreatLevelForColumn(PrecipColumns.TOH_PRECIP_6HR);
- if( ((level1Hr == ThreatLevel.ALERT || level1Hr == ThreatLevel.CAUTION))
- /*
- ||
- ((level3Hr == ThreatLevel.ALERT || level3Hr == ThreatLevel.CAUTION)) ||
- ((level6Hr == ThreatLevel.ALERT || level6Hr == ThreatLevel.CAUTION))
- */
- )
- {
- summaryStringBuffer = summaryStringBuffer.append("T");
- toolTipStringBuffer.append("T: Top Of The Hour Precip Exceeded the threshold
");
- }
-
- level1Hr = getCellThreatLevelForColumn(PrecipColumns.DIFF_1HR);
- level3Hr = getCellThreatLevelForColumn(PrecipColumns.DIFF_3HR);
- level6Hr = getCellThreatLevelForColumn(PrecipColumns.DIFF_6HR);
- if( ((level1Hr == ThreatLevel.ALERT || level1Hr == ThreatLevel.CAUTION)) ||
- ((level3Hr == ThreatLevel.ALERT || level3Hr == ThreatLevel.CAUTION)) ||
- ((level6Hr == ThreatLevel.ALERT || level6Hr == ThreatLevel.CAUTION)) )
- {
- summaryStringBuffer = summaryStringBuffer.append("D");
- toolTipStringBuffer.append("D: TOH Precip - FFG Difference Exceeded the threshold
");
- }
-
- level1Hr = getCellThreatLevelForColumn(PrecipColumns.RATIO_1HR);
- level3Hr = getCellThreatLevelForColumn(PrecipColumns.RATIO_3HR);
- level6Hr = getCellThreatLevelForColumn(PrecipColumns.RATIO_6HR);
- if( ((level1Hr == ThreatLevel.ALERT || level1Hr == ThreatLevel.CAUTION)) ||
- ((level3Hr == ThreatLevel.ALERT || level3Hr == ThreatLevel.CAUTION)) ||
- ((level6Hr == ThreatLevel.ALERT || level6Hr == ThreatLevel.CAUTION)) )
- {
- summaryStringBuffer = summaryStringBuffer.append("R");
- toolTipStringBuffer.append("R: TOH Precip / FFG Ratio Exceeded the threshold
");
- }
-
- summary = summaryStringBuffer.toString();
- _toolTipTextForPrecipThreatSummary = toolTipStringBuffer.toString();
- return summary;
- }
-// -------------------------------------------------------------------------------------
-
- public void setRiverBasin(String riverBasin)
- {
- _riverBasin = riverBasin;
- }
-
- public String getRiverBasin()
- {
- return _riverBasin;
- }
-
-
-} //end class
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverMonitorVtecEventDataManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverMonitorVtecEventDataManager.java
deleted file mode 100755
index 906c34e25d..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/RiverMonitorVtecEventDataManager.java
+++ /dev/null
@@ -1,323 +0,0 @@
-package ohd.hseb.monitor.river;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import ohd.hseb.db.DbTable;
-import ohd.hseb.ihfsdb.generated.VTECeventRecord;
-
-public class RiverMonitorVtecEventDataManager
-{
-
- private List _vtecAllEventList = null;
- private List _mostRecentEventList = null;
- private List _mostRecentActiveEventList = null;
- private VTECeventRecord _vtecEventRecordForEndTime = null;
- private VTECeventRecord _vtecEventRecordForExpireTime = null;
-
- public RiverMonitorVtecEventDataManager(List vtecAllEventList)
- {
- _vtecAllEventList = vtecAllEventList;
- }
-
- public List getMostRecentEventList()
- {
- if(_mostRecentEventList == null)
- _mostRecentEventList = calculateMostRecentEventList();
- return _mostRecentEventList;
- }
-
- public List getMostRecentActiveEventList()
- {
- if(_mostRecentActiveEventList == null)
- _mostRecentActiveEventList = calculateMostRecentActiveEventList();
- return _mostRecentActiveEventList;
- }
-
- public VTECeventRecord getVtecEventRecordForEndTime()
- {
- return _vtecEventRecordForEndTime;
- }
-
- public VTECeventRecord getVtecEventRecordForExpireTime()
- {
- return _vtecEventRecordForExpireTime;
- }
-
- //Creates the list that contains the recent event info for each signif
- public List calculateMostRecentEventList()
- {
- Map mostRecentEventMap = new HashMap();
- VTECeventRecord mostRecentEventRecord = null;
-
- if(_vtecAllEventList != null)
- {
- for(int i=0; i < _vtecAllEventList.size(); i++)
- {
- VTECeventRecord record = (VTECeventRecord) _vtecAllEventList.get(i);
- String key = record.getSignif();
-
- mostRecentEventRecord = (VTECeventRecord) mostRecentEventMap.get(key);
-
- //the first time, add the current record
- if (mostRecentEventRecord == null)
- {
- mostRecentEventMap.put(key, record);
- mostRecentEventRecord = record;
- }
-
- else // this is not the first active record for this geoId|signif
- {
- //this one is more recent, so replace the old record.
- if (record.getProducttime() > mostRecentEventRecord.getProducttime())
- {
- mostRecentEventMap.put(key, record);
- }
- }
- }
- }
- List mostRecentEventList = new ArrayList (mostRecentEventMap.values());
-
- return mostRecentEventList;
- }
-
- public List calculateMostRecentActiveEventList()
- {
- List mostRecentActiveEventList = null;
-
- getMostRecentEventList();
-
- if(_mostRecentEventList != null)
- {
- for(int i=0;i < _mostRecentEventList.size(); i++)
- {
- VTECeventRecord record = (VTECeventRecord) _mostRecentEventList.get(i);
- if(RiverMonitorVtecEventDataManager.checkIfEventActive(record))
- {
- if(mostRecentActiveEventList == null)
- {
- mostRecentActiveEventList = new ArrayList();
- }
-
- mostRecentActiveEventList.add(record);
- }
- }
- }
- return mostRecentActiveEventList;
- }
-
- public static boolean checkIfEventActive(VTECeventRecord record)
- {
- boolean active = false;
- String action = record.getAction();
- long endTime = record.getEndtime();
- long curTime = System.currentTimeMillis();
- /* if the event is explicity expired or cancelled,
- then the event tracking is not active.
- also, all ROU events are considered inactive.
- otherwise, see if the event end time has not passed yet */
-
- if (action.equals("CAN") || action.equals("EXP") ||
- action.equals("ROU") || action.length() == 0)
- {
- active = false;
- }
- else
- {
- /* if the endtime is not specified, assume the event is still active.
- unspecified can occur if the endtime has a missing value indicator
- or is set to 0. A 0 value can occur because the time may be NULL in
- the database, which is converted to a 0 value by the time conversion
- functions. */
-
- if (endTime == (long) DbTable.getNullLong())
- active = true;
- else //end time is past the current time, so the event is still active.
- {
- if (endTime > curTime)
- active = true;
- else
- active = false;
- }
- }
- return(active);
- }
-
-
- public boolean thereAreAnyActiveEventsForThisLocation()
- {
- boolean result = false;
-
- getMostRecentActiveEventList();
-
- if(_mostRecentActiveEventList != null)//there are active events
- {
- result = true;
- }
- return result;
- }
-
- public String getVtecSummary()
- {
- String summary = "";
- StringBuffer summaryStringBuffer = new StringBuffer("");
-
- getMostRecentActiveEventList();
-
- if(thereAreAnyActiveEventsForThisLocation())
- {
- for(int i=0;i < _mostRecentActiveEventList.size(); i++)
- {
- VTECeventRecord record = (VTECeventRecord) _mostRecentActiveEventList.get(i);
- summaryStringBuffer = summaryStringBuffer.append(record.getSignif());
- }
- }
- summary = summaryStringBuffer.toString();
- return summary;
- }
-
- public long getEventEndTime(long earliestAcceptableTimeForVtecEventProductTimeLookBack)
- {
- VTECeventRecord record = null;
- long endTime = DbTable.getNullLong();
-
- getMostRecentActiveEventList();
-
- //if there are any active events among the recent event for various signif
- //use the one that has the endtime close to current time (which is the earliest endtime in the most recent event list)
- if(thereAreAnyActiveEventsForThisLocation())
- {
- // loop thru the mostRecentActiveEventsList
- // This list will have size 0 (min) size 3 (max- accouting for W A Y)
- // Find the earliest endtime
- // Ignore the record with missing endtime
-
- long tempEndTime = Long.MAX_VALUE;
- for (int i = 0; i < _mostRecentActiveEventList.size(); i++)
- {
- record = (VTECeventRecord) _mostRecentActiveEventList.get(i);
-
- if(record.getEndtime() != DbTable.getNullLong())
- {
- if(record.getEndtime() < tempEndTime)
- {
- tempEndTime = record.getEndtime();
- endTime = tempEndTime;
- _vtecEventRecordForEndTime = record;
- }
- }
- }
-
- if(endTime == DbTable.getNullLong()) //ie., The recent active list has 1 or more events and all of their endtime is null
- {
- _vtecEventRecordForEndTime = (VTECeventRecord)_mostRecentActiveEventList.get(0);
- }
- }
- else if(_mostRecentEventList != null)//No active events going on, so consider the latest/most recent endtime(max of all endtime)
- {
- for (int i = 0; i < _mostRecentEventList.size(); i++)
- {
- record = (VTECeventRecord) _mostRecentEventList.get(i);
-
- if(i==0)
- {
- endTime = record.getEndtime();
- _vtecEventRecordForEndTime = record;
- }
- else
- {
- if(record.getEndtime() > endTime)
- {
- endTime = record.getEndtime();
- _vtecEventRecordForEndTime = record;
- }
- }
- }
-
- //check if the record's product time is within the window
- if( _vtecEventRecordForEndTime != null &&
- (_vtecEventRecordForEndTime.getProducttime() < earliestAcceptableTimeForVtecEventProductTimeLookBack))
- {
- _vtecEventRecordForEndTime = null;
- endTime = DbTable.getNullLong();
- }
- }
-
- return endTime;
- }
-
- public long getUGCExpireTime(long earliestAcceptableTimeForVtecEventProductTimeLookBack)
- {
- VTECeventRecord record = null;
- long expireTime = DbTable.getNullLong();
-
- getMostRecentActiveEventList();
-
- //if there are any active events among the recent event for various signif
- //use the one that has the expiretime close to current time (which is the earliest endtime in the most recent event list)
- if(thereAreAnyActiveEventsForThisLocation())
- {
- // loop thru the mostRecentActiveEventsList
- // This list will have size 0 (min) size 3 (max- accouting for W A Y)
- // Find the earliest expiretime
- // Ignore the record with missing expiretime
-
- long tempExpireTime = Long.MAX_VALUE;
- for (int i = 0; i < _mostRecentActiveEventList.size(); i++)
- {
- record = (VTECeventRecord) _mostRecentActiveEventList.get(i);
-
- if(record.getExpiretime() != DbTable.getNullLong())
- {
- if(record.getExpiretime() < tempExpireTime)
- {
- tempExpireTime = record.getExpiretime();
- _vtecEventRecordForExpireTime = record;
- expireTime = tempExpireTime;
- }
- }
- }
-
- if(expireTime == DbTable.getNullLong()) //ie., The recent active list has 1 or more events and all of their expiretime is null
- _vtecEventRecordForExpireTime = (VTECeventRecord) _mostRecentActiveEventList.get(0);// expiretime will be TBD
-
- }
- else if(_mostRecentEventList != null)//No active events going on, so consider the latest/most recent expiretime(max of all expiretime)
- {
- for (int i = 0; i < _mostRecentEventList.size(); i++)
- {
- record = (VTECeventRecord) _mostRecentEventList.get(i);
-
- if(i==0)
- {
- expireTime = record.getExpiretime();
- _vtecEventRecordForExpireTime = record;
- }
- else
- {
- if(record.getExpiretime() > expireTime)
- {
- expireTime = record.getExpiretime();
- _vtecEventRecordForExpireTime = record;
- }
- }
- }
-
- //check if the record's product time is within the window
- if(_vtecEventRecordForExpireTime != null &&
- (_vtecEventRecordForExpireTime.getProducttime() < earliestAcceptableTimeForVtecEventProductTimeLookBack))
- {
- _vtecEventRecordForExpireTime = null;
- expireTime = DbTable.getNullLong();
- }
- }
-
- return expireTime;
- }
-
-
-// -------------------------------------------------------------------------------------
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorAppManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorAppManager.java
deleted file mode 100755
index e16f98509e..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorAppManager.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package ohd.hseb.monitor.river.manager;
-
-import java.awt.Container;
-import java.awt.GridBagLayout;
-
-import javax.swing.JPanel;
-import javax.swing.JSplitPane;
-import javax.swing.JToolBar;
-
-import ohd.hseb.alertalarm.AlertAlarmDataManager;
-import ohd.hseb.db.Database;
-import ohd.hseb.monitor.MonitorFrame;
-import ohd.hseb.monitor.MonitorSplitPane;
-import ohd.hseb.monitor.MonitorTimeSeriesLiteManager;
-import ohd.hseb.monitor.derivedcolumns.DerivedColumnsFileManager;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.river.RiverMonitorDataManager;
-import ohd.hseb.monitor.river.settings.RiverMonitorMenuSettings;
-import ohd.hseb.monitor.settings.FilterSettings;
-import ohd.hseb.monitor.settings.ViewSettings;
-import ohd.hseb.officenotes.OfficeNotesDataManager;
-import ohd.hseb.util.MemoryLogger;
-import ohd.hseb.util.SessionLogger;
-import ohd.hseb.util.gui.ComponentHelper;
-import ohd.hseb.vtecevent.VtecEventDataManager;
-import com.raytheon.uf.common.ohd.AppsDefaults;
-
-
-public class RiverMonitorAppManager {
- private MessageSystemManager _msgSystemManager;
-
- private RiverMonitorDataManager _riverMonitorDataManager;
-
- private AppsDefaults _appsDefaults;
-
- public static final String DEFAULT_RIVER_SETTINGS_FILE = "DefaultRiverMonitorSettings.txt";
-
- public static final String SITE_RIVER_SETTINGS_FILE = "RiverMonitorSettings.txt";
-
- public static final String PE_CONFIG_FILE = "RiverMonitorPEConfig.txt";
-
- private SessionLogger _logger;
-
- private MonitorFrame _mainFrame;
-
- private DerivedColumnsFileManager _derivedColumnsFileManager;
-
- private String _appName = "RiverMonitor";
-
- public static String DERIVED_COLUMNS_FILE = "DerivedColumns.txt";
-
- public RiverMonitorAppManager(Database db, String missingRepresentation,
- String version, String versionDate,
- MonitorTimeSeriesLiteManager monitorTimeSeriesLiteManager) {
-
- _appsDefaults = AppsDefaults.getInstance();
-
- createLogger();
-
- ViewSettings viewSettings = new ViewSettings();
- FilterSettings filterSettings = new FilterSettings();
- RiverMonitorMenuSettings menuSettings = new RiverMonitorMenuSettings();
-
- createFrame(db, version);
-
- JSplitPane splitPane = new MonitorSplitPane(
- JSplitPane.HORIZONTAL_SPLIT, true);
-
- JPanel timeDisplayPanel = new JPanel();
- JToolBar toolBar = new JToolBar();
-
- OfficeNotesDataManager officeNotesDataMgr = new OfficeNotesDataManager(
- db, _logger, missingRepresentation);
- AlertAlarmDataManager alertAlarmDataMgr = new AlertAlarmDataManager(db,
- _logger, missingRepresentation);
- VtecEventDataManager vtecEventDataMgr = new VtecEventDataManager(db,
- _logger, missingRepresentation);
-
- String settingsDir = _appsDefaults
- .getToken("rivermon_config_dir",
- "/awips2/awipsShare/hydroapps/whfs/local/data/app/rivermon");
-
- _derivedColumnsFileManager = new DerivedColumnsFileManager(settingsDir
- + "/" + DERIVED_COLUMNS_FILE, _logger);
-
- _riverMonitorDataManager = new RiverMonitorDataManager(db,
- _appsDefaults, missingRepresentation, _logger, menuSettings,
- _derivedColumnsFileManager);
-
- _msgSystemManager = new MessageSystemManager();
-
- MemoryLogger.setLogger(_logger);
-
- new RiverMonitorRefreshManager(_msgSystemManager, _logger,
- _riverMonitorDataManager, splitPane);
-
- new RiverMonitorFilterManager(_msgSystemManager, _logger, _mainFrame,
- _riverMonitorDataManager, splitPane, _appsDefaults,
- filterSettings);
-
- new RiverMonitorMenuManager(_msgSystemManager, _logger, _mainFrame,
- version, versionDate, _appsDefaults, toolBar,
- _riverMonitorDataManager, officeNotesDataMgr,
- alertAlarmDataMgr, vtecEventDataMgr, menuSettings,
- timeDisplayPanel, _appName, monitorTimeSeriesLiteManager);
-
- new RiverMonitorViewManager(_mainFrame, _msgSystemManager, _logger,
- _riverMonitorDataManager, splitPane, viewSettings,
- _derivedColumnsFileManager, monitorTimeSeriesLiteManager,
- _appsDefaults);
-
- RiverMonitorSettingsManager settingsManager = new RiverMonitorSettingsManager(
- _msgSystemManager, _appsDefaults, _logger, _mainFrame,
- viewSettings, filterSettings, menuSettings);
-
- settingsManager.startRiverMonitor();
-
- Container frameContentPane = _mainFrame.getContentPane();
- _mainFrame.setLayout(new GridBagLayout());
-
- // col, row, width, height, weightx, weighty, fill
- ComponentHelper.addFrameComponent(frameContentPane, toolBar, 0, 0, 1,
- 1, 1, 0, 1);
- ComponentHelper.addFrameComponent(frameContentPane, timeDisplayPanel,
- 1, 0, 1, 1, 1, 0, 1);
- ComponentHelper.addFrameComponent(frameContentPane, splitPane, 0, 1, 2,
- 1, 1, 1, 1);
-
- _mainFrame.pack();
- _mainFrame.setVisible(true);
- }
-
- private void createLogger() {
- String logDir = _appsDefaults
- .getToken("rivermon_log_dir",
- "/awips2/awipsShare/hydroapps/whfs/local/data/log/rivermon");
- String logFile = logDir + "/" + _appName;
-
- _logger = new SessionLogger(_appName, logFile, true, true, null);
- _logger.log(null);
- _logger.log(_appName + " Started");
-
- }
-
- private void createFrame(Database db, String version) {
- _mainFrame = new MonitorFrame();
- String title = _appName + " DbName : " + db.getDatabaseName()
- + " Session : " + _logger.getSessionId();
- _mainFrame.setTitle(title);
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorFilterManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorFilterManager.java
deleted file mode 100755
index bcaa601715..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorFilterManager.java
+++ /dev/null
@@ -1,277 +0,0 @@
-package ohd.hseb.monitor.river.manager;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.JMenuItem;
-import javax.swing.JPopupMenu;
-import javax.swing.JScrollPane;
-import javax.swing.JSplitPane;
-import javax.swing.JTree;
-import javax.swing.SwingUtilities;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreePath;
-
-import ohd.hseb.monitor.MonitorFrame;
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.TreeDataManager;
-import ohd.hseb.monitor.manager.BaseManager;
-import ohd.hseb.monitor.manager.Receiver;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.messaging.MessageType;
-import ohd.hseb.monitor.river.RiverMonitorDataManager;
-import ohd.hseb.monitor.settings.FilterSettings;
-import ohd.hseb.monitor.treefilter.MonitorCheckTreeManager;
-import ohd.hseb.monitor.treefilter.MonitorCheckTreeSelectionModel;
-import ohd.hseb.util.SessionLogger;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-
-public class RiverMonitorFilterManager extends BaseManager
-{
- private SessionLogger _logger;
-
- private RiverMonitorDataManager _riverMonitorDataManager;
- private FilterSettings _filterSettings;
-
- private JSplitPane _splitPane;
-
- private AppsDefaults _appsDefaults;
-
- private MonitorCheckTreeManager _checkTreeManager;
-
- private JScrollPane _treeScrollPane;
-
- private JPopupMenu _popupMenuForTree;
- private JMenuItem _expandTreeMenuItem;
- private JMenuItem _collapseTreeMenuItem;
-
- private MonitorFrame _mainFrame;
- private String _iconsDir;
-
-
- public RiverMonitorFilterManager(MessageSystemManager msgSystemManager,SessionLogger logger,
- MonitorFrame mainFrame, RiverMonitorDataManager riverMonitorDataManager, JSplitPane splitPane,
- AppsDefaults appsDefaults, FilterSettings filterSettings)
- {
- _riverMonitorDataManager = riverMonitorDataManager;
- _splitPane = splitPane;
- _appsDefaults = appsDefaults;
- _mainFrame = mainFrame;
- _filterSettings = filterSettings;
- _iconsDir = _appsDefaults.getToken("rivermon_config_dir", "/awips/hydroapps/whfs/local/data/app/rivermon");
-
- createPopupMenuForTree();
-
- setMessageSystemManager(msgSystemManager);
- _msgSystemManager.registerReceiver(new UpdateDisplayWithSettingsReceiver(), MessageType.UPDATE_DISPLAY_WITH_SETTINGS);
- _msgSystemManager.registerReceiver(new RefreshDisplayReceiver(), MessageType.REFRESH_DISPLAY);
- }
-
- private void createTreeAndApplySettings(MonitorMessage message)
- {
- final String header = "RiverMonitorFilterManager.createTreeAndApplySettings(): ";
- System.out.println(header + " thread = " + Thread.currentThread().getId());
-
- _mainFrame.setWaitCursor();
- if(message.getMessageSource() != this)
- {
- System.out.println(header +" Invoked" + "...Source:" + message.getMessageSource() + " Type:" + message.getMessageType());
- List stringArrayListOfFilterItems = _riverMonitorDataManager.createStringArrayListOfFilterItems();
-
- TreeDataManager treeDataManager = new TreeDataManager();
-
- DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("HSA");
-
- JTree tree = treeDataManager.createFilterTreeFromList(rootNode, stringArrayListOfFilterItems);
-
- tree.setBackground(Color.BLACK);
-
- TreePath[] preSelectedPaths = _filterSettings.getSelectedPaths();
-
- // printTreePathArray(preSelectedPaths, "CreateTree--- preSelectedPaths :");
-
- TreePath[] preExpandedPaths = _filterSettings.getExpandedPaths();
-
- // printTreePathArray(preSelectedPaths, "CreateTree--- preExpandedPaths :");
-
- Map lidToCriticalColorMap = _riverMonitorDataManager.getLidToCriticalColorMap();
-
- _checkTreeManager = new MonitorCheckTreeManager(tree, preSelectedPaths, preExpandedPaths, lidToCriticalColorMap, _iconsDir);
- CheckTreeSelectionListener treeListener = new CheckTreeSelectionListener();
- tree.addMouseListener(treeListener);
-
- _treeScrollPane = new JScrollPane(tree);
- _treeScrollPane.setPreferredSize(new Dimension(300,645));
-
- _splitPane.setLeftComponent(_treeScrollPane);
-
- // printTreePathArray(_checkTreeManager.getSelectionModel().getSelectionPaths(), "Create Tree: ");
-
- _riverMonitorDataManager.getTreeFilterManager().traversePathsToDisplayLocationSelected(_checkTreeManager.getValidTreePaths(preSelectedPaths));
-
- }
- _mainFrame.setDefaultCursor();
- }
-
- private void highlightThisRow()
- {
- String header = "RiverMonitorFilterManager.highlightThisRow(): ";
-
- System.out.print(header );
- send(this, MessageType.FILTER_SELECT_ITEM);
- }
-
- private void sendRefreshDisplayMessage()
- {
- String header = "RiverMonitorFilterManager.sendRefreshDisplayMessage(): ";
-
- System.out.print(header);
- send(this, MessageType.REFRESH_DISPLAY);
- }
-
- private void setFilterSettings()
- {
- String header = "RiverMonitorFilterManager.setFilterSettings(): ";
- System.out.println(header);
-
- TreePath[] paths = _checkTreeManager.getSelectionModel().getSelectionPaths();
- _filterSettings.setSelectedPaths(paths);
-
- // printTreePathArray(paths, header + " selected path in ");
-
- TreePath[] expandedPaths = _checkTreeManager.getAllExpandedPaths();
- _filterSettings.setExpandedPaths(expandedPaths);
-
- }
-
- private void createPopupMenuForTree()
- {
- _popupMenuForTree = new JPopupMenu();
- _expandTreeMenuItem = new JMenuItem("Expand Entire Tree");
- _expandTreeMenuItem.setMnemonic('E');
- _collapseTreeMenuItem = new JMenuItem("Collapse Entire Tree");
- _collapseTreeMenuItem.setMnemonic('C');
- _popupMenuForTree.add(_expandTreeMenuItem);
- _popupMenuForTree.add(_collapseTreeMenuItem);
-
- TreePopupMenuListener treePopupMenuListener = new TreePopupMenuListener();
- _expandTreeMenuItem.addActionListener(treePopupMenuListener);
- _collapseTreeMenuItem.addActionListener(treePopupMenuListener);
- }
-
- private void printTreePathArray(TreePath[] treePathArray, String message)
- {
- if (message != null)
- {
- System.out.println(message);
- }
-
- if (treePathArray != null)
- {
- for (TreePath treePath : treePathArray)
- {
- System.out.println(treePath);
- }
- }
-
- return;
- }
-
- private class UpdateDisplayWithSettingsReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- createTreeAndApplySettings(message);
- }
- }
-
- private class RefreshDisplayReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- createTreeAndApplySettings(message);
- }
- }
-
- private class TreePopupMenuListener implements ActionListener
- {
- public void actionPerformed(ActionEvent e)
- {
-
- TreePath[] allAvailablePaths = _checkTreeManager.getAllAvailablePaths();
- if(e.getSource().toString().contains("Expand Entire Tree"))
- {
- _checkTreeManager.expandThesePaths(allAvailablePaths);
- }
- else //collapse tree
- {
- _checkTreeManager.collapseEntireTree();
- }
-
- setFilterSettings();
- }
- }
-
- class CheckTreeSelectionListener implements MouseListener
- {
- public void mouseClicked(MouseEvent e)
- {
-
- MonitorCheckTreeSelectionModel selectionModel = (MonitorCheckTreeSelectionModel) (_checkTreeManager.getSelectionModel());
-
- selectionModel.printInstanceId();
-
- TreePath paths[] = selectionModel.getSelectionPaths();
-
- // printTreePathArray(paths, "CheckTreeSelectionListener.mouseClicked(): ");
-
- setFilterSettings();
-
- _riverMonitorDataManager.getTreeFilterManager().traversePathsToDisplayLocationSelected(paths);
- sendRefreshDisplayMessage();
-
- if(SwingUtilities.isLeftMouseButton(e))
- {
- JTree tree = (JTree) e.getSource();
- int row = tree.getRowForLocation(e.getX(), e.getY());
- TreePath path = tree.getPathForRow(row);
- String itemClickedOnJtree = null;
- if(path != null)
- {
- if(path.getPathCount() == 4)
- {
- itemClickedOnJtree = path.getLastPathComponent().toString();
- System.out.println("Item of interest:"+ itemClickedOnJtree);
- _riverMonitorDataManager.setLidOfCurrentInterest(itemClickedOnJtree);
- highlightThisRow();
- }
- }
- }
- }
- public void mousePressed(MouseEvent e)
- {
- if(e.isPopupTrigger())
- {
- _popupMenuForTree.show(_treeScrollPane, e.getX(), e.getY());
- }
- }
-
- public void mouseReleased(MouseEvent e)
- {
- if(e.isPopupTrigger())
- {
- _popupMenuForTree.show(_treeScrollPane, e.getX(), e.getY());
- }
- }
- public void mouseEntered(MouseEvent e){}
- public void mouseExited(MouseEvent e){}
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorMenuManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorMenuManager.java
deleted file mode 100755
index 4416743862..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorMenuManager.java
+++ /dev/null
@@ -1,1145 +0,0 @@
-package ohd.hseb.monitor.river.manager;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JLabel;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JRadioButtonMenuItem;
-import javax.swing.JSeparator;
-import javax.swing.JToolBar;
-
-import ohd.hseb.alertalarm.AlertAlarmDataManager;
-import ohd.hseb.alertalarm.AlertAlarmDialog;
-import ohd.hseb.monitor.Monitor;
-import ohd.hseb.monitor.MonitorFrame;
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.MonitorTimeSeriesLiteManager;
-import ohd.hseb.monitor.MonitorToolBarManager;
-import ohd.hseb.monitor.manager.MonitorMenuManager;
-import ohd.hseb.monitor.manager.Receiver;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.messaging.MessageType;
-import ohd.hseb.monitor.river.LookBackTimeDialog;
-import ohd.hseb.monitor.river.RiverMonitorDataManager;
-import ohd.hseb.monitor.river.RiverMonitorJTableRowData;
-import ohd.hseb.monitor.river.settings.RiverColumnDataSettings;
-import ohd.hseb.monitor.river.settings.RiverMonitorMenuSettings;
-import ohd.hseb.officenotes.OfficeNotesDataManager;
-import ohd.hseb.officenotes.OfficeNotesDialog;
-import ohd.hseb.rivermonlocgroup.RiverMonGroupDialog;
-import ohd.hseb.rivermonlocgroup.RiverMonLocationDialog;
-import ohd.hseb.util.SessionLogger;
-import ohd.hseb.vtecevent.VtecEventDataManager;
-import ohd.hseb.vtecevent.VtecEventDialog;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-import com.raytheon.uf.common.util.RunProcess;
-
-public class RiverMonitorMenuManager extends MonitorMenuManager {
- private JMenuBar _menuBar;
-
- private JMenu _fileMenu, _displayMenu, _sortMenu, _configMenu,
- _detailsMenu, _helpMenu;
-
- private JMenu _fcstTsMenu;
-
- private JRadioButtonMenuItem _fcstTsFZMenuItem;
-
- private JRadioButtonMenuItem _fcstTsFFMenuItem;
-
- private JRadioButtonMenuItem _fcstTsIngestFilterMenuItem;
-
- private ButtonGroup _fcstTsGroup;
-
- private JMenuItem _selectColumnsMenuItem;
-
- private JCheckBoxMenuItem _showMissingRiverMenuItem;
-
- private JMenuItem _saveColumnSettingsMenuItem;
-
- private JMenuItem _loadSettingsMenuItem;
-
- private JMenuItem _loadOfficeSettingsMenuItem;
-
- private JMenuItem _saveOfficeSettingsMenuItem;
-
- private JMenuItem _refreshColumnMenuItem;
-
- private JMenuItem _exportTableToTextMenuItem;
-
- private JMenuItem _exitApplicationMenuItem;
-
- private JMenuItem _officeNotesMenuItem;
-
- private JMenuItem _alertAlarmMenuItem;
-
- private JMenuItem _vtecEventMenuItem;
-
- private JMenuItem _siteSpecificMenuItem;
-
- private JMenuItem _timeSeriesLiteMenuItem;
-
- private JMenuItem _riverMonitorPEConfigMenuItem;
-
- private JMenuItem _riverMonGroupMenuItem;
-
- private JMenuItem _riverMonLocationMenuItem;
-
- private JMenuItem _derivedColumnsMenuItem;
-
- private JMenuItem _hsagrplocSortMenuItem;
-
- private JMenuItem _riverThreatSortMenuItem;
-
- private JMenuItem _precipThreatSortMenuItem;
-
- private JMenuItem _clearSortMenuItem;
-
- private JMenuItem _validTimeLookUpForAlertAlarmMenuItem;
-
- private JMenuItem _endTimeLookUpForVTECEventMenuItem;
-
- private JMenuItem _ugcExpireTimeLookUpMenuItem;
-
- private JMenuItem _vtecEventProductTimeLookUpMenuItem;
-
- private JMenuItem _obsTimeLookUpForLatestObsValueMenuItem;
-
- private JMenuItem _fcstBasisTimeLookUpForMaxFcstValueMenuItem;
-
- private JMenuItem _precipThresholdForThreatColorMenuItem;
-
- private JMenuItem _aboutMenuItem;
-
- private RiverMonGroupDialog _riverMonGroupDialog = null;
-
- private RiverMonLocationDialog _riverMonLocationDialog;
-
- private RiverMonitorDataManager _rivermonitorDataManager;
-
- private RiverMonitorMenuSettings _menuSettings;
-
- private OfficeNotesDialog _officeNotesDialog;
-
- private OfficeNotesDataManager _officeNotesDataMgr;
-
- private AlertAlarmDialog _alertAlarmDialog;
-
- private AlertAlarmDataManager _alertAlarmDataMgr;
-
- private VtecEventDataManager _vtecEventDataMgr;
-
- private VtecEventDialog _vtecEventDialog;
-
- private String _settingsDir;
-
- private MonitorTimeSeriesLiteManager _monitorTimeSeriesLiteManager;
-
- private RiverMonitorJTableRowData _selectedRowData;
-
- private MonitorToolBarManager _toolBarManager;
-
- public RiverMonitorMenuManager(MessageSystemManager msgSystemManager,
- SessionLogger logger, MonitorFrame mainFrame, String version,
- String versionDate, AppsDefaults appsDefaults, JToolBar toolBar,
- RiverMonitorDataManager riverMonitorDataManager,
- OfficeNotesDataManager officeNotesDataMgr,
- AlertAlarmDataManager alertAlarmDataMgr,
- VtecEventDataManager vtecEventDataMgr,
- RiverMonitorMenuSettings menuSettings, JPanel timeDisplayPanel,
- String appName,
- MonitorTimeSeriesLiteManager monitorTimeSeriesLiteManager) {
- super(msgSystemManager, appsDefaults, logger);
- _appsDefaults = appsDefaults;
- _rivermonitorDataManager = riverMonitorDataManager;
-
- _menuSettings = menuSettings;
-
- _officeNotesDataMgr = officeNotesDataMgr;
- _alertAlarmDataMgr = alertAlarmDataMgr;
- _vtecEventDataMgr = vtecEventDataMgr;
- _monitorTimeSeriesLiteManager = monitorTimeSeriesLiteManager;
-
- _settingsDir = _appsDefaults.getToken("rivermon_config_dir",
- "/awips/hydroapps/whfs/local/data/app/rivermon");
-
- int defaultRefreshInterval = 15;
- createRefreshComponents(defaultRefreshInterval, timeDisplayPanel);
-
- _toolBarManager = new MonitorToolBarManager(toolBar, _appsDefaults,
- _officeNotesDataMgr);
- _toolBarManager.getOfficeNotesButton().addActionListener(
- new OfficeNotesDialogListener());
-
- setAboutInfo(version, versionDate, appName);
- _mainFrame = mainFrame;
-
- setMessageSystemManager(msgSystemManager);
- _msgSystemManager.registerReceiver(
- new UpdateDisplayWithSettingsReceiver(),
- MessageType.UPDATE_DISPLAY_WITH_SETTINGS);
- _msgSystemManager.registerReceiver(new ViewSelectItemReceiver(),
- MessageType.VIEW_SELECT_ITEM);
-
- _msgSystemManager.registerReceiver(new UpdateDisplayReceiver(),
- MessageType.REFRESH_DISPLAY);
-
- createMenus();
- setFrameListener();
- }
-
- @Override
- protected long getDataUpdateTime() {
- return _rivermonitorDataManager.getPdcUpdateTime();
- }
-
- @Override
- protected long getDisplayedRecordCount() {
- return _rivermonitorDataManager.getDisplayedRecordCount();
- }
-
- @Override
- public void setMenuSettingsRefreshInterval(int value) {
- _menuSettings.setRefreshInterval(value);
- }
-
- @Override
- public void setRefreshTimeSpinnerValue() {
- _refreshTimeSpinner.setValue(_menuSettings.getRefreshInterval());
- }
-
- private void createMenus() {
- _menuBar = new JMenuBar();
- _mainFrame.setJMenuBar(_menuBar);
-
- _toolBarManager.getOfficeNotesButton().addActionListener(
- new OfficeNotesDialogListener());
-
- _fileMenu = new JMenu("File");
- _configMenu = new JMenu("Config");
- _displayMenu = new JMenu("Display");
- _sortMenu = new JMenu("Sort");
- _detailsMenu = new JMenu("Details");
- _helpMenu = new JMenu("Help");
-
- _fileMenu.setMnemonic('F');
- _configMenu.setMnemonic('C');
- _displayMenu.setMnemonic('D');
- _sortMenu.setMnemonic('S');
- _detailsMenu.setMnemonic('E');
- _helpMenu.setMnemonic('H');
-
- // File Menu
-
- _refreshColumnMenuItem = new JMenuItem("Refresh");
- _refreshColumnMenuItem.setMnemonic('R');
- _fileMenu.add(_refreshColumnMenuItem);
-
- _fileMenu.add(new JSeparator());
-
- _saveColumnSettingsMenuItem = new JMenuItem("Save Custom Settings ...");
- _saveColumnSettingsMenuItem.setMnemonic('S');
- _fileMenu.add(_saveColumnSettingsMenuItem);
-
- _saveOfficeSettingsMenuItem = new JMenuItem("Save Office Settings");
- _saveOfficeSettingsMenuItem.setMnemonic('F');
- _saveOfficeSettingsMenuItem
- .setToolTipText("Save office settings to PrecipMonitorSettings.txt");
- _fileMenu.add(_saveOfficeSettingsMenuItem);
-
- _loadSettingsMenuItem = new JMenuItem("Load Custom Settings ...");
- _loadSettingsMenuItem.setMnemonic('L');
- _fileMenu.add(_loadSettingsMenuItem);
-
- _loadOfficeSettingsMenuItem = new JMenuItem("Load Office Settings");
- _loadOfficeSettingsMenuItem.setMnemonic('O');
- _loadOfficeSettingsMenuItem
- .setToolTipText("Load office settings from PrecipMonitorSettings.txt");
- _fileMenu.add(_loadOfficeSettingsMenuItem);
-
- _fileMenu.add(new JSeparator());
-
- _exportTableToTextMenuItem = new JMenuItem(
- "Export Data To Text File ...");
- _exportTableToTextMenuItem.setMnemonic('x');
- _fileMenu.add(_exportTableToTextMenuItem);
-
- _fileMenu.add(new JSeparator());
-
- _exitApplicationMenuItem = new JMenuItem("Exit");
- _exitApplicationMenuItem.setMnemonic('E');
- _fileMenu.add(_exitApplicationMenuItem);
-
- // Display Menu
-
- _selectColumnsMenuItem = new JMenuItem("Select Columns ...");
- _selectColumnsMenuItem.setMnemonic('S');
- _displayMenu.add(_selectColumnsMenuItem);
-
- _displayMenu.add(new JSeparator());
-
- _fcstTsMenu = new JMenu("Forecast Source");
- _fcstTsMenu.setMnemonic('F');
- _displayMenu.add(_fcstTsMenu);
-
- _validTimeLookUpForAlertAlarmMenuItem = new JMenuItem(
- "Alert Alarm ValidTime ...");
- _validTimeLookUpForAlertAlarmMenuItem.setMnemonic('A');
- _displayMenu.add(_validTimeLookUpForAlertAlarmMenuItem);
-
- _endTimeLookUpForVTECEventMenuItem = new JMenuItem(
- "VTEC Event EndTime ...");
- _endTimeLookUpForVTECEventMenuItem.setMnemonic('V');
- _displayMenu.add(_endTimeLookUpForVTECEventMenuItem);
-
- _ugcExpireTimeLookUpMenuItem = new JMenuItem("UGCExpire Time ...");
- _ugcExpireTimeLookUpMenuItem.setMnemonic('U');
- _displayMenu.add(_ugcExpireTimeLookUpMenuItem);
-
- _vtecEventProductTimeLookUpMenuItem = new JMenuItem(
- "VTEC Event Product Time ...");
- _vtecEventProductTimeLookUpMenuItem.setMnemonic('P');
- _displayMenu.add(_vtecEventProductTimeLookUpMenuItem);
-
- _obsTimeLookUpForLatestObsValueMenuItem = new JMenuItem(
- "Latest ObsTime ...");
- _obsTimeLookUpForLatestObsValueMenuItem.setMnemonic('O');
- _displayMenu.add(_obsTimeLookUpForLatestObsValueMenuItem);
-
- _fcstBasisTimeLookUpForMaxFcstValueMenuItem = new JMenuItem(
- "Latest Fcst Basis Time ...");
- _fcstBasisTimeLookUpForMaxFcstValueMenuItem.setMnemonic('B');
- _displayMenu.add(_fcstBasisTimeLookUpForMaxFcstValueMenuItem);
-
- _precipThresholdForThreatColorMenuItem = new JMenuItem(
- "Precip Threshold ...");
- _precipThresholdForThreatColorMenuItem.setMnemonic('P');
- _displayMenu.add(_precipThresholdForThreatColorMenuItem);
-
- _displayMenu.add(new JSeparator());
-
- _showMissingRiverMenuItem = new JCheckBoxMenuItem(
- "Show Locations with Missing Obs/Fcst Data");
- _showMissingRiverMenuItem.setMnemonic('M');
- _displayMenu.add(_showMissingRiverMenuItem);
-
- // Config Menu
-
- _riverMonGroupMenuItem = new JMenuItem("Group Definitions ...");
- _riverMonGroupMenuItem.setMnemonic('G');
- _configMenu.add(_riverMonGroupMenuItem);
-
- _riverMonLocationMenuItem = new JMenuItem(
- "Location Grouping/Ordering ...");
- _riverMonLocationMenuItem.setMnemonic('L');
- _configMenu.add(_riverMonLocationMenuItem);
-
- _configMenu.add(new JSeparator());
-
- _riverMonitorPEConfigMenuItem = new JMenuItem(
- "River Data Type Override ...");
- _riverMonitorPEConfigMenuItem.setMnemonic('P');
- _configMenu.add(_riverMonitorPEConfigMenuItem);
-
- _configMenu.add(new JSeparator());
-
- _derivedColumnsMenuItem = new JMenuItem("Derived Columns ...");
- _derivedColumnsMenuItem.setMnemonic('D');
- _configMenu.add(_derivedColumnsMenuItem);
-
- // Sort Menu
-
- _clearSortMenuItem = new JMenuItem("Clear Sort");
- _clearSortMenuItem.setMnemonic('C');
- _clearSortMenuItem.setToolTipText("Clear All Sorts");
- _sortMenu.add(_clearSortMenuItem);
-
- _sortMenu.add(new JSeparator());
-
- _hsagrplocSortMenuItem = new JMenuItem(
- "Sort by HSA | Group | Location Columns");
- _hsagrplocSortMenuItem.setMnemonic('O');
- _hsagrplocSortMenuItem
- .setToolTipText("Sort by HSA, group id, location id");
- _sortMenu.add(_hsagrplocSortMenuItem);
-
- _riverThreatSortMenuItem = new JMenuItem("River Threat Sort");
- _riverThreatSortMenuItem.setMnemonic('R');
- _riverThreatSortMenuItem.setToolTipText("Sort by Threat Column");
- _sortMenu.add(_riverThreatSortMenuItem);
-
- _precipThreatSortMenuItem = new JMenuItem("Precip Threat Sort");
- _precipThreatSortMenuItem.setMnemonic('P');
- _precipThreatSortMenuItem
- .setToolTipText("Sort by Precip Threat Column");
- _sortMenu.add(_precipThreatSortMenuItem);
-
- // Details Menu
-
- _officeNotesMenuItem = new JMenuItem("Office Notes ...");
- _officeNotesMenuItem.setMnemonic('O');
- _detailsMenu.add(_officeNotesMenuItem);
-
- _alertAlarmMenuItem = new JMenuItem("Alert Alarm ...");
- _alertAlarmMenuItem.setMnemonic('A');
- _detailsMenu.add(_alertAlarmMenuItem);
-
- _vtecEventMenuItem = new JMenuItem("VTEC Events ...");
- _vtecEventMenuItem.setMnemonic('V');
- _detailsMenu.add(_vtecEventMenuItem);
-
- _detailsMenu.add(new JSeparator());
-
- _siteSpecificMenuItem = new JMenuItem("SiteSpecific App...");
- _siteSpecificMenuItem.setMnemonic('S');
- _detailsMenu.add(_siteSpecificMenuItem);
-
- _timeSeriesLiteMenuItem = new JMenuItem("Time Series Lite...");
- _timeSeriesLiteMenuItem.setMnemonic('T');
- _detailsMenu.add(_timeSeriesLiteMenuItem);
-
- // Help Menu
-
- _aboutMenuItem = new JMenuItem("About ...");
- _aboutMenuItem.setMnemonic('A');
- _helpMenu.add(_aboutMenuItem);
-
- // sub menus
- _fcstTsGroup = new ButtonGroup();
- _fcstTsIngestFilterMenuItem = new JRadioButtonMenuItem("IngestFilter");
- _fcstTsIngestFilterMenuItem.setSelected(true);
- FcstTsMenuItemListener fcstTsListener = new FcstTsMenuItemListener();
- _fcstTsIngestFilterMenuItem.addActionListener(fcstTsListener);
- _fcstTsGroup.add(_fcstTsIngestFilterMenuItem);
- _fcstTsMenu.add(_fcstTsIngestFilterMenuItem);
- _fcstTsFFMenuItem = new JRadioButtonMenuItem("FF");
- _fcstTsFFMenuItem.addActionListener(fcstTsListener);
- _fcstTsGroup.add(_fcstTsFFMenuItem);
- _fcstTsMenu.add(_fcstTsFFMenuItem);
- _fcstTsFZMenuItem = new JRadioButtonMenuItem("FZ");
- _fcstTsFZMenuItem.addActionListener(fcstTsListener);
- _fcstTsGroup.add(_fcstTsFZMenuItem);
- _fcstTsMenu.add(_fcstTsFZMenuItem);
-
- setMenuListeners();
-
- _menuBar.add(_fileMenu);
- _menuBar.add(_displayMenu);
- _menuBar.add(_configMenu);
- _menuBar.add(_sortMenu);
- _menuBar.add(_detailsMenu);
- _menuBar.add(_helpMenu);
- }
-
- private void setMenuListeners() {
- ChangeColumnsDisplayedMenuListener changeMenuListener = new ChangeColumnsDisplayedMenuListener();
- _selectColumnsMenuItem.addActionListener(changeMenuListener);
-
- ShowMissingRiverMenuListener showMissingPrecipMenuListener = new ShowMissingRiverMenuListener();
- _showMissingRiverMenuItem
- .addItemListener(showMissingPrecipMenuListener);
-
- SaveSettingsListener saveMenuListener = new SaveSettingsListener();
- _saveColumnSettingsMenuItem.addActionListener(saveMenuListener);
-
- LoadSettingsListener loadMenuListener = new LoadSettingsListener();
- _loadSettingsMenuItem.addActionListener(loadMenuListener);
-
- LoadOfficeSettingsListener loadOfficeSettingsListener = new LoadOfficeSettingsListener();
- _loadOfficeSettingsMenuItem
- .addActionListener(loadOfficeSettingsListener);
-
- SaveOfficeSettingsListener saveOfficeSettingsListener = new SaveOfficeSettingsListener();
- _saveOfficeSettingsMenuItem
- .addActionListener(saveOfficeSettingsListener);
-
- ExitApplicationListener exitApplicationListener = new ExitApplicationListener();
- _exitApplicationMenuItem.addActionListener(exitApplicationListener);
-
- RefreshMenuListener RefreshMenuListener = new RefreshMenuListener();
- _refreshColumnMenuItem.addActionListener(RefreshMenuListener);
-
- SaveTableListener saveTableListener = new SaveTableListener();
- _exportTableToTextMenuItem.addActionListener(saveTableListener);
-
- AppSortListener appSortListener = new AppSortListener();
- _hsagrplocSortMenuItem.addActionListener(appSortListener);
-
- PrecipThreatSortListener precipThreatSortListener = new PrecipThreatSortListener();
- _precipThreatSortMenuItem.addActionListener(precipThreatSortListener);
-
- RiverThreatSortListener riverThreatSortListener = new RiverThreatSortListener();
- _riverThreatSortMenuItem.addActionListener(riverThreatSortListener);
-
- ClearSortListener clearSortListener = new ClearSortListener();
- _clearSortMenuItem.addActionListener(clearSortListener);
-
- AlertAlarmDialogListener alertAlarmDialogListener = new AlertAlarmDialogListener();
- _alertAlarmMenuItem.addActionListener(alertAlarmDialogListener);
-
- VtecEventDialogListener vtecEventDialogListener = new VtecEventDialogListener();
- _vtecEventMenuItem.addActionListener(vtecEventDialogListener);
-
- SiteSpecificListener siteSpecificListener = new SiteSpecificListener();
- _siteSpecificMenuItem.addActionListener(siteSpecificListener);
-
- OfficeNotesDialogListener officeNotesDialogListener = new OfficeNotesDialogListener();
- _officeNotesMenuItem.addActionListener(officeNotesDialogListener);
-
- TimeSeriesLiteMenuItemListener timeSeriesLiteMenuItemListener = new TimeSeriesLiteMenuItemListener();
- _timeSeriesLiteMenuItem
- .addActionListener(timeSeriesLiteMenuItemListener);
-
- RiverMonitorPEConfigEditorListener riverMonitorPEConfigEditorListener = new RiverMonitorPEConfigEditorListener();
- _riverMonitorPEConfigMenuItem
- .addActionListener(riverMonitorPEConfigEditorListener);
-
- RiverMonGroupDialogListener riverMonGroupDialogListener = new RiverMonGroupDialogListener();
- _riverMonGroupMenuItem.addActionListener(riverMonGroupDialogListener);
-
- RiverMonLocationDialogListener riverMonLocationDialogListener = new RiverMonLocationDialogListener();
- _riverMonLocationMenuItem
- .addActionListener(riverMonLocationDialogListener);
-
- AlertAlarmValidTimeListener alertAlarmValidTimeListener = new AlertAlarmValidTimeListener();
- _validTimeLookUpForAlertAlarmMenuItem
- .addActionListener(alertAlarmValidTimeListener);
-
- VtecEventEndTimeListener vtecEventEndTimeListener = new VtecEventEndTimeListener();
- _endTimeLookUpForVTECEventMenuItem
- .addActionListener(vtecEventEndTimeListener);
-
- UGCExpireTimeListener ugcExpireTimeListener = new UGCExpireTimeListener();
- _ugcExpireTimeLookUpMenuItem.addActionListener(ugcExpireTimeListener);
-
- VtecEventProductTimeListener vtecEventProductTimeListener = new VtecEventProductTimeListener();
- _vtecEventProductTimeLookUpMenuItem
- .addActionListener(vtecEventProductTimeListener);
-
- LatestObsTimeListener latestObsTimeListener = new LatestObsTimeListener();
- _obsTimeLookUpForLatestObsValueMenuItem
- .addActionListener(latestObsTimeListener);
-
- LatestFcstBasisTimeListener latestFcstBasisTimeListener = new LatestFcstBasisTimeListener();
- _fcstBasisTimeLookUpForMaxFcstValueMenuItem
- .addActionListener(latestFcstBasisTimeListener);
-
- PrecipThresholdListener precipThresholdListener = new PrecipThresholdListener(
- _menuSettings.getPrecipSettings());
- _precipThresholdForThreatColorMenuItem
- .addActionListener(precipThresholdListener);
-
- DerivedColumnsEditorListener derivedColumnsEditorListener = new DerivedColumnsEditorListener();
- _derivedColumnsMenuItem.addActionListener(derivedColumnsEditorListener);
-
- AboutListener aboutListener = new AboutListener();
- _aboutMenuItem.addActionListener(aboutListener);
-
- }
-
- private class DerivedColumnsEditorListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- String editorTitle = ("\"").concat("Derived Columns").concat("\"");
- String file = _settingsDir + "/"
- + RiverMonitorAppManager.DERIVED_COLUMNS_FILE;
- launchTextEditor(editorTitle, file, "RiverMonitor Application");
- }
- }
-
- private void setFrameListener() {
- FrameListener frameListener = new FrameListener();
- _mainFrame.addWindowListener(frameListener);
- }
-
- public void closeApplication() {
- _logger.log("RiverMonitor Application Exiting....");
- _logger.log("====================================");
- _rivermonitorDataManager.disconnect();
- _mainFrame.setVisible(false);
- _mainFrame.dispose();
- Monitor.disposeRiver();
- }
-
- private void createOfficeNotesDialog() {
- List lidList = _rivermonitorDataManager.getLidList();
- String lids[] = new String[lidList.size()];
- for (int i = 0; i < lidList.size(); i++) {
- lids[i] = lidList.get(i).toString();
- }
- Arrays.sort(lids);
- System.out.println("Create officenotes lids size:" + lidList.size());
- Map lidDescDetailsMap = _rivermonitorDataManager.getLidDescDetails();
- if (_officeNotesDialog == null)
- _officeNotesDialog = new OfficeNotesDialog(_mainFrame,
- _officeNotesDataMgr, "RIVERMON", lids, lidDescDetailsMap,
- _logger);
- }
-
- public void loadSettings() {
- String header = "RiverMonitorMenuManager.loadSettings(): ";
-
- System.out.print(header);
- send(this, MessageType.LOAD_SETTINGS);
- }
-
- private void loadOfficeSettings() {
- String header = "RiverMonitorMenuManager.loadOfficeSettings(): ";
-
- System.out.print(header);
- send(this, MessageType.LOAD_OFFICE_SETTINGS);
- }
-
- public void viewSelectItem(MonitorMessage message) {
- String header = "RiverMonitorMenuManager.viewSelectItem(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
- _selectedRowData = (RiverMonitorJTableRowData) message.getMessageData();
- }
-
- private class UpdateDisplayReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- updateRecordCount();
- }
- }
-
- public void updateDisplayWithSettings(MonitorMessage message) {
- String header = "RiverMonitorMenuManager.updateDisplayWithSettings(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
- refreshTimeDisplay();
- updateMenuWithNewSettings();
- }
-
- private void updateMenuWithNewSettings() {
- String fcstTypeSource = _menuSettings.getRiverSettings()
- .getFcstTypeSource();
-
- if (fcstTypeSource != null) {
- if (fcstTypeSource.equals("IngestFilter")) {
- _fcstTsIngestFilterMenuItem.setSelected(true);
- } else if (fcstTypeSource.equals("FF")) {
- _fcstTsFFMenuItem.setSelected(true);
- } else {
- _fcstTsFZMenuItem.setSelected(true);
- }
- } else {
- _fcstTsFZMenuItem.setActionCommand("IngestFilter");
- }
-
- if (_menuSettings.shouldShowMissingRiver())
- _showMissingRiverMenuItem.setSelected(true);
- else
- _showMissingRiverMenuItem.setSelected(false);
- }
-
- public void saveSettings() {
- String header = "RiverMonitorMenuManager.saveSettings(): ";
-
- System.out.print(header);
- send(this, MessageType.SAVE_SETTINGS);
- }
-
- private void saveOfficeSettings() {
- String header = "RiverMonitorMenuManager.saveOfficeSettings(): ";
-
- System.out.print(header);
- send(this, MessageType.SAVE_OFFICE_SETTINGS);
- }
-
- public void loadSettings(File fileHandler) {
- if (fileHandler != null) {
- String header = "RiverMonitorMenuManager.loadSettings(): ";
-
- System.out.print(header);
- send(this, MessageType.LOAD_SETTINGS);
- }
- }
-
- public void loadSettingsFromFile(File fileHandler) {
- String header = "RiverMonitorMenuManager.loadSettingsFromFile(): ";
- if (fileHandler != null) {
- _logger.log(header + "Read settings from "
- + fileHandler.getAbsolutePath());
- loadSettings(fileHandler);
- }
- }
-
- private void changeColumns() {
- String header = "RiverMonitorMenuManager.changeColumns(): ";
-
- System.out.print(header);
- send(this, MessageType.CHANGE_COLUMNS);
- }
-
- private void saveTable() {
- String header = "RiverMonitorMenuManager.saveTable(): ";
-
- System.out.print(header);
- send(this, MessageType.CREATE_TEXT_FROM_VIEW);
- }
-
- private void precipThreatSort() {
- String header = "RiverMonitorMenuManager.precipThreatSort(): ";
-
- System.out.print(header);
- send(this, MessageType.CLEAR_SORT);
-
- System.out.print(header);
- send(this, MessageType.PRECIP_THREAT_SORT);
- }
-
- private void riverThreatSort() {
- String header = "RiverMonitorMenuManager.riverThreatSort(): ";
-
- System.out.print(header);
- send(this, MessageType.CLEAR_SORT);
-
- System.out.print(header);
- send(this, MessageType.RIVER_THREAT_SORT);
- }
-
- private void appSort() {
- String header = "RiverMonitorMenuManager.appSort(): ";
-
- System.out.print(header);
- send(this, MessageType.CLEAR_SORT);
-
- System.out.print(header);
- send(this, MessageType.APP_SORT);
- }
-
- private void clearSort() {
- String header = "RiverMonitorMenuManager.clearSort(): ";
- System.out.print(header);
- send(this, MessageType.CLEAR_SORT);
- }
-
- private void createRiverMonGroupDialog() {
- String defaultHsa = _rivermonitorDataManager.getDefaultHsa();
- if (_riverMonGroupDialog == null)
- _riverMonGroupDialog = new RiverMonGroupDialog(_mainFrame,
- _rivermonitorDataManager.getRiverMonLocGroupDataManager(),
- _logger, defaultHsa);
- }
-
- private void createRiverMonLocationDialog() {
- if (_riverMonLocationDialog == null)
- _riverMonLocationDialog = new RiverMonLocationDialog(_mainFrame,
- _rivermonitorDataManager.getRiverMonLocGroupDataManager(),
- _logger);
- }
-
- private void createAlertAlarmDialog() {
- if (_alertAlarmDialog == null)
- _alertAlarmDialog = new AlertAlarmDialog(_mainFrame,
- _alertAlarmDataMgr, _logger);
- }
-
- private void createVtecEventDialog() {
- if (_vtecEventDialog == null)
- _vtecEventDialog = new VtecEventDialog(_mainFrame,
- _vtecEventDataMgr, _logger);
- }
-
- private class ExitApplicationListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- closeApplication();
- }
- }
-
- private class VtecEventDialogListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- createVtecEventDialog();
- if (_selectedRowData != null) {
- _vtecEventDialog.showVtecEventDialog(_selectedRowData.getLid());
- } else
- _vtecEventDialog.showVtecEventDialog(null);
- }
- }
-
- private class AlertAlarmDialogListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- createAlertAlarmDialog();
- if (_selectedRowData != null) {
- _alertAlarmDialog.showAlertAlarmDialog(_selectedRowData
- .getLid());
- } else
- _alertAlarmDialog.showAlertAlarmDialog(null);
- }
- }
-
- private class TimeSeriesLiteMenuItemListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- if (_selectedRowData != null) {
- _monitorTimeSeriesLiteManager.displayTimeSeriesLite(_mainFrame,
- _selectedRowData);
- } else {
- String textMsg = " Unable to display TimeSeriesLite
"
- + "Please highlight a row... ";
- JOptionPane.showMessageDialog(_mainFrame, textMsg,
- "TimeSeriesLite", JOptionPane.PLAIN_MESSAGE);
- }
- }
- }
-
- private class SiteSpecificListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- String whfsBinDir = _appsDefaults.getToken("whfs_bin_dir",
- "/awips/hydroapps/whfs/bin");
- String siteSpecificExe = whfsBinDir + "/run_SiteSpecific";
-
- // DR#10955
- RunProcess rt = RunProcess.getRunProcess();
-
- String cmd;
- if (_selectedRowData != null)
- cmd = siteSpecificExe + " " + _selectedRowData.getLid();
- else
- cmd = siteSpecificExe;
-
- try {
- _mainFrame.setWaitCursor();
- rt.exec(cmd);
- _logger.log("SiteSpecific App is launched [cmd:" + cmd + "]");
- _mainFrame.setDefaultCursor();
- } catch (IOException ex) {
- _mainFrame.setDefaultCursor();
- String str = "Unable to launch SiteSpecific Appln:[" + cmd
- + "]" + "Exception:" + ex;
- JOptionPane.showMessageDialog(_mainFrame, str,
- "RiverMonitor Application", JOptionPane.PLAIN_MESSAGE);
- }
- }
- }
-
- private class PrecipMonitorListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- // startMonitor("PrecipMonitor Application", "PRECIP");
- }
- }
-
- private class SaveTableListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- saveTable();
- }
- }
-
- public class OLDShowMissingRiverMenuListener implements ItemListener {
- public void itemStateChanged(ItemEvent e) {
- boolean prevValue = _menuSettings.shouldShowMissingRiver();
- boolean newValue = false;
- if (e.getStateChange() == ItemEvent.SELECTED) {
- newValue = true;
- } else if (e.getStateChange() == ItemEvent.DESELECTED) {
- newValue = false;
- }
-
- _menuSettings.setShowMissingRiver(newValue);
-
- if (prevValue != newValue) {
- menuChange();
- }
- }
- }
-
- public class ShowMissingRiverMenuListener implements ItemListener {
- public void itemStateChanged(ItemEvent e) {
- String header = "RiverMonitorMenuManager.ShowMissingPrecipMenuListener.itemStateChanged()";
-
- boolean prevValue = _menuSettings.shouldShowMissingRiver();
- boolean newValue = false;
- if (e.getStateChange() == ItemEvent.SELECTED) {
- newValue = true;
- }
-
- _menuSettings.setShowMissingRiver(newValue);
-
- if (prevValue != newValue) {
- sendMissingFilterChanged();
- }
- }
- }
-
- public class ChangeColumnsDisplayedMenuListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- changeColumns();
- }
- }
-
- private class ClearSortListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- clearSort();
- }
- }
-
- private class PrecipThreatSortListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- precipThreatSort();
- }
- }
-
- private class RiverThreatSortListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- riverThreatSort();
- }
- }
-
- private class AppSortListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- appSort();
- }
- }
-
- private class RefreshMenuListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- refresh();
- }
- }
-
- private class AlertAlarmValidTimeListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- int prevValue = _menuSettings.getRiverSettings()
- .getAlertAlarmLookBack();
-
- new LookBackTimeDialog(
- _mainFrame,
- _menuSettings.getRiverSettings(),
- "AlertAlarm----ValidTime Filter",
- new JLabel(
- "Num Of Hrs To Lookback:"),
- RiverColumnDataSettings.VALID_TIME_TAG, 168, 1);
-
- if (prevValue != _menuSettings.getRiverSettings()
- .getAlertAlarmLookBack()) {
- menuChange();
- }
- }
- }
-
- private class VtecEventEndTimeListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- int prevValue = _menuSettings.getRiverSettings()
- .getVtecEventEndTimeApproach();
-
- new LookBackTimeDialog(
- _mainFrame,
- _menuSettings.getRiverSettings(),
- "VTEC Event----EndTime Filter",
- new JLabel(
- "Num Of Hrs To LookAhead:"),
- RiverColumnDataSettings.VTEC_EVENT_END_TIME_TAG, 24, 1);
-
- if (prevValue != _menuSettings.getRiverSettings()
- .getVtecEventEndTimeApproach()) {
- menuChange();
- }
- }
- }
-
- private class VtecEventProductTimeListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- int prevValue = _menuSettings.getRiverSettings()
- .getVtecEventProductTimeLookBack();
-
- new LookBackTimeDialog(
- _mainFrame,
- _menuSettings.getRiverSettings(),
- "VTEC Event----Product Time Filter",
- new JLabel(
- "Num Of Hrs To Lookback:"),
- RiverColumnDataSettings.VTEC_EVENT_PRODUCT_TIME_TAG, 9000,
- 1);
-
- if (prevValue != _menuSettings.getRiverSettings()
- .getVtecEventProductTimeLookBack()) {
- menuChange();
- }
- }
- }
-
- private class UGCExpireTimeListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- int prevValue = _menuSettings.getRiverSettings()
- .getUgcExpireTimeApproach();
-
- new LookBackTimeDialog(
- _mainFrame,
- _menuSettings.getRiverSettings(),
- "UGC ExpireTime Filter",
- new JLabel(
- "Num Of Hrs To LookAhead:"),
- RiverColumnDataSettings.UGC_EXPIRE_TIME_TAG, 24, 1);
-
- if (prevValue != _menuSettings.getRiverSettings()
- .getUgcExpireTimeApproach()) {
- menuChange();
- }
- }
- }
-
- private class LatestObsTimeListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- int prevValue = _menuSettings.getRiverSettings()
- .getLatestObsLookBack();
-
- new LookBackTimeDialog(
- _mainFrame,
- _menuSettings.getRiverSettings(),
- "Latest ObsTime Filter",
- new JLabel(
- "Num Of Hrs To Lookback:"),
- RiverColumnDataSettings.LATEST_OBS_TIME_TAG, 720, 1);
-
- if (prevValue != _menuSettings.getRiverSettings()
- .getLatestObsLookBack()) {
- menuChange();
- }
- }
- }
-
- private class LatestFcstBasisTimeListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- int prevValue = _menuSettings.getRiverSettings()
- .getLatestFcstBasisTimeLookBack();
-
- new LookBackTimeDialog(
- _mainFrame,
- _menuSettings.getRiverSettings(),
- "Latest Fcst BasisTime Filter",
- new JLabel(
- "Num Of Hrs To Lookback:"),
- RiverColumnDataSettings.LATEST_FCST_BASIS_TIME_TAG, 720, 1);
-
- if (prevValue != _menuSettings.getRiverSettings()
- .getLatestFcstBasisTimeLookBack()) {
- menuChange();
- }
- }
- }
-
- private class FcstTsMenuItemListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- String prevValue = _menuSettings.getRiverSettings()
- .getFcstTypeSource();
- String selectedItem = e.getActionCommand();
- _menuSettings.getRiverSettings().setFcstTypeSource(selectedItem);
-
- if (!prevValue.equalsIgnoreCase(_menuSettings.getRiverSettings()
- .getFcstTypeSource())) {
- menuChange();
- }
- }
- }
-
- private class RiverMonitorPEConfigEditorListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- String editorTitle = ("\"").concat("PEConfig File").concat("\"");
- String file = _settingsDir + RiverMonitorAppManager.PE_CONFIG_FILE;
- launchTextEditor(editorTitle, file, "RiverMonitor Application");
- }
- }
-
- private class RiverMonGroupDialogListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- createRiverMonGroupDialog();
- boolean hasTableChanged = _riverMonGroupDialog
- .showRiverMonGroupDialog();
- if (hasTableChanged) {
- menuChange();
- }
- }
- }
-
- private class RiverMonLocationDialogListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- createRiverMonLocationDialog();
- boolean hasTableChanged = _riverMonLocationDialog
- .showRiverMonLocationDialog();
- System.out.println("Rivermonlocation table changed:"
- + hasTableChanged);
- if (hasTableChanged) {
- menuChange();
- }
- }
- }
-
- private class LoadOfficeSettingsListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- loadOfficeSettings();
- }
- }
-
- private class SaveOfficeSettingsListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- String message = " This will overwrite standard office settings for RiverMonitor.
"
- + "Are you sure ?
";
- if (confirmSaveOfficeSettings(message))
- saveOfficeSettings();
- }
- }
-
- private class LoadSettingsListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- loadSettings();
- }
- }
-
- private class FrameListener extends WindowAdapter {
- @Override
- public void windowClosing(WindowEvent event) {
- closeApplication();
- }
- }
-
- private class OfficeNotesDialogListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- createOfficeNotesDialog();
- if (_selectedRowData != null) {
- _officeNotesDialog.showOfficeNotesDialog(_selectedRowData
- .getLid());
- } else
- _officeNotesDialog.showOfficeNotesDialog(null);
-
- _toolBarManager.setOfficeNotesButtonIcon(_officeNotesDataMgr
- .getCountOfOfficeNotes());
- }
- }
-
- private class SaveSettingsListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- saveSettings();
- }
- }
-
- private class UpdateDisplayWithSettingsReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- setInitialRefreshTimeInfo();
- updateDisplayWithSettings(message);
- }
- }
-
- private class ViewSelectItemReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- viewSelectItem(message);
- }
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorRefreshManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorRefreshManager.java
deleted file mode 100755
index 172729d996..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorRefreshManager.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package ohd.hseb.monitor.river.manager;
-
-import javax.swing.JSplitPane;
-
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.manager.MonitorRefreshManager;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.messaging.MessageType;
-import ohd.hseb.monitor.river.RiverMonitorDataManager;
-import ohd.hseb.util.SessionLogger;
-import ohd.hseb.util.gui.DialogHelper;
-
-public class RiverMonitorRefreshManager extends MonitorRefreshManager
-{
-
- private RiverMonitorDataManager _riverMonitorDataManager;
-
- public RiverMonitorRefreshManager(MessageSystemManager msgSystemManager, SessionLogger logger,
- RiverMonitorDataManager riverMonitorDataManager, JSplitPane splitPane)
- {
- super(msgSystemManager, logger, splitPane);
-
- _riverMonitorDataManager = riverMonitorDataManager;
- }
-
- protected void reloadData(MonitorMessage incomingMessage, MessageType outgoingMessageType)
- {
-
- DialogHelper.setWaitCursor(_splitPane);
-
- String header = "MonitorRefreshManager.reloadData: ";
- System.out.println(header +" Invoked"+ "...Source:" + incomingMessage.getMessageSource() + " Type:" + incomingMessage.getMessageType());
-
- Runtime.getRuntime().gc();
-
- _riverMonitorDataManager.createRiverMonitorRowDataList();
-
- Runtime.getRuntime().gc();
-
- System.out.println(header);
- send(this, outgoingMessageType);
-
- DialogHelper.setDefaultCursor(_splitPane);
-
- }
-
-}
-
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorSettingsManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorSettingsManager.java
deleted file mode 100755
index 849ccf24ba..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorSettingsManager.java
+++ /dev/null
@@ -1,201 +0,0 @@
-package ohd.hseb.monitor.river.manager;
-
-import java.io.File;
-
-import javax.swing.JFileChooser;
-
-import ohd.hseb.monitor.MonitorFrame;
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.manager.BaseManager;
-import ohd.hseb.monitor.manager.Receiver;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.messaging.MessageType;
-import ohd.hseb.monitor.river.settings.RiverMonitorMenuSettings;
-import ohd.hseb.monitor.river.settings.RiverMonitorSettingsFileManager;
-import ohd.hseb.monitor.settings.FilterSettings;
-import ohd.hseb.monitor.settings.ViewSettings;
-import ohd.hseb.util.SessionLogger;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-
-public class RiverMonitorSettingsManager extends BaseManager {
- private String _settingsDir;
-
- private AppsDefaults _appsDefaults;
-
- private SessionLogger _logger;
-
- private JFileChooser _fileChooser;
-
- private MonitorFrame _mainFrame;
-
- private ViewSettings _viewSettings;
-
- private FilterSettings _filterSettings;
-
- private RiverMonitorMenuSettings _menuSettings;
-
- private RiverMonitorSettingsFileManager _riverMonitorSettingsFileManger;
-
- private String _officeSettingsFile;
-
- private String _defaultSettingsFile;
-
- public RiverMonitorSettingsManager(MessageSystemManager msgSystemManager,
- AppsDefaults appsDefaults, SessionLogger logger,
- MonitorFrame mainFrame, ViewSettings viewSettings,
- FilterSettings filterSettings, RiverMonitorMenuSettings menuSettings) {
- _appsDefaults = appsDefaults;
- _logger = logger;
- _viewSettings = viewSettings;
- _filterSettings = filterSettings;
- _menuSettings = menuSettings;
-
- _settingsDir = _appsDefaults.getToken("rivermon_config_dir",
- "/awips/hydroapps/whfs/local/data/app/rivermon");
-
- _riverMonitorSettingsFileManger = new RiverMonitorSettingsFileManager(
- _logger, _viewSettings, _filterSettings, _menuSettings);
-
- _mainFrame = mainFrame;
-
- _officeSettingsFile = _settingsDir.concat("/").concat(
- RiverMonitorAppManager.SITE_RIVER_SETTINGS_FILE);
- _defaultSettingsFile = _settingsDir.concat("/").concat(
- RiverMonitorAppManager.DEFAULT_RIVER_SETTINGS_FILE);
-
- setMessageSystemManager(msgSystemManager);
-
- _msgSystemManager.registerReceiver(new LoadSettingsReceiver(),
- MessageType.LOAD_SETTINGS);
- _msgSystemManager.registerReceiver(new LoadOfficeSettingsReceiver(),
- MessageType.LOAD_OFFICE_SETTINGS);
- _msgSystemManager.registerReceiver(new SaveSettingsReceiver(),
- MessageType.SAVE_SETTINGS);
- _msgSystemManager.registerReceiver(new SaveOfficeSettingsReceiver(),
- MessageType.SAVE_OFFICE_SETTINGS);
- }
-
- private void saveSettings(MonitorMessage message) {
- String header = "RiverMonitorSettingsManager.saveSettings(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- File fileHandler = null;
- _fileChooser = new JFileChooser();
-
- _fileChooser.setCurrentDirectory(new File(_settingsDir));
- _fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
-
- int result = _fileChooser.showSaveDialog(_mainFrame);
- if (result == JFileChooser.CANCEL_OPTION)
- fileHandler = null;
- else
- fileHandler = _fileChooser.getSelectedFile();
-
- System.out.print(header);
- saveSettingsToFile(fileHandler);
- }
-
- private void saveOfficeSettings(MonitorMessage message) {
- String header = "RiverMonitorSettingsManager.saveOfficeSettings(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- File fileHandler = new File(_officeSettingsFile);
-
- System.out.print(header);
- saveSettingsToFile(fileHandler);
- }
-
- private void saveSettingsToFile(File fileHandler) {
- send(this, MessageType.UPDATE_SETTINGS);
-
- if (fileHandler != null) {
- _riverMonitorSettingsFileManger.saveSettingsToFile(fileHandler);
- }
- }
-
- private void loadSettings(MonitorMessage message) {
- String header = "RiverMonitorSettingsManager.loadSettings(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- if (message.getMessageSource() != this) {
- File fileHandler = null;
- _fileChooser = new JFileChooser();
- _fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
-
- _fileChooser.setCurrentDirectory(new File(_settingsDir));
- int result = _fileChooser.showOpenDialog(_mainFrame);
-
- if (result == JFileChooser.CANCEL_OPTION)
- fileHandler = null;
- else
- fileHandler = _fileChooser.getSelectedFile();
-
- loadSettings(fileHandler);
- }
- }
-
- public void startRiverMonitor() {
- String header = "RiverMonitorSettings.startRiverMonitor(): ";
- File fileHandler = new File(_officeSettingsFile);
- if (fileHandler == null || (!fileHandler.exists())) {
- fileHandler = new File(_defaultSettingsFile);
- }
-
- _logger.log(header + "Trying to load from file :"
- + fileHandler.getAbsolutePath());
- // loadSettings(fileHandler);
- }
-
- private void loadSettings(File fileHandler) {
- String header = "RiverMonitorSettingsManager.loadSettings(): ";
- if (fileHandler != null) {
- _riverMonitorSettingsFileManger.setSettingsFromFile(fileHandler);
-
- System.out.print(header);
- send(this, MessageType.RELOAD_DATA_WITH_NEW_SETTINGS);
- }
- }
-
- private void loadOfficeSettings(MonitorMessage message) {
- String header = "RiverMonitorSettingsManager.loadOfficeSettings(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- File fileHandler = new File(_officeSettingsFile);
-
- loadSettings(fileHandler);
- }
-
- private class SaveOfficeSettingsReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- saveOfficeSettings(message);
- }
- }
-
- private class LoadOfficeSettingsReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- loadOfficeSettings(message);
- }
- }
-
- private class LoadSettingsReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- loadSettings(message);
- }
- }
-
- private class SaveSettingsReceiver implements Receiver {
- public void receive(MonitorMessage message) {
- saveSettings(message);
- }
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorViewManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorViewManager.java
deleted file mode 100755
index c1fd864a1b..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/manager/RiverMonitorViewManager.java
+++ /dev/null
@@ -1,703 +0,0 @@
-package ohd.hseb.monitor.river.manager;
-
-import java.awt.Dimension;
-import java.awt.Point;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.util.List;
-
-import javax.swing.JFileChooser;
-import javax.swing.JScrollPane;
-import javax.swing.JSplitPane;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import ohd.hseb.db.DbTable;
-import ohd.hseb.ihfsdb.generated.VTECeventRecord;
-import ohd.hseb.monitor.LocationInfoColumns;
-import ohd.hseb.monitor.MonitorFrame;
-import ohd.hseb.monitor.MonitorMessage;
-import ohd.hseb.monitor.MonitorTimeSeriesLiteManager;
-import ohd.hseb.monitor.derivedcolumns.DerivedColumnsFileManager;
-import ohd.hseb.monitor.manager.BaseManager;
-import ohd.hseb.monitor.manager.Receiver;
-import ohd.hseb.monitor.messaging.MessageSystemManager;
-import ohd.hseb.monitor.messaging.MessageType;
-import ohd.hseb.monitor.precip.PrecipColumns;
-import ohd.hseb.monitor.river.RiverColumns;
-import ohd.hseb.monitor.river.RiverMonitorDataManager;
-import ohd.hseb.monitor.river.RiverMonitorJTableRowData;
-import ohd.hseb.monitor.settings.ViewSettings;
-import ohd.hseb.util.SessionLogger;
-import ohd.hseb.util.gui.jtable.ComplexJTableManager;
-import ohd.hseb.util.gui.jtable.JTableColumnDescriptor;
-import ohd.hseb.util.gui.jtable.JTableColumnDisplaySettings;
-import ohd.hseb.util.gui.jtable.JTableManager;
-
-import com.raytheon.uf.common.ohd.AppsDefaults;
-
-public class RiverMonitorViewManager extends BaseManager
-{
- private SessionLogger _logger;
-
- private RiverMonitorDataManager _riverMonitorDataManager;
-
- private JTableManager _riverMonitorTableManager;
-
- private ViewSettings _viewSettings;
-
- private JSplitPane _splitPane;
-
- private List _riverMonitorAllRowDataList;
-
- private String _columnNamesCurrentlyDisplayed[];
-
- private DerivedColumnsFileManager _derivedColumnsFileManager;
-
- private MonitorFrame _mainFrame;
-
- private RiverMonitorJTableRowData _selectedRowData;
-
- private MonitorTimeSeriesLiteManager _monitorTimeSeriesLiteManager;
-
- private AppsDefaults _appsDefaults;
-
- public RiverMonitorViewManager(MonitorFrame mainFrame,
- MessageSystemManager msgSystemManager, SessionLogger logger,
- RiverMonitorDataManager riverMonitorDataManager,
- JSplitPane splitPane, ViewSettings viewSettings,
- DerivedColumnsFileManager derivedColumnsFileManager,
- MonitorTimeSeriesLiteManager monitorTimeSeriesLiteManager,
- AppsDefaults appsDefaults)
- {
- _logger = logger;
- _riverMonitorDataManager = riverMonitorDataManager;
- _splitPane = splitPane;
- _mainFrame = mainFrame;
- _viewSettings = viewSettings;
-
- _derivedColumnsFileManager = derivedColumnsFileManager;
- _monitorTimeSeriesLiteManager = monitorTimeSeriesLiteManager;
- _appsDefaults = appsDefaults;
-
- List riverColumnsList = new RiverColumns()
- .getRiverColumnsList(null);
-
- _derivedColumnsFileManager.getDerivedColumns();
- String derivedColumnNames[] = _derivedColumnsFileManager
- .getDerivedColumnNames();
- String alignmentForDerivedColumns[] = _derivedColumnsFileManager
- .getAlignmentForDerivedColumns();
- if (derivedColumnNames != null)
- {
- addDerivedColumnNames(riverColumnsList, derivedColumnNames,
- alignmentForDerivedColumns);
- }
-
- Dimension columnHeaderPreferredSize = new Dimension(100, 50);
- _riverMonitorTableManager = new ComplexJTableManager(riverColumnsList,
- _riverMonitorAllRowDataList, columnHeaderPreferredSize);
-
- setMessageSystemManager(msgSystemManager);
- _msgSystemManager.registerReceiver(new SelectViewItemReceiver(),
- MessageType.FILTER_SELECT_ITEM);
- _msgSystemManager.registerReceiver(new ChangeColumnsReceiver(),
- MessageType.CHANGE_COLUMNS);
- _msgSystemManager.registerReceiver(new AppSortReceiver(),
- MessageType.APP_SORT);
- _msgSystemManager.registerReceiver(new RiverThreatSortReceiver(),
- MessageType.RIVER_THREAT_SORT);
- _msgSystemManager.registerReceiver(new PrecipThreatSortReceiver(),
- MessageType.PRECIP_THREAT_SORT);
- _msgSystemManager.registerReceiver(new ClearSortReceiver(),
- MessageType.CLEAR_SORT);
- _msgSystemManager.registerReceiver(
- new UpdateDisplayWithSettingsReceiver(),
- MessageType.UPDATE_DISPLAY_WITH_SETTINGS);
- _msgSystemManager.registerReceiver(new RefreshDisplayReceiver(),
- MessageType.REFRESH_DISPLAY);
- _msgSystemManager.registerReceiver(new SaveViewReceiver(),
- MessageType.CREATE_TEXT_FROM_VIEW);
- _msgSystemManager.registerReceiver(new UpdateSettingsReceiver(),
- MessageType.UPDATE_SETTINGS);
-
- }
-
- private void addDerivedColumnNames(List riverColumnsList,
- String derivedColumnNames[], String alignmentForDerivedColumns[])
- {
- for (int i = 0; i < derivedColumnNames.length; i++)
- {
- riverColumnsList.add(new JTableColumnDescriptor(
- derivedColumnNames[i], alignmentForDerivedColumns[i],
- derivedColumnNames[i]));
- }
- }
-
- private void createTableAndApplySettings(MonitorMessage message)
- {
- String header = "RiverViewManager.createTableAndApplySettings(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- _riverMonitorAllRowDataList = _riverMonitorDataManager
- .getRiverMonitorRowDataList();
-
- _columnNamesCurrentlyDisplayed = null;
- String columnDisplaySettingsString = _viewSettings
- .getColumnDisplaySettings();
- JTableColumnDisplaySettings columnDisplaySettings = _riverMonitorTableManager
- .getTableSettings();
- columnDisplaySettings
- .setSettingsFromString(columnDisplaySettingsString);
-
- _columnNamesCurrentlyDisplayed = _riverMonitorTableManager
- .getColumnNamesThatAreCurrentlyDisplayed();
- if (_columnNamesCurrentlyDisplayed == null)
- {
- _columnNamesCurrentlyDisplayed = new String[] {
- LocationInfoColumns.LOCATION_ID,
- LocationInfoColumns.GROUP_NAME };
- }
-
- List selectedRowDataList = _riverMonitorDataManager
- .getTreeFilterManager().filter(_riverMonitorAllRowDataList);
- _riverMonitorTableManager.setChangedAllRowDataList(selectedRowDataList);
-
- _riverMonitorTableManager.setDisplayableColumns(
- _columnNamesCurrentlyDisplayed, true, true);
- _riverMonitorTableManager.setPreferredSizeForJScrollPane(new Dimension(
- 690, 645));
-
- JScrollPane tableScrollPane = _riverMonitorTableManager
- .getJScrollPane();
-
- _splitPane.setRightComponent(tableScrollPane);
-
- _riverMonitorTableManager
- .addTableListener(new TableMouseMotionListener());
- _riverMonitorTableManager
- .addTableListener(new TableListSelectionListener());
- _riverMonitorTableManager.addTableListener(new TableMouseListener());
- }
-
- public void refreshDisplay(MonitorMessage message)
- {
- String header = "RiverMonitorViewManager.refreshDisplay(): ";
-
- System.out.println(header +" Invoked"+ "...Source:" + message.getMessageSource() + " Type:" + message.getMessageType());
-
- _riverMonitorAllRowDataList = _riverMonitorDataManager.getRiverMonitorRowDataList();
- List selectedRowDataList = _riverMonitorDataManager.getTreeFilterManager().filter(_riverMonitorAllRowDataList);
- _riverMonitorTableManager.setChangedAllRowDataList(selectedRowDataList);
-
- _riverMonitorTableManager.refreshDisplay();
-
- JScrollPane tableScrollPane = _riverMonitorTableManager.getJScrollPane();
-
- _splitPane.setRightComponent(tableScrollPane);
-
- }
-
- private void updateSettings(MonitorMessage message)
- {
- String header = "RiverViewManager.selectViewItem(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
- updateSettings();
- }
-
- private void updateSettings()
- {
- JTableColumnDisplaySettings columnDisplaySettings = _riverMonitorTableManager
- .getTableSettings();
- String settings = columnDisplaySettings.getSettingsString();
- _viewSettings.setColumnDisplaySettings(settings);
- }
-
- private void selectViewItem(MonitorMessage message)
- {
- String header = "RiverViewManager.selectViewItem(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- String lidOfInterest = _riverMonitorDataManager
- .getLidOfCurrentInterest();
- int rowToHighLight = _riverMonitorTableManager
- .getTheRowIndexToHighLightBasedOnValue(lidOfInterest,
- LocationInfoColumns.LOCATION_ID);
- System.out.println("Row to highlight:" + rowToHighLight);
- if (rowToHighLight != -1)
- _riverMonitorTableManager
- .selectRows(rowToHighLight, rowToHighLight);
- }
-
- public void printFileException(IOException exception, String header)
- {
- header = header + ".printFileException(): ";
- _logger.log(header + "ERROR = " + exception.getMessage());
- exception.printStackTrace(_logger.getPrintWriter());
- _logger.log(header + "End of stack trace");
- }
-
- private void saveTableToFile(String fileName)
- {
- File fileHandler = new File(fileName);
- String header = "RiverMonitorViewManager.saveTableToFile(): ";
- String displayedColumns[] = _riverMonitorTableManager
- .getColumnNamesThatAreCurrentlyDisplayed();
- String rowData[][] = _riverMonitorTableManager.getDisplayRowDataArray();
- BufferedWriter out = null;
- int maxStringLen = 33;
- try
- {
- FileOutputStream fileOutput = new FileOutputStream(fileName, false);
- OutputStreamWriter outputStream = new OutputStreamWriter(fileOutput);
- out = new BufferedWriter(outputStream);
- }
- catch (IOException exception)
- {
- printFileException(exception, header);
- }
- if (displayedColumns != null)
- {
- try
- {
- out.newLine();
- StringBuffer columnNameStringBuffer = new StringBuffer();
- for (int i = 0; i < displayedColumns.length; i++)
- {
- columnNameStringBuffer.append(getTrimmedOrPaddedString(
- displayedColumns[i], maxStringLen));
- columnNameStringBuffer.append(" |");
- }
- out.write(columnNameStringBuffer.toString());
- out.newLine();
- }
- catch (IOException exception)
- {
- printFileException(exception, header);
- }
- }
- try
- {
- for (int i = 0; i < rowData.length; i++)
- {
- out.newLine();
- StringBuffer dataStringBuffer = new StringBuffer();
- for (int j = 0; j < rowData[i].length; j++)
- {
- dataStringBuffer.append(getTrimmedOrPaddedString(
- rowData[i][j], maxStringLen));
- dataStringBuffer.append(" |");
- }
- out.write(dataStringBuffer.toString());
- }
- }
- catch (IOException exception)
- {
- printFileException(exception, header);
- }
-
- try
- {
- out.close();
- }
- catch (IOException exception)
- {
- _logger.log(header + "Unable to close file["
- + fileHandler.getAbsolutePath() + "]");
- printFileException(exception, header);
- }
- }
-
- private String getTrimmedOrPaddedString(String origString, int desiredLength)
- {
- String newString = origString;
-
- String formatString = "%-" + String.valueOf(desiredLength) + "s";
-
- newString = String.format(formatString, origString);
-
- if (newString.length() > desiredLength)
- {
- newString = newString.substring(0, desiredLength);
- }
-
- return newString;
- }
-
- private void saveView(MonitorMessage message)
- {
- String header = "RiverMonitorViewManager.saveView(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- File file = null;
- JFileChooser saveFileChooser = new JFileChooser();
- String settingsDir = _appsDefaults.getToken("whfs_report_dir",
- "/awips/hydroapps/whfs/local/data/report");
- saveFileChooser.setDialogTitle("Export Table To Text File");
- saveFileChooser.setCurrentDirectory(new File(settingsDir));
- saveFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
-
- int result = saveFileChooser.showSaveDialog(_mainFrame);
- if (result == JFileChooser.CANCEL_OPTION)
- file = null;
- else
- file = saveFileChooser.getSelectedFile();
-
- if (file != null)
- {
- saveTableToFile(file.toString());
- }
- }
-
- private void changeColumns(MonitorMessage message)
- {
- String header = "RiverMonitorViewManager.changeColumns(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- _riverMonitorTableManager.invokeColumnSelector(_mainFrame);
-
- updateSettings();
- }
-
- private void updateSort(String[] columnNamesToSort, int[] columnSortNumber,
- boolean[] columnSortOrder)
- {
- _riverMonitorTableManager.setSortInfoNotBasedOnUserClicks(
- columnNamesToSort, columnSortOrder, columnSortNumber);
- updateSettings();
- }
-
- private void riverThreatSort(MonitorMessage message)
- {
- String header = "RiverMonitorViewManager.riverThreatSort(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- clearSort();
-
- String columnNamesToSort[] = { RiverColumns.THREAT };
- int columnSortNumber[] = { 0 };
- boolean columnSortOrder[] = { false };
-
- updateSort(columnNamesToSort, columnSortNumber, columnSortOrder);
- }
-
- private void precipThreatSort(MonitorMessage message)
- {
- String header = "RiverMonitorViewManager.precipThreatSort(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- clearSort();
-
- String columnNamesToSort[] = { PrecipColumns.PRECIP_THREAT };
- int columnSortNumber[] = { 0 };
- boolean columnSortOrder[] = { false };
-
- updateSort(columnNamesToSort, columnSortNumber, columnSortOrder);
- }
-
- private void appSort(MonitorMessage message)
- {
- String header = "RiverMonitorViewManager.appSort(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- clearSort();
-
- String columnNamesToSort[] = { LocationInfoColumns.HSA,
- LocationInfoColumns.GROUP_ORDINAL,
- LocationInfoColumns.LOCATION_ORDINAL };
- int columnSortNumber[] = { 0, 1, 2 };
- boolean columnSortOrder[] = { true, true, true };
-
- updateSort(columnNamesToSort, columnSortNumber, columnSortOrder);
- }
-
- private void clearSort()
- {
- _riverMonitorTableManager.clearSort();
- }
-
- private void clearSort(MonitorMessage message)
- {
- String header = "RiverMonitorViewManager.clearSort(): ";
- System.out.println(header + " Invoked" + "...Source:"
- + message.getMessageSource() + " Type:"
- + message.getMessageType());
-
- clearSort();
- updateSettings();
- }
-
- private void rowSelected(RiverMonitorJTableRowData selectedRowData)
- {
- String header = "RiverMonitorViewManager.rowSelected(): ";
-
- System.out.print(header);
- send(this, MessageType.VIEW_SELECT_ITEM, selectedRowData);
- }
-
- // -------------------------------------------------------------------------------------
- public String getToolTipForSelectedCell(String columnName, int rowIndex)
- {
- RiverMonitorJTableRowData rowData = (RiverMonitorJTableRowData) _riverMonitorTableManager
- .getSelectedRowData(rowIndex);
- String toolTip = "";
- VTECeventRecord record = null;
-
- if (columnName.equals(RiverColumns.UGC_EXPIRE_TIME))
- {
- record = rowData.getVtecEventRecordForExpireTime();
- }
- else if (columnName.equals(RiverColumns.EVENT_END_TIME)
- || columnName.equals(RiverColumns.VTEC_SUMMARY))
- {
- record = rowData.getVtecEventRecordForEndTime();
- }
-
- if (record != null)
- {
- long missingValue = DbTable.getNullLong();
- String beginTime = rowData.getStringValue(record.getBegintime(),
- missingValue);
- String endTime = rowData.getStringValue(record.getEndtime(),
- missingValue);
- String productTime = rowData.getStringValue(
- record.getProducttime(), missingValue);
- String expireTime = rowData.getStringValue(record.getExpiretime(),
- missingValue);
-
- toolTip = "Action: [" + record.getAction()
- + "] Signif: [" + record.getSignif() + "]\n
"
- + "BeginTime: [" + beginTime + "] EndTime: [" + endTime
- + "]\n
" + "ProductTime: [" + productTime
- + "] ExpireTime: [" + expireTime + "]\n
";
- }
- else if (columnName.equals(RiverColumns.THREAT))
- {
- toolTip = rowData.getToolTipTextForThreatSummary();
- }
- else if (columnName.equals(PrecipColumns.PRECIP_THREAT))
- {
- toolTip = rowData.getToolTipTextForPrecipThreatSummary();
- }
- else if (columnName.equals(RiverColumns.ALERT_ALARM))
- {
- toolTip = rowData.getToolTipTextForAlertAlarmSummary();
- }
-
- if (toolTip.length() <= 12) // tooltip has "" only
- {
- String name = rowData.getName();
- String state = rowData.getState();
- String county = rowData.getCounty();
- String hsa = rowData.getHsa();
- String stream = rowData.getStream();
- String bankfull = rowData.getDataValue(RiverColumns.BANK_FULL);
- String actionStage = rowData.getDataValue(RiverColumns.ACT_STG);
- String floodStage = rowData.getDataValue(RiverColumns.FLD_STG);
- String actionFlow = rowData.getDataValue(RiverColumns.ACT_FLOW);
- String floodFlow = rowData.getDataValue(RiverColumns.FLD_FLOW);
- String modStage = rowData.getDataValue(RiverColumns.MOD_STG);
- String minStage = rowData.getDataValue(RiverColumns.MIN_STG);
- String majStage = rowData.getDataValue(RiverColumns.MAJ_STG);
-
- toolTip = "Name:[" + name + "]\n
" + "County: ["
- + county + "] State: [" + state + "] HSA: [" + hsa
- + "]\n
" + "Stream: [" + stream + "] BankFull: ["
- + bankfull + "]\n
" + "ActionStg: [" + actionStage
- + "] FloodStg: [" + floodStage + "]\n
"
- + "ActionFlow: [" + actionFlow + "] FloodFlow: ["
- + floodFlow + "]\n
" + "MinStg: [" + minStage
- + "] ModStg: [" + modStage + "] MajStg: [" + majStage
- + "]\n
";
- }
- return toolTip;
- }
-
- private class ChangeColumnsReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- changeColumns(message);
- }
- }
-
- private class ClearSortReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- clearSort(message);
- }
- }
-
- private class PrecipThreatSortReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- precipThreatSort(message);
- }
- }
-
- private class RiverThreatSortReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- riverThreatSort(message);
- }
- }
-
- private class AppSortReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- appSort(message);
- }
- }
-
- private class SelectViewItemReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- selectViewItem(message);
- }
- }
-
- private class RefreshDisplayReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- refreshDisplay(message);
- }
- }
-
- private class UpdateDisplayWithSettingsReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- createTableAndApplySettings(message);
- }
- }
-
- private class UpdateSettingsReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- updateSettings(message);
- }
- }
-
- private class SaveViewReceiver implements Receiver
- {
- public void receive(MonitorMessage message)
- {
- saveView(message);
- }
- }
-
- private class TableListSelectionListener implements ListSelectionListener
- {
- public void valueChanged(ListSelectionEvent e)
- {
- if (e.getValueIsAdjusting() == false)
- {
- List selectedRowData = _riverMonitorTableManager
- .getSelectedRowsData();
- for (int i = 0; i < selectedRowData.size(); i++)
- {
- if (i == 0)
- {
- RiverMonitorJTableRowData rowData = (RiverMonitorJTableRowData) selectedRowData
- .get(i);
- _selectedRowData = rowData;
- rowSelected(_selectedRowData);
- }
- }
- }
- }
- }
-
- private class TableMouseListener implements MouseListener
- {
- public void mouseClicked(MouseEvent e)
- {
- // String header =
- // "RiverMonitorViewManager.TableMouseListener.mouseClicked(): ";
- Point p = new Point(e.getX(), e.getY());
- int rowIndex = _riverMonitorTableManager.getMousePointedRowIndex(p);
- RiverMonitorJTableRowData rowData = (RiverMonitorJTableRowData) _riverMonitorTableManager
- .getSelectedRowData(rowIndex);
-
- if (e.getClickCount() == 2)
- {
- // System.out.println(header + " starting TSL for " +
- // rowData.getLid());
- _selectedRowData = rowData;
- rowSelected(_selectedRowData);
- _monitorTimeSeriesLiteManager.displayTimeSeriesLite(_mainFrame,
- _selectedRowData);
- }
- }
-
- public void mousePressed(MouseEvent e)
- {
- }
-
- public void mouseReleased(MouseEvent e)
- {
- }
-
- public void mouseEntered(MouseEvent e)
- {
- }
-
- public void mouseExited(MouseEvent e)
- {
- }
- }
-
- // -------------------------------------------------------------------------------------
- class TableMouseMotionListener implements MouseMotionListener
- {
- public void mouseDragged(MouseEvent e)
- {
- }
-
- public void mouseMoved(MouseEvent e)
- {
- Point p = new Point(e.getX(), e.getY());
- int rowIndex = _riverMonitorTableManager.getMousePointedRowIndex(p);
- int colIndex = _riverMonitorTableManager
- .getMousePointedColumnIndex(p);
- String columnName = _riverMonitorTableManager
- .getColumnNameAtIndex(colIndex);
- String toolTip = "";
- if (rowIndex != -1)
- {
- toolTip = getToolTipForSelectedCell(columnName, rowIndex);
- _riverMonitorTableManager.setRowToolTipText(toolTip);
- }
- }
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/settings/RiverColumnDataSettings.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/settings/RiverColumnDataSettings.java
deleted file mode 100755
index cd2a814bfd..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/settings/RiverColumnDataSettings.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package ohd.hseb.monitor.river.settings;
-
-public class RiverColumnDataSettings
-{
- private String _fcstTypeSource;
- private int _alertalarmLookBack;
- private int _latestObsLookBack;
- private int _latestFcstBasisTimeLookBack;
- private int _vtecEventEndTimeApproach;
- private int _ugcExpireTimeApproach;
- private int _vtecEventProductTimeLookBack;
-
- public static String DEFAULT_FCST_TYPESOURCE = "IngestFilter" ;
- public static int DEFAULT_ALERTALARM_LOOKBACK = 8;
- public static int DEFAULT_LATEST_OBS_LOOKBACK = 12 ;
- public static int DEFAULT_LATEST_FCST_BASISTIME_LOOKBACK = 24;
- public static int DEFAULT_VTEC_ENDTIME_APPROACH = 4;
- public static int DEFAULT_UGC_EXPIRETIME_APPROACH = 4;
- public static int DEFAULT_VTEC_EVENT_PRODUCT_TIME_LOOKBACK = 168;
-
- public static final String RIVER_SETTINGS_BEGIN_TAG = "#River Settings Begin";
- public static final String RIVER_SETTINGS_END_TAG = "#River Settings End";
- public static String FCST_TS_TAG = "FCST_TS";
- public static String VALID_TIME_TAG = "Valid_Time";
- public static String VTEC_EVENT_END_TIME_TAG = "VTECEventEnd_Time";
- public static String UGC_EXPIRE_TIME_TAG = "UGCExpire_Time";
- public static String VTEC_EVENT_PRODUCT_TIME_TAG = "VTECEventProduct_Time";
- public static String LATEST_FCST_BASIS_TIME_TAG = "LatestFcst_BasisTime";
- public static String LATEST_OBS_TIME_TAG = "LatestObs_Time";
-
- public RiverColumnDataSettings()
- {
- resetSettings();
- }
-
- public void resetSettings()
- {
- _fcstTypeSource = DEFAULT_FCST_TYPESOURCE ;
- _alertalarmLookBack = DEFAULT_ALERTALARM_LOOKBACK;
- _latestObsLookBack = DEFAULT_LATEST_OBS_LOOKBACK;
- _latestFcstBasisTimeLookBack = DEFAULT_LATEST_FCST_BASISTIME_LOOKBACK;
- _vtecEventEndTimeApproach = DEFAULT_VTEC_ENDTIME_APPROACH;
- _ugcExpireTimeApproach = DEFAULT_UGC_EXPIRETIME_APPROACH;
- _vtecEventProductTimeLookBack = DEFAULT_VTEC_EVENT_PRODUCT_TIME_LOOKBACK;
- }
-
- public String getFcstTypeSource()
- {
- return _fcstTypeSource;
- }
- public void setFcstTypeSource(String fcstTypeSource)
- {
- _fcstTypeSource = fcstTypeSource;
- }
- public int getAlertAlarmLookBack()
- {
- return _alertalarmLookBack;
- }
- public void setAlertAlarmLookBack(int alertalarmLookBack)
- {
- _alertalarmLookBack = alertalarmLookBack;
- }
- public int getLatestObsLookBack()
- {
- return _latestObsLookBack;
- }
- public void setLatestObsLookBack(int latestObsLookBack)
- {
- _latestObsLookBack = latestObsLookBack;
- }
- public int getLatestFcstBasisTimeLookBack()
- {
- return _latestFcstBasisTimeLookBack;
- }
- public void setLatestFcstBasisTimeLookBack(int fcstBasisTimeLookBack)
- {
- _latestFcstBasisTimeLookBack = fcstBasisTimeLookBack;
- }
- public int getVtecEventEndTimeApproach()
- {
- return _vtecEventEndTimeApproach;
- }
- public void setVtecEventEndTimeApproach(int vtecEventEndTimeApproach)
- {
- _vtecEventEndTimeApproach = vtecEventEndTimeApproach;
- }
- public int getUgcExpireTimeApproach()
- {
- return _ugcExpireTimeApproach;
- }
- public void setUgcExpireTimeApproach(int ugcExpireTimeApproach)
- {
- _ugcExpireTimeApproach = ugcExpireTimeApproach;
- }
-
- public int getVtecEventProductTimeLookBack()
- {
- return _vtecEventProductTimeLookBack;
- }
-
- public void setVtecEventProductTimeLookBack(int vtecEventProductTimeLookBack)
- {
- _vtecEventProductTimeLookBack = vtecEventProductTimeLookBack;
- }
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/settings/RiverMonitorMenuSettings.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/settings/RiverMonitorMenuSettings.java
deleted file mode 100755
index 493a4288ec..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/settings/RiverMonitorMenuSettings.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package ohd.hseb.monitor.river.settings;
-
-import ohd.hseb.monitor.precip.settings.PrecipColumnDataSettings;
-import ohd.hseb.util.BooleanHolder;
-
-public class RiverMonitorMenuSettings
-{
- private int _refreshInterval;
-
- public static final String REFRESH_INTERVAL_TAG = "RefreshInterval";
-
- public static final String SHOW_MISSING_RIVER_TAG = "ShowMissingRiver";
-
- public static int DEFAULT_REFRESH_INTERVAL = 15;
-
- private PrecipColumnDataSettings _precipSettings;
- private RiverColumnDataSettings _riverSettings;
-
- // public boolean _showMissingRiver;
-
- private BooleanHolder _showMissingDataBooleanHolder = new BooleanHolder(true);
-
-
- public RiverMonitorMenuSettings()
- {
- _refreshInterval = DEFAULT_REFRESH_INTERVAL;
- setShowMissingRiver(false);
- _precipSettings = new PrecipColumnDataSettings();
- _riverSettings = new RiverColumnDataSettings();
- }
-
- public void resetSettings()
- {
- _refreshInterval = DEFAULT_REFRESH_INTERVAL;
- setShowMissingRiver(false);
- _precipSettings.resetSettings();
- _riverSettings.resetSettings();
- }
-
- public RiverMonitorMenuSettings(int refreshInterval, boolean showMissingPrecip)
- {
- _refreshInterval = refreshInterval;
- setShowMissingRiver(showMissingPrecip);
- _precipSettings = new PrecipColumnDataSettings();
- _riverSettings = new RiverColumnDataSettings();
- }
-
- public void setPrecipSettings(PrecipColumnDataSettings precipSettings)
- {
- _precipSettings = precipSettings;
- }
-
- public PrecipColumnDataSettings getPrecipSettings()
- {
- return _precipSettings;
- }
-
- public void setRiverSettings(RiverColumnDataSettings riverSettings)
- {
- _riverSettings = riverSettings;
- }
-
- public RiverColumnDataSettings getRiverSettings()
- {
- return _riverSettings;
- }
-
- public void setRefreshInterval(int refreshInterval)
- {
- _refreshInterval = refreshInterval;
- }
-
- public int getRefreshInterval()
- {
- return _refreshInterval;
- }
-
- public boolean shouldShowMissingRiver()
- {
- return getShowMissingDataBooleanHolder().getValue();
- }
-
- public void setShowMissingRiver(boolean showMissingRiver)
- {
- _showMissingDataBooleanHolder.setValue(showMissingRiver);
- }
-
- private void setShowMissingDataBooleanHolder(BooleanHolder showMissingPrecipBooleanHolder)
- {
- _showMissingDataBooleanHolder = showMissingPrecipBooleanHolder;
- }
-
- public BooleanHolder getShowMissingDataBooleanHolder()
- {
- return _showMissingDataBooleanHolder;
- }
-
-
-}
diff --git a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/settings/RiverMonitorSettingsFileManager.java b/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/settings/RiverMonitorSettingsFileManager.java
deleted file mode 100755
index f0eccfb643..0000000000
--- a/cave/ohd.hseb.monitor/src/ohd/hseb/monitor/river/settings/RiverMonitorSettingsFileManager.java
+++ /dev/null
@@ -1,347 +0,0 @@
-package ohd.hseb.monitor.river.settings;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import ohd.hseb.monitor.precip.settings.PrecipColumnDataSettings;
-import ohd.hseb.monitor.settings.FilterSettings;
-import ohd.hseb.monitor.settings.MonitorSettingsFileManager;
-import ohd.hseb.monitor.settings.ViewSettings;
-import ohd.hseb.util.SessionLogger;
-
-public class RiverMonitorSettingsFileManager extends MonitorSettingsFileManager
-{
- private RiverMonitorMenuSettings _menuSettings;
- private Map _filterTokenValuesMap;
-
- public RiverMonitorSettingsFileManager(SessionLogger logger, ViewSettings viewSettings,
- FilterSettings filterSettings, RiverMonitorMenuSettings menuSettings)
- {
- super(logger, "#RiverMonitorSettings File", viewSettings, filterSettings);
- _menuSettings = menuSettings;
- _logger = logger;
- createDisplayTokenSet();
- createMenuTokenSet();
- }
-
- public Set createMenuTokenSet()
- {
- _menuTokenSet = new HashSet();
-
- _menuTokenSet.add(RiverColumnDataSettings.FCST_TS_TAG);
- _menuTokenSet.add(RiverColumnDataSettings.LATEST_FCST_BASIS_TIME_TAG);
- _menuTokenSet.add(RiverColumnDataSettings.LATEST_OBS_TIME_TAG);
- _menuTokenSet.add(RiverColumnDataSettings.UGC_EXPIRE_TIME_TAG);
- _menuTokenSet.add(RiverColumnDataSettings.VALID_TIME_TAG);
- _menuTokenSet.add(RiverColumnDataSettings.VTEC_EVENT_END_TIME_TAG);
- _menuTokenSet.add(RiverColumnDataSettings.VTEC_EVENT_PRODUCT_TIME_TAG);
- _menuTokenSet.add(RiverMonitorMenuSettings.REFRESH_INTERVAL_TAG);
- _menuTokenSet.add(RiverMonitorMenuSettings.SHOW_MISSING_RIVER_TAG);
- _menuTokenSet.add(PrecipColumnDataSettings.DIFF_ALERT_TAG);
- _menuTokenSet.add(PrecipColumnDataSettings.DIFF_CAUTION_TAG);
- _menuTokenSet.add(PrecipColumnDataSettings.PRECIP_ALERT_TAG);
- _menuTokenSet.add(PrecipColumnDataSettings.PRECIP_CAUTION_TAG);
- _menuTokenSet.add(PrecipColumnDataSettings.RATIO_ALERT_TAG);
- _menuTokenSet.add(PrecipColumnDataSettings.RATIO_CAUTION_TAG);
-
- return _displayTokenSet;
- }
-
- public boolean setSettingsFromFile(File fileHandler)
- {
- String header = "RiverMonitorSettingsFileManager.setSettingsFromFile(): ";
- boolean isReadCompleted = true;
-
- resetSettings();
-
- if(isValidSettingsFile(_logger, fileHandler, _settingsFileBeginTag ))
- {
- BufferedReader in = null;
- String line;
- try
- {
- in = new BufferedReader(new FileReader(fileHandler));
-
- while(( line = in.readLine()) != null)
- {
- line = line.trim();
- processLine(line);
- }
- }
- catch(IOException e)
- {
- printFileException(_logger, e,header);
- isReadCompleted = false ;
- }
- }
- else
- {
- isReadCompleted = false;
- }
-
- setViewAndFilterSettings();
- setRiverSettings();
- return isReadCompleted;
- }
-
- private void resetSettings()
- {
- _tableDisplaySettingsList = null;
- _expandPathTokenValuesList = null;
- _pathTokenValuesList = null;
- _filterTokenValuesMap = null;
-
- setViewAndFilterSettings();
- _menuSettings.resetSettings();
- }
-
- private void setRiverSettings()
- {
-
- if(_filterTokenValuesMap != null)
- {
- Object object = _filterTokenValuesMap.get(RiverColumnDataSettings.FCST_TS_TAG);
- if(object != null)
- {
- String fcstTypeSource = _filterTokenValuesMap.get(RiverColumnDataSettings.FCST_TS_TAG).toString();
- _menuSettings.getRiverSettings().setFcstTypeSource(fcstTypeSource);
- }
-
- object = _filterTokenValuesMap.get(RiverColumnDataSettings.VALID_TIME_TAG);
- if(object != null)
- {
- Integer alerAlarmLoookback = new Integer(object.toString());
- _menuSettings.getRiverSettings().setAlertAlarmLookBack(alerAlarmLoookback);
- }
-
- object = _filterTokenValuesMap.get(RiverColumnDataSettings.LATEST_OBS_TIME_TAG);
- if(object != null)
- {
- Integer latestObsLookback = new Integer(_filterTokenValuesMap.get(RiverColumnDataSettings.LATEST_OBS_TIME_TAG).toString());
- _menuSettings.getRiverSettings().setLatestObsLookBack(latestObsLookback);
- }
-
- object = _filterTokenValuesMap.get(RiverColumnDataSettings.LATEST_FCST_BASIS_TIME_TAG);
- if(object != null)
- {
- Integer latestFcstBasisTime = new Integer(_filterTokenValuesMap.get(RiverColumnDataSettings.LATEST_FCST_BASIS_TIME_TAG).toString());
- _menuSettings.getRiverSettings().setLatestFcstBasisTimeLookBack(latestFcstBasisTime);
- }
-
- object = _filterTokenValuesMap.get(RiverColumnDataSettings.VTEC_EVENT_PRODUCT_TIME_TAG);
- if(object != null)
- {
- Integer vtecEventProductTimeLookback = new Integer(_filterTokenValuesMap.get(RiverColumnDataSettings.VTEC_EVENT_PRODUCT_TIME_TAG).toString());
- _menuSettings.getRiverSettings().setVtecEventProductTimeLookBack(vtecEventProductTimeLookback);
- }
-
- object = _filterTokenValuesMap.get(RiverColumnDataSettings.VTEC_EVENT_END_TIME_TAG);
- if(object != null)
- {
- Integer vtecEventEndTimeApproach = new Integer(_filterTokenValuesMap.get(RiverColumnDataSettings.VTEC_EVENT_END_TIME_TAG).toString());
- _menuSettings.getRiverSettings().setVtecEventEndTimeApproach(vtecEventEndTimeApproach);
- }
-
- object = _filterTokenValuesMap.get(RiverColumnDataSettings.UGC_EXPIRE_TIME_TAG);
- if(object != null)
- {
- Integer ugcExpireTimeApproach = new Integer(_filterTokenValuesMap.get(RiverColumnDataSettings.UGC_EXPIRE_TIME_TAG).toString());
- _menuSettings.getRiverSettings().setUgcExpireTimeApproach(ugcExpireTimeApproach);
- }
- }
- }
-
- public void saveSettingsToFile(File fileHandler)
- {
- createSettingsFile(fileHandler);
-
- BufferedWriter out = null;
- String header = "RiverMonitorSettingsFileManager.saveSettingsToFile(): ";
- try
- {
- out = new BufferedWriter(new FileWriter(fileHandler));
- }
- catch(IOException exception)
- {
- _logger.log(header+"ERROR = " + exception.getMessage());
- exception.printStackTrace(_logger.getPrintWriter());
- }
-
- saveDisplaySettings(out);
-
- saveMenuSettingsToFile(out);
- }
-
- private void processPrecipToken(String tokenName, String tokenValue)
- {
-
- String spiltStr[] = tokenValue.split("\\|");
- String hr1, hr3, hr6;
-
- if(spiltStr != null)
- {
- if(spiltStr.length == 3) // we have 3 values 1hr | 3hr | 6hr correctly
- {
- hr1 = null; hr3 = null; hr6 = null;
-
- hr1 = spiltStr[0].trim();
- hr3 = spiltStr[1].trim();
- hr6 = spiltStr[2].trim();
-
- if(tokenName.compareTo(PrecipColumnDataSettings.PRECIP_ALERT_TAG) == 0)
- {
- _menuSettings.getPrecipSettings().setPrecipAlert1Hr(new Double(hr1));
- _menuSettings.getPrecipSettings().setPrecipAlert3Hr(new Double(hr3));
- _menuSettings.getPrecipSettings().setPrecipAlert6Hr(new Double(hr6));
- }
- else if(tokenName.compareTo(PrecipColumnDataSettings.PRECIP_CAUTION_TAG) == 0)
- {
- _menuSettings.getPrecipSettings().setPrecipCaution1Hr(new Double(hr1));
- _menuSettings.getPrecipSettings().setPrecipCaution3Hr(new Double(hr3));
- _menuSettings.getPrecipSettings().setPrecipCaution6Hr(new Double(hr6));
- }
- else if(tokenName.compareTo(PrecipColumnDataSettings.RATIO_ALERT_TAG) == 0)
- {
- _menuSettings.getPrecipSettings().setRatioAlert1Hr(new Integer(hr1));
- _menuSettings.getPrecipSettings().setRatioAlert3Hr(new Integer(hr3));
- _menuSettings.getPrecipSettings().setRatioAlert6Hr(new Integer(hr6));
- }
- else if(tokenName.compareTo(PrecipColumnDataSettings.RATIO_CAUTION_TAG) == 0)
- {
- _menuSettings.getPrecipSettings().setRatioCaution1Hr(new Integer(hr1));
- _menuSettings.getPrecipSettings().setRatioCaution3Hr(new Integer(hr3));
- _menuSettings.getPrecipSettings().setRatioCaution6Hr(new Integer(hr6));
- }
- else if(tokenName.compareTo(PrecipColumnDataSettings.DIFF_ALERT_TAG) == 0)
- {
- _menuSettings.getPrecipSettings().setDiffAlert1Hr(new Double(hr1));
- _menuSettings.getPrecipSettings().setDiffAlert3Hr(new Double(hr3));
- _menuSettings.getPrecipSettings().setDiffAlert6Hr(new Double(hr6));
- }
- else if(tokenName.compareTo(PrecipColumnDataSettings.DIFF_CAUTION_TAG) == 0)
- {
- _menuSettings.getPrecipSettings().setDiffCaution1Hr(new Double(hr1));
- _menuSettings.getPrecipSettings().setDiffCaution3Hr(new Double(hr3));
- _menuSettings.getPrecipSettings().setDiffCaution6Hr(new Double(hr6));
- }
- }
- }
- }
-
- public void processMenuToken(String tokenName, String tokenValue)
- {
- if(tokenName.compareTo(RiverMonitorMenuSettings.REFRESH_INTERVAL_TAG) == 0)
- {
- _menuSettings.setRefreshInterval(new Integer(tokenValue));
- }
- if(tokenName.compareTo(RiverMonitorMenuSettings.SHOW_MISSING_RIVER_TAG) == 0)
- {
- _menuSettings.setShowMissingRiver(new Boolean(tokenValue));
- }
- else if( (tokenName.equals(PrecipColumnDataSettings.DIFF_ALERT_TAG) ||
- tokenName.equals(PrecipColumnDataSettings.DIFF_CAUTION_TAG) ||
- tokenName.equals(PrecipColumnDataSettings.PRECIP_ALERT_TAG) ||
- tokenName.equals(PrecipColumnDataSettings.PRECIP_CAUTION_TAG) ||
- tokenName.equals(PrecipColumnDataSettings.RATIO_ALERT_TAG) ||
- tokenName.equals(PrecipColumnDataSettings.RATIO_CAUTION_TAG) ))
- {
- processPrecipToken(tokenName, tokenValue);
- }
- else
- {
- if(_filterTokenValuesMap == null)
- {
- _filterTokenValuesMap = new HashMap