Package com._1c.g5.lwt
Class AbstractLightItem<T>
- java.lang.Object
-
- com._1c.g5.lwt.AbstractLightItem<T>
-
- Type Parameters:
T
- - class of item data.
- Direct Known Subclasses:
LightListItem
public abstract class AbstractLightItem<T> extends Object
Base class for list/tree/table items. Item has text and image. Text can be empty, image can benull
.
-
-
Constructor Summary
Constructors Constructor Description AbstractLightItem(T data, ILightControl parent)
Constructor.AbstractLightItem(T data, ILightControl parent, org.eclipse.jface.viewers.StyledString styledText, org.eclipse.swt.graphics.Image image)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description org.eclipse.swt.graphics.Point
computeSize(org.eclipse.swt.graphics.GC gc, boolean flushCache)
Computes item size.T
getData()
Returns item data.int
getImageLocation()
Returns image location relatively to text.ILightControl
getParent()
Returns parent control.String
getText()
Returns item text.int
getTextLocation()
Returns text location.abstract void
handleEvent(org.eclipse.swt.widgets.Event event)
Processes swt event.boolean
isCalculateSubText()
Returnstrue
if sub text calculation enabled.boolean
isSelected()
Returnstrue
if item is selected.void
paint(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle)
Paints item using given gc in given rectangle.void
setCalculateSubText(boolean calculateSubText)
Sets if sub text should be calculated or not.protected void
setHot(boolean isHot)
Sets item hot state.void
setImageLocation(int imageLocation)
Sets image location relatively to text.void
setSelected(boolean isSelected)
Sets if item is selected.void
setText(org.eclipse.jface.viewers.StyledString text)
Sets item text.void
setTextLocation(int textLocation)
Sets text location.
-
-
-
Constructor Detail
-
AbstractLightItem
public AbstractLightItem(T data, ILightControl parent)
Constructor.- Parameters:
data
- - item data. Cannot benull
.parent
- - parent of this item. Cannot benull
.
-
AbstractLightItem
public AbstractLightItem(T data, ILightControl parent, org.eclipse.jface.viewers.StyledString styledText, org.eclipse.swt.graphics.Image image)
Constructor.- Parameters:
data
- - item data. Cannot benull
.parent
- - parent of this item. Cannot benull
.styledText
- - item text. Cannot benull
.image
- - item image. Can benull
.
-
-
Method Detail
-
setText
public void setText(org.eclipse.jface.viewers.StyledString text)
Sets item text.- Parameters:
text
- - item text. Cannot benull
.
-
getText
public String getText()
Returns item text.- Returns:
- item text. Cannot return
null
.
-
getData
public T getData()
Returns item data.- Returns:
- item data. Cannot return
null
.
-
setSelected
public void setSelected(boolean isSelected)
Sets if item is selected.- Parameters:
isSelected
- -true
if item is selected.
-
isSelected
public boolean isSelected()
Returnstrue
if item is selected.- Returns:
true
if item is selected.
-
setTextLocation
public void setTextLocation(int textLocation)
Sets text location. (Should beSWT.LEFT
|SWT.CENTER
|SWT.RIGHT
)- Parameters:
textLocation
- - text location.- See Also:
SWT.LEFT
,SWT.CENTER
,SWT.RIGHT
-
getTextLocation
public int getTextLocation()
Returns text location. (Should beSWT.LEFT
|SWT.CENTER
|SWT.RIGHT
)- Returns:
- text location.
- See Also:
SWT.LEFT
,SWT.CENTER
,SWT.RIGHT
-
setImageLocation
public void setImageLocation(int imageLocation)
Sets image location relatively to text. (Should beSWT.LEFT
|SWT.RIGHT
)- Parameters:
imageLocation
- - image location relatively to text.- See Also:
SWT.LEFT
,SWT.RIGHT
-
getImageLocation
public int getImageLocation()
Returns image location relatively to text.- Returns:
- image location relatively to text.
- See Also:
SWT.LEFT
,SWT.RIGHT
-
getParent
public ILightControl getParent()
Returns parent control.- Returns:
- parent control. Cannot return
null
.
-
handleEvent
public abstract void handleEvent(org.eclipse.swt.widgets.Event event)
Processes swt event.- Parameters:
event
- - event to process. Cannot benull
.
-
computeSize
public org.eclipse.swt.graphics.Point computeSize(org.eclipse.swt.graphics.GC gc, boolean flushCache)
Computes item size.- Parameters:
gc
- - gc to compute size. Cannot benull
.flushCache
- -true
if cache should be flushed.- Returns:
- item size. Cannot return
null
.
-
paint
public void paint(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle)
Paints item using given gc in given rectangle.- Parameters:
gc
- - gc to use for painting. Cannot benull
.rectangle
- - rectangle to paint. Cannot benull
.
-
setCalculateSubText
public void setCalculateSubText(boolean calculateSubText)
Sets if sub text should be calculated or not. Iftrue
, sub text will be calculated if item text takes more space than given in paint rectangle.- Parameters:
calculateSubText
- -true
if sub text should be calculated.
-
isCalculateSubText
public boolean isCalculateSubText()
Returnstrue
if sub text calculation enabled.- Returns:
true
if sub text calculation enabled.
-
setHot
protected void setHot(boolean isHot)
Sets item hot state.- Parameters:
isHot
- -true
if hot.
-
-