net.sourceforge.wohenchan
Class LanguageChooser

java.lang.Object
  |
  +--org.eclipse.swt.widgets.Widget
        |
        +--org.eclipse.swt.widgets.Control
              |
              +--org.eclipse.swt.widgets.Scrollable
                    |
                    +--org.eclipse.swt.widgets.Composite
                          |
                          +--net.sourceforge.wohenchan.LanguageChooser
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable

public class LanguageChooser
extends org.eclipse.swt.widgets.Composite

This is a pulldown menu allowing manual and automatic selection of language. UI proposal at http://sourceforge.net/forum/message.php?msg_id=34059

Version:
$Name: $ $Date: 2003/09/14 08:26:56 $
Author:
$Author: wtanaka $

Nested Class Summary
private  class LanguageChooser.ComboModel
           
 
Field Summary
private static java.lang.String AUTO_DETECT_CHOICE
           
private static java.lang.String AUTO_DETECT_SUFFIX
           
private  boolean m_autodetect
           
private  boolean m_autoDetectSelect
          When a call happens to setAutodetectOn(), turn this flag on.
private  org.eclipse.swt.widgets.Combo m_combo
           
private  LanguageChooser.ComboModel m_comboModel
           
private  java.lang.String[] m_contents
           
private  java.util.Hashtable m_contentsToIndex
           
private  int m_lastAutoChoice
           
private  boolean m_nexttimefireselection
           
private  java.util.Vector m_selectionListeners
           
 
Fields inherited from class org.eclipse.swt.widgets.Composite
 
Fields inherited from class org.eclipse.swt.widgets.Scrollable
 
Fields inherited from class org.eclipse.swt.widgets.Control
 
Fields inherited from class org.eclipse.swt.widgets.Widget
handle
 
Constructor Summary
LanguageChooser(org.eclipse.swt.widgets.Composite parent)
           
LanguageChooser(org.eclipse.swt.widgets.Composite parent, java.lang.String[] contents)
          Constructs this LanguageChooser with the given strings as items in the list.
 
Method Summary
 void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
           
private  void fireSelectionEvent()
           
private static java.lang.String[] getAllLanguages()
           
 java.lang.String getSelectedEncoding()
           
 LanguageInfoInterface getSelectedEncodingObject()
           
private  boolean isAutodetectOn()
           
static void main(java.lang.String[] args)
           
 void setAutodetectedChoice(int index)
          This should be called by the autodetection logic in order to set the current autodetected choice.
 void setAutodetectedChoice(java.lang.String lang)
           
private  void setAutodetectOn(boolean autodetect)
          Sets whether or not this LanguageChooser is in manual or automatic mode.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
checkSubclass, computeSize, getBorderWidth, getChildren, getLayout, getTabList, layout, layout, setFocus, setLayout, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBounds, getDisplay, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AUTO_DETECT_SUFFIX

private static final java.lang.String AUTO_DETECT_SUFFIX
See Also:
Constant Field Values

AUTO_DETECT_CHOICE

private static final java.lang.String AUTO_DETECT_CHOICE
See Also:
Constant Field Values

m_combo

private final org.eclipse.swt.widgets.Combo m_combo

m_comboModel

private final LanguageChooser.ComboModel m_comboModel

m_contents

private final java.lang.String[] m_contents

m_contentsToIndex

private final java.util.Hashtable m_contentsToIndex

m_autodetect

private boolean m_autodetect

m_lastAutoChoice

private int m_lastAutoChoice

m_autoDetectSelect

private boolean m_autoDetectSelect
When a call happens to setAutodetectOn(), turn this flag on. The next time a call happens to actionPerformed, assume that it was triggered by said previous call to setAutodetectOn(), and don't turn off autodetect.


m_nexttimefireselection

private boolean m_nexttimefireselection

m_selectionListeners

private java.util.Vector m_selectionListeners
Constructor Detail

LanguageChooser

public LanguageChooser(org.eclipse.swt.widgets.Composite parent,
                       java.lang.String[] contents)
Constructs this LanguageChooser with the given strings as items in the list.


LanguageChooser

public LanguageChooser(org.eclipse.swt.widgets.Composite parent)
Method Detail

getAllLanguages

private static java.lang.String[] getAllLanguages()

addSelectionListener

public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)

fireSelectionEvent

private void fireSelectionEvent()

setAutodetectOn

private void setAutodetectOn(boolean autodetect)
Sets whether or not this LanguageChooser is in manual or automatic mode. This method should only be called from the swing thread.


isAutodetectOn

private boolean isAutodetectOn()

setAutodetectedChoice

public void setAutodetectedChoice(int index)
This should be called by the autodetection logic in order to set the current autodetected choice. If isAutodetectOn() is false, this method does nothing. The string is matched against the strings provided in the constructor using the equals() method. Calling this method will suggest the new autodetected value for this pulldown. If isAutodetectOn(), this method will switch the selection to the given index.


setAutodetectedChoice

public void setAutodetectedChoice(java.lang.String lang)

getSelectedEncoding

public java.lang.String getSelectedEncoding()

getSelectedEncodingObject

public LanguageInfoInterface getSelectedEncodingObject()

main

public static void main(java.lang.String[] args)