/* $Id: GS_RWPackage.java 301 2011-08-18 15:03:36Z shayashi $ */
package smart_gs.reasoning_web.logical;

import javax.swing.JLabel;
import javax.swing.JPanel;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import reasoning_web.logical.RWPackage;
import reasoning_web.logical.inter_face.NoWayToShowException;
import smart_gs.logical.GSResource;
import smart_gs.logical.URICreator;
import smart_gs.reasoning_web.URIBearer;
import smart_gs.reasoning_web.logical.GS_RWElement;

public class GS_RWPackage extends RWPackage implements GS_RWElement{
	
	public GS_RWPackage(String uri, String originalURI, String version){
		super(uri, originalURI, version);
	}

	public GS_RWPackage() {
		super();
	}

	// TODO 表示できないものの表示を統一せよ！！
	public JPanel createElementViewPanel() throws NoWayToShowException {
		JPanel panel = new JPanel();
		panel.add(new JLabel("Package"));
		return panel;
	}
	public JPanel createElementViewPanel(int width, int height) throws NoWayToShowException {
		JPanel panel = new JPanel();
		panel.add(new JLabel("Package"));
		panel.setSize(width, height);
		return panel;
	}
	public void show() {
		
	}
/*	public String getURI() {
		return "SMART://package/"+this.name;
	}
*/
	public Element createXMLElement(Document document) {
		Element element = document.createElement("package");
		element.setAttribute("name",this.name);
		element.setAttribute("source",this.source);
		element.setAttribute("uri", this.uri);
		element.setAttribute(GSResource.ORIGINAL_URI, this.originalURI);
		element.setAttribute(GSResource.OLD_VERSION_URI, this.getOldVersionURI());
		element.setAttribute(GSResource.VERSION, this.version);		
		for(int i=0;i<this.elements.size();i++){
			Element elem = ((GS_RWElement)this.elements.get(i)).createXMLElement(document);
			element.appendChild(elem);
		}
		return element;
	}
	@Override
	public String getTypeString() {
		return URICreator.GS_RWPACKAGE;
	}
}
