2 * iDMC the interactive Dynamical Model Calculator simulates and performs
3 * graphical and numerical analysis of systems of differential and
4 * difference equations.
6 * Copyright (C) 2004 Marji Lines and Alfredo Medio.
8 * Written by Daniele Pizzoni <auouo@tin.it>.
11 * The software program was developed within a research project financed
12 * by the Italian Ministry of Universities, the Universities of Udine and
13 * Ca'Foscari of Venice, the Friuli-Venezia Giulia Region.
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or any
20 * This program is distributed in the hope that it will be useful, but
21 * WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * General Public License for more details.
25 package org
.tsho
.dmc2
.ui
.components
;
27 import java
.beans
.PropertyChangeEvent
;
28 import java
.beans
.PropertyChangeListener
;
30 import javax
.swing
.Action
;
31 import javax
.swing
.JMenuItem
;
33 import org
.tsho
.dmc2
.ui
.AbstractPlotFrame
;
36 * This adds visibility support by actions
39 // TODO is there a way to do the same thing in a simpler way??
40 public class DmcMenuItem
extends JMenuItem
{
42 public DmcMenuItem(final DmcAction a
) {
46 protected void configurePropertiesFromAction(final Action a
) {
47 super.configurePropertiesFromAction(a
);
49 setVisible(((DmcAction
) a
).isVisible());
52 protected PropertyChangeListener
createActionPropertyChangeListener(
55 return new MyPropertyChangeListener(
56 super.createActionPropertyChangeListener(a
));
59 final class MyPropertyChangeListener
implements PropertyChangeListener
{
60 PropertyChangeListener superListener
;
61 private MyPropertyChangeListener(PropertyChangeListener l
) {
65 public void propertyChange(PropertyChangeEvent evt
) {
67 if (evt
.getPropertyName().equals(
68 DmcAction
.VISIBILITY_KEY
)) {
69 DmcMenuItem
.this.setVisible(((Boolean
) evt
.getNewValue()).booleanValue());
71 superListener
.propertyChange(evt
);