|
org.eclipse.rse.ui.widgets
Class SystemHistoryCombo
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.rse.ui.widgets.SystemHistoryCombo
-
All Implemented Interfaces:
-
EventListener,
ISystemCombo,
KeyListener,
TraverseListener,
Drawable,
org.eclipse.swt.internal.SWTEventListener
-
public class SystemHistoryCombo
- extends
Composite
- implements
ISystemCombo,
TraverseListener,
KeyListener
This re-usable widget is for a combox box that persists its history and
allows the user to manipulate that history.
The composite is layed as follows:
______________v...
-
See Also:
-
updateHistory()
Fields inherited from class org.eclipse.swt.widgets.
Widget
|
handle
|
Methods inherited from class org.eclipse.swt.widgets.
Composite
|
changed,
checkSubclass,
computeSize,
getBackgroundMode,
getChildren,
getClientArea,
getLayout,
getLayoutDeferred,
getTabList,
isLayoutDeferred,
layout,
layout,
layout,
layout,
setBackgroundMode,
setLayout,
setLayoutDeferred,
setTabList
|
Methods inherited from class org.eclipse.swt.widgets.
Control
|
addControlListener,
addDragDetectListener,
addFocusListener,
addHelpListener,
addKeyListener,
addMenuDetectListener,
addMouseListener,
addMouseMoveListener,
addMouseTrackListener,
addMouseWheelListener,
addPaintListener,
addTraverseListener,
computeSize,
dragDetect,
dragDetect,
forceFocus,
getAccessible,
getBackground,
getBackgroundImage,
getBounds,
getCursor,
getData,
getDragDetect,
getEnabled,
getFont,
getForeground,
getLayoutData,
getLocation,
getMenu,
getMonitor,
getParent,
getRegion,
getShell,
getSize,
getToolTipText,
getVisible,
internal_dispose_GC,
internal_new_GC,
isEnabled,
isFocusControl,
isReparentable,
isVisible,
moveAbove,
moveBelow,
pack,
pack,
print,
redraw,
redraw,
removeControlListener,
removeDragDetectListener,
removeFocusListener,
removeHelpListener,
removeKeyListener,
removeMenuDetectListener,
removeMouseListener,
removeMouseMoveListener,
removeMouseTrackListener,
removeMouseWheelListener,
removePaintListener,
removeTraverseListener,
setBackground,
setBackgroundImage,
setBounds,
setBounds,
setCapture,
setCursor,
setDragDetect,
setFont,
setForeground,
setLayoutData,
setLocation,
setLocation,
setMenu,
setParent,
setRedraw,
setRegion,
setSize,
setSize,
setVisible,
toControl,
toControl,
toDisplay,
toDisplay,
traverse,
update
|
Methods inherited from class org.eclipse.swt.widgets.
Widget
|
addDisposeListener,
addListener,
checkWidget,
dispose,
getData,
getDisplay,
getListeners,
getStyle,
isDisposed,
isListening,
notifyListeners,
removeDisposeListener,
removeListener,
removeListener,
setData,
setData,
toString
|
SystemHistoryCombo
public SystemHistoryCombo(
Composite parent,
int style,
String key,
boolean readonly)
- Constructor for SystemHistoryCombo
-
Parameters:
-
parent - The owning composite -
style - The swt style to apply to the overall composite. Typically it is just SWT.NULL -
key - The unique string used as a preferences key to persist the history for this widget -
readonly - Set to true for a readonly combo vs user-editable combo box
SystemHistoryCombo
public SystemHistoryCombo(
Composite parent,
int style,
String key,
int maxComboEntries,
boolean readonly)
- Constructor for SystemHistoryCombo
-
Parameters:
-
parent - The owning composite -
style - The swt style to apply to the overall composite. Typically it is just SWT.NULL -
key - The unique string used as a preferences key to persist the history for this widget -
maxComboEntries - The number of history entries to show in the combo box. This only restricts the
combo box not the full history list -
readonly - Set to true for a readonly combo vs user-editable combo box
getCombo
public
Combo getCombo()
- Return the combo box widget
-
-
Specified by:
-
getCombo
in interface
ISystemCombo
-
setWidthHint
public void setWidthHint(int widthHint)
- Set the width hint for the combo box widget (in pixels).
Default is only 100, so you may want to set it.
A rule of thumb is 10 pixels per character, but allow 15 for the litte button on the right.
You must call this versus setting it yourself, else you may see truncation.
-
-
Specified by:
-
setWidthHint
in interface
ISystemCombo
-
setAutoUpperCase
public void setAutoUpperCase(boolean enable)
- Set auto-uppercase. When enabled, all non-quoted values are uppercases when added to the history.
-
-
Specified by:
-
setAutoUpperCase
in interface
ISystemCombo
-
getHistoryButton
public
Button getHistoryButton()
- Return the history button widget
-
-
setText
public void setText(
String text)
- Set the combo field's current contents
-
-
getText
public
String getText()
- Query the history combo field's current contents
-
-
Specified by:
-
getText
in interface
ISystemCombo
-
setEnabled
public void setEnabled(boolean enabled)
- Disable/Enable all the child controls.
-
-
Specified by:
-
setEnabled
in interface
ISystemCombo
-
Overrides:
-
setEnabled
in class
Control
-
setToolTipText
public void setToolTipText(
String tip)
- Set the tooltip text for the combo field
-
-
Specified by:
-
setToolTipText
in interface
ISystemCombo
-
Overrides:
-
setToolTipText
in class
Control
-
setHistoryButtonToolTipText
public void setHistoryButtonToolTipText(
String tip)
- Set the tooltip text for the history button
-
-
setButtonToolTipText
public void setButtonToolTipText(
String tip)
- Same as #setHistoryButtonToolTipText(String)
-
-
Specified by:
-
setButtonToolTipText
in interface
ISystemCombo
-
setTextLimit
public void setTextLimit(int limit)
- Set the combo field's text limit
-
-
setFocus
public boolean setFocus()
- Set the focus to the combo field
-
-
Specified by:
-
setFocus
in interface
ISystemCombo
-
Overrides:
-
setFocus
in class
Composite
-
setItems
public void setItems(
String[] items)
- Set the items in the combo field
-
-
setDefaultHistory
public void setDefaultHistory(
String[] items)
- Set the items to default the history to, IF the history
is currently empty.
-
-
setHistoryKey
public void setHistoryKey(
String key)
- Reset the history key. This changes the contents!
You should re-call setDefaultHistory() as well after this, if you had called it before
-
-
getItems
public
String[] getItems()
- Get the items in the combo field
-
-
select
public void select(int selIdx)
- Select the combo dropdown list entry at the given index
-
-
Specified by:
-
select
in interface
ISystemCombo
-
select
public int select(
String itemText)
- Select the given text. This finds the given string in the list,
determines its zero-based offset, and calls select for that index.
If the item is not found it does nothing.
Returns the index number of the found string, or -1 if not found.
-
-
setSelectionIndex
public void setSelectionIndex(int selIdx)
- Same as
select(int)
-
-
Specified by:
-
setSelectionIndex
in interface
ISystemCombo
-
clearSelection
public void clearSelection()
- Clear the selection of the text in the entry field part of the combo.
Also deselects the list part.
-
-
Specified by:
-
clearSelection
in interface
ISystemCombo
-
clearTextSelection
public void clearTextSelection()
- Clear the selection of the text in the entry field part of the combo.
Does not deselect the list part.
-
-
Specified by:
-
clearTextSelection
in interface
ISystemCombo
-
getSelectionIndex
public int getSelectionIndex()
- Get the index number of the currently selected item. Only really
reliable in readonly mode.
-
-
Specified by:
-
getSelectionIndex
in interface
ISystemCombo
-
addSelectionListener
public void addSelectionListener(
SelectionListener listener)
- Register a listener interested in an item is selected in the combo box
-
-
Specified by:
-
addSelectionListener
in interface
ISystemCombo
-
-
See Also:
-
removeSelectionListener(SelectionListener)
removeSelectionListener
public void removeSelectionListener(
SelectionListener listener)
- Remove a previously set combo box selection listener.
-
-
Specified by:
-
removeSelectionListener
in interface
ISystemCombo
-
-
See Also:
-
addSelectionListener(SelectionListener)
addModifyListener
public void addModifyListener(
ModifyListener listener)
- Register a listener interested in entry field modify events
-
-
-
See Also:
-
removeModifyListener(ModifyListener)
removeModifyListener
public void removeModifyListener(
ModifyListener listener)
- Remove a previously set entry field listener.
-
-
-
See Also:
-
addModifyListener(ModifyListener)
getHistory
public
String[] getHistory()
- Return the current history for the directory combo box
-
-
updateHistory
public void updateHistory()
- Update the history with current entry field setting, but don't refresh contents.
This is called automatically for you when setText is called. However, for non-readonly
versions, you should still call this yourself when OK is successfully pressed on the
dialog box.
-
-
updateHistory
public void updateHistory(boolean refresh)
- Update the history with current entry field setting, and optionally refresh the list from the new history
This is called automatically for you when setText is called. However, for non-readonly
versions, you should still call this yourself when OK is successfully pressed on the
dialog box.
-
-
setHistory
public void setHistory(
String[] newHistory)
- Set the history to the given array of strings. Replaces what is there.
-
-
prepareComposite
protected
Composite prepareComposite(int numColumns)
- Prepares this composite control and sets the default layout data.
-
-
-
Parameters:
-
numColumns - Number of columns the new group will contain.
createCombo
public static
Combo createCombo(
Composite parent,
boolean readonly)
- Creates a new combobox instance and sets the default
layout data.
Does NOT set the widthHint as that causes problems. Instead the combo will
consume what space is available within this composite.
-
-
-
Parameters:
-
parent - composite to put the button into.
addOurButtonSelectionListener
protected void addOurButtonSelectionListener()
-
-
historyButtonPressed
protected void historyButtonPressed()
-
-
createHistoryButton
protected
Button createHistoryButton()
-
-
setHistoryButtonHeight
public void setHistoryButtonHeight(int height)
-
-
keyTraversed
public void keyTraversed(
TraverseEvent e)
-
-
Specified by:
-
keyTraversed
in interface
TraverseListener
-
keyPressed
public void keyPressed(
KeyEvent e)
-
-
Specified by:
-
keyPressed
in interface
KeyListener
-
keyReleased
public void keyReleased(
KeyEvent e)
-
-
Specified by:
-
keyReleased
in interface
KeyListener
-
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.
|
|