Ejemplo n.º 1
0
 /**
  * set param is hardly ever being used, which means things like will be setting the current row
  * visibly current when in fact it already is visibly current. No big deal!
  */
 public void setDisplay(OperationEnum currentOperation, int row, String reason) {
   StateEnum currentState = oper.getState(block);
   Block currentBlock = oper.getCurrentBlock();
   // int idxCurrentRow = block.getCursorPosition() - 1;
   int idxCurrentRow = block.getIndex();
   if (currentState.isNew() && currentState.isPrior()) {
     idxCurrentRow--;
   }
   /**/
   if (false /*SdzNote.SET_DISPLAY_ON_TABLE.isVisible()*/) {
     times++;
     Err.pr("");
     Err.pr("Inside setDisplay for <" + block + "> times: " + times);
     Err.pr("\tCurrent block: " + currentBlock);
     Err.pr("\tblock that has table: " + block);
     Err.pr("\tcurrent operation: " + currentOperation);
     Err.pr("\tcurrent state: " + currentState);
     Err.pr("\trow to change to: " + idxCurrentRow);
     if (times == 39) {
       Err.debug();
     }
   }
   /**/
   if (currentOperation == OperationEnum.REMOVE
   // && currentState.isNew()
   // && !block.isChildOf( currentBlock)
   ) {
     usersModel.fireTableRowsDeleted(idxCurrentRow, idxCurrentRow);
     // usersModel.fireRowChangedTo( idxCurrentRow-1);
   }
   /*
   else if(currentOperation == OperationEnum.REMOVE &&
   currentState.isNavigating() &&
   !block.isChildOf( currentBlock))
   {
   // w/out this, in case where deleted first row,
   // would not have become selected again
   usersModel.fireRowChangedTo( idxCurrentRow);
   }
   */
   else if (currentOperation == OperationEnum.EXECUTE_QUERY) {
     usersModel.fireTableDataChanged(
         "setDisplay because of " + currentOperation + ", because " + reason);
     // No evidence yet that need this
     // usersModel.fireRowChangedTo( idxCurrentRow);
   }
   if (currentState.isNew()
       && (currentOperation == OperationEnum.PREVIOUS || currentOperation == OperationEnum.NEXT)) {
     usersModel.fireRowChangedTo(idxCurrentRow);
   }
   /*
   else
   if((currentOperation == OperationEnum.INSERT
   || currentOperation == OperationEnum.INSERT_PRIOR)
   && block == currentBlock)
   {
   usersModel.fireRowChangedTo( idxCurrentRow);
   Err.pr( "blankoutDisplay, have changed row to " + idxCurrentRow);
   }
   */
   else if (currentOperation == OperationEnum.REFRESH) {
     Err.pr(/*SdzNote.SET_DISPLAY_ON_TABLE*/ false, "@@ setDisplay for op " + currentOperation);
     usersModel.fireTableDataChanged(
         row, row, "setDisplay for op " + currentOperation + " because " + reason);
   } else {
     Err.pr(SdzNote.SET_DISPLAY_ON_TABLE, "@@ setDisplay, default as op was " + currentOperation);
     usersModel.fireRowChangedTo(idxCurrentRow);
   }
 }
Ejemplo n.º 2
0
 /**
  * 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);
   }
 }