Ejemplo n.º 1
0
 /**
  * Set up the default screen control for this field.
  *
  * @param itsLocation Location of this component on screen (ie., GridBagConstraint).
  * @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout).
  * @param converter The converter to set the screenfield to.
  * @param iDisplayFieldDesc Display the label? (optional).
  * @param properties Extra properties
  * @return Return the component or ScreenField that is created for this field.
  */
 public ScreenComponent setupDefaultView(
     ScreenLoc itsLocation,
     ComponentParent targetScreen,
     Convert converter,
     int iDisplayFieldDesc,
     Map<String, Object> properties) {
   if (targetScreen != null) {
     Record recCurrencys =
         (Record) Utility.getRecordOwner(targetScreen).getRecord(Currencys.CURRENCYS_FILE);
     if (recCurrencys != null) {
       BaseField fldCurrencyCode = recCurrencys.getField(Currencys.CURRENCY_CODE);
       Converter conv =
           new FieldDescConverter(
               fldCurrencyCode, (Converter) converter); // Use the description for this field
       ScreenComponent sfCurrency =
           createScreenComponent(
               ScreenModel.EDIT_TEXT,
               itsLocation,
               targetScreen,
               conv,
               iDisplayFieldDesc,
               properties);
       sfCurrency.setEnabled(false);
       itsLocation =
           targetScreen.getNextLocation(
               ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR);
       iDisplayFieldDesc = ScreenConstants.DONT_DISPLAY_DESC; // Display it only once
     }
   }
   return super.setupDefaultView(
       itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
 }
Ejemplo n.º 2
0
 /** Make a default screen. */
 public ScreenParent makeScreen(
     ScreenLoc itsLocation,
     ComponentParent parentScreen,
     int iDocMode,
     Map<String, Object> properties) {
   ScreenParent screen = null;
   if ((iDocMode & ScreenConstants.MAINT_MODE) == ScreenConstants.MAINT_MODE)
     screen =
         Record.makeNewScreen(
             COUNTRY_SCREEN_CLASS,
             itsLocation,
             parentScreen,
             iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC,
             properties,
             this,
             true);
   else if ((iDocMode & ScreenConstants.DISPLAY_MODE) == ScreenConstants.DISPLAY_MODE)
     screen =
         Record.makeNewScreen(
             COUNTRY_GRID_SCREEN_CLASS,
             itsLocation,
             parentScreen,
             iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC,
             properties,
             this,
             true);
   else screen = super.makeScreen(itsLocation, parentScreen, iDocMode, properties);
   return screen;
 }
Ejemplo n.º 3
0
 /**
  * Called when a valid record is read from the table/query.
  *
  * @param bDisplayOption If true, display any changes.
  */
 public void doValidRecord(boolean bDisplayOption) {
   super.doValidRecord(bDisplayOption);
   Record recApTrx = this.getOwner();
   if (m_iDepartureEstimate == -1) {
     TrxStatus recTrxStatus =
         new TrxStatus(
             this.getOwner()
                 .findRecordOwner()); // Rarely, but if it doesn't exist in the screen, add it!
     m_iDepartureEstimate =
         recTrxStatus.getTrxStatusID(
             TransactionType.ACCTPAY, ApTrx.AP_TRX_FILE, ApTrx.DEP_ESTIMATE);
     m_iDepartureEstimateManual =
         recTrxStatus.getTrxStatusID(
             TransactionType.ACCTPAY, ApTrx.AP_TRX_FILE, ApTrx.DEPARTURE_EST_MANUAL);
     recTrxStatus.free();
   }
   if ((recApTrx.getField(ApTrx.TRX_STATUS_ID).getValue() == m_iDepartureEstimate)
       || (recApTrx.getField(ApTrx.TRX_STATUS_ID).getValue() == m_iDepartureEstimateManual)) {
     recApTrx
         .getField(ApTrx.INVOICE_AMOUNT)
         .moveFieldToThis(recApTrx.getField(ApTrx.DEPARTURE_ESTIMATE));
     recApTrx
         .getField(ApTrx.INVOICE_BALANCE)
         .moveFieldToThis(recApTrx.getField(ApTrx.DEPARTURE_ESTIMATE));
     recApTrx
         .getField(ApTrx.INVOICE_BALANCE_LOCAL)
         .moveFieldToThis(recApTrx.getField(ApTrx.DEPARTURE_ESTIMATE_LOCAL));
   }
 }
Ejemplo n.º 4
0
 /**
  * User selected a new row. From the ListSelectionListener interface.
  *
  * @param source The source data.
  * @param iStartRow The start row.
  * @param iEndRow The end row.
  * @param iSelectType The select type.
  * @return true if the selection changed?
  */
 public boolean selectionChanged(Object source, int iStartRow, int iEndRow, int iSelectType) {
   int iSelectedRow = this.getSelectedRow();
   boolean bChanged = super.selectionChanged(source, iStartRow, iEndRow, iSelectType);
   if (iSelectedRow != this.getSelectedRow())
     if (m_gridScreen != null) // Could have been freed.
     { // Selection changed
       int iErrorCode = DBConstants.NORMAL_RETURN;
       FieldList fieldList = null;
       Record record = m_gridScreen.getMainRecord();
       iSelectedRow = this.getSelectedRow();
       if (iSelectedRow != -1) fieldList = this.makeRowCurrent(iSelectedRow, false);
       if (fieldList == null) iSelectedRow = -1; // No record = de-select
       if (iSelectedRow == -1)
         iErrorCode = record.handleRecordChange(DBConstants.DESELECT_TYPE); // Record DeSelected!!!
       else iErrorCode = record.handleRecordChange(DBConstants.SELECT_TYPE); // Record selected!!!
       if (iErrorCode != DBConstants.NORMAL_RETURN) ; // DO Something?
     }
   return bChanged;
 }
Ejemplo n.º 5
0
 /**
  * Sort this table by this column.
  *
  * @param iColumn The column to sort by.
  * @param If true, sort ascending.
  * @return true if successful.
  */
 public boolean sortByColumn(int iColumn, boolean bOrder) {
   if (m_gridScreen != null) {
     if (m_gridScreen.getConverter() == null) { // If there is no sorter, add a default one
       Record record = m_gridScreen.getMainRecord();
       if (record != null) {
         boolean bAddDefaultSorter = true;
         FileListener listener = record.getListener();
         while (listener != null) {
           if (listener instanceof FileFilter)
             bAddDefaultSorter = false; // Too difficult to figure out sort order
           listener = (FileListener) listener.getNextListener();
         }
         if (bAddDefaultSorter)
           if (m_gridScreen instanceof GridScreen) // Always
           {
             ShortField tempField =
                 new ShortField(
                     null, "SortOrder", DBConstants.DEFAULT_FIELD_LENGTH, "Sort Order", null);
             SortOrderHandler sortListener = new SortOrderHandler((GridScreen) m_gridScreen);
             if ((record.getDatabaseType() & DBConstants.TABLE_TYPE_MASK) == DBConstants.TABLE)
               sortListener.setCreateSortOrder(
                   true); // On simple tables, allow user to re-sort on any key
             tempField.addListener(sortListener);
             record.addListener(new FreeOnFreeHandler(tempField));
           }
       }
     }
     if (m_gridScreen.getConverter() != null) {
       Convert converter = m_gridScreen.getConverter();
       if (iColumn > 0) {
         if (!bOrder) iColumn = -iColumn; // Negative means descending
         return (converter.setValue(iColumn) == DBConstants.NORMAL_RETURN);
       }
     }
   }
   return super.sortByColumn(iColumn, bOrder);
 }
Ejemplo n.º 6
0
 /**
  * Is the main record modified?
  *
  * @return True if the record has changed.
  */
 public boolean isRecordChanged() {
   Record record = m_gridScreen.getMainRecord();
   return record.getTable().getCurrentTable().getRecord().isModified(); // Is this record modified?
 }
Ejemplo n.º 7
0
 /**
  * Restore this fieldlist with items from the input cache. I use a standard field buffer and
  * append all the screen items which are not included in the field.
  *
  * @param fieldList The record to fill with the data.
  */
 public void restoreCurrentRecord(FieldList fieldList) {
   super.restoreCurrentRecord(fieldList);
   ((Record) fieldList).setModified(m_brgCurrentLockedDataMods);
 }
Ejemplo n.º 8
0
 /** Set up all the screen fields. */
 public void setupSFields() {
   Record recVendor =
       ((ReferenceField) this.getMainRecord().getField(ApTrx.VENDOR_ID)).getReferenceRecord(this);
   if (recVendor != null) { // Make sure currency is read for LocalCurrencyField(s).
     Record recCurrencys =
         ((ReferenceField) recVendor.getField(Vendor.CURRENCYS_ID)).getReferenceRecord(this);
     recVendor.getField(Vendor.CURRENCYS_ID).addListener(new ReadSecondaryHandler(recCurrencys));
   }
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.CODE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.TRX_STATUS_ID)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.VENDOR_ID)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.TOUR_ID)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.DEPARTURE_DATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.DESCRIPTION)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.START_SERVICE_DATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.END_SERVICE_DATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.FINALIZATION_DATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.DEPARTURE_ESTIMATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.DEPARTURE_EXCHANGE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.DEPARTURE_ESTIMATE_LOCAL)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.INVOICE_NO)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.INVOICE_DATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.INVOICE_AMOUNT)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.INVOICE_LOCAL)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.INVOICE_BALANCE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.INVOICE_BALANCE_LOCAL)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.AMOUNT_SELECTED)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.ACKNOWLEDGE_DATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.ACKNOWLEDGED_ON)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.ACKNOWLEDGED_BY)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
 }
Ejemplo n.º 9
0
 /** Get the table name. */
 public String getTableNames(boolean bAddQuotes) {
   return (m_tableName == null)
       ? Record.formatTableNames(PROFILE_TYPE_FILE, bAddQuotes)
       : super.getTableNames(bAddQuotes);
 }
Ejemplo n.º 10
0
 /** Get the table name. */
 public String getTableNames(boolean bAddQuotes) {
   return (m_tableName == null)
       ? Record.formatTableNames(TOUR_HEADER_CHAIN_FILE, bAddQuotes)
       : super.getTableNames(bAddQuotes);
 }
Ejemplo n.º 11
0
 /** Set up all the screen fields */
 public void setupSFields() {
   Record record = this.getMainRecord();
   this.addColumn(record.getField(Dog.DOG_FILE, Animal.NAME));
   this.addColumn(record.getField(Dog.DOG_FILE, Animal.COLOR));
   this.addColumn(record.getField(Vet.VET_FILE, Vet.NAME));
 }