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.PointcomputeSize(org.eclipse.swt.graphics.GC gc, boolean flushCache)Computes item size.TgetData()Returns item data.intgetImageLocation()Returns image location relatively to text.ILightControlgetParent()Returns parent control.StringgetText()Returns item text.intgetTextLocation()Returns text location.abstract voidhandleEvent(org.eclipse.swt.widgets.Event event)Processes swt event.booleanisCalculateSubText()Returnstrueif sub text calculation enabled.booleanisSelected()Returnstrueif item is selected.voidpaint(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle)Paints item using given gc in given rectangle.voidsetCalculateSubText(boolean calculateSubText)Sets if sub text should be calculated or not.protected voidsetHot(boolean isHot)Sets item hot state.voidsetImageLocation(int imageLocation)Sets image location relatively to text.voidsetSelected(boolean isSelected)Sets if item is selected.voidsetText(org.eclipse.jface.viewers.StyledString text)Sets item text.voidsetTextLocation(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- -trueif item is selected.
-
isSelected
public boolean isSelected()
Returnstrueif item is selected.- Returns:
trueif 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- -trueif 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- -trueif sub text should be calculated.
-
isCalculateSubText
public boolean isCalculateSubText()
Returnstrueif sub text calculation enabled.- Returns:
trueif sub text calculation enabled.
-
setHot
protected void setHot(boolean isHot)
Sets item hot state.- Parameters:
isHot- -trueif hot.
-
-