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

7.9 XmlHeadFactory,用来产生与模型对应的xmlhead

时间:2014-07-11 12:49:27      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   strong   cti   io   

package custom.gef.editor.model;

import custom.gef.editor.model.connection.MessageFromModel;
import custom.gef.editor.model.connection.MessageToModel;
import custom.gef.editor.model.port.PortGuideModel;
import custom.gef.editor.model.port.PortOperationModel;





public class XmlHeadFactory {
    public final static String HEAD_ERROR="ERROR_HEAD"; 
    
    //connection model XML head
    public final static String HEAD_CONNECTION="Connection";
    //public final static String HEAD_FOUND=HEAD_CONNECTION+"FoundModel";
    public final static String HEAD_CONNECTIONFROM=HEAD_CONNECTION+"From";
    public final static String HEAD_CONNECTIONTO=HEAD_CONNECTION+"To";
    
    //port model XML head
    public final static String HEAD_PORT="Port";
    public final static String HEAD_PORTOPERATION=HEAD_PORT+"OperationModel";
    public final static String HEAD_PORTGUIDE =HEAD_PORT+"GuideModel";
    
    public static String getModelXMLHead(ElementModel model){
        
         if(model instanceof ConnectionElementModel)
            return getConnectioModelXMLHead(model);
         else if(model instanceof PortElementModel)
            return getPortModelXMLHead(model);
         return HEAD_ERROR;
    }
    
    
    public static String getConnectioModelXMLHead(ElementModel model){
         
         /*if(model instanceof FoundModel){
                    return HEAD_FOUND;
         }
         else */if(model instanceof MessageFromModel){
                    return HEAD_CONNECTIONFROM;
         }
         else if(model instanceof MessageToModel){
                    return HEAD_CONNECTIONTO;
         }
         return HEAD_ERROR;
         }
    
    public static String getPortModelXMLHead(ElementModel model){
        if(model instanceof PortOperationModel){
            return HEAD_PORTOPERATION;
        }
        else if(model instanceof PortGuideModel){
            return HEAD_PORTGUIDE;
        }
        return HEAD_ERROR;
    }
    
}

 

7.9 XmlHeadFactory,用来产生与模型对应的xmlhead,布布扣,bubuko.com

7.9 XmlHeadFactory,用来产生与模型对应的xmlhead

标签:style   blog   color   strong   cti   io   

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

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