//增加属性 public void addProperty(PropertyElement property) { for (int i = 0; i < getElementCount(); i++) { InstanceElement element = (InstanceElement)getElement(i); element.addProperty(property); } }
//插入属性 public void inseartProperty(PropertyElement property,int index) { for (int i = 0; i < getElementCount(); i++) { InstanceElement element = (InstanceElement)getElement(i); element.inseartProperty(property, index); } }
//克隆 public override ObjectElement clone() { PropertyElement newInstance = new PropertyElement((PropertiesManager)parent); baseCloneTo(newInstance); newInstance.ValueType = ValueType; newInstance.propertyTypeElementUsed = propertyTypeElementUsed; newInstance.defaultValue = defaultValue; return newInstance; }
//判断相同 public bool equalsPropertyElement(PropertyElement destPropertyElement) { if (destPropertyElement == null || destPropertyElement.ValueType != ValueType || !destPropertyElement.name.Equals(name)) { return false; } return true; }
public void readObjectInit(System.IO.Stream s) { short len = 0; len = IOUtil.readShort(s); for (int i = 0; i < len; i++) { PropertyElement element = new PropertyElement(this); addElement(element); } }
//拷贝(不克隆关联属性) public PropertyElement getCopy(PropertiesManager parentT) { PropertyElement newInstance = new PropertyElement(parentT); newInstance.ValueType = ValueType; return newInstance; }
public void configPropertyName(PropertyElement property) { if (property == null) { return; } PropertyValueElement element = (PropertyValueElement)propertyValueManager.getElement(property.getID()); element.name = property.name + ""; propertyValueManager.refreshUI_Element(property.getID()); }
//删除属性 public void removeProperty(PropertyElement property) { propertyValueManager.removeElement(property.getID()); }
//插入属性 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 configProperty(PropertyElement property) { if (property == null) { return; } PropertyValueElement element = (PropertyValueElement)propertyValueManager.getElement(property.getID()); element.name = property.name + ""; element.ValueType = property.ValueType; element.setValue(property.getDefaultValue()); propertyValueManager.refreshUI_Element(property.getID()); }
//增加属性 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(); }
//删除属性 public bool removeProperty(PropertyElement property) { String s=property.getUsedInf(); if (s!=null) { SmallDialog_ShowParagraph.showString(s, "不能删除被使用的属性"); return false; } for (int i = 0; i < getElementCount(); i++) { InstanceElement element = (InstanceElement)getElement(i); element.removeProperty(property); } return true; }
//配置属性 public void configPropertyName(PropertyElement property) { for (int i = 0; i < getElementCount(); i++) { InstanceElement element = (InstanceElement)getElement(i); element.configPropertyName(property); } }
public static PropertyElement createElement(PropertiesManager managerT) { manager = managerT; element = new PropertyElement(manager); setDialog("新建属性单元"); dialog.comboBox_Value.SelectedIndex = 0; dialog.setPropsList(); dialog.ShowDialog(); return element; }
//设置单元 public static bool configElement(PropertyElement elementT) { if (elementT == null) { Console.WriteLine("error in configElement"); return false; } manager = (PropertiesManager)elementT.parent; element = elementT; setDialog("设置属性单元"); dialog.textBox_name.Text = element.name; dialog.comboBox_Value.SelectedIndex = element.ValueType == Consts.PARAM_INT ? 0 : element.ValueType == Consts.PARAM_STR ? 1 : element.ValueType == Consts.PARAM_PROP ? 2 : 3; dialog.setPropsList(); dialog.ShowDialog(); return needRefreshUI; }