org.jbundle.base.db.Record.addNew()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(12.9k)|赞(0)|评价(0)|浏览(109)

本文整理了Java中org.jbundle.base.db.Record.addNew方法的一些代码示例,展示了Record.addNew的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.addNew方法的具体详情如下:
包路径:org.jbundle.base.db.Record
类名称:Record
方法名:addNew

Record.addNew介绍

[英]Create a new empty record.

Leave the current position unchanged, and clear this record's fields to their initial values.
[中]创建一个新的空记录。
保持当前位置不变,并将此记录的字段清除为其初始值。

代码示例

代码示例来源:origin: org.jbundle.base.db/org.jbundle.base.db

/**
   * The Field has Changed.
   * Do an addNew() on the target record.
   * @param bDisplayOption If true, display the change.
   * @param iMoveMode The type of move being done (init/read/screen).
   * @return The error code (or NORMAL_RETURN if okay).
   * Field Changed, do an addNew on this record.
   */
  public int fieldChanged(boolean bDisplayOption, int iMoveMode)
  {
    try   {
      m_recTarget.addNew();
    } catch (DBException e)   {
      return e.getErrorCode();
    }
    return DBConstants.NORMAL_RETURN;
  }
}

代码示例来源:origin: org.jbundle.base/org.jbundle.base

/**
   * The Field has Changed.
   * Do an addNew() on the target record.
   * @param bDisplayOption If true, display the change.
   * @param iMoveMode The type of move being done (init/read/screen).
   * @return The error code (or NORMAL_RETURN if okay).
   * Field Changed, do an addNew on this record.
   */
  public int fieldChanged(boolean bDisplayOption, int iMoveMode)
  {
    try   {
      m_recTarget.addNew();
    } catch (DBException e)   {
      return e.getErrorCode();
    }
    return DBConstants.NORMAL_RETURN;
  }
}

代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed

/**
   * The Field has Changed.
   * Do an addNew() on the target record.
   * @param bDisplayOption If true, display the change.
   * @param iMoveMode The type of move being done (init/read/screen).
   * @return The error code (or NORMAL_RETURN if okay).
   * Field Changed, do an addNew on this record.
   */
  public int fieldChanged(boolean bDisplayOption, int iMoveMode)
  {
    try   {
      m_recTarget.addNew();
    } catch (DBException e)   {
      return e.getErrorCode();
    }
    return DBConstants.NORMAL_RETURN;
  }
}

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.acctpay.screen

/**
 * FieldChanged Method.
 */
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
  Record recTrxDesc = ((ReferenceField)this.getOwner().getRecord().getField(PaymentHistory.LINKED_TRX_DESC_ID)).getReference();
  if (recTrxDesc != null)
    if (BankTrx.BANK_TRX_FILE.equalsIgnoreCase(recTrxDesc.getField(TrxDesc.DESC_CODE).toString()))
      return super.fieldChanged(bDisplayOption, iMoveMode);
  try {
    m_record.addNew();
  } catch (DBException e) {
  }
  return DBConstants.NORMAL_RETURN;
}

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.acctpay.screen

/**
 * FieldChanged Method.
 */
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
  Record recTrxDesc = ((ReferenceField)this.getOwner().getRecord().getField(PaymentHistory.LINKED_TRX_DESC_ID)).getReference();
  if (recTrxDesc != null)
    if (BankTrx.BANK_TRX_FILE.equalsIgnoreCase(recTrxDesc.getField(TrxDesc.DESC_CODE).toString()))
      return super.fieldChanged(bDisplayOption, iMoveMode);
  try {
    m_record.addNew();
  } catch (DBException e) {
  }
  return DBConstants.NORMAL_RETURN;
}

代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed

/**
   * The Field has Changed.
   * If the flag is true, do inherited (read secondary), otherwise do initRecord.
   * @param bDisplayOption If true, display the change.
   * @param iMoveMode The type of move being done (init/read/screen).
   * @return The error code (or NORMAL_RETURN if okay).
   */
  public int fieldChanged(boolean bDisplayOption, int iMoveMode)
  {
    if (m_convFlag.getState())
      return super.fieldChanged(bDisplayOption, iMoveMode);
    else
    {
      try
      {
        m_record.initRecord(bDisplayOption);    // Clear the fields
        m_record.addNew();
      }
      catch(DBException ex)
      {
        ex.printStackTrace(); // Never
      }
    }
    return DBConstants.NORMAL_RETURN;
  }
}

