标签:c style class blog code java
1.创建了XMLModel这个类:本来还有个rebuildformXML的方法,但是现在用不到,以后再说。
public interface XmlModel { public void initModel(); public void doSaveXML(); }
2.对AbstractModel这个类进行了修改,最终变为:
package hellogef.model; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import org.eclipse.ui.views.properties.IPropertySource; public abstract class AbstractModel implements IPropertySource,XmlModel{
private PropertyChangeSupport listeners = new PropertyChangeSupport(this);
public void addPropertyChangeListener(PropertyChangeListener listener){ listeners.addPropertyChangeListener(listener); } public void firePropertyChange(String propertyName,Object oldValue,Object newValue){ listeners.firePropertyChange(propertyName, oldValue, newValue); } public void removePropertyChangeListener(PropertyChangeListener listener){ listeners.removePropertyChangeListener(listener); } protected void fireStructureChange(String prop, Object child) { listeners.firePropertyChange(prop, null, child); } }
3.新添加一个类:elementModel,nodeModel和connectionModel继承自它。
<diagram> <figure> <startnode> <name>start</name> <!—ID应该是随机生成的吧,假设是5--> <ID> 5</ID> <connectionpoint> <x>2.5</x> <y>3.5</y> </connectionpoint> <!--怎么表示图形呢?--> <startfigure></startfigure>??? </startnode> <movenode> <name>start</name> <ID> 2</ID> <connectionpoint> <x>2.5</x> <y>3.5</y> </connectionpoint> <movefigure></movefigure> <velocity>30</velocity> <displacement>10</displacement> </movenode> <connection> <from>5</from> <to>2</to> </connection>
<connection> <from>2</from> <to>6</to> </connection>
<stopnode> <name>stop</name> <ID>6<ID> <connectionpoint> <x>10.5</x> <y>20</y> </connectionpoint> <stopfigure></stopfure> </stopnode> </figure> </diagram>
5.29日 自己程序的编写,目的:生成xml文件,布布扣,bubuko.com
标签:c style class blog code java
原文地址:http://www.cnblogs.com/liyuhui20093357/p/3760292.html