Class TmfViewerFolder
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.tracecompass.tmf.ui.widgets.tabsview.TmfViewerFolder
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
public class TmfViewerFolder
extends org.eclipse.swt.widgets.Composite
Allows the user to create multiple tabs which makes it look like folders. It
simplifies the management of the viewer contained in each tab.
The indexing of the viewers is based on their name.
- Author:
- Mathieu Denis
-
Field Summary
Fields inherited from class org.eclipse.swt.widgets.Control
handleFields inherited from class org.eclipse.swt.widgets.Widget
nativeZoom -
Constructor Summary
ConstructorsConstructorDescriptionTmfViewerFolder(org.eclipse.swt.widgets.Composite parent) Constructor with empty styleTmfViewerFolder(org.eclipse.swt.widgets.Composite parent, int style) Constructor -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddTab(ITmfViewer viewer, String viewerID, int style) Create a new tab that will hold the viewer content.voidclear()Disposes of all the viewers contained in the folder and restart to a clean state.org.eclipse.swt.widgets.CompositeGets the folder that will be use as the parent of tabs that will hold the viewer.@Nullable ITmfViewerGets the current shown viewerGets a viewer based on his name.Gets the viewers list contained in the folder view.voidsetSelection(int index) Selects the tab at the specified index from the insertion orderMethods inherited from class org.eclipse.swt.widgets.Composite
changed, 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, 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, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, reskin, setData, setDataMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
Constructor Details
-
TmfViewerFolder
public TmfViewerFolder(org.eclipse.swt.widgets.Composite parent) Constructor with empty style- Parameters:
parent- The parent composite
-
TmfViewerFolder
public TmfViewerFolder(org.eclipse.swt.widgets.Composite parent, int style) Constructor- Parameters:
parent- The parent compositestyle- The style of the view that will be created
-
-
Method Details
-
clear
public void clear()Disposes of all the viewers contained in the folder and restart to a clean state. -
addTab
Create a new tab that will hold the viewer content. The viewer name will be used as the name for the tab. The viewer ID must be unique and can be used to retrieve the viewer from the folder. The parent of the viewer control must be the folder returned bygetParentFolder()- Parameters:
viewer- The viewer to put in the new tabviewerID- The ID that will be assigned to this viewer for easy retrievingstyle- The style of the widget to build- Returns:
- true on success, false otherwise
-
getParentFolder
public org.eclipse.swt.widgets.Composite getParentFolder()Gets the folder that will be use as the parent of tabs that will hold the viewer. In order to be able to add new tabs in this view, the parent of the viewer control has to be this composite.- Returns:
- the folder composite to use as the parent for the viewer control to create.
-
getViewer
Gets a viewer based on his name.- Parameters:
viewerName- The name of the viewer to find in the folder- Returns:
- The viewer which name is viewerName, or null if there is no such viewer
-
getViewer
Gets the current shown viewer- Returns:
- the current shown viewer
- Since:
- 4.3
-
getViewers
Gets the viewers list contained in the folder view. The list can return the viewers in any order. It is not to be assumed that the viewers are returned in the same order as they were inserted.- Returns:
- a collection of viewers contained in this view.
-
setSelection
public void setSelection(int index) throws org.eclipse.swt.SWTException Selects the tab at the specified index from the insertion order- Parameters:
index- The index of the tab to be selected- 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
-