代码示例来源:origin: org.jbundle.base.db/org.jbundle.base.db

/**
   * The Field has Changed.
   * If the flag is true, do inherited (read secondary), otherwise do initRecord.
   * @param bDisplayOption If true, display the change.
   * @param iMoveMode The type of move being done (init/read/screen).
   * @return The error code (or NORMAL_RETURN if okay).
   */
  public int fieldChanged(boolean bDisplayOption, int iMoveMode)
  {
    if (m_convFlag.getState())
      return super.fieldChanged(bDisplayOption, iMoveMode);
    else
    {
      try
      {
        m_record.initRecord(bDisplayOption);    // Clear the fields
        m_record.addNew();
      }
      catch(DBException ex)
      {
        ex.printStackTrace(); // Never
      }
    }
    return DBConstants.NORMAL_RETURN;
  }
}

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.request.report

/**
 * UpdateRequestDetail Method.
 */
public void updateRequestDetail(Record recRequestDetail, Record recRequestHistoryDetail)
{
  try   {
    recRequestHistoryDetail.close();
    while (recRequestHistoryDetail.hasNext())
    {
      recRequestHistoryDetail.next();
  
      recRequestDetail.addNew();
      recRequestDetail.moveFields(recRequestHistoryDetail, Record.MOVE_BY_NAME, true, DBConstants.SCREEN_MOVE, true, false, false, false);   // Move all fields to the history record
      recRequestDetail.add();  
    }
  } catch (DBException ex)    {
    ex.printStackTrace();
  }
}

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.request.report

/**
 * UpdateRequestDetail Method.
 */
public void updateRequestDetail(Record recRequestDetail, Record recRequestHistoryDetail)
{
  try   {
    recRequestHistoryDetail.close();
    while (recRequestHistoryDetail.hasNext())
    {
      recRequestHistoryDetail.next();
  
      recRequestDetail.addNew();
      recRequestDetail.moveFields(recRequestHistoryDetail, Record.MOVE_BY_NAME, true, DBConstants.SCREEN_MOVE, true, false, false, false);   // Move all fields to the history record
      recRequestDetail.add();  
    }
  } catch (DBException ex)    {
    ex.printStackTrace();
  }
}

代码示例来源:origin: org.jbundle.base.screen/org.jbundle.base.screen.model

/**
 * Process the "Add" toolbar command.
 * @return  true    If command was handled
 */
public boolean onAdd()
{
  Record record = this.getMainRecord();
  if (record == null)
    return false;
  try {
    if (record.isModified(false))
    {
      if (record.getEditMode() == Constants.EDIT_IN_PROGRESS)
        record.set();
      else if (record.getEditMode() == Constants.EDIT_ADD)
        record.add();
    }
    record.addNew();
    this.clearStatusText();
  } catch(DBException ex) {
    this.displayError(ex);
    return false;
  }
  return true;
}
/**

代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed

/**
 * Add all the screen listeners.
 */
public void addListeners()
{
  // This beginning code is a trick to make the grid screen think that a zero record is the header.
  this.setProperty("fakeHeader", DBConstants.FALSE);
  if (m_recHeader != null)
    if ((m_recHeader.getEditMode() == DBConstants.EDIT_ADD) || (m_recHeader.getEditMode() == DBConstants.EDIT_NONE))
      if (this.getProperty(DBParams.HEADER_OBJECT_ID) == null)
      {
        this.setProperty("fakeHeader", DBConstants.TRUE);
        this.setProperty(DBParams.HEADER_OBJECT_ID, "0");
        if (m_recHeader.getCounterField() != null)
          if (m_recHeader.getCounterField().getDefault() == null)
        {
          m_recHeader.getCounterField().setDefault(new Integer(0)); // This will guarantee that the sub record's parent field is non-null
          try {
            m_recHeader.addNew();
          } catch (DBException ex) {
          }
        }
      }
  super.addListeners();
}
/**

代码示例来源:origin: org.jbundle.base/org.jbundle.base

/**
 * Create/Clear the current object (Always called from the record class).
 * @exception DBException File exception.
 */
