1 23 package info.monitorenter.gui.chart.events; 24 25 import info.monitorenter.gui.chart.IAxis; 26 import info.monitorenter.gui.chart.IRangePolicy; 27 import info.monitorenter.gui.chart.layout.LayoutFactory.PropertyChangeCheckBoxMenuItem; 28 29 import java.awt.event.ActionEvent ; 30 import java.beans.PropertyChangeEvent ; 31 32 46 public class AxisActionSetRangePolicy extends AAxisAction { 47 48 51 private static final long serialVersionUID = -3093734349885438197L; 52 53 57 private IRangePolicy m_rangePolicy; 58 59 78 public AxisActionSetRangePolicy(final IAxis axis, final String description, 79 final IRangePolicy rangePolicy) { 80 super(axis, description); 81 this.m_rangePolicy = rangePolicy; 82 axis.addPropertyChangeListener(IAxis.PROPERTY_RANGEPOLICY, this); 83 84 } 85 86 89 public void actionPerformed(final ActionEvent e) { 90 this.m_axis.setRangePolicy(this.m_rangePolicy); 91 } 92 93 96 public void propertyChange(final PropertyChangeEvent evt) { 97 String property = evt.getPropertyName(); 98 if (property.equals(IAxis.PROPERTY_RANGEPOLICY)) { 99 Class rangepolicyClass = evt.getNewValue().getClass(); 100 Boolean oldValue, newValue; 101 if (rangepolicyClass == this.m_rangePolicy.getClass()) { 102 oldValue = new Boolean (false); 103 newValue = new Boolean (true); 104 } else { 105 oldValue = new Boolean (true); 106 newValue = new Boolean (false); 107 } 108 this.firePropertyChange(PropertyChangeCheckBoxMenuItem.PROPERTY_SELECTED, oldValue, newValue); 109 } 110 } 111 } 112 | Popular Tags |