码迷,mamicode.com
首页 > 其他好文 > 详细

5.29日 自己程序的编写,目的:生成xml文件

时间:2014-05-30 17:55:48      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:c   style   class   blog   code   java   

1.创建了XMLModel这个类:本来还有个rebuildformXML的方法,但是现在用不到,以后再说。

bubuko.com,布布扣
public interface XmlModel {    
    public void initModel();    
    public void doSaveXML();
}
bubuko.com,布布扣

2.对AbstractModel这个类进行了修改,最终变为:

bubuko.com,布布扣
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); } }
bubuko.com,布布扣

3.新添加一个类:elementModel,nodeModel和connectionModel继承自它。

bubuko.com,布布扣
<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>
bubuko.com,布布扣

 

 

 

 

 

 

5.29日 自己程序的编写,目的:生成xml文件,布布扣,bubuko.com

5.29日 自己程序的编写,目的:生成xml文件

标签:c   style   class   blog   code   java   

原文地址:http://www.cnblogs.com/liyuhui20093357/p/3760292.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!