/** * Initialize this converter. * @param converter The property field. * @param strProperty The property to display/set in the properties field. */ public void init(Converter converter, String strProperty) { m_strProperty = strProperty; super.init(converter); } /**
/** * Set up the default 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 iDisplayFieldDesc Display the label? (optional). * @return Return the component or ScreenField that is created for this field. */ public Object setupDefaultView(Object itsLocation, Object targetScreen, Convert converter, int iDisplayFieldDesc) // Add this view to the list { // I NEVER call the thin implementation. return this.setupDefaultView((ScreenLocation)itsLocation, (BasePanel)targetScreen, (Converter)converter, iDisplayFieldDesc); } /**
/** * Free this converter. */ public void free() { super.free(); } /**
/** * Get this converter to use at this index. * @param iIndex The converter index. * @return The current converter. */ public Converter getConverterToPass(int iIndex) { if (iIndex == -1) return super.getNextConverter(); if (m_vconvDependent != null) { if (iIndex < m_vconvDependent.size()) return (Converter)m_vconvDependent.get(iIndex); } return null; // Use the next converter on the chain } /**
/** * Retrieve (in string format) from this field. * @return The data in string format. */ public String getString() { String data = super.getString(); if (m_properties.getProperty((String)data) != null) data = m_properties.getProperty(data); return data; } };
converter.setNextConverter(propConverter); if (((FieldConverter)converter).getNextConverter() instanceof PropertiesConverter) ((FieldConverter)converter).getNextConverter().free(); converter.setNextConverter(fldProductDesc);
/** * Get the maximum length of this field. * @return The length plus one character for the dash. */ public int getMaxLength() { // Must be overidden return super.getMaxLength() + 1; // Include a space for the dash } /**
/** * Get the field description. * @return The field description. */ public String getFieldDesc() { if (m_convDescField != null) return m_convDescField.getFieldDesc(); if ((m_strAltDesc == null) || (m_strAltDesc.length() == 0)) return super.getFieldDesc(); else return m_strAltDesc; } }
/** * Add this component to the components displaying this field. * Make sure all the converter have this screenfield on their list. * @param Object sField The screen component.. either a awt.Component or a ScreenField. */ public void addComponent(Object screenField) { // Set up the dependencies, This will recompute if any change from these three fields this.setEnableTranslation(false); super.addComponent(screenField); this.setEnableTranslation(true); for (int iIndex = 0; ; iIndex++) { Converter converter = this.getConverterToPass(iIndex); if (converter == null) break; converter.addComponent(screenField); } } /**
/** * Get the image for Buttons and Bitmaps and drag cursors. * (Previously getBitmap). * Return The bitmap for the current table. */ public String getBitmap() { if (m_recTarget != null) { Record recTarget = null; if (m_recTarget.getBaseRecord().getTable().getCurrentTable() != null) recTarget = m_recTarget.getBaseRecord().getTable().getCurrentTable().getRecord(); if (recTarget != null) return recTarget.getBitmap(); // Bitmap for this table } return super.getBitmap(); // Default value } /**
/** * Set up the default 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 iDisplayFieldDesc Display the label? (optional). * @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) // Add this view to the list { ScreenComponent sField = null; BaseField field = (BaseField)this.getField(); if (field != null) { sField = field.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); if (sField != null) if (sField.getConverter() == null) sField.setConverter(this); } else sField = BaseField.createScreenComponent(ScreenModel.EDIT_TEXT, itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); return sField; } }
/** * Get this converter to use at this index. * @param iIndex The converter index. * @return The current converter. */ public Converter getConverterToPass(int iIndex) { if (iIndex == -1) return super.getNextConverter(); if (m_vconvDependent != null) { if (iIndex < m_vconvDependent.size()) return (Converter)m_vconvDependent.get(iIndex); } return null; // Use the next converter on the chain } /**
/** * Retrieve (in string format) from this field. * @return This field as a percent string. */ public String getString() { String string = super.getString(); if ((string != null) && (string.length() > 0)) string = this.decodeString(string); return string; } public String decodeString(String string)
converter.setNextConverter(propConverter); if (((FieldConverter)converter).getNextConverter() instanceof PropertiesConverter) ((FieldConverter)converter).getNextConverter().free(); converter.setNextConverter(fldProductDesc);
/** * Get the maximum length of this field. * @return The fake field length. */ public int getMaxLength() { if (m_iFakeLength != -1) return m_iFakeLength; else return super.getMaxLength(); } /**
/** * Get the field description. * @return The field description. */ public String getFieldDesc() { if (m_convDescField != null) return m_convDescField.getFieldDesc(); if ((m_strAltDesc == null) || (m_strAltDesc.length() == 0)) return super.getFieldDesc(); else return m_strAltDesc; } }
/** * Add this component to the components displaying this field. * Make sure all the converter have this screenfield on their list. * @param Object sField The screen component.. either a awt.Component or a ScreenField. */ public void addComponent(Object screenField) { // Set up the dependencies, This will recompute if any change from these three fields this.setEnableTranslation(false); super.addComponent(screenField); this.setEnableTranslation(true); for (int iIndex = 0; ; iIndex++) { Converter converter = this.getConverterToPass(iIndex); if (converter == null) break; converter.addComponent(screenField); } } /**
/** * Get the image for Buttons and Bitmaps and drag cursors. * (Previously getBitmap). * Return The bitmap for the current table. */ public String getBitmap() { if (m_recTarget != null) { Record recTarget = null; if (m_recTarget.getBaseRecord().getTable().getCurrentTable() != null) recTarget = m_recTarget.getBaseRecord().getTable().getCurrentTable().getRecord(); if (recTarget != null) return recTarget.getBitmap(); // Bitmap for this table } return super.getBitmap(); // Default value } /**
/** * Set up the default 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 iDisplayFieldDesc Display the label? (optional). * @return Return the component or ScreenField that is created for this field. */ public ScreenField setupDefaultView(ScreenLocation itsLocation, BasePanel targetScreen, Converter converter, int iDisplayFieldDesc) // Add this view to the list { ScreenField sField = null; BaseField field = (BaseField)this.getField(); if (field != null) { sField = field.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc); if (sField != null) if (sField.getConverter() == null) sField.setConverter(this); } else sField = new SEditText(itsLocation, targetScreen, converter, iDisplayFieldDesc); return sField; } }
/** * Initialize this converter. * @param converter The next converter in the converter chain. */ public void init(Converter converter) { super.init(converter); } /**