📄 jfoperationmodifyproperty.java
字号:
/**
* $Id:JFOperationModifyProperty.java $
*
* Copyright 2004 ~ 2005 JingFei International Cooperation LTD. All rights reserved. *
*/
package com.jfimagine.jfgraph.shape.action;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Comparator;
import java.util.Collections;
import com.jfimagine.jfgraph.geom.JFPoint;
import com.jfimagine.jfgraph.shape.base.AbstractObject;
import com.jfimagine.jfgraph.shape.base.AbstractShape;
import com.jfimagine.jfgraph.shape.base.ObjectList;
import com.jfimagine.jfgraph.shape.union.JFPage;
import com.jfimagine.jfgraph.shape.union.JFLayer;
/**
* Class JFOperationModifyProperty is used to record a modify properties operation.
*/
public class JFOperationModifyProperty extends JFOperation{
/** object id of the object to be changed text.
*/
private int m_objectId =0;
/** old properties of this object */
private ObjectList m_oldProperties =null;
/** new properties of this object */
private ObjectList m_newProperties =null;
/**
* Constructor.
* @param page A page that used to do opeation.
* @param obj An object that to be changed text.
* @param oldProperties Last properties assigned.
* @param newProperties New properties assigned.
*/
public JFOperationModifyProperty(JFPage page,AbstractObject obj,ObjectList oldProperties,ObjectList newProperties){
m_page =page;
setActionId(JFOperation.OPER_MODIFY_PROPERTIES);
if (obj==null) return;
AbstractShape aShape =(AbstractShape)obj;
m_objectId =aShape.getObjectId();
try{
m_oldProperties =(ObjectList)oldProperties.clone();
m_newProperties =(ObjectList)newProperties.clone();
}catch(Exception e){
}
}
/** undo this operation
* @return new objects selected
*/
public List undo(){
List ret =new ArrayList();
AbstractObject obj=getObject(m_objectId,false);
if (obj!=null){
try{
AbstractShape aShape =(AbstractShape)obj;
ObjectList oldProperties=(ObjectList)m_oldProperties.clone();
aShape.getPropertyList().setList(new ArrayList(oldProperties.getList()));
ret.add(obj);
}catch(Exception e){
}
}
return ret;
}
/** redo this operation
* @return new objects selected
*/
public List redo(){
List ret =new ArrayList();
AbstractObject obj=getObject(m_objectId,false);
if (obj!=null){
try{
AbstractShape aShape =(AbstractShape)obj;
ObjectList newProperties=(ObjectList)m_newProperties.clone();
aShape.getPropertyList().setList(new ArrayList(newProperties.getList()));
ret.add(obj);
}catch(Exception e){
}
}
return ret;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -