📄 maptag.java
字号:
/*
* License
*
* The contents of this file are subject to the Jabber Open Source License
* Version 1.0 (the "License"). You may not copy or use this file, in either
* source code or executable form, except in compliance with the License. You
* may obtain a copy of the License at http://www.jabber.com/license/ or at
* http://www.opensource.org/.
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Copyrights
*
* Portions created by or assigned to Jabber.com, Inc. are
* Copyright (c) 2000 Jabber.com, Inc. All Rights Reserved. Contact
* information for Jabber.com, Inc. is available at http://www.jabber.com/.
*
* Portions Copyright (c) 1999-2000 David Waite
*
* Acknowledgements
*
* Special thanks to the Jabber Open Source Contributors for their
* suggestions and support of Jabber.
*
* Changes
*
* @author David Waite <a href="mailto:dwaite@jabber.com">
* <i><dwaite@jabber.com></i></a>
*
* @author $Author: chris $
* @version $Revision: 1.1 $
*
* j.komzak
* Changed into MapTag
*/
package edu.ou.kmi.buddyspace.plugins.maps.xml;
/*
* MapTag.java
*
* Project: BuddySpace
* (C) Copyright Knowledge Media Institute 2002
*
*
* Created on 16 August 2002, 10:20
*/
import java.util.Vector;
import java.util.Enumeration;
import org.jabber.jabberbeans.*;
import org.jabber.jabberbeans.Extension.*;
/**
* <code>MapTag</code> contains <map> tag.
*
* @author Jiri Komzak, Knowledge Media Institute, Open University, United Kingdom
*/
public class MapTag
extends XMLData
implements MessageExtension, QueryExtension
{
/** Vector of 'Layer' objects contained */
private Vector layers;
private String id = null;
/**
* Creates a new <code>MapTag</code> instance, based on the builder
* state.
*
* @param builder an <code>MapTagBuilder</code> value
* @exception InstantiationException if malformed or insufficient data is
* in the builder.
*/
public MapTag(MapTagBuilder builder)
throws InstantiationException
{
layers = (Vector) builder.getLayers().clone();
id = builder.getID();
}
public String getID() {
return id;
}
public void setID(String id) {
this.id = id;
}
/**
* returns an enumeration of <code>layers</code> contained within this
* object.
*
* @return an <code>Enumeration</code> value
*/
public Enumeration layers()
{
return layers.elements();
}
public void addLayer(LayerTag newLayer)
{
layers.add(newLayer);
}
public void deleteLayer(LayerTag layer)
{
layers.remove(layer);
}
/**
* <code>appendItem</code> converts this packet to XML.
* It then appends it to a StringBuffer.
*
* @param retval The <code>StringBuffer</code> to append to
*/
public void appendItem(StringBuffer retval)
{
retval.append("<map id=\"" + id
+ "\" xmlns=\"http://jabber.open.ac.uk/tags/map\"");
Enumeration items = layers();
if (items==null)
{
retval.append("/>\n");
return;
}
else
retval.append(">\n");
while (items.hasMoreElements())
((LayerTag)items.nextElement()).appendItem(retval);
retval.append("</map>\n");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -