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

📄 setpropertyvaluecommand.java

📁 对eclipse gef进行封装,可以生成图形化编辑器
💻 JAVA
字号:
/*******************************************************************************
 * $Header: /cvsroot/EOS6/work_dir/niegy/com.primeton.studio.gef.ui/src/com/primeton/studio/gef/ui/commands/SetPropertyValueCommand.java,v 1.3 2006/12/12 08:26:39 niegy Exp $
 * $Revision: 1.3 $
 * $Date: 2006/12/12 08:26:39 $
 *
 *==============================================================================
 *
 * Copyright (c) 2001-2006 Primeton Technologies, Ltd.
 * All rights reserved. 
 * 
 * Created on 2006-10-30
 *******************************************************************************/


package com.primeton.studio.gef.ui.commands;

import org.eclipse.gef.commands.Command;

import com.primeton.studio.gef.ui.properties.NodePropertySource;

/**
 * TODO此处填写 class 信息
 *
 * @author niegy (mailto:niegy@primeton.com)
 */
/*
 * 修改历史
 * $Log: SetPropertyValueCommand.java,v $
 * Revision 1.3  2006/12/12 08:26:39  niegy
 * 重构代码,实现一般图元的编辑框
 *
 * Revision 1.2  2006/11/22 07:07:38  niegy
 * 增加table
 *
 * Revision 1.1  2006/11/17 03:15:13  niegy
 * create
 * 
 */
public class SetPropertyValueCommand extends Command {
    private NodePropertySource propertySource;
    private Object propertyId;
    private Object oldValue;
    private Object newValue;

    public SetPropertyValueCommand(NodePropertySource propertySource, Object propertyId, Object newValue)
    {
        this.propertySource = propertySource;
        this.propertyId = propertyId;
        oldValue = propertySource.getPropertyValue(propertyId);
        this.newValue = newValue;
        setLabel("set Property Value");
    }

    public void execute()
    {
        super.execute();
        propertySource.setPropertyValueImpl(propertyId, newValue);
//        ModelChangeNotifer.getInstance().fireModelChange();
    }

    public void undo()
    {
        propertySource.getPropertyValue(propertyId);
        super.undo();
        propertySource.setPropertyValueImpl(propertyId, oldValue);
        ModelChangeNotifer.getInstance().fireModelChange();
    }

    public void redo()
    {
        super.redo();
        propertySource.setPropertyValueImpl(propertyId, newValue);
        ModelChangeNotifer.getInstance().fireModelChange();
    }
}

⌨️ 快捷键说明

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