Package org.apache.hop.ui.core.widget
Class MetaSelectionLine<T extends IHopMetadata>
- java.lang.Object
-
- org.eclipse.swt.widgets.Widget
-
- org.eclipse.swt.widgets.Control
-
- org.eclipse.swt.widgets.Scrollable
-
- org.eclipse.swt.widgets.Composite
-
- org.apache.hop.ui.core.widget.MetaSelectionLine<T>
-
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
@GuiPlugin public class MetaSelectionLine<T extends IHopMetadata> extends org.eclipse.swt.widgets.Composite
The goal of this composite is to add a line on a dialog which contains: - A label (for example: Database connection) - A Combo Variable selection (editable ComboBox, for example containing all connection values in the MetaStore) - New and Edit buttons (The latter opens up a generic Metadata editor)
-
-
Field Summary
Fields Modifier and Type Field Description static StringGUI_PLUGIN_TOOLBAR_PARENT_IDstatic StringTOOLBAR_ITEM_EDITstatic StringTOOLBAR_ITEM_METAstatic StringTOOLBAR_ITEM_NEW
-
Constructor Summary
Constructors Constructor Description MetaSelectionLine(IVariables variables, IHopMetadataProvider metadataProvider, Class<T> managedClass, org.eclipse.swt.widgets.Composite parentComposite, int flags, String labelText, String toolTipText)MetaSelectionLine(IVariables variables, IHopMetadataProvider metadataProvider, Class<T> managedClass, org.eclipse.swt.widgets.Composite parentComposite, int flags, String labelText, String toolTipText, boolean leftAlignedLabel)MetaSelectionLine(IVariables variables, IHopMetadataProvider metadataProvider, Class<T> managedClass, org.eclipse.swt.widgets.Composite parentComposite, int flags, String labelText, String toolTipText, boolean leftAlignedLabel, boolean negativeMargin)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(String item)voidaddModifyListener(org.eclipse.swt.events.ModifyListener lsMod)voidaddSelectionListener(org.eclipse.swt.events.SelectionListener lsDef)voidaddToConnectionLine(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.widgets.Control previous, T selected, org.eclipse.swt.events.ModifyListener lsMod)Adds the connection line for the given parent and previous control, and returns a meta selection manager controlvoidaddTraverseListener(org.eclipse.swt.events.TraverseListener tl)protected booleaneditMetadata()We look at the managed class name, add Dialog to it and then simply us that class to edit the dialog.voideditMetadataElement()voidfillItems()Look up the object names from the metadata and populate the items in the combobox with it.org.eclipse.swt.custom.CCombogetComboWidget()static StringgetEditIcon(Object guiPluginObject)intgetItemCount()String[]getItems()org.eclipse.swt.widgets.LabelgetLabelWidget()Class<T>getManagedClass()Gets managedClassMetadataManager<T>getManager()Gets managerIHopMetadataProvidergetMetadataProvider()Gets metadataProviderintgetSelectionIndex()IVariablesgetSpace()Gets variablesStringgetText()IVariablesgetVariables()Gets variablesComboVargetwCombo()Gets wComboorg.eclipse.swt.widgets.LabelgetwLabel()Gets wLabelorg.eclipse.swt.widgets.ToolBargetwToolBar()Gets wToolBarTloadSelectedElement()Load the selected element and return it.protected voidmanageMetadata()voidnewMetadataElement()voidremove(int index)voidremoveAll()voidselect(int index)voidsetEnabled(boolean flag)booleansetFocus()voidsetItems(String[] items)voidsetText(String name)voidviewInPerspective()-
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, redraw, setBackgroundMode, 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, 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, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, 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, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData
-
-
-
-
Field Detail
-
GUI_PLUGIN_TOOLBAR_PARENT_ID
public static final String GUI_PLUGIN_TOOLBAR_PARENT_ID
- See Also:
- Constant Field Values
-
TOOLBAR_ITEM_EDIT
public static final String TOOLBAR_ITEM_EDIT
- See Also:
- Constant Field Values
-
TOOLBAR_ITEM_NEW
public static final String TOOLBAR_ITEM_NEW
- See Also:
- Constant Field Values
-
TOOLBAR_ITEM_META
public static final String TOOLBAR_ITEM_META
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MetaSelectionLine
public MetaSelectionLine(IVariables variables, IHopMetadataProvider metadataProvider, Class<T> managedClass, org.eclipse.swt.widgets.Composite parentComposite, int flags, String labelText, String toolTipText)
-
MetaSelectionLine
public MetaSelectionLine(IVariables variables, IHopMetadataProvider metadataProvider, Class<T> managedClass, org.eclipse.swt.widgets.Composite parentComposite, int flags, String labelText, String toolTipText, boolean leftAlignedLabel)
-
MetaSelectionLine
public MetaSelectionLine(IVariables variables, IHopMetadataProvider metadataProvider, Class<T> managedClass, org.eclipse.swt.widgets.Composite parentComposite, int flags, String labelText, String toolTipText, boolean leftAlignedLabel, boolean negativeMargin)
-
-
Method Detail
-
editMetadataElement
@GuiToolbarElement(root="MetaSelectionLine-Toolbar", id="10010-metadata-edit", toolTip="i18n::MetadataElement.Edit.Tooltip", imageMethod="getEditIcon") public void editMetadataElement()
-
newMetadataElement
@GuiToolbarElement(root="MetaSelectionLine-Toolbar", id="10020-metadata-new", toolTip="i18n::MetadataElement.New.Tooltip", image="ui/images/new.svg") public void newMetadataElement()
-
viewInPerspective
@GuiToolbarElement(root="MetaSelectionLine-Toolbar", id="10030-metadata-perspective", toolTip="i18n::MetadataElement.View.Tooltip", image="ui/images/metadata.svg") public void viewInPerspective()
-
manageMetadata
protected void manageMetadata()
-
editMetadata
protected boolean editMetadata()
We look at the managed class name, add Dialog to it and then simply us that class to edit the dialog.
-
fillItems
public void fillItems() throws HopExceptionLook up the object names from the metadata and populate the items in the combobox with it.- Throws:
HopException- In case something went horribly wrong.
-
loadSelectedElement
public T loadSelectedElement()
Load the selected element and return it. In case of errors, log them to LogChannel.UI- Returns:
- The selected element or null if it doesn't exist or there was an error
-
addToConnectionLine
public void addToConnectionLine(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.widgets.Control previous, T selected, org.eclipse.swt.events.ModifyListener lsMod)Adds the connection line for the given parent and previous control, and returns a meta selection manager control- Parameters:
parent- the parent composite objectprevious- the previous control
-
addModifyListener
public void addModifyListener(org.eclipse.swt.events.ModifyListener lsMod)
-
addSelectionListener
public void addSelectionListener(org.eclipse.swt.events.SelectionListener lsDef)
-
setText
public void setText(String name)
-
getText
public String getText()
-
setItems
public void setItems(String[] items)
-
add
public void add(String item)
-
getItems
public String[] getItems()
-
getItemCount
public int getItemCount()
-
removeAll
public void removeAll()
-
remove
public void remove(int index)
-
select
public void select(int index)
-
getSelectionIndex
public int getSelectionIndex()
-
setEnabled
public void setEnabled(boolean flag)
- Overrides:
setEnabledin classorg.eclipse.swt.widgets.Control
-
setFocus
public boolean setFocus()
- Overrides:
setFocusin classorg.eclipse.swt.widgets.Composite
-
addTraverseListener
public void addTraverseListener(org.eclipse.swt.events.TraverseListener tl)
- Overrides:
addTraverseListenerin classorg.eclipse.swt.widgets.Control
-
getComboWidget
public org.eclipse.swt.custom.CCombo getComboWidget()
-
getLabelWidget
public org.eclipse.swt.widgets.Label getLabelWidget()
-
getMetadataProvider
public IHopMetadataProvider getMetadataProvider()
Gets metadataProvider- Returns:
- value of metadataProvider
-
getSpace
public IVariables getSpace()
Gets variables- Returns:
- value of variables
-
getVariables
public IVariables getVariables()
Gets variables- Returns:
- value of variables
-
getManager
public MetadataManager<T> getManager()
Gets manager- Returns:
- value of manager
-
getwLabel
public org.eclipse.swt.widgets.Label getwLabel()
Gets wLabel- Returns:
- value of wLabel
-
getwCombo
public ComboVar getwCombo()
Gets wCombo- Returns:
- value of wCombo
-
getwToolBar
public org.eclipse.swt.widgets.ToolBar getwToolBar()
Gets wToolBar- Returns:
- value of wToolBar
-
-