本文整理汇总了Java中org.pentaho.di.ui.core.widget.ComboVar类的典型用法代码示例。如果您正苦于以下问题:Java ComboVar类的具体用法?Java ComboVar怎么用?Java ComboVar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ComboVar类属于org.pentaho.di.ui.core.widget包,在下文中一共展示了ComboVar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createArgumentUI
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
/**
* Create the UI to enter one argument.
* @param argumentDescriptor
* @param lastControl
* @param items
* @return The combobox where the user enters the argument.
*/
private ComboVar createArgumentUI(Object[] argumentDescriptor, Control lastControl, String[] items){
String argumentName = (String)argumentDescriptor[0];
Label label = new Label(metadataComposite, SWT.RIGHT);
label.setText(BaseMessages.getString(PKG, "JdbcMetadata.arguments." + argumentName + ".Label"));
label.setToolTipText(BaseMessages.getString(PKG, "JdbcMetadata.arguments." + argumentName + ".Tooltip"));
props.setLook(label);
FormData labelFormData = new FormData();
labelFormData.left = new FormAttachment(0, 0);
labelFormData.right = new FormAttachment(middle, -margin);
labelFormData.top = new FormAttachment(lastControl, margin);
label.setLayoutData(labelFormData);
ComboVar comboVar = new ComboVar(transMeta, metadataComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(comboVar);
FormData comboVarFormData = new FormData();
comboVarFormData.left = new FormAttachment(middle, 0);
comboVarFormData.right = new FormAttachment(100, 0);
comboVarFormData.top = new FormAttachment(lastControl, margin);
comboVar.setLayoutData(comboVarFormData);
comboVar.setItems(items);
comboVar.addModifyListener(lsMod);
return comboVar;
}
示例2: createArgumentsUI
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
/**
* Create UI to enter arguments.
* Return a new set of arguments to store in the meta object
*/
private String[] createArgumentsUI(Object[] argumentDescriptors, String[] currentValues){
logDebug("createArgumentsUI, currentValues = " + (currentValues == null ? "null" : currentValues.length));
Object[] argumentDescriptor;
int argc = argumentDescriptors.length;
String[] newArguments = new String[argc];
Control lastControl = removeArgumentFieldsButton;
String[] items = argumentSourceFields.getSelection() ? getFieldListForCombo() : emptyFieldList;
for (int i = 0; i < argc; i++){
argumentDescriptor = (Object[])argumentDescriptors[i];
ComboVar comboVar = createArgumentUI(argumentDescriptor, lastControl, items);
lastControl = comboVar;
//copy the old argument values to the new arguments array
if (i >= currentValues.length) continue;
String argumentValue = currentValues[i];
newArguments[i] = argumentValue;
if (argumentValue == null) continue;
comboVar.setText(argumentValue);
}
return newArguments;
}
示例3: getFieldsFromPrevious
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
/**
* Gets fields from previous steps and populate a ComboVar.
* @param comboVar the comboVar to populate
* @param TransMeta the source transformation
* @param StepMeta the source step
*/
public static final void getFieldsFromPrevious(ComboVar comboVar,TransMeta transMeta,StepMeta stepMeta)
{
String selectedField=null;
int indexField=-1;
try{
RowMetaInterface r = transMeta.getPrevStepFields(stepMeta);
selectedField=comboVar.getText();
comboVar.removeAll();
if (r!=null && !r.isEmpty()) {
r.getFieldNames();
comboVar.setItems(r.getFieldNames());
indexField=r.indexOfValue(selectedField);
}
// Select value if possible...
if(indexField>-1) comboVar.select(indexField); else { if(selectedField!=null) comboVar.setText(selectedField);};
}catch(KettleException ke){
new ErrorDialog(comboVar.getShell(),Messages.getString("BaseStepDialog.FailedToGetFieldsPrevious.DialogTitle"),
Messages.getString("BaseStepDialog.FailedToGetFieldsPrevious.DialogMessage"),ke);
}
}
示例4: setEncodings
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
private void setEncodings(ComboVar var)
{
// Encoding of the text file:
String encoding=Const.NVL(var.getText(),Const.getEnvironmentVariable("file.encoding", "UTF-8"));
var.removeAll();
ArrayList<Charset> values = new ArrayList<Charset>(Charset.availableCharsets().values());
for (int i=0;i<values.size();i++)
{
Charset charSet = (Charset)values.get(i);
var.add( charSet.displayName() );
}
// Now select the default!
int idx = Const.indexOfString(encoding, var.getItems() );
if (idx>=0) var.select( idx );
}
示例5: getFieldsFromPrevious
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
/**
* Gets fields from previous steps and populate a ComboVar.
* @param comboVar the comboVar to populate
* @param TransMeta the source transformation
* @param StepMeta the source step
*/
public static final void getFieldsFromPrevious(ComboVar comboVar,TransMeta transMeta,StepMeta stepMeta)
{
String selectedField=null;
int indexField=-1;
try{
RowMetaInterface r = transMeta.getPrevStepFields(stepMeta);
selectedField=comboVar.getText();
comboVar.removeAll();
if (r!=null && !r.isEmpty()) {
r.getFieldNames();
comboVar.setItems(r.getFieldNames());
indexField=r.indexOfValue(selectedField);
}
// Select value if possible...
if(indexField>-1) comboVar.select(indexField); else { if(selectedField!=null) comboVar.setText(selectedField);};
}catch(KettleException ke){
new ErrorDialog(comboVar.getShell(),BaseMessages.getString(PKG, "BaseStepDialog.FailedToGetFieldsPrevious.DialogTitle"),
BaseMessages.getString(PKG, "BaseStepDialog.FailedToGetFieldsPrevious.DialogMessage"),ke);
}
}
示例6: addDatabases
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
public void addDatabases(ComboVar wConnection, Class<? extends DatabaseInterface> databaseType) {
for (int i = 0; i < transMeta.nrDatabases(); i++) {
DatabaseMeta ci = transMeta.getDatabase(i);
if (databaseType==null || ci.getDatabaseInterface().getClass().equals(databaseType)) {
wConnection.add(ci.getName());
}
}
// Add the metaDBConnectionName if we have it
// and it is already not added to the list in wConnection.
if (!Const.isEmpty(input.getDbConnectionName())) {
String[] arrayDatabaseList = wConnection.getItems();
if (arrayDatabaseList == null) {
List<String> databaseNameList = Arrays.asList(arrayDatabaseList);
if (!databaseNameList.contains(input.getDbConnectionName())) {
wConnection.add(input.getDbConnectionName());
}
}
}
}
示例7: getFieldsFromPrevious
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
/**
* Gets fields from previous steps and populate a ComboVar.
*
* @param comboVar the Combo Box (with Variables) to populate
* @param transMeta the transformation metadata
* @param stepMeta the step metadata
*/
public static final void getFieldsFromPrevious(ComboVar comboVar,TransMeta transMeta,StepMeta stepMeta)
{
String selectedField=null;
int indexField=-1;
try{
RowMetaInterface r = transMeta.getPrevStepFields(stepMeta);
selectedField=comboVar.getText();
comboVar.removeAll();
if (r!=null && !r.isEmpty()) {
r.getFieldNames();
comboVar.setItems(r.getFieldNames());
indexField=r.indexOfValue(selectedField);
}
// Select value if possible...
if(indexField>-1) comboVar.select(indexField); else { if(selectedField!=null) comboVar.setText(selectedField);};
}catch(KettleException ke){
new ErrorDialog(comboVar.getShell(),BaseMessages.getString(PKG, "BaseStepDialog.FailedToGetFieldsPrevious.DialogTitle"),
BaseMessages.getString(PKG, "BaseStepDialog.FailedToGetFieldsPrevious.DialogMessage"),ke);
}
}
示例8: setEncodings
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
private void setEncodings( ComboVar var ) {
// Encoding of the text file:
String encoding = Const.NVL( var.getText(), Const.getEnvironmentVariable( "file.encoding", "UTF-8" ) );
var.removeAll();
ArrayList<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
for ( int i = 0; i < values.size(); i++ ) {
Charset charSet = values.get( i );
var.add( charSet.displayName() );
}
// Now select the default!
int idx = Const.indexOfString( encoding, var.getItems() );
if ( idx >= 0 ) {
var.select( idx );
}
}
示例9: addDatabases
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
public void addDatabases( ComboVar wConnection, Class<? extends DatabaseInterface> databaseType ) {
for ( int i = 0; i < transMeta.nrDatabases(); i++ ) {
DatabaseMeta ci = transMeta.getDatabase( i );
if ( databaseType == null || ci.getDatabaseInterface().getClass().equals( databaseType ) ) {
wConnection.add( ci.getName() );
}
}
// Add the metaDBConnectionName if we have it
// and it is already not added to the list in wConnection.
if ( !Utils.isEmpty( input.getDbConnectionName() ) ) {
String[] arrayDatabaseList = wConnection.getItems();
if ( arrayDatabaseList == null ) {
List<String> databaseNameList = Arrays.asList();
if ( !databaseNameList.contains( input.getDbConnectionName() ) ) {
wConnection.add( input.getDbConnectionName() );
}
}
}
}
示例10: getArguments
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
private String[] getArguments(){
logDebug("getArguments");
List<String> list = new ArrayList<String>();
Control [] controls = metadataComposite.getChildren();
String text;
for (Control control : controls) {
if (!(control instanceof ComboVar)) continue;
ComboVar comboVar = (ComboVar)control;
text = comboVar.getText();
list.add(text);
}
String[] arguments = new String[list.size()];
list.toArray(arguments);
return arguments;
}
示例11: createWidget
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
@Override
protected ComboVar createWidget( Composite parent ) {
ComboVar comboVar = createComboVar( this.variableSpace, parent, SWT.BORDER );
String[] itemsArray = this.items.toArray( new String[ items.size() ] );
comboVar.setItems( itemsArray );
return comboVar;
}
示例12: createWidget
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
@Override protected Field<ComboVar> createWidget( Composite parent ) {
final Field<ComboVar> field = new Field<ComboVar>( parent, SWT.NONE );
prepareControl( field, new ComboVarBuilder( field, props, variableSpace ) );
for ( ModifyListener ml : listeners ) {
field.getControl().addModifyListener( ml );
}
for ( SelectionAdapter selectionListener : selectionListeners ) {
field.getControl().addSelectionListener( selectionListener );
}
return field;
}
示例13: testCreateWidget
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
@Test
public void testCreateWidget() throws Exception {
ComboVar comboVarMock = mock( ComboVar.class );
doReturn( comboVarMock ).when( comboVarBuilderSpy )
.createComboVar( any( VariableSpace.class ), any( Composite.class ), anyInt() );
when( comboVarBuilderSpy.addItem( anyString() ) ).thenCallRealMethod();
ComboVar comboVar = comboVarBuilderSpy.createWidget( parent );
assertNotNull( comboVar );
assertEquals( 0, comboVar.getItemCount() );
}
示例14: getFieldsFromPrevious
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
/**
* Gets fields from previous steps and populate a ComboVar.
*
* @param comboVar the comboVar to populate
* @param TransMeta the source transformation
* @param StepMeta the source step
*/
public static final void getFieldsFromPrevious( ComboVar comboVar, TransMeta transMeta, StepMeta stepMeta ) {
String selectedField = null;
int indexField = -1;
try {
RowMetaInterface r = transMeta.getPrevStepFields(stepMeta);
selectedField = comboVar.getText();
comboVar.removeAll();
if (r != null && !r.isEmpty()) {
r.getFieldNames();
comboVar.setItems(r.getFieldNames());
indexField = r.indexOfValue(selectedField);
}
// Select value if possible...
if (indexField > -1) {
comboVar.select(indexField);
} else {
if (selectedField != null) {
comboVar.setText(selectedField);
}
}
;
} catch (KettleException ke) {
new ErrorDialog(comboVar.getShell(),
BaseMessages.getString(PKG, "BaseStepDialog.FailedToGetFieldsPrevious.DialogTitle"),
BaseMessages.getString(PKG, "BaseStepDialog.FailedToGetFieldsPrevious.DialogMessage"), ke);
}
}
示例15: getFieldsFromPrevious
import org.pentaho.di.ui.core.widget.ComboVar; //导入依赖的package包/类
/**
* Gets fields from previous steps and populate a ComboVar.
*
* @param comboVar
* the comboVar to populate
* @param TransMeta
* the source transformation
* @param StepMeta
* the source step
*/
public static final void getFieldsFromPrevious( ComboVar comboVar, TransMeta transMeta, StepMeta stepMeta ) {
String selectedField = null;
int indexField = -1;
try {
RowMetaInterface r = transMeta.getPrevStepFields( stepMeta );
selectedField = comboVar.getText();
comboVar.removeAll();
if ( r != null && !r.isEmpty() ) {
r.getFieldNames();
comboVar.setItems( r.getFieldNames() );
indexField = r.indexOfValue( selectedField );
}
// Select value if possible...
if ( indexField > -1 ) {
comboVar.select( indexField );
} else {
if ( selectedField != null ) {
comboVar.setText( selectedField );
}
}
} catch ( KettleException ke ) {
new ErrorDialog( comboVar.getShell(),
BaseMessages.getString( PKG, "BaseStepDialog.FailedToGetFieldsPrevious.DialogTitle" ),
BaseMessages.getString( PKG, "BaseStepDialog.FailedToGetFieldsPrevious.DialogMessage" ), ke );
}
}