Package com._1c.g5.lwt.controls
Class LightImageCombo
- java.lang.Object
-
- com._1c.g5.lwt.AbstractLightControl
-
- com._1c.g5.lwt.controls.LightImageCombo
-
- All Implemented Interfaces:
IEditable
,ILightControl
public class LightImageCombo extends AbstractLightControl implements IEditable
Special Combo with constant label. In this combo user can choose image on the left from label
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LightImageCombo.Item
Combo image item description.
-
Constructor Summary
Constructors Constructor Description LightImageCombo()
Instantiates a new light image combo.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addItem(LightImageCombo.Item item)
Appends the item to this combo.void
addItem(LightImageCombo.Item item, int index)
Adds the item to this combo.void
addSelectionIndexListener(IChangedListener<LightImageCombo,Integer> listener)
Adds the selection index listener.org.eclipse.swt.graphics.Point
computeSize(org.eclipse.swt.graphics.GC gc, int width, int height, boolean flushCache)
Computes the size of this control.void
deselectAll()
Clears the item selection.org.eclipse.swt.graphics.Color
getBackgroundColor()
Returns image combo background color.org.eclipse.swt.graphics.Color
getBorderColor()
Returns image combo border color.int
getItemCount()
Gets the item count.int
getSelectionIndex()
Gets the selection index.String
getText()
Returns image combo text.void
handleEvent(org.eclipse.swt.widgets.Event event)
Handles the SWT event, SWT events are pumped to this method if this control is active.boolean
isEditable()
Returns control editable state.boolean
isGrayed()
This image combo grayed state.void
paint(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle)
Paints the given rectangle of this control.void
removeAllItems()
Removes all items from this combo.void
removeItem(int index)
Removes the item at the specified index.void
removeSelectionIndexListener(IChangedListener<LightImageCombo,Integer> listener)
Removes the selection index listener.void
selectItem(int index)
Selects the item at the given index.void
setBackgroundColor(org.eclipse.swt.graphics.Color backgroundColor)
Sets the background color.void
setBorderColor(org.eclipse.swt.graphics.Color borderColor)
Sets the border color.void
setEditable(boolean isEditable)
Sets control editable state.boolean
setFocus(FocusSource focusSource)
Sets the focus to this control.void
setGrayed(boolean grayed)
Sets the grayed state of this image combo.void
setItem(int index, LightImageCombo.Item item)
Sets the item at the specified index.void
setItems(LightImageCombo.Item[] items)
Sets all the items.void
setText(String text)
Sets this image combo text.void
toggleDropdown(boolean visible)
Displays or hides the drop-down list.-
Methods inherited from class com._1c.g5.lwt.AbstractLightControl
addControlListener, dispose, getBounds, getCursor, getData, getLayoutData, getOverlay, getParent, getTooltip, getVisibleBounds, invalidate, invalidate, isDisposed, isEnabled, isFocused, isVisible, removeControlListener, setBounds, setCursor, setData, setEnabled, setFocusable, setLayoutData, setOverlay, setParent, setTooltip, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com._1c.g5.lwt.ILightControl
initialize
-
-
-
-
Method Detail
-
getText
public String getText()
Returns image combo text.- Returns:
- image combo text, cannot be
null
.
-
setText
public void setText(String text)
Sets this image combo text.- Parameters:
text
- the text to set.
-
isGrayed
public boolean isGrayed()
This image combo grayed state.- Returns:
true
if grayed,false
if not.
-
setGrayed
public void setGrayed(boolean grayed)
Sets the grayed state of this image combo.- Parameters:
grayed
-true
if grayed,false
if not.
-
getBorderColor
public org.eclipse.swt.graphics.Color getBorderColor()
Returns image combo border color.- Returns:
- image combo border color, can be
null
.
-
getBackgroundColor
public org.eclipse.swt.graphics.Color getBackgroundColor()
Returns image combo background color.- Returns:
- image combo background color, can be
null
.
-
setBorderColor
public void setBorderColor(org.eclipse.swt.graphics.Color borderColor)
Sets the border color.- Parameters:
borderColor
- the new border color.
-
setBackgroundColor
public void setBackgroundColor(org.eclipse.swt.graphics.Color backgroundColor)
Sets the background color.- Parameters:
backgroundColor
- the new background color.
-
computeSize
public org.eclipse.swt.graphics.Point computeSize(org.eclipse.swt.graphics.GC gc, int width, int height, boolean flushCache)
Description copied from interface:ILightControl
Computes the size of this control.- Specified by:
computeSize
in interfaceILightControl
- Overrides:
computeSize
in classAbstractLightControl
- Parameters:
gc
- the GC to do measurements with.width
- the width hint,SWT.DEFAULT
to compute the preferred width.height
- the height hint,SWT.DEFAULT
to compute the preferred height.flushCache
- the flush cache flag, instructs the associated layout to reset all its caches, if any.- Returns:
- the computed size.
-
handleEvent
public void handleEvent(org.eclipse.swt.widgets.Event event)
Description copied from interface:ILightControl
Handles the SWT event, SWT events are pumped to this method if this control is active.- Specified by:
handleEvent
in interfaceILightControl
- Overrides:
handleEvent
in classAbstractLightControl
- Parameters:
event
- the event to handle.- See Also:
ILightComposite.setActiveControl(ILightControl)
-
paint
public void paint(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle)
Description copied from interface:ILightControl
Paints the given rectangle of this control.- Specified by:
paint
in interfaceILightControl
- Parameters:
gc
- theGC
to paint on.rectangle
- the rectangle to paint.
-
setEditable
public void setEditable(boolean isEditable)
Description copied from interface:IEditable
Sets control editable state.- Specified by:
setEditable
in interfaceIEditable
- Parameters:
isEditable
- -true
if control can be edited.
-
isEditable
public boolean isEditable()
Description copied from interface:IEditable
Returns control editable state.- Specified by:
isEditable
in interfaceIEditable
- Returns:
true
if control can be edited.
-
addItem
public void addItem(LightImageCombo.Item item, int index)
Adds the item to this combo.- Parameters:
item
- the item to add, cannot benull
index
- the item index.
-
addItem
public void addItem(LightImageCombo.Item item)
Appends the item to this combo.- Parameters:
item
- the item to append, cannot benull
-
setItem
public void setItem(int index, LightImageCombo.Item item)
Sets the item at the specified index.- Parameters:
index
- the index of the item.item
- the new item, cannot benull
-
getSelectionIndex
public int getSelectionIndex()
Gets the selection index.- Returns:
- the selection index or
-1
if nothing selected.
-
getItemCount
public int getItemCount()
Gets the item count.- Returns:
- the item count.
-
setItems
public void setItems(LightImageCombo.Item[] items)
Sets all the items.- Parameters:
items
- the new items.
-
removeAllItems
public void removeAllItems()
Removes all items from this combo.
-
removeItem
public void removeItem(int index)
Removes the item at the specified index.- Parameters:
index
- the index.
-
selectItem
public void selectItem(int index)
Selects the item at the given index.- Parameters:
index
- the index of item to select.
-
deselectAll
public void deselectAll()
Clears the item selection.
-
addSelectionIndexListener
public void addSelectionIndexListener(IChangedListener<LightImageCombo,Integer> listener)
Adds the selection index listener.- Parameters:
listener
- the listener to add, cannot benull
-
removeSelectionIndexListener
public void removeSelectionIndexListener(IChangedListener<LightImageCombo,Integer> listener)
Removes the selection index listener.- Parameters:
listener
- the listener to remove, cannot benull
-
toggleDropdown
public void toggleDropdown(boolean visible)
Displays or hides the drop-down list.- Parameters:
visible
-true
to show / refresh the drop-down,false
to hide it.
-
setFocus
public boolean setFocus(FocusSource focusSource)
Description copied from interface:ILightControl
Sets the focus to this control.- Specified by:
setFocus
in interfaceILightControl
- Overrides:
setFocus
in classAbstractLightControl
- Parameters:
focusSource
- the focus request source.- Returns:
true
if focus was set,false
otherwise.
-
-