Class InternalCompositeTable

java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.nebula.widgets.compositetable.InternalCompositeTable
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable, org.eclipse.swt.widgets.Listener

class InternalCompositeTable
extends org.eclipse.swt.widgets.Composite
implements org.eclipse.swt.widgets.Listener
(non-API) Class InternalCompositeTable. This is the run-time CompositeTableControl. It gets its prototype row and (optional) header objects from its SWT parent, then uses them to implement an SWT virtual table control.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    (package private) int clientAreaHeight  
    (package private) EmptyTablePlaceholder emptyTablePlaceholder  
    (package private) org.eclipse.swt.events.ControlAdapter scrollerResizeHandler  

    Fields inherited from class org.eclipse.swt.widgets.Control

    handle
  • Constructor Summary

    Constructors 
    Constructor Description
    InternalCompositeTable​(org.eclipse.swt.widgets.Composite parentControl, int style)
    Constructor InternalCompositeTable.
  • Method Summary

    Modifier and Type Method Description
    void addRefreshContentProvider​(IRowContentProvider listener)
    Adds the specified listener to the set of listeners that will be notified when a row refresh event occurs.
    void clearSelection()
    (non-API) See CompositeTable.clearSelection() instead.
    void dispose()  
    boolean doDeleteRow()  
    void doFocusInitialRow()  
    void doFocusLastRow()  
    boolean doInsertRow()  
    boolean doMakeFocusedRowVisible()
    Makes sure that the focused row is visible
    void doPageDown()  
    void doPageUp()  
    void doRowDown()  
    void doRowUp()  
    void focusGained​(TableRow sender, org.eclipse.swt.events.FocusEvent e)
    Handle focusGained events on any child control.
    void focusLost​(TableRow sender, org.eclipse.swt.events.FocusEvent e)
    Handle focusLost events on any child control.
    int getControlRow​(org.eclipse.swt.widgets.Control rowControl)
    Method getControlRow.
    TableRow getControlRowObject​(org.eclipse.swt.widgets.Control rowControl)
    Method getControlRowObject.
    org.eclipse.swt.widgets.Control getCurrentRowControl()
    Returns the SWT control corresponding to the current row.
    (package private) org.eclipse.swt.widgets.Control getHeader()
    Returns the actual header control (not the prototype).
    org.eclipse.swt.widgets.Control getHeaderControl()
    (non-API) Method getHeaderControl.
    int getNumRowsVisible()
    Method getNumRowsVisible.
    org.eclipse.swt.widgets.Control[] getRowControls()
    Method getRowControls.
    (package private) int getRowHeight​(int clientAreaHeight)  
    org.eclipse.swt.graphics.Point getSelection()
    Method getSelection.
    int getTopRow()
    Method getTopRow.
    void handleEvent​(org.eclipse.swt.widgets.Event event)
    Scroll wheel event handling.
    boolean isHSliderVisible()
    Returns if the slider is visible.
    boolean isVSliderVisible()
    Returns if the slider is visible.
    void keyPressed​(TableRow sender, org.eclipse.swt.events.KeyEvent e)
    Handle a keyPressed event on any row control.
    void keyTraversed​(TableRow sender, org.eclipse.swt.events.TraverseEvent e)
    Handle the keyTraversed event on any child control in the table.
    protected void layoutControlHolder()
    Layout the child controls within the controlHolder Composite.
    (package private) void refreshAllRows()
    Fire the refresh event on all visible rows.
    (package private) void refreshRow​(int row)  
    void removeRefreshContentProvider​(IRowContentProvider listener)
    Remove the specified listener from the set of listeners that will be notified when a row refresh event occurs.
    void setBackground​(org.eclipse.swt.graphics.Color color)  
    void setHSliderVisible​(boolean visible)
    Sets if the slider is visible or not.
    void setMaxRowsVisible​(int maxRowsVisible)
    Method setMaxRowsVisible.
    void setMenu​(org.eclipse.swt.widgets.Menu menu)  
    void setNumRowsInCollection​(int numRowsInCollection)
    Method setNumRowsInCollection.
    void setSelection​(int column, int row)
    Method setSelection.
    void setTopRow​(int topRow)
    Method setTopRow.
    void setVSliderVisible​(boolean visible)
    Sets if the slider is visible or not.
    void setWeights()
    Method setWeights.
    (package private) void updateVisibleRows()
    Main refresh algorithm entry point.

    Methods inherited from class org.eclipse.swt.widgets.Composite

    changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString

    Methods inherited from class org.eclipse.swt.widgets.Scrollable

    computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar

    Methods inherited from class org.eclipse.swt.widgets.Control

    addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.swt.graphics.Drawable

    isAutoScalable
  • Field Details

  • Constructor Details

    • InternalCompositeTable

      public InternalCompositeTable​(org.eclipse.swt.widgets.Composite parentControl, int style)
      Constructor InternalCompositeTable. The usual SWT constructor. The same style bits are allowed here as are allowed on Composite.
      Parameters:
      parentControl - The SWT parent.
      style - Style bits.
  • Method Details

    • setBackground

      public void setBackground​(org.eclipse.swt.graphics.Color color)
      Overrides:
      setBackground in class org.eclipse.swt.widgets.Control
    • setVSliderVisible

      public void setVSliderVisible​(boolean visible)
      Sets if the slider is visible or not.
      Parameters:
      visible - true if the slider should be visible; false otherwise.
    • isVSliderVisible

      public boolean isVSliderVisible()
      Returns if the slider is visible.
      Returns:
      true if the slider is visible; false otherwise.
    • setHSliderVisible

      public void setHSliderVisible​(boolean visible)
      Sets if the slider is visible or not.
      Parameters:
      visible - true if the slider should be visible; false otherwise.
    • isHSliderVisible

      public boolean isHSliderVisible()
      Returns if the slider is visible.
      Returns:
      true if the slider is visible; false otherwise.
    • dispose

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

      protected void layoutControlHolder()
      Layout the child controls within the controlHolder Composite.
    • updateVisibleRows

      void updateVisibleRows()
      Main refresh algorithm entry point. This method refreshes everything in the table:
      • Makes sure the correct number of rows are visible
      • Makes sure each row has been refreshed with data from the underlying model
    • getRowHeight

      int getRowHeight​(int clientAreaHeight)
    • refreshAllRows

      void refreshAllRows()
      Fire the refresh event on all visible rows.
    • refreshRow

      void refreshRow​(int row)
    • getHeaderControl

      public org.eclipse.swt.widgets.Control getHeaderControl()
      (non-API) Method getHeaderControl. Return the prototype control being used as a header.
      Returns:
      The header control
    • getHeader

      org.eclipse.swt.widgets.Control getHeader()
      Returns the actual header control (not the prototype).
      Returns:
      a control instance or null, if no header is available
    • setMaxRowsVisible

      public void setMaxRowsVisible​(int maxRowsVisible)
      Method setMaxRowsVisible. Sets the maximum number of rows that will be permitted in the table at once. For example, setting this property to 1 will have the effect of creating a single editing area with a scroll bar on the right allowing the user to scroll through all rows using either the mouse or the PgUp/PgDn keys. The default value is Integer.MAX_VALUE.
      Parameters:
      maxRowsVisible - the maximum number of rows that are permitted to be visible at one time, regardless of the control's size.
    • getNumRowsVisible

      public int getNumRowsVisible()
      Method getNumRowsVisible. Returns the actual number of rows that are currently visible. Normally CompositeTable displays as many rows as will fit vertically given the control's size. This value can be clamped to a maximum using the MaxRowsVisible property.
      Returns:
      the actual number of rows that are currently visible.
    • setNumRowsInCollection

      public void setNumRowsInCollection​(int numRowsInCollection)
      Method setNumRowsInCollection. Sets the number of rows in the data structure that is being edited.
      Parameters:
      numRowsInCollection - the number of rows represented by the underlying data structure.
    • setTopRow

      public void setTopRow​(int topRow)
      Method setTopRow. Set the number of the line that is being displayed in the top row of the CompositeTable editor (0-based). If the new top row is not equal to the current top row, the table will automatically be scrolled to the new position. This number must be greater than 0 and less than NumRowsInCollection.
      Parameters:
      topRow - the line number of the new top row.
    • getTopRow

      public int getTopRow()
      Method getTopRow. Return the number of the line that is being displayed in the top row of the CompositeTable editor (0-based).
      Returns:
      the number of the top line.
    • getSelection

      public org.eclipse.swt.graphics.Point getSelection()
      Method getSelection. Returns the currently-selected (column, row) pair where the row specifies the offset from the top of the table window. In order to get the current row in the underlying data structure, use getSelection().y + getCurrentRow().
      Returns:
      the currently-selected (column, row) pair where the row specifies the offset from the top of the table window, or null if no selection is available.
    • setSelection

      public void setSelection​(int column, int row)
      Method setSelection. Sets the currently-selected (column, row) pair where the row specifies the offset from the top of the table window. In order to get the current row in the underlying data structure, use getSelection().y + getCurrentRow().
      Parameters:
      column - the column to select
      row - the row to select
    • clearSelection

      public void clearSelection()
      (non-API) See CompositeTable.clearSelection() instead.
    • setWeights

      public void setWeights()
      Method setWeights. Indicates that the column weights were just set and we should re-layout the control holder object.
    • addRefreshContentProvider

      public void addRefreshContentProvider​(IRowContentProvider listener)
      Adds the specified listener to the set of listeners that will be notified when a row refresh event occurs.
      Parameters:
      listener - the listener to add.
    • removeRefreshContentProvider

      public void removeRefreshContentProvider​(IRowContentProvider listener)
      Remove the specified listener from the set of listeners that will be notified when a row refresh event occurs.
      Parameters:
      listener - the listener to remove.
    • keyPressed

      public void keyPressed​(TableRow sender, org.eclipse.swt.events.KeyEvent e)
      Handle a keyPressed event on any row control.
      Parameters:
      sender - The row that is sending the event
      e - the actual KeyEvent
    • keyTraversed

      public void keyTraversed​(TableRow sender, org.eclipse.swt.events.TraverseEvent e)
      Handle the keyTraversed event on any child control in the table.
      Parameters:
      sender - The row sending the event.
      e - The SWT TraverseEvent
    • doMakeFocusedRowVisible

      public boolean doMakeFocusedRowVisible()
      Makes sure that the focused row is visible
      Returns:
      true if the display needed to be scrolled; false otherwise
    • handleEvent

      public void handleEvent​(org.eclipse.swt.widgets.Event event)
      Scroll wheel event handling.
      Specified by:
      handleEvent in interface org.eclipse.swt.widgets.Listener
    • focusLost

      public void focusLost​(TableRow sender, org.eclipse.swt.events.FocusEvent e)
      Handle focusLost events on any child control. This is not currently used.
      Parameters:
      sender - The row containing the sending control.
      e - The SWT FocusEvent.
    • focusGained

      public void focusGained​(TableRow sender, org.eclipse.swt.events.FocusEvent e)
      Handle focusGained events on any child control. FIXME: Needs to automatically scroll horizontally if the newly-focused control is fully or partially occluded.
      Parameters:
      sender - The row containing the sending control.
      e - The SWT FocusEvent.
    • getCurrentRowControl

      public org.eclipse.swt.widgets.Control getCurrentRowControl()
      Returns the SWT control corresponding to the current row.
      Returns:
      the current row control.
    • getRowControls

      public org.eclipse.swt.widgets.Control[] getRowControls()
      Method getRowControls. Returns an array of SWT controls where each control represents a row control in the CompositeTable's current scrolled position. If CompositeTable is resized, scrolled, such that the rows that the CompositeTable control is displaying change in any way, the array that is returned by this method will become out of date and need to be retrieved again.
      Returns:
      Control[] An array of SWT Control objects, each representing an SWT row object.
    • setMenu

      public void setMenu​(org.eclipse.swt.widgets.Menu menu)
      Overrides:
      setMenu in class org.eclipse.swt.widgets.Control
    • getControlRow

      public int getControlRow​(org.eclipse.swt.widgets.Control rowControl)
      Method getControlRow. Given a row control, returns its row number relative to the topRow.
      Parameters:
      rowControl - The row object to find
      Returns:
      The row number of the rowControl relative to the topRow (0-based)
      Throws:
      java.lang.IllegalArgumentException - if rowControl is not currently visible
    • getControlRowObject

      public TableRow getControlRowObject​(org.eclipse.swt.widgets.Control rowControl)
      Method getControlRowObject. Given a row control, returns its row number relative to the topRow.
      Parameters:
      rowControl - The row object to find
      Returns:
      The row object managing the rowControl
      Throws:
      java.lang.IllegalArgumentException - if rowControl is not currently visible
    • doFocusInitialRow

      public void doFocusInitialRow()
    • doFocusLastRow

      public void doFocusLastRow()
    • doPageUp

      public void doPageUp()
    • doPageDown

      public void doPageDown()
    • doRowUp

      public void doRowUp()
    • doRowDown

      public void doRowDown()
    • doInsertRow

      public boolean doInsertRow()
    • doDeleteRow

      public boolean doDeleteRow()