Class GridColumnGroup


  • public class GridColumnGroup
    extends org.eclipse.swt.widgets.Item

    NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS.

    Instances of this class represent a column group in a grid widget. A column group header is displayed above grouped columns. The column group can optionally be configured to expand and collapse. A column group in the expanded state shows GridColumns whose detail property is true. A column group in the collapsed state shows GridColumns whose summary property is true.

    Styles:
    SWT.TOGGLE
    Events:
    Expand, Collapse
    • Constructor Summary

      Constructors 
      Constructor Description
      GridColumnGroup​(Grid parent, int style)
      Constructs a new instance of this class given its parent (which must be a Table) and a style value describing its behavior and appearance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addTreeListener​(org.eclipse.swt.events.TreeListener listener)
      Adds the listener to the collection of listeners who will be notified when an item in the receiver is expanded or collapsed by sending it one of the messages defined in the TreeListener interface.
      void dispose()
      int getAlignment()
      Returns the column group header alignment.
      (package private) org.eclipse.swt.graphics.Rectangle getBounds()  
      GridColumn[] getColumns()
      Returns the columns within this group.
      boolean getExpanded()
      Returns true if the receiver is expanded, false otherwise.
      (package private) GridColumn getFirstVisibleColumn()
      Returns the first visible column in this column group.
      org.eclipse.swt.graphics.Font getHeaderFont()
      Returns the font that the receiver will use to paint textual information for the header.
      GridHeaderRenderer getHeaderRenderer()  
      boolean getHeaderWordWrap()
      Returns whether or not text is word-wrapped in the header for this column group.
      (package private) GridColumn getLastVisibleColumn()
      Returns the last visible column in this column group.
      (package private) int getNewColumnIndex()  
      Grid getParent()  
      private void init​(int style)  
      (package private) void newColumn​(GridColumn column, int index)  
      (package private) void removeColumn​(GridColumn col)  
      void removeTreeListener​(org.eclipse.swt.events.TreeListener listener)
      Removes the listener from the collection of listeners who will be notified when items in the receiver are expanded or collapsed.
      void setExpanded​(boolean expanded)
      Sets the expanded state of the receiver.
      void setHeaderFont​(org.eclipse.swt.graphics.Font font)
      Sets the Font to be used when displaying the Header text.
      void setHeaderRenderer​(GridHeaderRenderer headerRenderer)
      Sets the header renderer.
      void setHeaderWordWrap​(boolean wordWrap)
      Sets whether or not text is word-wrapped in the header for this column group.
      • Methods inherited from class org.eclipse.swt.widgets.Item

        checkSubclass, getImage, getText, setImage, setText
      • Methods inherited from class org.eclipse.swt.widgets.Widget

        addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • parent

        private Grid parent
      • expanded

        private boolean expanded
      • headerFont

        private org.eclipse.swt.graphics.Font headerFont
    • Constructor Detail

      • GridColumnGroup

        public GridColumnGroup​(Grid parent,
                               int style)
        Constructs a new instance of this class given its parent (which must be a Table) and a style value describing its behavior and appearance.
        Parameters:
        parent - the parent table
        style - the style of the group
        Throws:
        java.lang.IllegalArgumentException -
        • ERROR_NULL_ARGUMENT - if the parent is null
        org.eclipse.swt.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 Detail

      • init

        private void init​(int style)
      • addTreeListener

        public void addTreeListener​(org.eclipse.swt.events.TreeListener listener)
        Adds the listener to the collection of listeners who will be notified when an item in the receiver is expanded or collapsed by sending it one of the messages defined in the TreeListener interface.
        Parameters:
        listener - the listener which should be notified
        Throws:
        java.lang.IllegalArgumentException -
        • ERROR_NULL_ARGUMENT - if the listener is null
        org.eclipse.swt.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:
        TreeListener, removeTreeListener(org.eclipse.swt.events.TreeListener)
      • removeTreeListener

        public void removeTreeListener​(org.eclipse.swt.events.TreeListener listener)
        Removes the listener from the collection of listeners who will be notified when items in the receiver are expanded or collapsed.
        Parameters:
        listener - the listener which should no longer be notified
        Throws:
        java.lang.IllegalArgumentException -
        • ERROR_NULL_ARGUMENT - if the listener is null
        org.eclipse.swt.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:
        TreeListener, addTreeListener(org.eclipse.swt.events.TreeListener)
      • getParent

        public Grid getParent()
        Returns:
        the parent grid
        Throws:
        org.eclipse.swt.SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • getNewColumnIndex

        int getNewColumnIndex()
      • newColumn

        void newColumn​(GridColumn column,
                       int index)
      • removeColumn

        void removeColumn​(GridColumn col)
      • getColumns

        public GridColumn[] getColumns()
        Returns the columns within this group.

        Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.

        Returns:
        the columns
        Throws:
        org.eclipse.swt.SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • dispose

        public void dispose()
        Overrides:
        dispose in class org.eclipse.swt.widgets.Widget
      • getHeaderRenderer

        public GridHeaderRenderer getHeaderRenderer()
        Returns:
        the header renderer.
        Throws:
        org.eclipse.swt.SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • setHeaderRenderer

        public void setHeaderRenderer​(GridHeaderRenderer headerRenderer)
        Sets the header renderer.
        Parameters:
        headerRenderer - The headerRenderer to set.
        Throws:
        java.lang.IllegalArgumentException -
        • ERROR_NULL_ARGUMENT - if the renderer is null
        org.eclipse.swt.SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • getExpanded

        public boolean getExpanded()
        Returns true if the receiver is expanded, false otherwise.
        Returns:
        the expanded attribute
        Throws:
        org.eclipse.swt.SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • setExpanded

        public void setExpanded​(boolean expanded)
        Sets the expanded state of the receiver.
        Parameters:
        expanded - the expanded to set
        Throws:
        org.eclipse.swt.SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • getFirstVisibleColumn

        GridColumn getFirstVisibleColumn()
        Returns the first visible column in this column group.
        Returns:
        first visible column
      • getLastVisibleColumn

        GridColumn getLastVisibleColumn()
        Returns the last visible column in this column group.
        Returns:
        last visible column
      • getBounds

        org.eclipse.swt.graphics.Rectangle getBounds()
      • setHeaderWordWrap

        public void setHeaderWordWrap​(boolean wordWrap)
        Sets whether or not text is word-wrapped in the header for this column group. 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()
      • getHeaderWordWrap

        public boolean getHeaderWordWrap()
        Returns whether or not text is word-wrapped in the header for this column group.
        Returns:
        true if the header wraps its text.
        See Also:
        GridColumn.setHeaderWordWrap(boolean)
      • getHeaderFont

        public org.eclipse.swt.graphics.Font getHeaderFont()
        Returns the font that the receiver will use to paint textual information for the header.
        Returns:
        the receiver's font
        Throws:
        org.eclipse.swt.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

        public void setHeaderFont​(org.eclipse.swt.graphics.Font font)
        Sets the Font to be used when displaying the Header text.
        Parameters:
        font -
      • getAlignment

        public int getAlignment()
        Returns the column group header alignment.
        Returns:
        SWT.LEFT, SWT.RIGHT, SWT.CENTER
        Throws:
        org.eclipse.swt.SWTException -
        • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
        • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver