01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
10: //The Original Code is "The Columba Project"
11: //
12: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14: //
15: //All Rights Reserved.
16: package org.columba.core.gui.action;
17:
18: import javax.swing.AbstractAction;
19:
20: import org.columba.api.gui.IAbstractColumbaAction;
21: import org.columba.api.gui.frame.IFrameMediator;
22: import org.columba.api.plugin.IExtensionInterface;
23:
24: /**
25: * AbstractColumbaAction extends the Swing Action API providing
26: * more action properties. It maintains a reference to the action's
27: * parent frame. Every action should subclass this class
28: * implementing the actionPerformed(ActionEvent) method. Action
29: * properties can be accessed using the getValue(String) and
30: * putValue(String, Object) methods, just as it is handled in
31: * Swing.
32: *
33: * @author fdietz
34: */
35:
36: public abstract class AbstractColumbaAction extends AbstractAction
37: implements IExtensionInterface, IAbstractColumbaAction {
38: /**
39: * show button text in toolbar
40: */
41: protected boolean showToolbarText = true;
42: protected IFrameMediator frameMediator;
43:
44: /**
45: *
46: * default constructor
47: *
48: * @param frameMediator frame controller
49: * @param name i18n name
50: *
51: */
52: public AbstractColumbaAction(IFrameMediator frameMediator,
53: String name) {
54: super (name);
55: this .frameMediator = frameMediator;
56: }
57:
58: /**
59: * {@inheritDoc}
60: */
61: public IFrameMediator getFrameMediator() {
62: return frameMediator;
63: }
64:
65: /**
66: * {@inheritDoc}
67: */
68: public void setFrameMediator(IFrameMediator frameController) {
69: this .frameMediator = frameController;
70: }
71:
72: /**
73: * {@inheritDoc}
74: */
75: public boolean isShowToolBarText() {
76: return showToolbarText;
77: }
78:
79: /**
80: * {@inheritDoc}
81: */
82: public void setShowToolBarText(boolean showToolbarText) {
83: if (this .showToolbarText != showToolbarText) {
84: Boolean oldValue = this .showToolbarText ? Boolean.TRUE
85: : Boolean.FALSE;
86: this .showToolbarText = showToolbarText;
87: firePropertyChange("showToolBarText", oldValue,
88: showToolbarText ? Boolean.TRUE : Boolean.FALSE);
89: }
90: }
91: }
|