public void addNew() throws DBException
{
  super.addNew();
  Record recCurrent = this.moveToCurrentRecord(null);   // Perhaps, they supplied a default record type and this will switch it.
  if ((recCurrent != null) && (this.getBaseRecord() != recCurrent))
    recCurrent.handleNewRecord(); // Display Fields and do Add behaviors on correct record
  else if ((this.getCurrentRecord() != null) && (this.getCurrentRecord() != this.getBaseRecord()))
  {
    this.getBaseRecord().matchListeners(this.getCurrentRecord(), false, true, true, true, true);      // Clone the listeners that are not there already.
    this.getCurrentRecord().addNew();
  }
}
/**

代码示例来源:origin: org.jbundle.base/org.jbundle.base.mixed

/**
 * Create/Clear the current object (Always called from the record class).
 * @exception DBException File exception.
 */
public void addNew() throws DBException
{
  super.addNew();
  Record recCurrent = this.moveToCurrentRecord(null);   // Perhaps, they supplied a default record type and this will switch it.
  if ((recCurrent != null) && (this.getBaseRecord() != recCurrent))
    recCurrent.handleNewRecord(); // Display Fields and do Add behaviors on correct record
  else if ((this.getCurrentRecord() != null) && (this.getCurrentRecord() != this.getBaseRecord()))
  {
    this.getBaseRecord().matchListeners(this.getCurrentRecord(), false, true, true, true, true);      // Clone the listeners that are not there already.
    this.getCurrentRecord().addNew();
  }
}
/**

代码示例来源:origin: org.jbundle.base.screen/org.jbundle.base.screen.model

/**
 * Process the Refresh Command.
 * @return true if successful.
 */
public boolean onRefresh()
{
  Record record = this.getMainRecord();
  if (record == null)
    return false;
  try
  {
    if (record.getEditMode() == Constants.EDIT_IN_PROGRESS)
    {   // If they're adding, can't delete nothing!
      if (record.isRefreshedRecord())
        return this.onDelete();
      Object bookmark = record.getHandle(DBConstants.BOOKMARK_HANDLE);
      record.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE);
    }
    if (record.getEditMode() == Constants.EDIT_ADD)
      record.addNew();
    this.clearStatusText();
  } catch (DBException ex) {
    this.displayError(ex);
    return false;
  }
  return true;
}
/**

代码示例来源:origin: org.jbundle.base.db/org.jbundle.base.db

/**
 * Create/Clear the current object (Always called from the record class).
 * @exception DBException File exception.
 */
public void addNew() throws DBException
{
  super.addNew();
  Record recCurrent = this.moveToCurrentRecord(null);   // Perhaps, they supplied a default record type and this will switch it.
  if ((recCurrent != null) && (this.getBaseRecord() != recCurrent))
    recCurrent.handleNewRecord(); // Display Fields and do Add behaviors on correct record
  else if ((this.getCurrentRecord() != null) && (this.getCurrentRecord() != this.getBaseRecord()))
  {
    this.getBaseRecord().matchListeners(this.getCurrentRecord(), false, true, true, true, true);      // Clone the listeners that are not there already.
    this.getCurrentRecord().addNew();
  }
}
/**

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.request.report

/**
 * UpdateHistoryDetail Method.
 */
public void updateHistoryDetail(Record recRequestDetail, Record recRequestHistoryDetail, Record recRequest)
{
  try   {
    recRequestDetail.close();
    while (recRequestDetail.hasNext())
    {
      recRequestDetail.next();
      recRequestDetail.edit();
  
      recRequestHistoryDetail.addNew();
      recRequestHistoryDetail.moveFields(recRequestDetail, Record.MOVE_BY_NAME, true, DBConstants.SCREEN_MOVE, true, false, false, false);   // Move all fields to the history record
      recRequestHistoryDetail.getField(RequestHistoryDetail.PROFILE_ID).moveFieldToThis(recRequest.getField(Request.PROFILE_ID));
      recRequestHistoryDetail.add();  
  
      recRequestDetail.remove();
    }
  } catch (DBException ex)    {
    ex.printStackTrace();
  }
}

