Class AbstractTable
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.libreoffice.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:
addLine()to customize the action performed when clicking on the Add button.removeLine()to customize the action performed when clicking on the Remove button.handleDoubleClick(DoubleClickEvent)to customize the action performed on a double click on the table.createCellEditors(Table)to customize how to edit the cells of the different columns of the table.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.eclipse.swt.widgets.Tableprotected org.eclipse.jface.viewers.TableViewerFields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandleFields inherited from class org.eclipse.swt.widgets.Widget
handle -
Constructor Summary
ConstructorsConstructorDescriptionAbstractTable(org.eclipse.swt.widgets.Composite parent, String title, String[] colTitles, int[] colWidths, String[] colProperties) Constructor for a generic table. -
Method Summary
Modifier and TypeMethodDescriptionprotected ITableElementaddLine()Method called after an action on the Add button.protected voidaddLine(ITableElement element) Adding a line to the table model.voidaddSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) protected org.eclipse.jface.viewers.CellEditor[]createCellEditors(org.eclipse.swt.widgets.Table pTable) Method called to configure the columns cell editors.protected voidCreates and layout all the graphic components of the table.voiddispose()Cleans up the table after having used it.getLines()Convenient method to get the table lines.org.eclipse.jface.viewers.ISelectionprotected voidhandleDoubleClick(org.eclipse.jface.viewers.DoubleClickEvent event) Method called when a double click event has been raised by the table.protected ITableElementMethod called after an action on the Remove button.voidremoveSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) voidsetSelection(org.eclipse.jface.viewers.ISelection pSelection) voidsetToolTipText(String pString) 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, toStringMethods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsModeMethods 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, isAutoScalable, 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, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, addTypedListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setData
-
Field Details
-
mTable
protected org.eclipse.swt.widgets.Table mTable -
mTableViewer
protected org.eclipse.jface.viewers.TableViewer mTableViewer
-
-
Constructor Details
-
AbstractTable
public AbstractTable(org.eclipse.swt.widgets.Composite parent, String title, String[] colTitles, int[] colWidths, String[] colProperties) Constructor for a generic table. The number of columns is the minimum of the length of the three arrays in parameter.- Parameters:
parent- the parent composite where to add the tabletitle- a title for the tablecolTitles- an array with the colums titlescolWidths- an array with the columns widthcolProperties- an array with the columns properties
-
-
Method Details
-
dispose
public void dispose()Cleans up the table after having used it.- Overrides:
disposein classorg.eclipse.swt.widgets.Widget
-
getLines
Convenient method to get the table lines.- Returns:
- a vector containing the
ITableElementobjects representing the lines.
-
setToolTipText
- Overrides:
setToolTipTextin classorg.eclipse.swt.widgets.Control
-
addLine
Adding a line to the table model.- Parameters:
element- 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 returnnullto 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
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
Method called after an action on the Remove button. This method should be overridden to customize the table.- Returns:
- the table line removed or
nullif none was removed.
-
handleDoubleClick
protected void handleDoubleClick(org.eclipse.jface.viewers.DoubleClickEvent event) 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:
event- the double click event raised
-
addSelectionChangedListener
public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) - Specified by:
addSelectionChangedListenerin interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
getSelection
public org.eclipse.jface.viewers.ISelection getSelection()- Specified by:
getSelectionin interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
removeSelectionChangedListener
public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener) - Specified by:
removeSelectionChangedListenerin interfaceorg.eclipse.jface.viewers.ISelectionProvider
-
setSelection
public void setSelection(org.eclipse.jface.viewers.ISelection pSelection) - Specified by:
setSelectionin interfaceorg.eclipse.jface.viewers.ISelectionProvider
-