View Javadoc

    1   /*
    2    *  soapUI, copyright (C) 2004-2007 eviware.com
    3    *
    4    *  soapUI is free software; you can redistribute it and/or modify it under the
    5    *  terms of version 2.1 of the GNU Lesser General Public License as published by
    6    *  the Free Software Foundation.
    7    *
    8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
    9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    10   *  See the GNU Lesser General Public License for more details at gnu.org.
    11   */
    12
    13  package com.eviware.soapui.impl.wsdl.panels.support;
    14
    15  import java.beans.PropertyChangeListener;
    16  import java.beans.PropertyChangeSupport;
    17
    18  import org.apache.xmlbeans.SchemaTypeSystem;
    19
    20  import com.eviware.soapui.impl.wsdl.panels.request.components.editor.XmlDocument;
    21
    22  /***
    23   * Adapter for XmlDocument implementations/sources
    24   *
    25   * @author ole.matzura
    26   */
    27
    28  public class XmlDocumentAdapter implements XmlDocument
    29  {
    30  	private String xml;
    31  	private SchemaTypeSystem typeSystem;
    32  	private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport( this );
    33
    34  	public SchemaTypeSystem getTypeSystem()
    35  	{
    36  		return typeSystem;
    37  	}
    38
    39  	public void setTypeSystem( SchemaTypeSystem typeSystem )
    40  	{
    41  		this.typeSystem = typeSystem;
    42  	}
    43
    44  	public String getXml()
    45  	{
    46  		return xml;
    47  	}
    48
    49  	public boolean hasTypeSystem()
    50  	{
    51  		return typeSystem != null;
    52  	}
    53
    54  	public void setXml(String xml)
    55  	{
    56  		String oldXml = this.xml;
    57  		this.xml = xml;
    58
    59  		propertyChangeSupport.firePropertyChange( XML_PROPERTY, oldXml, xml );
    60  	}
    61
    62  	public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
    63  	{
    64  		propertyChangeSupport.addPropertyChangeListener( propertyName, listener );
    65  	}
    66
    67  	public void addPropertyChangeListener(PropertyChangeListener listener)
    68  	{
    69  		propertyChangeSupport.addPropertyChangeListener( listener );
    70  	}
    71
    72  	public void removePropertyChangeListener(PropertyChangeListener listener)
    73  	{
    74  		propertyChangeSupport.removePropertyChangeListener( listener );
    75  	}
    76
    77  	public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
    78  	{
    79  		propertyChangeSupport.removePropertyChangeListener( propertyName, listener );
    80  	}
    81
    82  	public void release()
    83  	{
    84  		typeSystem = null;
    85  	}
    86  }