Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
com.google.scrollview.ui.SVPopupMenu Class Reference

Inherits ActionListener.

List of all members.

## Public Member Functions

void | add (String parent, String name, int id)
void | add (String parent, String name, int id, String value, String desc)
void | actionPerformed (ActionEvent e)
void | show (Component Invoker, int x, int y)

## Detailed Description

The SVPopupMenu class provides the functionality to add a popup menu to ScrollView. Each popup menu item gets associated with a (client-defined) command-id, which SVPopupMenu will return upon clicking it.

Author:
  wanke.nosp@m.@goo.nosp@m.gle.c.nosp@m.om

Definition at line 34 of file SVPopupMenu.java.

## Member Function Documentation

void com.google.scrollview.ui.SVPopupMenu.actionPerformed | ( | ActionEvent | e | ) |

inline

A click on one of the items in our menubar has occured. Forward it to the item itself to let it decide what happens.

Definition at line 129 of file SVPopupMenu.java.

{
// Get the corresponding menuitem
SVAbstractMenuItem svm = items.get(e.getActionCommand());
svm.performAction(svWindow, SVEventType.SVET_POPUP);
}

void com.google.scrollview.ui.SVPopupMenu.add | ( | String | parent,
|  | String | name,
|  | int | id
| ) |  |

inline

Add a new entry to the menubar. For these items, the server will poll the client to ask what to do.

Parameters:

  parent | The menu we add our new entry to (should have been defined before). If the parent is "", we will add the entry to the root (top-level)
  name | The caption of the new entry.
  id | The Id of the new entry. If it is -1, the entry will be treated as a menu.

Definition at line 64 of file SVPopupMenu.java.

{
// A duplicate entry - we just throw it away, since its already in.
if (items.get(name) != null) { return; }
// A new submenu at the top-level
if (parent.equals("")) {
JMenu jli = new JMenu(name);
SVAbstractMenuItem mli = new SVSubMenuItem(name, jli);
items.put(name, mli);
root.add(jli);
}
// A new sub-submenu
else if (id == -1) {
SVAbstractMenuItem jmi = items.get(parent);
JMenu jli = new JMenu(name);
SVAbstractMenuItem mli = new SVSubMenuItem(name, jli);
items.put(name, mli);
jmi.add(jli);
}
// A new child entry. Add to appropriate parent.
else {
SVAbstractMenuItem jmi = items.get(parent);
if (jmi == null) {
System.out.println("ERROR: Unknown parent " + parent);
System.exit(1);
}
SVAbstractMenuItem mli = new SVEmptyMenuItem(id, name);
mli.mi.addActionListener(this);
items.put(name, mli);
jmi.add(mli);
}
}

void com.google.scrollview.ui.SVPopupMenu.add | ( | String | parent,
|  | String | name,
|  | int | id,
|  | String | value,
|  | String | desc
| ) |  |

inline

Add a new entry to the menubar. In this case, we also know its value and possibly even have a description. For these items, the server will not poll the client to ask what to do, but just show an input dialog and send a message with the new value.

Parameters:

  parent | The menu we add our new entry to (should have been defined before). If the parent is "", we will add the entry to the root (top-level)
  name | The caption of the new entry.
  id | The Id of the new entry. If it is -1, the entry will be treated as a menu.
  value | The value of the new entry.
  desc | The description of the new entry.

Definition at line 111 of file SVPopupMenu.java.

{
SVAbstractMenuItem jmi = items.get(parent);
SVMenuItem mli = new SVMenuItem(id, name, value, desc);
mli.mi.addActionListener(this);
items.put(name, mli);
if (jmi == null) { // add to root
root.add(mli.mi);
} else { // add to parent
jmi.add(mli);
}
}

void com.google.scrollview.ui.SVPopupMenu.show | ( | Component | Invoker,
|  | int | x,
|  | int | y
| ) |  |

inline

Gets called by the SVEventHandler of the window to actually show the content of the popup menu.

Definition at line 141 of file SVPopupMenu.java.

{
root.show(Invoker, x, y);
}

The documentation for this class was generated from the following file:

- /mnt/data/src/tesseract-ocr/java/com/google/scrollview/ui/SVPopupMenu.java