guk.editIM
Class EditIMPopups

java.lang.Object
  |
  +--guk.editIM.EditIMPopups
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class EditIMPopups
extends java.lang.Object
implements java.awt.event.ActionListener

Helper for the EditIM Input Method EditorI: displays some sub menus like file requesters and choice popups and similar stuff. Throws results as ActionEvents. Delegates tasks to other classes.


Field Summary
(package private)  ClipWindow clipper
          An instance of an helper class which will provide an utility window to use the system clipboard more easily.
(package private)  FileRequester fileReq
          An instance of an helper class which will provide the file requester (with special features for the input method editor).
(package private)  javax.swing.JFrame glyphDialog
           
(package private)  java.util.Vector glyphHistory
           
(package private)  javax.swing.JPanel glyphHistoryBar
           
(package private)  javax.swing.JComboBox glyphHistoryCombo
           
(package private)  javax.swing.JComboBox glyphModeCombo
           
(package private) static int glyphPalSize
          The history Vector for the glyph button and the dialog for that plus the combobox used for the history and a JPanel to show buttons and combo boxes which also hold the history
(package private)  HelpEditIM help
          An instance of an helper class which will provide the help and about popup windows.
(package private)  java.lang.Object[] localeButtons
          An array of things that might help to label our buttons for the locale button related choice popups
(package private)  MenuHelpers menu
          The MenuHelpers class provides functions like creating menu items and buttons.
(package private)  java.awt.Frame pframe
          A Frame to where the type to client function applies (for the current implementation, can be any Component)
 
Constructor Summary
EditIMPopups(MenuHelpers menuHelper)
          The constructor needs a MenuHelpers instance for generic settings like font, action listener and centering base.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          The main point where events are coming in.
(package private)  void assignLocaleButton(java.lang.String localeS)
          Builds a popup where the user can select a locale button slot to trigger a setlocalebuttonlocale button locale command.
(package private)  void glyphListener(java.lang.String type, char glyph)
          Postprocess glyph dialog results and create commands in proper syntax for our listener, or take action directly.
(package private)  void glyphPopup(char glyph, boolean popup)
          Popup a menu that allows to copy/add/type (to clipboard, table2 or client respectively) the current glyph or one from a glyph history.
(package private)  int queryLocaleButton(java.lang.Object[] question)
          Generic "ask to select a locale button" helper.
 void setGlyphBar(javax.swing.JPanel glyphBar)
          Hand over a panel where we can present glyph related interaction components.
 void setLocaleButtons(java.lang.Object[] buttons)
          Hand over buttons to us, to ease labelling the choice items in every locale button related popup menu.
 void setTypeTarget(java.awt.Frame pFrame)
          Select a Frame (currently, a Component would be enough) to which it sends simulated keypresses (used in the glyph menu).
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

menu

MenuHelpers menu
The MenuHelpers class provides functions like creating menu items and buttons. Initially, no action listener is set.

pframe

java.awt.Frame pframe
A Frame to where the type to client function applies (for the current implementation, can be any Component)

help

HelpEditIM help
An instance of an helper class which will provide the help and about popup windows.

fileReq

FileRequester fileReq
An instance of an helper class which will provide the file requester (with special features for the input method editor).

clipper

ClipWindow clipper
An instance of an helper class which will provide an utility window to use the system clipboard more easily.

localeButtons

java.lang.Object[] localeButtons
An array of things that might help to label our buttons for the locale button related choice popups

glyphPalSize

static final int glyphPalSize
The history Vector for the glyph button and the dialog for that plus the combobox used for the history and a JPanel to show buttons and combo boxes which also hold the history

glyphHistory

java.util.Vector glyphHistory

glyphDialog

javax.swing.JFrame glyphDialog

glyphHistoryCombo

javax.swing.JComboBox glyphHistoryCombo

glyphHistoryBar

javax.swing.JPanel glyphHistoryBar

glyphModeCombo

javax.swing.JComboBox glyphModeCombo
Constructor Detail

EditIMPopups

public EditIMPopups(MenuHelpers menuHelper)
The constructor needs a MenuHelpers instance for generic settings like font, action listener and centering base. Instantiates the other helper classes.
Parameters:
menuHelper - Provides functions like creating menu items. Should have the listener and font set.
Method Detail

