## org.eclipse.emf.ecoretools.tabbedproperties.sections.widgets
Class TableViewerComposite

    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.emf.ecoretools.tabbedproperties.sections.widgets.TableViewerComposite

All Implemented Interfaces:
  org.eclipse.swt.graphics.Drawable

Direct Known Subclasses:
  ReferenceViewerComposite

    public class TableViewerComposite

extends org.eclipse.swt.widgets.Composite

This widget contains a TableViewer representing the Parameters of an Operation. There are two Buttons (one for adding a new Parameter, the other for deleting the current selected Parameter) Creation 10 august 06 Last Modified 11 august 06

Field Summary

Fields inherited from class org.eclipse.swt.widgets.Composite
`embeddedHandle`

Fields inherited from class org.eclipse.swt.widgets.Widget
`handle`

Constructor Summary
`TableViewerComposite(org.eclipse.swt.widgets.Composite parent, java.lang.String[] colNames, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory widgetFactory)` The constructor

Method Summary
`void` `addElement()` Add a new empty Element in the ObjectManager
`void` `addElement(java.lang.Object newElement)` Add the given Element in the ObjectManager
`void` `addSelectionListener(org.eclipse.swt.events.SelectionListener listener)` Adds a selection listener
`protected void` `createAddButton(org.eclipse.swt.widgets.Composite comp)` Create the ADD button
`protected void` `createButtons(org.eclipse.swt.widgets.Composite parent)` Create ADD and REMOVE buttons in the section composite
`protected void` `createOtherButtons(org.eclipse.swt.widgets.Composite comp)` User may implement other buttons to be displayed at the right side of the table.
`protected void` `createRemoveButton(org.eclipse.swt.widgets.Composite comp)` Create the REMOVE button
`protected void` `createTable(org.eclipse.swt.widgets.Composite parent)` TODO modify the table appearance Create the Table
`protected void` `createTableViewer()` Create the TableViewer
`protected void` `fireWidgetSelected()` Notifies selection listeners
`org.eclipse.swt.widgets.Button` `getAddButton()`
`java.lang.String[]` `getColumnHeaders()` Gets a collection of current column names
`org.eclipse.emf.ecoretools.tabbedproperties.internal.sections.TableObjectManager` `getObjectManager()`
`java.util.List<org.eclipse.swt.widgets.Button>` `getOtherButtons()`
`org.eclipse.swt.widgets.Button` `getRemoveButton()`
`org.eclipse.jface.viewers.ISelection` `getSelection()` Returns the current selection from the table
`java.lang.Object` `getSelectionItem()` Returns the first object that has been selected
`org.eclipse.swt.widgets.Table` `getTable()` Return the table composite
`java.util.List<?>` `getValue()` Returns the contents of this table as a list.
`protected org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory` `getWidgetFactory()`
`protected void` `hookButtonListeners()` Hook the listeners
`protected void` `hookListeners()` Hook the listeners
`void` `refresh()` Refresh the Table contents when model has been changed from the outside.
`void` `removeElement(java.lang.Object element)` Remove the given Element from the ObjectManager
`void` `removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)` Removes a selection listener
`void` `setAddListener(org.eclipse.swt.events.SelectionListener listener)` Set the Listener to associate with the ADD button
`void` `setColumnNames(java.lang.String[] newColumnNames)` Set a new set of columns
`void` `setEditingDomain(org.eclipse.emf.edit.domain.EditingDomain editingDomain)` Modification will be taken in charge by the object manager.
`void` `setEnabled(boolean enabled)`
`void` `setInput(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature feature)` Sets or clears the input for this viewer
`void` `setLabelProvider(org.eclipse.jface.viewers.IBaseLabelProvider labelProvider)` Sets the label provider for this viewer.
`void` `setOtherButtons(java.util.List<org.eclipse.swt.widgets.Button> buttons)` Update the new Buttons to use with the Composite
`void` `setRemoveListener(org.eclipse.swt.events.SelectionListener listener)` Set the Listener to associate with the REMOVE button
`void` `updateSelectedItem(java.lang.Object data)` This method is called each time a new item is selected in the Table.

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, 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, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update`

Methods inherited from class org.eclipse.swt.widgets.Widget
`addDisposeListener, addListener, checkWidget, dispose, getData, 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`

Constructor Detail

### TableViewerComposite

    public TableViewerComposite(org.eclipse.swt.widgets.Composite parent,
                                java.lang.String[] colNames,
                                org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory widgetFactory)

  The constructor

  Parameters:
    `parent` - a widget which will be the parent of the new instance (cannot be null)
    `colNames` - the name of the different columns of the table
    `widgetFactory` - the widgetFactory to use to create the widgets

Method Detail

### createTable

    protected void createTable(org.eclipse.swt.widgets.Composite parent)

  TODO modify the table appearance Create the Table

  Parameters:
    `parent` - the parent Composite

### createTableViewer

    protected void createTableViewer()

  Create the TableViewer

### createButtons

    protected void createButtons(org.eclipse.swt.widgets.Composite parent)

  Create ADD and REMOVE buttons in the section composite

  Parameters:
    `parent` - the parent Composite

### createAddButton

    protected void createAddButton(org.eclipse.swt.widgets.Composite comp)

  Create the ADD button

  Parameters:
    `comp` - the parent Composite

### createRemoveButton

    protected void createRemoveButton(org.eclipse.swt.widgets.Composite comp)

  Create the REMOVE button

  Parameters:
    `comp` - the parent Composite

### createOtherButtons

    protected void createOtherButtons(org.eclipse.swt.widgets.Composite comp)

  User may implement other buttons to be displayed at the right side of the table. This method must initialize a list of Buttons.

  Parameters:
    `comp` - The composite where buttons are going to be created

### hookListeners

    protected void hookListeners()

  Hook the listeners

### hookButtonListeners

    protected void hookButtonListeners()

  Hook the listeners

### setInput

    public void setInput(org.eclipse.emf.ecore.EObject eObject,
                         org.eclipse.emf.ecore.EStructuralFeature feature)

  Sets or clears the input for this viewer

  Parameters:
    `eObject` - EObject to be represented
    `feature` - Feature to modify

### setLabelProvider

    public void setLabelProvider(org.eclipse.jface.viewers.IBaseLabelProvider labelProvider)

  Sets the label provider for this viewer. When the given parameter is null, it will set a default label provider, in particular when the table viewer is going to display multifeature Attributes. In order to display multifeature references, client may pass a AdapterFactoryLabelProvider.

  Parameters:
    `labelProvider` - The label Provider.

### setEnabled

    public void setEnabled(boolean enabled)

  Overrides:
    `setEnabled` in class `org.eclipse.swt.widgets.Control`
  See Also:
    `Control.setEnabled(boolean)`

### setEditingDomain

    public void setEditingDomain(org.eclipse.emf.edit.domain.EditingDomain editingDomain)

  Modification will be taken in charge by the object manager. Client may specify an editing domain to consider modifications

  Parameters:
    `editingDomain` - Manages a self-contained set of interrelated EMF models and the `Command`s that modify them.

### refresh

    public void refresh()

  Refresh the Table contents when model has been changed from the outside.

### addElement

    public void addElement()

  Add a new empty Element in the ObjectManager

### addElement

    public void addElement(java.lang.Object newElement)

  Add the given Element in the ObjectManager

  Parameters:
    `newElement` - the Element to add

### removeElement

    public void removeElement(java.lang.Object element)

  Remove the given Element from the ObjectManager

  Parameters:
    `element` - the Element to remove

### getColumnHeaders

    public java.lang.String[] getColumnHeaders()

  Gets a collection of current column names

  Returns:
    List of the current column names

### setColumnNames

    public void setColumnNames(java.lang.String[] newColumnNames)

  Set a new set of columns

  Parameters:
    `newColumnNames` - Array containing the column names

### getObjectManager

    public org.eclipse.emf.ecoretools.tabbedproperties.internal.sections.TableObjectManager getObjectManager()

  Returns:
    Return the TableObjectManager

### getAddButton

    public org.eclipse.swt.widgets.Button getAddButton()

  Returns:
    Return the add button

### getRemoveButton

    public org.eclipse.swt.widgets.Button getRemoveButton()

  Returns:
    Return the remove button

### getOtherButtons

    public java.util.List<org.eclipse.swt.widgets.Button> getOtherButtons()

  Returns:
    Returns the list of buttons added if any, otherwise buttons list is null;

### setOtherButtons

    public void setOtherButtons(java.util.List<org.eclipse.swt.widgets.Button> buttons)

  Update the new Buttons to use with the Composite

  Parameters:
    `buttons` - a list of Buttons

### getSelection

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

  Returns the current selection from the table

  Returns:
    The Structured selection from this table

### getSelectionItem

    public java.lang.Object getSelectionItem()

  Returns the first object that has been selected

  Returns:
    The first object of the selection

### getValue

    public java.util.List<?> getValue()

  Returns the contents of this table as a list.

  Returns:
    The list of contest corresponding to this EStructuralFeature

### setAddListener

    public void setAddListener(org.eclipse.swt.events.SelectionListener listener)

  Set the Listener to associate with the ADD button

  Parameters:
    `listener` - a SelectionListener

### setRemoveListener

    public void setRemoveListener(org.eclipse.swt.events.SelectionListener listener)

  Set the Listener to associate with the REMOVE button

  Parameters:
    `listener` - a SelectionListener

### getTable

    public org.eclipse.swt.widgets.Table getTable()

  Return the table composite

  Returns:
    Table

### updateSelectedItem

    public void updateSelectedItem(java.lang.Object data)

  This method is called each time a new item is selected in the Table. When client desire to do something when an item is selected, this method must be overrided

  Parameters:
    `data` - the new item that was selected

### getWidgetFactory

    protected org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory getWidgetFactory()

  Returns:
    the widgetFactory

### fireWidgetSelected

    protected void fireWidgetSelected()

  Notifies selection listeners

### addSelectionListener

    public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)

  Adds a selection listener

  Parameters:
    `listener` - The listener to add

### removeSelectionListener

    public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)

  Removes a selection listener

  Parameters:
    `listener` - The listener to remove

Copyright 2007 Anyware Technologies. All Rights Reserved.