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

📄 abstractgraphchange.java

📁 用Java开发的、实现类似Visio功能的应用程序源码
💻 JAVA
字号:
/**
 *    $Id:AbstractGraphChange.java $
 *
 *    Copyright 2004 ~ 2005  JingFei International Cooperation LTD. All rights reserved. *
 */
package com.jfimagine.jfgraph.event;

import java.util.List;
import java.util.ArrayList;

import com.jfimagine.jfgraph.geom.Rect;

import com.jfimagine.jfgraph.shape.base.ObjectList;
import com.jfimagine.jfgraph.shape.base.AbstractShape;

 /**
 * A AbstractGraphChange class is the base graph change information class.
 *
 * @author     CookieMaker    
 *
 * @version $Revision: 1.3.1 $
 */  
public abstract class AbstractGraphChange {
        
	/** graph change type. */        
	private int m_changeType	=0;

	/** changed shape list */
	private ObjectList m_objList	=new ObjectList();
	
	/** last mouse x coordinate */
	private int m_lastMouseX	=0;
	/** last mouse y coordinate */
	private int m_lastMouseY	=0;
	
	/** current mouse x coordinate */
	private int m_mouseX		=0;
	/** current mouse y coordinate */
	private int m_mouseY		=0;

	
	/** get graph change type. 
	 *  @return the graph change type.
	 */        
	public int getChangeType(){
		return m_changeType;
	}
	/** set graph change type. 
	 *  @param changeType A new graph change type.
	 */        
	public void setChangeType(int changeType){
		m_changeType	=changeType;
	}
 
	/** get last mouse x coordinate. 
	 *  @return the last mouse x coordinate.
	 */        
	public int getLastMouseX(){
		return m_lastMouseX;
	}
	/** set last mouse x coordinate. 
	 *  @param lastMouseX A new last mouse x coordinate.
	 */        
	public void setLastMouseX(int lastMouseX){
		m_lastMouseX	=lastMouseX;
	}

	/** get last mouse y coordinate. 
	 *  @return the last mouse y coordinate.
	 */        
	public int getLastMouseY(){
		return m_lastMouseY;
	}
	/** set last mouse y coordinate. 
	 *  @param lastMouseY A new last mouse y coordinate.
	 */        
	public void setLastMouseY(int lastMouseY){
		m_lastMouseY	=lastMouseY;
	} 
	/** set last mouse position coordinates. 
	 *  @param lastMouseX,lastMouseY A new last mouse position coordinates.
	 */        
	public void setLastMousePosition(int lastMouseX, int lastMouseY){
		m_lastMouseX	=lastMouseX;
		m_lastMouseY	=lastMouseY;
	} 

	/** get current mouse x coordinate. 
	 *  @return the current mouse x coordinate.
	 */        
	public int getMouseX(){
		return m_mouseX;
	}
	/** set current mouse x coordinate. 
	 *  @param mouseX A new current mouse x coordinate.
	 */        
	public void setMouseX(int mouseX){
		m_mouseX	=mouseX;
	}

	/** get current mouse y coordinate. 
	 *  @return the current mouse y coordinate.
	 */        
	public int getMouseY(){
		return m_mouseY;
	}
	/** set current mouse y coordinate. 
	 *  @param mouseY A new current mouse y coordinate.
	 */        
	public void setMouseY(int mouseY){
		m_mouseY	=mouseY;
	} 

	/** set current mouse position coordinates. 
	 *  @param mouseX,mouseY A new current mouse position coordinates.
	 */        
	public void setMousePosition(int mouseX, int mouseY){
		m_mouseX	=mouseX;
		m_mouseY	=mouseY;
	} 
	
	
	/** get the first shape in changed shape list. 
	 *  @return the first shape.
	 */        
	public AbstractShape getFirstShape(){
		try{
			if (m_objList.size()==0)
				return null;
			else
				return (AbstractShape)m_objList.getByIndex(0);
		}catch(Exception e){
			return null;
		}
	}

	/** get the changed shape list.
	 *  @return the changed shape list.
	 */        
	public ObjectList getShapeList(){
		return m_objList;
	}

	/** set the changed shape list.
	 *  @param A new changed object(An abstractShape,an objectList or list)
	 */        
	public void setShape(Object obj){
		try{
			if (obj==null)
				m_objList.clear();

			else if (obj instanceof AbstractShape)
				setShape((AbstractShape)obj);

			else if (obj instanceof ObjectList)
				setShape((ObjectList)obj);

			else if (obj instanceof List)
				setShape((List)obj);

			else
				m_objList.clear();
		}catch(Exception e){
		}
	}


	/** set the changed shape list.
	 *  @param A new changed shape(only one shape was changed).
	 */        
	public void setShape(AbstractShape shape){
		try{
			m_objList.clear();
			if (shape!=null)
				m_objList.add(shape);
		}catch(Exception e){
		}
	}


	/** set the changed shape list.
	 *  @param A new changed shape list.
	 */        
	public void setShape(ObjectList objList){
		if (objList!=null)
			setShape(objList.getList());		
		else
			setShape(new ArrayList());
	}


	/** set the changed shape list.
	 *  @param A new changed shape list.
	 */        
	public void setShape(List objList){
		try{
			if (objList!=null){
				m_objList.setList(objList);
			}else{
				m_objList.clear();
			}
		}catch(Exception e){
		}
	}

 
 	/** get the size of changed shage list.
	 *  @return the size.
	 */        
	public int getSize(){
		return m_objList.size();		
	}

 	/** get the bounds of changed shage list.
	 *  @return the bounds.
	 */        
	public Rect getBounds(){
		return m_objList.getBounds();
	}


}

⌨️ 快捷键说明

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