use of org.apache.hop.pipeline.transform.BaseTransformMeta in project hop by apache.
the class WidgetUtils method createFieldDropDown.
/**
* creates a ComboVar populated with fields from the previous transform.
*
* @param parentComposite - the composite in which the widget will be placed
* @param props - PropsUi props for L&F
* @param transformMeta - transformMeta of the current transform
* @param formData - FormData to use for placement
*/
public static ComboVar createFieldDropDown(Composite parentComposite, PropsUi props, IVariables variables, BaseTransformMeta transformMeta, FormData formData) {
PipelineMeta pipelineMeta = transformMeta.getParentTransformMeta().getParentPipelineMeta();
ComboVar fieldDropDownCombo = new ComboVar(variables, parentComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(fieldDropDownCombo);
fieldDropDownCombo.addModifyListener(e -> transformMeta.setChanged());
fieldDropDownCombo.setLayoutData(formData);
Listener focusListener = e -> {
String current = fieldDropDownCombo.getText();
fieldDropDownCombo.getCComboWidget().removeAll();
fieldDropDownCombo.setText(current);
try {
IRowMeta rmi = pipelineMeta.getPrevTransformFields(variables, transformMeta.getParentTransformMeta().getName());
List ls = rmi.getValueMetaList();
for (Object l : ls) {
ValueMetaBase vmb = (ValueMetaBase) l;
fieldDropDownCombo.add(vmb.getName());
}
} catch (HopTransformException ex) {
// can be ignored, since previous transform may not be set yet.
transformMeta.logDebug(ex.getMessage(), ex);
}
};
fieldDropDownCombo.getCComboWidget().addListener(SWT.FocusIn, focusListener);
return fieldDropDownCombo;
}
use of org.apache.hop.pipeline.transform.BaseTransformMeta in project hop by apache.
the class LoadSaveBase method createMeta.
public T createMeta() {
try {
T meta = clazz.newInstance();
if (meta instanceof BaseTransformMeta) {
TransformMeta mockParentTransformMeta = mock(TransformMeta.class);
((BaseTransformMeta) meta).setParentTransformMeta(mockParentTransformMeta);
PipelineMeta mockPipelineMeta = mock(PipelineMeta.class);
when(mockParentTransformMeta.getParentPipelineMeta()).thenReturn(mockPipelineMeta);
}
return meta;
} catch (Exception e) {
throw new RuntimeException("Unable to create meta of class " + clazz.getCanonicalName(), e);
}
}
Aggregations