glyphPopup

void glyphPopup(char glyph,
                boolean popup)
Popup a menu that allows to copy/add/type (to clipboard, table2 or client respectively) the current glyph or one from a glyph history. only pops up when popup is true, just adds glyph to history else.
Parameters:
glyph - The glyph for which the menu is to be presented and which should be added to the history / palette area. The history forgets the oldest entry when it runs out of space.
popup - Only when this is true, a menu will pop up. Otherwise, only the history / palette is updated.

glyphListener

void glyphListener(java.lang.String type,
                   char glyph)
Postprocess glyph dialog results and create commands in proper syntax for our listener, or take action directly. The jumpfield and addcharif commands are passed on, combo is ignored, cancel closes the glyph menu popup. The type to client command sends the glyph to the pFrame client in form of a KeyEvent, and the copy command tries to copy the glyph to the clipboard, which usually crashes in Java 1.3.1 Unix, so be careful.
Parameters:
type - The kind of action that should be taken, in form of a string (jumpfield, addcharif, type, copy, combo or cancel).
glyph - The character to which the command should apply, unless the type string already specifies one.

setGlyphBar

public void setGlyphBar(javax.swing.JPanel glyphBar)
Hand over a panel where we can present glyph related interaction components.
Parameters:
glyphBar - The area where an extended glyph GUI can be displayed (normally no popup) by the glyph interaction components above.

setTypeTarget

public void setTypeTarget(java.awt.Frame pFrame)
Select a Frame (currently, a Component would be enough) to which it sends simulated keypresses (used in the glyph menu).
Parameters:
pFrame - A frame to which, by means of posting KeyEvents, this object should be able to send simulated key presses. Used for the type to client function, which will be unavailable when no pFrame is set.

assignLocaleButton

void assignLocaleButton(java.lang.String localeS)
Builds a popup where the user can select a locale button slot to trigger a setlocalebuttonlocale button locale command. Triggers a selectlocalebutton button locale command, where button is the button number selected by the user (the popup shows some user friendly combo box) and locale is localeS. The actual GUI part of the work is done in queryLocaleButton.
Parameters:
localeS - The locale name to be appended to the command.

queryLocaleButton

int queryLocaleButton(java.lang.Object[] question)
Generic "ask to select a locale button" helper. Implements the GUI described at assignLocaleButton.

setLocaleButtons

public void setLocaleButtons(java.lang.Object[] buttons)
Hand over buttons to us, to ease labelling the choice items in every locale button related popup menu.
Parameters:
buttons - Some array of buttons or other objects. Their names or whatever seems to properly describe them are used to fill the choice menu that allows the user to select a button.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
The main point where events are coming in.

this is an ActionListener, so it must handle actionPerformed. All requests are coming in through this method. Each type of request should be handled by calling one or more of the private methods of this class. This is the common parser for all. Some of the methods above throw events back by using menu.tellListener().

 Accepted commands:
 glyphbutton CHAR - popup menu with history selection and
    buttons to copy or add to table2 or type to client
 glyphbuttonupdate CHAR - just update the history selection
    (which has an additional non-popup user interface in current
    versions, so the popup menu mode is no longer needed)
 glyphbarbutton CHAR - perform action as selected by glyphModeCombo
 glpyhbarcombo updated - glyphModeCombo value has changed
 GLYtype CHAR - send char as key event to our pframe
 GLYcopy CHAR - send char to clipboard
 GLYjumpfield CHAR - redirected to jumpfield CHAR (scroll to...)
 GLYaddcharif CHAR - redirected to addcharif CHAR (add to table)
   (all GLY... commands are also internally used by the glyph popup)
 loadlocale file - ask for a filename AND type to be loaded
 mergelocale file - as loadlocale file, but for merge.
 savelocale file - ask for filename AND type
 setlocalebutton locale - ask for a button number
 showwindow help - show help window (JTextArea/...)
 showwindow about - show about window and some properties
    does not need to show lots of status (hard to implement)
 clipmenu open - show window with system clipboard interface
 errormessage text - show text as an error message popup
 typeclient glyph - pretend that somebody typed the glyph
    into the window of our creator! (currently only triggered
    by glyphbutton processing and also DONE right there).
 

Specified by:
actionPerformed in interface java.awt.event.ActionListener