comparison mupdf-source/thirdparty/tesseract/java/com/google/scrollview/ui/SVMenuItem.java @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 // Copyright 2007 Google Inc. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); You may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
6 // applicable law or agreed to in writing, software distributed under the
7 // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
8 // OF ANY KIND, either express or implied. See the License for the specific
9 // language governing permissions and limitations under the License.
10
11 package com.google.scrollview.ui;
12
13 /**
14 * A MenuListItem is any sort of menu entry. This can either be within a popup
15 * menu or within a menubar. It can either be a submenu (only name and
16 * command-id) or a name with an associated value and possibly description. They
17 * can also have new entries added (if they are submenus).
18 *
19 * @author wanke@google.com
20 */
21
22 import com.google.scrollview.events.SVEventType;
23
24 import javax.swing.JMenuItem;
25
26 /**
27 * Constructs a new menulistitem which also has a value and a description. For
28 * these, we will not have to ask the server what the value is when the user
29 * wants to change it, but can just call the client with the new value.
30 */
31 class SVMenuItem extends SVAbstractMenuItem {
32 public String value = null;
33 public String desc = null;
34
35 SVMenuItem(int id, String name, String v, String d) {
36 super(id, name, new JMenuItem(name));
37 value = v;
38 desc = d;
39 }
40
41 /**
42 * Ask the user for new input for a variable and send it.
43 * Depending on whether there is a description given for the entry, show
44 * the description in the dialog or just show the name.
45 */
46 @Override
47 public void performAction(SVWindow window, SVEventType eventType) {
48 if (desc != null) {
49 window.showInputDialog(desc, value, id, eventType);
50 } else {
51 window.showInputDialog(name, value, id, eventType);
52 }
53 }
54
55 /** Returns the actual value of the MenuListItem. */
56 @Override
57 public String getValue() {
58 return value;
59 }
60 }