/** * Not part of the table model (so doesn't get called when the table is painting). Has proven to * be a good place to set the table up just prior to painting. */ public void blankoutDisplay(OperationEnum currentOperation, int row, String reason) { int idxCurrentRow = block.getIndex(); // OperationEnum currentOperation = oper.getCurrentOperation(); StateEnum currentState = oper.getState(block); Block currentBlock = oper.getCurrentBlock(); if (false /*SdzNote.SET_DISPLAY_ON_TABLE.isVisible()*/) { times++; Err.pr(""); Err.pr("Inside blankoutDisplay for <" + block + "> times: " + times); Err.pr("\tcurrentBlock: " + currentBlock); Err.pr("\tblock that has table: " + block); Err.pr("\tcurrent operation: " + currentOperation); Err.pr("\tcurrent state: " + currentState); Err.pr("\tidxCurrentRow: " + idxCurrentRow); if (times == 39) { Err.debug(); } } if (currentOperation == OperationEnum.INSERT_AFTER_PLACE || currentOperation == OperationEnum.INSERT_AT_PLACE) { if (block == currentBlock) { int index = -99; /* We don't do this for field, so lets not do it for table either if(currentOperation == OperationEnum.INSERT || currentOperation == OperationEnum.INSERT_IGNORE) { index = block.getIndex() + 1; } else */ { index = block.getIndex(); } usersModel.acceptEdit(); usersModel.fireTableRowsInserted(index, index); // Was trying to select the row on the table. Doing at the post operation performed // trigger (see SdzDsgnr for this) actually works, so as there's a workaround // we've left this as a slight note Err.pr( SdzNote.AUTO_SELECT_TABLE_ROW_AFTER_INSERT, "Do we actually need access to the JTable if wanted to do this here?"); // usersModel.fireRowChangedTo(index); Err.pr("Inserting a row s/know to move to it as well..."); Err.pr(SdzNote.SET_DISPLAY_ON_TABLE, "blankoutDisplay, have changed row to " + index); } else { // For example when insert master usersModel.fireTableDataChanged( "blankoutDisplay because of an " + "INSERT on different block to current, because " + reason); } } else if (currentOperation == OperationEnum.REMOVE /* && block == currentBlock*/) { /* * Do not want to fireTableDataChanged(), as this would lead to the * edited data being written ie. setValueAt() being called. */ usersModel.rejectEdit(); if ( /* (currentState.isNavigating() || currentState.isNew()) ||*/ currentState == StateEnum.FROZEN) { // When do this then model will no longer have the extra artificial // inserted row, and fireTableRowsDeleted will work usersModel.fireTableRowsDeleted(idxCurrentRow, idxCurrentRow); } } else if (currentOperation == OperationEnum.EXECUTE_QUERY) { /* * As above */ usersModel.rejectEdit(); usersModel.fireTableDataChanged("blankoutDisplay because of EXECUTE_QUERY because " + reason); } else if ((currentOperation == OperationEnum.NEXT || currentOperation == OperationEnum.PREVIOUS) && currentState.isNavigating()) { usersModel.fireTableDataChanged("blankoutDisplay because of NEXT/PREVIOUS because " + reason); } else if (currentOperation == OperationEnum.REFRESH) { Err.pr( /*SdzNote.SET_DISPLAY_ON_TABLE*/ false, "@@ blankoutDisplay for op " + currentOperation); usersModel.fireTableDataChanged( row, row, "blankoutDisplay for op " + currentOperation + " because " + reason); } else { Err.pr( /*SdzNote.SET_DISPLAY_ON_TABLE*/ false, "@@ blankoutDisplay, default as op was " + currentOperation); usersModel.fireTableDataChanged( "blankoutDisplay because of Un-programmed for op " + currentOperation + " because " + reason); } }