Package org.eclipse.nebula.widgets.grid
Class GridColumn
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Item
org.eclipse.nebula.widgets.grid.GridColumn
- All Implemented Interfaces:
Adaptable
Instances of this class represent a column in a grid widget.
- Styles:
- SWT.LEFT, SWT.RIGHT, SWT.CENTER
- Events:
- Move, Resize, Selection, Show, Hide
-
Constructor Summary
ConstructorDescriptionGridColumn
(GridColumnGroup parent, int style) Constructs a new instance of this class given its parent column group (which must be aGridColumnGroup
), a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent.GridColumn
(Grid parent, int style) Constructs a new instance of this class given its parent (which must be aGrid
) and a style value describing its behavior and appearance.GridColumn
(Grid parent, int style, int index) Constructs a new instance of this class given its parent (which must be aGrid
), a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addControlListener
(ControlListener listener) Adds a listener to the list of listeners notified when the column is moved or resized.void
addSelectionListener
(SelectionListener listener) Adds the listener to the collection of listeners who will be notified when the receiver's is pushed, by sending it one of the messages defined in theSelectionListener
interface.void
dispose()
Disposes of the operating system resources associated with the receiver and all its descendents.<T> T
getAdapter
(Class<T> adapter) Implementation of theAdaptable
interface.int
Returns the column alignment.boolean
Returns the checkable state.Returns the column group if this column was created inside a group, ornull
otherwise.Returns the font that the receiver will use to paint textual information for the footer.Returns the receiver's footer image if it has one, or null if it does not.Returns the receiver's footer text, which will be an empty string if it has never been set.Returns the font that the receiver will use to paint textual information for the header.Returns the tooltip of the column header.boolean
Returns whether or not text is word-wrapped in the header for this column.int
boolean
Returns true if this column is moveable.Returns the parent grid.boolean
Returns true if the column is resizeable.int
getSort()
Returns the sort indicator value.boolean
Returns the visibility state as set withsetVisible
.int
getWidth()
Returns the width of the column.boolean
Returns the true if the cells in receiver wrap their text.boolean
isCheck()
Returns true if the column includes a check box.boolean
isDetail()
Returns true if this column is set as a detail column in a column group.boolean
Returns true if this column is set as a summary column in a column group.protected boolean
boolean
isTree()
Returns true if this column includes a tree toggle.boolean
Returns true if the column is visible, false otherwise.void
pack()
Causes the receiver to be resized to its preferred size.void
removeControlListener
(ControlListener listener) Removes the given control listener.void
removeSelectionListener
(SelectionListener listener) Removes the listener from the collection of listeners who will be notified when the receiver's selection changes.void
setAlignment
(int alignment) Sets the column alignment.void
setCheckable
(boolean checkable) Sets the checkable state.void
Sets the application defined property of the receiver with the specified name to the given value.void
setDetail
(boolean detail) Sets the column as a detail column in a column group.void
setFooterFont
(Font font) Sets the Font to be used when displaying the Footer text.void
setFooterImage
(Image image) Sets the receiver's footer image to the argument, which may be null indicating that no image should be displayed.void
setFooterText
(String text) Sets the receiver's footer text.void
setHeaderFont
(Font font) Sets the Font to be used when displaying the Header text.void
setHeaderTooltip
(String toolTipText) Sets the tooltip text of the column header.void
setHeaderWordWrap
(boolean wordWrap) Sets whether or not text is word-wrapped in the header for this column.void
Sets the receiver's image to the argument, which may be null indicating that no image should be displayed.void
setMinimumWidth
(int minimumWidth) Set the minimum width of the columnvoid
setMoveable
(boolean moveable) Sets the column moveable or fixed.void
setResizeable
(boolean resizeable) Sets the column resizeable.void
setSort
(int style) Sets the sort indicator style for the column.void
setSummary
(boolean summary) Sets the column as a summary column in a column group.protected void
setTableCheck
(boolean tableCheck) void
Sets the receiver's text.void
setTree
(boolean tree) Makes this column the one with tree toggle.void
setVisible
(boolean visible) Sets the column's visibility.void
setWidth
(int width) Sets the width of the column.void
setWordWrap
(boolean wordWrap) If the argument is true, wraps the text in the receiver's cells.Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkSubclass, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, toString
-
Constructor Details
-
GridColumn
Constructs a new instance of this class given its parent (which must be aGrid
) and a style value describing its behavior and appearance. The item is added to the end of the items maintained by its parent.- Parameters:
parent
- an Grid control which will be the parent of the new instance (cannot be null)style
- the style of control to construct- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the parent is null
SWTException
-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
-
GridColumn
Constructs a new instance of this class given its parent (which must be aGrid
), a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent.- Parameters:
parent
- an Grid control which will be the parent of the new instance (cannot be null)style
- the style of control to constructindex
- the index to store the receiver in its parent- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the parent is null
SWTException
-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
-
GridColumn
Constructs a new instance of this class given its parent column group (which must be aGridColumnGroup
), a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent.- Parameters:
parent
- an Grid control which will be the parent of the new instance (cannot be null)style
- the style of control to construct- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the parent is null
SWTException
-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
-
-
Method Details
-
dispose
public void dispose()Disposes of the operating system resources associated with the receiver and all its descendents. After this method has been invoked, the receiver and all descendents will answertrue
when sent the messageisDisposed()
. Any internal connections between the widgets in the tree will have been removed to facilitate garbage collection.NOTE: This method is not called recursively on the descendents of the receiver. This means that, widget implementers can not detect when a widget is being disposed of by re-implementing this method, but should instead listen for the
Dispose
event. -
getParent
Returns the parent grid.- Returns:
- the parent grid.
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getColumnGroup
Returns the column group if this column was created inside a group, ornull
otherwise.- Returns:
- the column group.
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
addSelectionListener
Adds the listener to the collection of listeners who will be notified when the receiver's is pushed, by sending it one of the messages defined in theSelectionListener
interface.- Parameters:
listener
- the listener which should be notified- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
removeSelectionListener
Removes the listener from the collection of listeners who will be notified when the receiver's selection changes.- Parameters:
listener
- the listener which should no longer be notified- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
-
addControlListener
Adds a listener to the list of listeners notified when the column is moved or resized.- Parameters:
listener
- listener- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
removeControlListener
Removes the given control listener.- Parameters:
listener
- listener.- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setWidth
public void setWidth(int width) Sets the width of the column.- Parameters:
width
- new width- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getWidth
public int getWidth()Returns the width of the column.- Returns:
- width of column
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setMinimumWidth
public void setMinimumWidth(int minimumWidth) Set the minimum width of the column- Parameters:
minimumWidth
- the minimum width
-
getMinimumWidth
public int getMinimumWidth()- Returns:
- the minimum width
-
setText
Description copied from class:Item
Sets the receiver's text. -
setImage
Description copied from class:Item
Sets the receiver's image to the argument, which may be null indicating that no image should be displayed. -
setSort
public void setSort(int style) Sets the sort indicator style for the column. This method does not actual sort the data in the table. Valid values include: SWT.UP, SWT.DOWN, SWT.NONE.- Parameters:
style
- SWT.UP, SWT.DOWN, SWT.NONE- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getSort
public int getSort()Returns the sort indicator value.- Returns:
- SWT.UP, SWT.DOWN, SWT.NONE
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setMoveable
public void setMoveable(boolean moveable) Sets the column moveable or fixed.- Parameters:
moveable
- true to enable column moving- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getMoveable
public boolean getMoveable()Returns true if this column is moveable.- Returns:
- true if moveable.
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setResizeable
public void setResizeable(boolean resizeable) Sets the column resizeable.- Parameters:
resizeable
- true to make the column resizeable- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getResizeable
public boolean getResizeable()Returns true if the column is resizeable.- Returns:
- true if the column is resizeable.
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setCheckable
public void setCheckable(boolean checkable) Sets the checkable state. If false the checkboxes in the column cannot be checked.- Parameters:
checkable
- the new checkable state.- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getCheckable
public boolean getCheckable()Returns the checkable state. If false the checkboxes in the column cannot be checked.- Returns:
- true if the column is checkable (only applicable when style is SWT.CHECK).
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setDetail
public void setDetail(boolean detail) Sets the column as a detail column in a column group. Detail columns are shown when a column group is expanded. If this column was not created in a column group, this method has no effect.- Parameters:
detail
- true to show this column when the group is expanded.- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
isDetail
public boolean isDetail()Returns true if this column is set as a detail column in a column group. Detail columns are shown when the group is expanded.- Returns:
- true if the column is a detail column.
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setSummary
public void setSummary(boolean summary) Sets the column as a summary column in a column group. Summary columns are shown when a column group is collapsed. If this column was not created in a column group, this method has no effect.- Parameters:
summary
- true to show this column when the group is collapsed.- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
isSummary
public boolean isSummary()Returns true if this column is set as a summary column in a column group. Summary columns are shown when the group is collapsed.- Returns:
- true if the column is a summary column.
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setVisible
public void setVisible(boolean visible) Sets the column's visibility.- Parameters:
visible
- the visible to set- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getVisible
public boolean getVisible()Returns the visibility state as set withsetVisible
.- Returns:
- the visible
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
isVisible
public boolean isVisible()Returns true if the column is visible, false otherwise. If the column is in a group and the group is not expanded and this is a detail column, returns false (and vice versa).- Returns:
- true if visible, false otherwise
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
isCheck
public boolean isCheck()Returns true if the column includes a check box.- Returns:
- true if the column includes a check box.
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setTree
public void setTree(boolean tree) Makes this column the one with tree toggle.- Parameters:
tree
- true to add toggle.- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.13
-
isTree
public boolean isTree()Returns true if this column includes a tree toggle.- Returns:
- true if the column includes the tree toggle.
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setAlignment
public void setAlignment(int alignment) Sets the column alignment.- Parameters:
alignment
- SWT.LEFT, SWT.RIGHT, SWT.CENTER- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getAlignment
public int getAlignment()Returns the column alignment.- Returns:
- SWT.LEFT, SWT.RIGHT, SWT.CENTER
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getWordWrap
public boolean getWordWrap()Returns the true if the cells in receiver wrap their text.- Returns:
- true if the cells wrap their text.
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setWordWrap
public void setWordWrap(boolean wordWrap) If the argument is true, wraps the text in the receiver's cells. This feature will not cause the row height to expand to accommodate the wrapped text. Please useGrid#setItemHeight
to change the height of each row.- Parameters:
wordWrap
- true to make cells wrap their text.- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setHeaderFont
Sets the Font to be used when displaying the Header text.- Parameters:
font
- the new header font (or null)- Throws:
IllegalArgumentException
-- ERROR_INVALID_ARGUMENT - if the argument has been disposed
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getHeaderFont
Returns the font that the receiver will use to paint textual information for the header.- Returns:
- the receiver's font
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setHeaderTooltip
Sets the tooltip text of the column header.- Parameters:
toolTipText
- the tooltip text- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getHeaderTooltip
Returns the tooltip of the column header.- Returns:
- the tooltip text (or null)
- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setHeaderWordWrap
public void setHeaderWordWrap(boolean wordWrap) Sets whether or not text is word-wrapped in the header for this column. If Grid.setAutoHeight(true) is set, the row height is adjusted to accommodate word-wrapped text.- Parameters:
wordWrap
- Set to true to wrap the text, false otherwise- See Also:
-
getHeaderWordWrap
public boolean getHeaderWordWrap()Returns whether or not text is word-wrapped in the header for this column.- Returns:
- true if the header wraps its text.
- See Also:
-
pack
public void pack()Causes the receiver to be resized to its preferred size.- Throws:
SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setData
Description copied from class:Widget
Sets the application defined property of the receiver with the specified name to the given value.Applications may associate arbitrary objects with the receiver in this fashion. If the objects stored in the properties need to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so.
-
getAdapter
Description copied from class:Widget
Implementation of theAdaptable
interface.IMPORTANT: This method is not part of the RWT public API. It is marked public only so that it can be shared within the packages provided by RWT. It should never be accessed from application code.
- Specified by:
getAdapter
in interfaceAdaptable
- Overrides:
getAdapter
in classWidget
- Parameters:
adapter
- the lookup class- Returns:
- an object that can be cast to the given class or
null
if there is no adapter associated with the given class.
-
isTableCheck
protected boolean isTableCheck() -
setTableCheck
protected void setTableCheck(boolean tableCheck)
-