View Javadoc

1   /*
2    * Copyright 2006-2016 The JGUIraffe Team.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License")
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.jguiraffe.gui.builder.action;
17  
18  /**
19   * <p>
20   * Definition of an interface for describing properties of an action.
21   * </p>
22   * <p>
23   * This interface is used in communication between a concrete implementation of
24   * the <code>{@link ActionManager}</code> interface and tag handler classes
25   * for defining action objects. The properties defined by this interface are
26   * supported by the generic action classes.
27   * </p>
28   * <p>
29   * The here specified properties are typical for GUI controls that represent
30   * actions, e.g. a textual description, an icon, and a tool tip text.
31   * </p>
32   *
33   * @author Oliver Heger
34   * @version $Id: ActionData.java 205 2012-01-29 18:29:57Z oheger $
35   */
36  public interface ActionData
37  {
38      /**
39       * Returns the name of the represented action.
40       *
41       * @return the action's name
42       */
43      String getName();
44  
45      /**
46       * Returns a text for this action. This is the text as displayed for the
47       * user, e.g. the name of a menu.
48       *
49       * @return the action's text
50       */
51      String getText();
52  
53      /**
54       * Returns the tool tip text for the represented action.
55       *
56       * @return the tool tip
57       */
58      String getToolTip();
59  
60      /**
61       * Returns the mnemonic for the represented action. The mnemonic is the
62       * letter in an action's text that be typed for triggering the action. For
63       * instance, if the action is represented by a menu item, the text of the
64       * item will display this character in a high-lighted way (e.g. underlined).
65       * If the parent menu is open, the user can directly type this character
66       * for selecting this menu item.
67       *
68       * @return the mnemonic
69       */
70      int getMnemonicKey();
71  
72      /**
73       * Returns the <code>Accelerator</code> associated with this action. Through
74       * an accelerator the action can be associated with a specific key
75       * combination. By typing this key combination the action will be triggered.
76       * An example for an accelerator is the well-known key combination CONTROL+C
77       * for copying the current selection into the clipboard.
78       *
79       * @return the <code>Accelerator</code> for this action; can be <b>null</b>,
80       *         then the action is not associated with an
81       *         <code>Accelerator</code>
82       */
83      Accelerator getAccelerator();
84  
85      /**
86       * Returns an icon for the represented action.
87       *
88       * @return an icon for the action
89       */
90      Object getIcon();
91  
92      /**
93       * Returns the task object for the represented action. This object will be
94       * invoked whenever the action is triggered. A task can be a <code>Runnable</code>
95       * or an <code>{@link ActionTask}</code> object.
96       *
97       * @return the task for the action
98       */
99      Object getTask();
100 }