initial import
[iDMC.git] / src / java / org / tsho / dmc2 / ui / components / DmcAction.java
blob2cce58281a8dae4e90c495c7fcac074854cbd152
1 /*
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
18 * later version.
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 javax.swing.AbstractAction;
30 /**
31 * An action with a visibility property. Use with DmcMenuItem & DmcButton
33 public abstract class DmcAction extends AbstractAction {
34 public static final String VISIBILITY_KEY = "visible";
36 public DmcAction() {
37 super();
39 putValue(VISIBILITY_KEY, new Boolean(true));
42 public void setVisible(final boolean visible) {
44 Boolean oldValue = (Boolean) this.getValue(VISIBILITY_KEY);
46 if (visible == oldValue.booleanValue()) {
47 return;
50 Boolean b = new Boolean(visible);
51 putValue(VISIBILITY_KEY, b);
53 firePropertyChange(VISIBILITY_KEY, oldValue, b);
56 public boolean isVisible() {
57 return ((Boolean) getValue(VISIBILITY_KEY)).booleanValue();