⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 changesupport.java

📁 Owing to the applet Gantt chart source yard, already Chinese melt, Gantt chart can demonstrate a Chi
💻 JAVA
字号:
/** *   ListenerSupport.java *   Copyright 2005 Carlos Silva A. *  *   Licensed under the Apache License, Version 2.0 (the "License"); *   you may not use this file except in compliance with the License.  *   You may obtain a copy of the License at   *  *   http://www.apache.org/licenses/LICENSE-2.0 *  *   Unless required by applicable law or agreed to in writing, software *   distributed under the License is distributed on an "AS IS" BASIS, *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *   See the License for the specific language governing permissions and *   limitations under the License. *  */package jgantt.model;import java.util.Enumeration;import java.util.Vector;/** * ListenerSupport, permite Agregar o remover listener a una lista de suscritos. * Ademas, permite definir bloques de cambios que deben despacharse  * todos juntos al final del bloque. * <p>El ultimo mensaje del bloque se envia con la marca:<code>isLast</code>.</p> *  * <p>$Date: 2004/04/25 03:00:08 $</p>  * @version $Revision: 1.2 $ * @author Carlos Silva */abstract public class ChangeSupport {	Vector listeners = new Vector();	boolean dispatchChanges = true;	Vector eventQueue = new Vector();	//	metodos publicos	/**	 * Agrega un escuchador	 * @param o listener	 */	public void addListener(Object o) {		if (!listeners.contains(o))			listeners.addElement(o);	}	/**	 * Elimina un escuchador	 * @param o listener	 */	public void removeListener(Object o) {		listeners.remove(o);	}		/**	 * No envia las notificaciones automaticamente.	 *	 */	public void beginBlockChanges() {		dispatchChanges = false;	}	/**	 * Envia todos los mensajes pendientes.	 *	 */	public void commitBlockChanges() {		dispatchChanges = true;		while (!eventQueue.isEmpty()) {			Change c = (Change) eventQueue.remove(0);			if (eventQueue.isEmpty())				c.setNotLast();			notifyChange(c);					}	}	public void sendChange(Change c) {		if (dispatchChanges) {			notifyChange(c);		} else			eventQueue.add(c);	}	// funciones protegidas 	protected void notifyChange(Change c) {		for (Enumeration e = listeners.elements(); e.hasMoreElements();) {			Object l = e.nextElement();			notifyListener(l, c);		}	}	/**	 * 	 * @param listener Objeto a notificar	 * @param change Cambio que ha sido realizado	 */	abstract protected void notifyListener(Object listener, Change change);}

⌨️ 快捷键说明

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