Back to index

moin  1.9.0~rc2
ChangeAttributeCommand.java
Go to the documentation of this file.
00001 /*
00002  * @(#)ChangeAttributeCommand.java 5.1
00003  *
00004  */
00005 
00006 package CH.ifa.draw.standard;
00007 
00008 import java.awt.Color;
00009 import CH.ifa.draw.framework.*;
00010 import CH.ifa.draw.util.*;
00011 
00015 public  class ChangeAttributeCommand
00016         extends Command {
00017 
00018     private DrawingView fView;
00019     private String      fAttribute;
00020     private Object      fValue;
00021 
00029     public ChangeAttributeCommand(String name, String attributeName,
00030                            Object value, DrawingView view) {
00031         super(name);
00032         fAttribute = attributeName;
00033         fValue = value;
00034         fView = view;
00035     }
00036 
00037     public void execute() {
00038         FigureEnumeration k = fView.selectionElements();
00039         while (k.hasMoreElements()) {
00040             Figure f = k.nextFigure();
00041             f.setAttribute(fAttribute, fValue);
00042         }
00043         fView.checkDamage();
00044     }
00045 
00046     public boolean isExecutable() {
00047         return fView.selectionCount() > 0;
00048     }
00049 
00050 }
00051 
00052