modelelement.java

来自「一个eclipse插件源代码。用于web开发」· Java 代码 · 共 203 行

JAVA
203
字号
/*
 * $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/gefmodule/model/ModelElement.java,v 1.1.1.1 2004/07/01 09:07:48 wang_j Exp $
 * $Revision: 1.1.1.1 $
 * $Date: 2004/07/01 09:07:48 $
 *
 * ====================================================================
 *
 * The NanJing HopeRun(IT-FOREST) Software License, Version 2.0.0
 *
 * Copyright 2003-2004 by NanJing HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and
 *                        IT Forest Corporation
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
 * You shall not disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into with
 * HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
 */
package com.webpump.ui.gefmodule.model;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.*;

import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

/**
 * Class for ModelElement
 * 
 * @author shi_l
 * @version 2.0.0 2004-5-30
 */
abstract public class ModelElement implements IPropertySource, Cloneable, Serializable {

	/**children*/
	public static final String CHILDREN = "Children";

	/**inputs*/
	public static final String INPUTS = "inputs";

	/**outputs*/
	public static final String OUTPUTS = "outputs";

	/**listens*/
	transient protected PropertyChangeSupport listeners = new PropertyChangeSupport(this);

	/**serial version id*/
	static final long serialVersionUID = 1;

	/**
	 * add property change listener
	 * @param l PropertyChangeListener
	 */
	public void addPropertyChangeListener(PropertyChangeListener l) {
		listeners.addPropertyChangeListener(l);
	}

	/**
	 * fire property change
	 * @param prop String
	 * @param old Object
	 * @param newValue Object
	 */
	protected void firePropertyChange(String prop, Object old, Object newValue) {
		listeners.firePropertyChange(prop, old, newValue);
	}

	/**
	 * fire structure change
	 * @param prop String
	 * @param child Object
	 */
	protected void fireStructureChange(String prop, Object child) {
		listeners.firePropertyChange(prop, null, child);
	}

	/**
	 * get editable value
	 * @return this Object
	 */
	public Object getEditableValue() {
		return this;
	}

	/**
	 * get property descriptors
	 * return null
	 */
	public IPropertyDescriptor[] getPropertyDescriptors() {
		return new IPropertyDescriptor[0];
	}

	/**
	 * get property value
	 * @return null
	 */
	public Object getPropertyValue(Object propName) {
		return null;
	}

	/**
	 * get property value according the given name
	 * @param propName String
	 * @return null
	 */
	final Object getPropertyValue(String propName) {
		return null;
	}

	/**
	 * read object
	 * @param in ObjectInputStream
	 * @throws IOException
	 * @throws ClassNotFoundException
	 */
	private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
		in.defaultReadObject();
		listeners = new PropertyChangeSupport(this);
	}

	/**
	 * is property set
	 * @param propName Object
	 * @return is property set boolean
	 */
	public boolean isPropertySet(Object propName) {
		return isPropertySet((String) propName);
	}

	/**
	 * is property set according the given name
	 * @param propName Object
	 * @return is property set boolean
	 */
	final boolean isPropertySet(String propName) {
		return true;
	}

	/**
	 * remove property change listener
	 * @param l PropertyChangeListener
	 */
	public void removePropertyChangeListener(PropertyChangeListener l) {
		listeners.removePropertyChangeListener(l);
	}

	/**
	 * reset property value
	 * @param propName Object
	 */
	public void resetPropertyValue(Object propName) {
	}

	/**
	 * reset property value
	 * @param propName String
	 */
	final void resetPropertyValue(String propName) {
	}

	/**
	 *set property value
	 * @param propName Object
	 * 		  val Object
	 */
	public void setPropertyValue(Object propName, Object val) {
	}

	/**
	 *set property value
	 * @param propName String
	 * 		  val Object
	 */
	final void setPropertyValue(String propName, Object val) {
	}

	/**
	 * update
	 */
	public void update() {
	}

	/**
	 * get node attribute
	 * @param node
	 * @param name
	 * @return node attribute String
	 */
	protected String getNodeAttribute(Node node, String name) {
		NamedNodeMap atts = node.getAttributes();
		Node attribute = null;
		if (atts != null)
			attribute = atts.getNamedItem(name);
		if (attribute != null)
			return attribute.getNodeValue();
		return null;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?