public override ObjectElement clone() { PropertyValueElement newInstance = new PropertyValueElement((PropertyValueManager)parent); baseCloneTo(newInstance); newInstance.ValueType = ValueType; if (ValueType == Consts.PARAM_INT) { newInstance.value = Convert.ToInt32(value) + 0; } else if (ValueType == Consts.PARAM_STR) { newInstance.value = Convert.ToString(value)+ ""; } else { newInstance.value = value; } return newInstance; }
public void ReadObject(System.IO.Stream s) { short len = 0; len = IOUtil.readShort(s); for (int i = 0; i < len; i++) { PropertyValueElement element = new PropertyValueElement(this); addElement(element); } for (int i = 0; i < len; i++) { PropertyValueElement element = (PropertyValueElement)this.getElement(i); element.ReadObject(s); } }
//插入属性 public void inseartProperty(PropertyElement property,int index) { PropertyValueElement element = new PropertyValueElement(propertyValueManager); element.name = property.name + ""; element.ValueType = property.ValueType; element.setValue(property.getDefaultValue()); propertyValueManager.insertElement(element, index); propertyValueManager.refreshUI(); }
//刷新属性(全部填写默认属性) public void refreshProperty() { this.removeAll(); for (int i = 0; i < propertiesManager.getElementCount(); i++) { PropertyValueElement element = new PropertyValueElement(this); PropertyElement property = (PropertyElement)(propertiesManager.getElement(i)); element.name = property.name + ""; element.ValueType = property.ValueType; element.setValue(property.getDefaultValue()); addElement(element); } }
//增加属性 public void addProperty(PropertyElement property) { PropertyValueElement element = new PropertyValueElement(propertyValueManager); element.name = property.name + ""; element.ValueType = property.ValueType; element.setValue(property.getDefaultValue()); propertyValueManager.addElement(element); propertyValueManager.refreshUI(); }