Class ValueComboChooser
- java.lang.Object
-
- org.eclipse.swt.widgets.Widget
-
- org.eclipse.swt.widgets.Control
-
- org.eclipse.swt.widgets.Scrollable
-
- org.eclipse.swt.widgets.Composite
-
- com._1c.g5.v8.dt.common.ui.controls.ValueChooser
-
- com._1c.g5.v8.dt.common.ui.controls.ValueComboChooser
-
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
public class ValueComboChooser extends ValueChooser
Extension ofValueChooser
component which includes combo-box behavior (drop-down list) along with standard ActionBar action button decorated with combo dropdown arrow.
The component allows to add other custom actions to the control expanding its capabilities.
The implementation is based on theCCombo
code base, with the list is being replaced with the native SWT table. TODO documentation with samples TODO full support of parent scrollable components - now there is some minor glitch in this.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ValueComboChooser.CommitListener
-
Field Summary
Fields Modifier and Type Field Description static String
COMBO_BUTTON_ID
Combo button identifier used to distinguish actions activated via action bar of the component.
-
Constructor Summary
Constructors Constructor Description ValueComboChooser(org.eclipse.swt.widgets.Composite parent, org.eclipse.ui.forms.widgets.FormToolkit toolkit, int maxDecorationWidth, int style)
Creates a new instance of the combo chooser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(org.eclipse.swt.graphics.Image image, String value)
Adds a new element to the combo.void
addCommitListener(ValueComboChooser.CommitListener commitListener)
void
clearSelection()
Clears selection from the text in the content area and popup.void
deselectAll()
Removes selected element from the content area.void
dropDown(boolean drop)
Drops the popup down.IActionBarItem
getArrowButton()
int
getItemCount()
Gets the number of items in the combo.int
getSelectionIndex()
Gets the index of the current selection in the control.void
remove(int index)
Removes element from the combo.void
removeAll()
Clears all elements from the combo.void
removeCommitListener(ValueComboChooser.CommitListener commitListener)
void
replace(int index, org.eclipse.swt.graphics.Image image, String value)
Replace element from the combo.void
select(int index)
Selects element of the combo.-
Methods inherited from class com._1c.g5.v8.dt.common.ui.controls.ValueChooser
addActionBarListener, addButton, addDisposeListener, addFocusListener, addListener, addModifyListener, addSpinner, addTraverseListener, addVerifyListener, dispose, getActionBarItems, getImage, getSelection, getSelectionCount, getStyledText, getText, isEditable, removeActionBarListener, removeModifyListener, removeVerifyListener, selectAll, setEditable, setImage, setMultiLine, setSelection, setSelection, setText, setVisibleLineCount
-
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
-
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
-
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
-
Methods inherited from class org.eclipse.swt.widgets.Widget
checkWidget, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
-
-
-
-
Field Detail
-
COMBO_BUTTON_ID
public static final String COMBO_BUTTON_ID
Combo button identifier used to distinguish actions activated via action bar of the component.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ValueComboChooser
public ValueComboChooser(org.eclipse.swt.widgets.Composite parent, org.eclipse.ui.forms.widgets.FormToolkit toolkit, int maxDecorationWidth, int style)
Creates a new instance of the combo chooser.- Parameters:
parent
- Parent widget for the chooser.toolkit
- Form toolkit reference.maxDecorationWidth
- Max width of the decoration in content area.style
- The styling of the widget.
-
-
Method Detail
-
addCommitListener
public void addCommitListener(ValueComboChooser.CommitListener commitListener)
-
removeCommitListener
public void removeCommitListener(ValueComboChooser.CommitListener commitListener)
-
add
public void add(org.eclipse.swt.graphics.Image image, String value)
Adds a new element to the combo.- Parameters:
image
- The decorating image to add as a part of the element (optional).value
- The text value of the item (mandatory)
-
replace
public void replace(int index, org.eclipse.swt.graphics.Image image, String value)
Replace element from the combo.- Parameters:
index
- Index of the element to replaceimage
- The decorating image a part of the element (optional).value
- The text value of the item (mandatory)
-
clearSelection
public void clearSelection()
Clears selection from the text in the content area and popup.- Overrides:
clearSelection
in classValueChooser
-
deselectAll
public void deselectAll()
Removes selected element from the content area.
-
getArrowButton
public IActionBarItem getArrowButton()
- Returns:
- arrow button associated with this value combo chooser.
-
getItemCount
public int getItemCount()
Gets the number of items in the combo.- Returns:
- The number of items.
-
getSelectionIndex
public int getSelectionIndex()
Gets the index of the current selection in the control.- Returns:
- The index of the selection.
-
remove
public void remove(int index)
Removes element from the combo.- Parameters:
index
- Index of the element to remove.
-
removeAll
public void removeAll()
Clears all elements from the combo.
-
select
public void select(int index)
Selects element of the combo.- Parameters:
index
- Index of the selection.
-
dropDown
public void dropDown(boolean drop)
Drops the popup down.- Parameters:
drop
- True if the popup should be dropped down; false if it should be collapsed.
-
-