]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_2_1-src/src/com/ibm/richtext/uiimpl/KeymapMenuItemSet.java
go
[Dictionary.git] / jars / icu4j-4_2_1-src / src / com / ibm / richtext / uiimpl / KeymapMenuItemSet.java
1 /*\r
2  * (C) Copyright IBM Corp. 1998-2004.  All Rights Reserved.\r
3  *\r
4  * The program is provided "as is" without any warranty express or\r
5  * implied, including the warranty of non-infringement and the implied\r
6  * warranties of merchantibility and fitness for a particular purpose.\r
7  * IBM will not be liable for any damages suffered by you as a result\r
8  * of using the Program. In no event will IBM be liable for any\r
9  * special, indirect or consequential damages or lost profits even if\r
10  * IBM has been advised of the possibility of their occurrence. IBM\r
11  * will not be liable for any third party claims against you.\r
12  */\r
13 package com.ibm.richtext.uiimpl;\r
14 \r
15 import com.ibm.richtext.textpanel.KeyRemap;\r
16 import com.ibm.richtext.textpanel.TextPanelEvent;\r
17 import com.ibm.richtext.textpanel.MTextPanel;\r
18 import com.ibm.richtext.uiimpl.resources.MenuData;\r
19 \r
20 public final class KeymapMenuItemSet extends ChoiceMenuItemSet {\r
21 \r
22     static final String COPYRIGHT =\r
23                 "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved";\r
24     public KeymapMenuItemSet(KeyRemap[] values,\r
25                              MenuData[] menuData) {\r
26         \r
27         super(values, menuData);\r
28     }\r
29     \r
30     protected void handleValueSelected(Object value) {\r
31         \r
32         MTextPanel textPanel = getTextPanel();\r
33         if (textPanel == null) {\r
34             throw new Error("Menu item is enabled when panel is null!");\r
35         }\r
36 \r
37         textPanel.setKeyRemap((KeyRemap) value);\r
38     }\r
39     \r
40     protected Object getCurrentValue() {\r
41         \r
42         MTextPanel textPanel = getTextPanel();\r
43         if (textPanel == null) {\r
44             throw new Error("Shouldn't call this without a text panel!");\r
45         }\r
46         return textPanel.getKeyRemap();\r
47     }\r
48     \r
49     public void textEventOccurred(TextPanelEvent event) {\r
50         \r
51         setChecked();\r
52     }\r
53     \r
54     public boolean respondsToEventType(int type) {\r
55         \r
56         return type == TextPanelEvent.KEYREMAP_CHANGED;\r
57     }\r
58 \r
59 }\r