1 23 package info.monitorenter.gui.chart.events; 24 25 import info.monitorenter.gui.chart.ITrace2D; 26 import info.monitorenter.gui.chart.layout.LayoutFactory.PropertyChangeCheckBoxMenuItem; 27 28 import java.awt.Stroke ; 29 import java.awt.event.ActionEvent ; 30 import java.beans.PropertyChangeEvent ; 31 32 42 public final class Trace2DActionSetStroke extends ATrace2DAction { 43 44 47 private static final long serialVersionUID = 3978986583057707570L; 48 49 52 private Stroke m_stroke; 53 54 72 public Trace2DActionSetStroke(final ITrace2D trace, final String description, final Stroke stroke) { 73 super(trace, description); 74 this.m_stroke = stroke; 75 trace.addPropertyChangeListener(ITrace2D.PROPERTY_STROKE, this); 76 } 77 78 81 public void actionPerformed(final ActionEvent e) { 82 this.m_trace.setStroke(this.m_stroke); 83 } 84 85 88 public void propertyChange(final PropertyChangeEvent evt) { 89 String property = evt.getPropertyName(); 90 if (property.equals(ITrace2D.PROPERTY_STROKE)) { 91 Stroke newValue = (Stroke ) evt.getNewValue(); 92 if (newValue.equals(this.m_stroke)) { 94 this.firePropertyChange(PropertyChangeCheckBoxMenuItem.PROPERTY_SELECTED, 95 new Boolean (false), new Boolean (true)); 96 } else { 97 this.firePropertyChange(PropertyChangeCheckBoxMenuItem.PROPERTY_SELECTED, 98 new Boolean (true), new Boolean (false)); 99 } 100 } 101 } 102 } 103 | Popular Tags |