/** * Initialize this converter. * @param converter The next converter in the converter chain. */ public void init(Converter converter) { super.init(converter); } /**
/** * Free this converter. */ public void free() { super.free(); } /**
/** * Get the field on the end of this converter chain. * @return The field on the end of the chain. */ public FieldInfo getField() { if (this.getNextConverter() != null) return this.getNextConverter().getField(); else return super.getField(); } // Return the source BaseField (if linked to a field!) /**
if (this.getNextConverter() != null) FieldInfo field = this.getField(); this.getNextConverter().removeComponent(screenField); return; // DO NOT Free this converter, it is referenced by another ScreenField! if (converter instanceof LinkedConverter) converter = ((LinkedConverter)converter).getNextConverter(); else converter = null;
/** * Get the binary image of this field's data. * @return The raw data. */ public Object getData() { // Move raw data from this field Object data = super.getData(); if (data instanceof Integer) { // Always int iStatusType = ((Integer)data).intValue(); String strData = Constants.BLANK; // int x = (iStatusType & 1 << BookingConstants.INFO_LOOKUP); if ((iStatusType & 1 << BookingConstants.INFO_LOOKUP) != 0) strData += INFO + ' '; if ((iStatusType & 1 << BookingConstants.COST_LOOKUP) != 0) strData += PRICE + ' '; if ((iStatusType & 1 << BookingConstants.INVENTORY_LOOKUP) != 0) strData += INVENTORY + ' '; if ((iStatusType & 1 << BookingConstants.PRODUCT_LOOKUP) != 0) strData += PRODUCT + ' '; if (!Constants.BLANK.equals(strData)) strData += PENDING; else strData = VALID; data = strData; } return data; } }
/** * Get the current string length of the data at the end of this converter chain. * @return The string length (or -1 if unknown). */ public int getLength() { // Must be overidden if (this.getNextConverter() != null) return this.getNextConverter().getLength(); else return super.getLength(); } /**
public Object getData() Object data = super.getData();
/** * Get the maximum length of this field. * @return The maximum field length. */ public int getMaxLength() { // Must be overidden if (this.getNextConverter() != null) return this.getNextConverter().getMaxLength(); else return super.getMaxLength(); } /**
/** * Constructor. */ public void init(Converter converter) { super.init(converter); } /**
/** * Get the field description. * @return The field description. */ public String getFieldDesc() { // Must be overidden if (this.getNextConverter() != null) return this.getNextConverter().getFieldDesc(); else return super.getFieldDesc(); } /**
/** * Constructor. * @param converter The next converter in the converter chain. */ public LinkedConverter(Converter converter) { this(); this.init(converter); } /**
/** * Add this component to the components displaying this field. * @param Object sField The screen component.. either a awt.Component or a ScreenField. */ public void addComponent(Object screenField) { if (this.getNextConverter() != null) this.getNextConverter().addComponent(screenField); else super.addComponent(screenField); } /**
/** * Enable or disable the converter translation. * @param bEnableTranslation If true, enable translation. * @return The old translation value. */ public boolean setEnableTranslation(boolean bEnableTranslation) { boolean bOldTranslation = m_bEnableTranslation; m_bEnableTranslation = false; LinkedConverter converter = this; while (converter != null) { if (converter.getNextConverter() instanceof LinkedConverter) { converter = (LinkedConverter)((LinkedConverter)converter).getNextConverter(); if (converter instanceof MultipleFieldConverter) ((MultipleFieldConverter)converter).setEnableTranslation(bEnableTranslation); } else converter = null; } m_bEnableTranslation = bEnableTranslation; return bOldTranslation; } /**
/** * Convert the field's code to the display's index (for popup). * @return The value in this field to a 0 based index in a table. */ public int convertFieldToIndex() // init this field override for other value { // Must be overidden if (this.getNextConverter() != null) return this.getNextConverter().convertFieldToIndex(); else return super.convertFieldToIndex(); } /**
/** * Get the data on the end of this converter chain. * @return The raw data. */ public Object getData() { if (this.getNextConverter() != null) return this.getNextConverter().getData(); else return super.getData(); } /**
/** * Get the image for Buttons and Bitmaps and drag cursors. * @return The bitmap for this converter. */ public String getBitmap() { if (this.getNextConverter() != null) return this.getNextConverter().getBitmap(); else return super.getBitmap(); } /**
/** * For binary fields, return the current state. * @param True is this field is true. */ public boolean getState() // init this field override for other value { // Must be overidden if (this.getNextConverter() != null) return this.getNextConverter().getState(); else return super.getState(); } /**
/** * Retrieve (in string format) from this field. * @return The data in string format. */ public String getString() { if (this.getNextConverter() != null) return this.getNextConverter().getString(); // This will work for text fields that require no conversion else return super.getString(); } /**
/** * For numeric fields, get the current value. * @return The converter value as a double. */ public double getValue() { if (this.getNextConverter() != null) return this.getNextConverter().getValue(); else return super.getValue(); } }
/** * Convert this index to a display field. * @param index The index to convert. * @return The display string. */ public String convertIndexToDisStr(int index) { if (this.getNextConverter() != null) return this.getNextConverter().convertIndexToDisStr(index); // By default, use the same string else return super.convertIndexToDisStr(index); } /**