org.openoffice.ide.eclipse.core.gui
Class AbstractTable

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.openoffice.ide.eclipse.core.gui.AbstractTable
All Implemented Interfaces:
org.eclipse.jface.viewers.ISelectionProvider, org.eclipse.swt.graphics.Drawable
Direct Known Subclasses:
InterfaceMembersTable, InterfacesTable, OOoTable, SDKTable

public class AbstractTable
extends org.eclipse.swt.widgets.Composite
implements org.eclipse.jface.viewers.ISelectionProvider

Abstract table structure used in the plugin. This avoid to rewrite to many times the same code for basic table managment.

In order to create a new table class, the following methods should be overridden:

Author:
cedricbosdo

Field Summary
protected  org.eclipse.swt.widgets.Table mTable
           
protected  org.eclipse.jface.viewers.TableViewer mTableViewer
           
 
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
 
Fields inherited from class org.eclipse.swt.widgets.Widget
handle
 
Constructor Summary
AbstractTable(org.eclipse.swt.widgets.Composite pParent, java.lang.String pTitle, java.lang.String[] pColTitles, int[] pColWidths, java.lang.String[] pColProperties)
          Constructor for a generic table.
 
Method Summary
protected  ITableElement addLine()
          Method called after an action on the Add button.
protected  void addLine(ITableElement pElement)
          Adding a line to the table model.
 void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener pListener)
          
protected  org.eclipse.jface.viewers.CellEditor[] createCellEditors(org.eclipse.swt.widgets.Table pTable)
          Method called to configure the columns cell editors.
protected  void createContent()
          Creates and layout all the graphic components of the table.
 void dispose()
          Cleans up the table after having used it.
 java.util.Vector<ITableElement> getLines()
          Convenient method to get the table lines.
 org.eclipse.jface.viewers.ISelection getSelection()
          
protected  void handleDoubleClick(org.eclipse.jface.viewers.DoubleClickEvent pEvent)
          Method called when a double click event has been raised by the table.
protected  ITableElement removeLine()
          Method called after an action on the Del button.
 void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener pListener)
          
 void setSelection(org.eclipse.jface.viewers.ISelection pSelection)
          
 void setToolTipText(java.lang.String pString)
          
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getBorderWidth, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getData, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mTable

protected org.eclipse.swt.widgets.Table mTable

mTableViewer

protected org.eclipse.jface.viewers.TableViewer mTableViewer
Constructor Detail

AbstractTable

public AbstractTable(org.eclipse.swt.widgets.Composite pParent,
                     java.lang.String pTitle,
                     java.lang.String[] pColTitles,
                     int[] pColWidths,
                     java.lang.String[] pColProperties)
Constructor for a generic table. The number of columns is the minimum of the length of the three arrays in parameter.

Parameters:
pParent - the parent composite where to add the table
pTitle - a title for the table
pColTitles - an array with the colums titles
pColWidths - an array with the columns width
pColProperties - an array with the columns properties
Method Detail

dispose

public void dispose()
Cleans up the table after having used it.

Overrides:
dispose in class org.eclipse.swt.widgets.Widget

getLines

public java.util.Vector<ITableElement> getLines()
Convenient method to get the table lines.

Returns:
a vector containing the ITableElement objects representing the lines.

setToolTipText

public void setToolTipText(java.lang.String pString)

Overrides:
setToolTipText in class org.eclipse.swt.widgets.Control

addLine

protected void addLine(ITableElement pElement)
Adding a line to the table model.

Parameters:
pElement - the line to add.

createContent

protected void createContent()
Creates and layout all the graphic components of the table.


createCellEditors

protected org.eclipse.jface.viewers.CellEditor[] createCellEditors(org.eclipse.swt.widgets.Table pTable)
Method called to configure the columns cell editors. This method should be overridden in order to set customized editors. The default action is to return null to indicate that no editing is allowed.

Parameters:
pTable - the table for which to create the cell editors, i.e. the internal table object of this class.
Returns:
the cell editors in the order of the columns

addLine

protected ITableElement addLine()
Method called after an action on the Add button. This method should be overridden to customize the table.

Returns:
the new table line to add.

removeLine

protected ITableElement removeLine()
Method called after an action on the Del button. This method should be overridden to customize the table.

Returns:
the table line removed or null if none was removed.

handleDoubleClick

protected void handleDoubleClick(org.eclipse.jface.viewers.DoubleClickEvent pEvent)
Method called when a double click event has been raised by the table. This implementation doesn't perform any action and is intended to be overridden.

Parameters:
pEvent - the double click event raised

addSelectionChangedListener

public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener pListener)

Specified by:
addSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider

getSelection

public org.eclipse.jface.viewers.ISelection getSelection()

Specified by:
getSelection in interface org.eclipse.jface.viewers.ISelectionProvider

removeSelectionChangedListener

public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener pListener)

Specified by:
removeSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider

setSelection

public void setSelection(org.eclipse.jface.viewers.ISelection pSelection)

Specified by:
setSelection in interface org.eclipse.jface.viewers.ISelectionProvider