代码示例来源:origin: com.tourgeek.tour/com.tourgeek.tour.request.report

/**
 * UpdateHistoryDetail Method.
 */
public void updateHistoryDetail(Record recRequestDetail, Record recRequestHistoryDetail, Record recRequest)
{
  try   {
    recRequestDetail.close();
    while (recRequestDetail.hasNext())
    {
      recRequestDetail.next();
      recRequestDetail.edit();
  
      recRequestHistoryDetail.addNew();
      recRequestHistoryDetail.moveFields(recRequestDetail, Record.MOVE_BY_NAME, true, DBConstants.SCREEN_MOVE, true, false, false, false);   // Move all fields to the history record
      recRequestHistoryDetail.getField(RequestHistoryDetail.PROFILE_ID).moveFieldToThis(recRequest.getField(Request.PROFILE_ID));
      recRequestHistoryDetail.add();  
  
      recRequestDetail.remove();
    }
  } catch (DBException ex)    {
    ex.printStackTrace();
  }
}

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.acctrec.screen

/**
 * Add all the screen listeners.
 */
public void addListeners()
{
  super.addListeners();
  
  this.getMainRecord().getListener(UpdateArTrxAcctDetailHandler.class, true).setEnabledListener(false);    // Since I will be doing the updating
  this.getMainRecord().addListener(new UpdateCrDrAcctDetailHandler(this.getRecord(Booking.BOOKING_FILE)));
  
  try {
    this.getMainRecord().addNew();
  } catch (DBException e) {
  }
  this.setEnabled(true);
  this.getMainRecord().getField(ArTrx.TRX_STATUS_ID).setEnabled(false);
  this.getMainRecord().getField(ArTrx.AMOUNT).addListener(new SetCrDrTypeHandler(null));
}
/**

代码示例来源:origin: com.tourapp.tour/com.tourapp.tour.acctrec.screen

/**
 * Add all the screen listeners.
 */
public void addListeners()
{
  super.addListeners();
  
  this.getMainRecord().getListener(UpdateArTrxAcctDetailHandler.class, true).setEnabledListener(false);    // Since I will be doing the updating
  this.getMainRecord().addListener(new UpdateRefundAcctDetailHandler(this.getRecord(Booking.BOOKING_FILE)));
  
  try {
    this.getMainRecord().addNew();
  } catch (DBException e) {
  }
  this.setEnabled(true);
  TrxStatus recTrxStatus = (TrxStatus)this.getRecord(TrxStatus.TRX_STATUS_FILE);
  recTrxStatus.getTrxStatusID(TransactionType.ACCTREC, ArTrx.AR_TRX_FILE, ArTrx.REFUND_SUBMITTED);
  this.getMainRecord().getField(ArTrx.TRX_STATUS_ID).addListener(new InitFieldHandler(recTrxStatus.getField(TrxStatus.ID)));
  this.getMainRecord().getField(ArTrx.TRX_STATUS_ID).setEnabled(false);
}

代码示例来源:origin: org.jbundle.base.db/org.jbundle.base.db

/**
   * Called when a new blank record is required for the table/query.
   * If the file is empty, this does an addNew, otherwise, the first record
   * is read.
   * @param bDisplayOption If true, display any changes.
   */
  public void doNewRecord(boolean bDisplayOption)
  {
    super.doNewRecord(bDisplayOption);
    try   {
      if (this.getOwner().isOpen())   // Don't do first time!
      {
        boolean bOldEnableState = this.isEnabledListener();
        this.setEnabledListener(false);      // Just in case AddNew decides to call this
        this.getOwner().close();
        if (this.getOwner().hasNext())  // records yet?
          this.getOwner().next();
        else
          this.getOwner().addNew(); // Make a new one
        this.setEnabledListener(bOldEnableState);
      }
    } catch (DBException ex)    {
      if (ex.getErrorCode() == DBConstants.FILE_NOT_FOUND)
        if ((this.getOwner().getOpenMode() & DBConstants.OPEN_DONT_CREATE) == DBConstants.OPEN_DONT_CREATE)
          return;   // Special case - they didn't want the table created if not found
      ex.printStackTrace(); // Never
    }
  }
}

相关文章

微信公众号

最新文章

更多

Record类方法