Class ValueChooser
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
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
- Direct Known Subclasses:
ValueComboChooser
public class ValueChooser
extends org.eclipse.swt.widgets.Composite
1C-specific composite widget for displaying/editing the value of the text
field in property/scheme editor(s) as well as providing controls for
changing the value of the field via actions associated with this field.
The widget consists of two major areas:
- Content area which shows selected value and optional graphical decoration (image)
- And control area holding a set of content management action buttons (like selection from list, cleaning of the current field value, etc
-
Field Summary
Fields inherited from class org.eclipse.swt.widgets.Control
handle -
Constructor Summary
ConstructorsConstructorDescriptionValueChooser(org.eclipse.swt.widgets.Composite parent, org.eclipse.ui.forms.widgets.FormToolkit toolkit, int maxDecorationWidth, int style) Constructs new instance of the widget using parent and style as input arguments. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddActionBarListener(IActionBarListener listener) Adds action bar listener to the embedded action bar.Adds a button to the contained action bar.voidaddDisposeListener(org.eclipse.swt.events.DisposeListener listener) Adds dispose listener to the control.voidaddFocusListener(org.eclipse.swt.events.FocusListener listener) voidaddListener(int eventType, org.eclipse.swt.widgets.Listener listener) Adds a listener to the text field in case of keyUp or keyDown eventvoidaddModifyListener(org.eclipse.swt.events.ModifyListener listener) Adds modification listener to the control.addSpinner(String name, int style) voidaddTraverseListener(org.eclipse.swt.events.TraverseListener listener) Adds traverse listener to the controlvoidaddVerifyListener(org.eclipse.swt.events.VerifyListener listener) Adds verification listener to the control.voidClears selection from the text in the content area.voiddispose()org.eclipse.swt.graphics.ImagegetImage()Gets decorating image for the content area of the control.org.eclipse.swt.graphics.PointReturns the selection.intGets the number of selected characters.org.eclipse.swt.custom.StyledTextGet current styled textgetText()Gets the text entered into the text field.booleanChecks if the control is in editable state.voidremoveActionBarListener(IActionBarListener listener) Removes action bar listener from the embedded action bar.voidremoveModifyListener(org.eclipse.swt.events.ModifyListener modifyListener) voidremoveVerifyListener(org.eclipse.swt.events.VerifyListener listener) Removes verification listener from the control.voidSelects the whole text within the text control of the widget.voidsetEditable(boolean editable) Sets/resets the read-only mode for the text control.voidsetImage(org.eclipse.swt.graphics.Image image) Sets decorating image for the content area of the control/voidsetMultiLine(boolean multiLine) Sets the multiline mode for the value chooser.voidsetSelection(int start) Sets selection to the text with given offsets.voidsetSelection(int start, int end) Sets selection to the text with given offsets.voidSets the text to the text field.voidsetVisibleLineCount(int count) Sets visible line count, activates multiline mode.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, toStringMethods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBarMethods 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, updateMethods inherited from class org.eclipse.swt.widgets.Widget
checkWidget, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setDataMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
Constructor Details
-
ValueChooser
public ValueChooser(org.eclipse.swt.widgets.Composite parent, org.eclipse.ui.forms.widgets.FormToolkit toolkit, int maxDecorationWidth, int style) Constructs new instance of the widget using parent and style as input arguments.- Parameters:
parent- Parent container.toolkit- Form toolkit reference.maxDecorationWidth- Maximum width allowed for the control decoration.style- The style flag set.
-
-
Method Details
-
getActionBarItems
- Returns:
- array of action items of the action bar associated with this value chooser.
Never
null.
-
addActionBarListener
Adds action bar listener to the embedded action bar.- Parameters:
listener- Listener to add.
-
addButton
public IActionBarItem addButton(String name, org.eclipse.swt.graphics.Image image, String toolTip, int style) Adds a button to the contained action bar.- Parameters:
name- Name of the button.image- Image being shown on the button.toolTip- Button tooltip which is shown when hovering over the button/.stele- Style modifer of the buttong being added.- Returns:
- The action bar button instance for further configuration.
-
addDisposeListener
public void addDisposeListener(org.eclipse.swt.events.DisposeListener listener) Adds dispose listener to the control.- Overrides:
addDisposeListenerin classorg.eclipse.swt.widgets.Widget- Parameters:
listener- The listener to add.
-
addFocusListener
public void addFocusListener(org.eclipse.swt.events.FocusListener listener) - Overrides:
addFocusListenerin classorg.eclipse.swt.widgets.Control
-
addListener
public void addListener(int eventType, org.eclipse.swt.widgets.Listener listener) Adds a listener to the text field in case of keyUp or keyDown event- Overrides:
addListenerin classorg.eclipse.swt.widgets.Widget- Parameters:
eventType- Type of the eventlistener- Listener to add
-
addModifyListener
public void addModifyListener(org.eclipse.swt.events.ModifyListener listener) Adds modification listener to the control.- Parameters:
listener- The listener to add.
-
addSpinner
-
addTraverseListener
public void addTraverseListener(org.eclipse.swt.events.TraverseListener listener) Adds traverse listener to the control- Overrides:
addTraverseListenerin classorg.eclipse.swt.widgets.Control- Parameters:
listner- Ther listener to add.
-
addVerifyListener
public void addVerifyListener(org.eclipse.swt.events.VerifyListener listener) Adds verification listener to the control.- Parameters:
listener- The listener to add.
-
clearSelection
public void clearSelection()Clears selection from the text in the content area. -
getImage
public org.eclipse.swt.graphics.Image getImage()Gets decorating image for the content area of the control.- Returns:
- The image (if any) decorating content area.
-
getSelection
public org.eclipse.swt.graphics.Point getSelection()Returns the selection. Text selections are specified in terms of caret positions. In a text widget that contains N characters, there are N+1 caret positions, ranging from 0..N- Returns:
- start and end of the selection, x is the offset of the first selected character, y is the offset after the last selected character. The selection values returned are visual (i.e., x will always always be <= y). To determine if a selection is right-to-left (RtoL) vs. left-to-right (LtoR), compare the caretOffset to the start and end of the selection (e.g., caretOffset == start of selection implies that the selection is RtoL).
-
getSelectionCount
public int getSelectionCount()Gets the number of selected characters.- Returns:
- the number of selected characters.
-
getStyledText
public org.eclipse.swt.custom.StyledText getStyledText()Get current styled text- Returns:
- Styled Text
-
getText
Gets the text entered into the text field.- Returns:
- The text contained in the text field.
-
isEditable
public boolean isEditable()Checks if the control is in editable state.- Returns:
- True if control is editable; false otherwise.
-
removeActionBarListener
Removes action bar listener from the embedded action bar.- Parameters:
listener- Listener to remove.
-
removeModifyListener
public void removeModifyListener(org.eclipse.swt.events.ModifyListener modifyListener) -
removeVerifyListener
public void removeVerifyListener(org.eclipse.swt.events.VerifyListener listener) Removes verification listener from the control.- Parameters:
listener- The listener to remove.
-
selectAll
public void selectAll()Selects the whole text within the text control of the widget. -
setEditable
public void setEditable(boolean editable) Sets/resets the read-only mode for the text control.- Parameters:
readOnly- The editable flag.
-
setImage
public void setImage(org.eclipse.swt.graphics.Image image) Sets decorating image for the content area of the control/- Parameters:
image- Image to set.
-
setMultiLine
public void setMultiLine(boolean multiLine) Sets the multiline mode for the value chooser.- Parameters:
multiline- True if the chooser should be a multiline one; false otherwise.
-
setVisibleLineCount
public void setVisibleLineCount(int count) Sets visible line count, activates multiline mode.- Parameters:
count- number of visible lines.
-
setSelection
public void setSelection(int start) Sets selection to the text with given offsets. Index is zero-based. -
setSelection
public void setSelection(int start, int end) Sets selection to the text with given offsets. Index is zero-based.- Parameters:
start- Start index of the selection.end- End index of the seletion.
-
setText
Sets the text to the text field.- Parameters:
text- The text to set.
-
dispose
public void dispose()- Overrides:
disposein classorg.eclipse.swt.widgets.Widget
-