/** * Constructor. * @param record The parent record. * @param strName The field name. * @param iDataLength The maximum string length (pass -1 for default). * @param strDesc The string description (usually pass null, to use the resource file desc). * @param strDefault The default value (if object, this value is the default value, if string, the string is the default). */ public XMLPropertiesField(Record record, String strName, int iDataLength, String strDesc, Object strDefault) { this(); this.init(record, strName, iDataLength, strDesc, strDefault); } /**
/** * Convert these java properties to a string. * @param properties The java properties. * @return The properties string. */ public String propertiesToInternalString(Map<String,Object> properties) { return XMLPropertiesField.propertiesToXML(properties); } /**
/** * Load the properties from the string and parse them. * @return The java properties. */ public Map<String,Object> internalStringToProperties(String strProperties) { return XMLPropertiesField.xmlToProperties(strProperties); } /**
/** * Creates a new object of the same class as this object. * @return a clone of this instance. * @exception CloneNotSupportedException if the object's class does not support the <code>Cloneable</code> interface. * @see java.lang.Cloneable */ public Object clone() throws CloneNotSupportedException { BaseField field = new XMLPropertiesField(null, m_strFieldName, m_iMaxLength, m_strFieldDesc, null); field.setRecord(m_record); // Set table without adding to table field list return field; } /**
/** * Get this property. * @param strProperty The key to lookup. * @return The property for this key. */ public String getProperty(String strProperty) { if (strProperty.equalsIgnoreCase(DBParams.MENU)) if (m_strMenu != null) return m_strMenu; // Current menu property if (this.getMainRecord() != null) if ((this.getMainRecord().getEditMode() == DBConstants.EDIT_CURRENT) || (this.getMainRecord().getEditMode() == DBConstants.EDIT_IN_PROGRESS)) { if ("menutitle".equalsIgnoreCase(strProperty)) return this.getMenuName(this.getMainRecord()); if ("type".equalsIgnoreCase(strProperty)) return this.getMenuType(this.getMainRecord()); if ("icon".equalsIgnoreCase(strProperty)) return this.getMenuIcon(this.getMainRecord()); if ("menudesc".equalsIgnoreCase(strProperty)) return this.getMenuDesc(this.getMainRecord()); if ("link".equalsIgnoreCase(strProperty)) return this.getMenuLink(this.getMainRecord()); if (this.getMainRecord() instanceof Menus) if (((XMLPropertiesField)this.getMainRecord().getField(Menus.kParams)).getProperty(strProperty) != null) return ((XMLPropertiesField)this.getMainRecord().getField(Menus.kParams)).getProperty(strProperty); } return super.getProperty(strProperty); } /**
/** * Called when a valid record is read from the table/query. * @param bDisplayOption If true, display any changes. */ public void doValidRecord(boolean bDisplayOption) // init this field override for other value { // Convert the XMLProperties field to a URL type string (yikes... in the same field) Record recMenus = this.getOwner(); XMLPropertiesField field = (XMLPropertiesField)recMenus.getField(Menus.kParams); Map<String,Object> properties = field.getProperties(); String strURL = null; strURL = Utility.propertiesToURL(strURL, properties); if (strURL != null) if (strURL.length() > 0) if (strURL.charAt(0) == '?') strURL = strURL.substring(1); field.setString(strURL); super.doValidRecord(bDisplayOption); } });
/** * Creates a new object of the same class as this object. * @return a clone of this instance. * @exception CloneNotSupportedException if the object's class does not support the <code>Cloneable</code> interface. * @see java.lang.Cloneable */ public Object clone() throws CloneNotSupportedException { BaseField field = new XMLPropertiesField(null, m_strFieldName, m_iMaxLength, m_strFieldDesc, null); field.setRecord(m_record); // Set table without adding to table field list return field; } /**
/** * Get this property. * @param strProperty The key to lookup. * @return The property for this key. */ public String getProperty(String strProperty) { if (strProperty.equalsIgnoreCase(DBParams.MENU)) if (m_strMenu != null) return m_strMenu; // Current menu property if (this.getMainRecord() != null) if ((this.getMainRecord().getEditMode() == DBConstants.EDIT_CURRENT) || (this.getMainRecord().getEditMode() == DBConstants.EDIT_IN_PROGRESS)) { if ("menutitle".equalsIgnoreCase(strProperty)) return this.getMenuName(this.getMainRecord()); if ("type".equalsIgnoreCase(strProperty)) return this.getMenuType(this.getMainRecord()); if ("icon".equalsIgnoreCase(strProperty)) return this.getMenuIcon(this.getMainRecord()); if ("menudesc".equalsIgnoreCase(strProperty)) return this.getMenuDesc(this.getMainRecord()); if ("link".equalsIgnoreCase(strProperty)) return this.getMenuLink(this.getMainRecord()); if (this.getMainRecord() instanceof MenusModel) if (((XMLPropertiesField)this.getMainRecord().getField(MenusModel.PARAMS)).getProperty(strProperty) != null) return ((XMLPropertiesField)this.getMainRecord().getField(MenusModel.PARAMS)).getProperty(strProperty); } return super.getProperty(strProperty); } /**
/** * Creates a new object of the same class as this object. * @return a clone of this instance. * @exception CloneNotSupportedException if the object's class does not support the <code>Cloneable</code> interface. * @see java.lang.Cloneable */ public Object clone() throws CloneNotSupportedException { BaseField field = new XMLPropertiesField(null, m_strFieldName, m_iMaxLength, m_strFieldDesc, null); field.setRecord(m_record); // Set table without adding to table field list return field; } /**
/** * Load the properties from the string and parse them. * @return The java properties. */ public Map<String,Object> internalStringToProperties(String strProperties) { return XMLPropertiesField.xmlToProperties(strProperties); } /**
/** * Convert these java properties to a string. * @param properties The java properties. * @return The properties string. */ public String propertiesToInternalString(Map<String,Object> properties) { return XMLPropertiesField.propertiesToXML(properties); } /**
/** * Constructor. * @param record The parent record. * @param strName The field name. * @param iDataLength The maximum string length (pass -1 for default). * @param strDesc The string description (usually pass null, to use the resource file desc). * @param strDefault The default value (if object, this value is the default value, if string, the string is the default). */ public XMLPropertiesField(Record record, String strName, int iDataLength, String strDesc, Object strDefault) { this(); this.init(record, strName, iDataLength, strDesc, strDefault); } /**
field = new StringField(this, PROGRAM, 255, null, null); if (iFieldSeq == 11) field = new XMLPropertiesField(this, PARAMS, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 12) field = new StringField(this, ICON_RESOURCE, 255, null, null);
/** * Load the properties from the string and parse them. * @return The java properties. */ public Map<String,Object> internalStringToProperties(String strProperties) { return XMLPropertiesField.xmlToProperties(strProperties); } /**
/** * Convert these java properties to a string. * @param properties The java properties. * @return The properties string. */ public String propertiesToInternalString(Map<String,Object> properties) { return XMLPropertiesField.propertiesToXML(properties); } /**
/** * Constructor. * @param record The parent record. * @param strName The field name. * @param iDataLength The maximum string length (pass -1 for default). * @param strDesc The string description (usually pass null, to use the resource file desc). * @param strDefault The default value (if object, this value is the default value, if string, the string is the default). */ public XMLPropertiesField(Record record, String strName, int iDataLength, String strDesc, Object strDefault) { this(); this.init(record, strName, iDataLength, strDesc, strDefault); } /**
field = new StringField(this, "Program", 255, null, null); if (iFieldSeq == kParams) field = new XMLPropertiesField(this, "Params", Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == kIconResource) field = new StringField(this, "IconResource", 255, null, null);