Java Code Examples for org.eclipse.swt.widgets.TableItem

The following examples show how to use org.eclipse.swt.widgets.TableItem. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: hop   Source File: SwitchCaseDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Copy information from the meta-data input to the dialog fields.
 */
public void getData() {
  wFieldName.setText( Const.NVL( input.getFieldname(), "" ) );
  wContains.setSelection( input.isContains() );
  wDataType.setText( ValueMetaBase.getTypeDesc( input.getCaseValueType() ) );
  wDecimalSymbol.setText( Const.NVL( input.getCaseValueDecimal(), "" ) );
  wGroupingSymbol.setText( Const.NVL( input.getCaseValueGroup(), "" ) );
  wConversionMask.setText( Const.NVL( input.getCaseValueFormat(), "" ) );

  for ( int i = 0; i < input.getCaseTargets().size(); i++ ) {
    TableItem item = wValues.table.getItem( i );
    SwitchCaseTarget target = input.getCaseTargets().get( i );
    if ( target != null ) {
      item.setText( 1, Const.NVL( target.caseValue, "" ) ); // The value
      item.setText( 2, target.caseTargetTransform == null ? "" : target.caseTargetTransform.getName() ); // The target transform name
    }
  }
  wValues.removeEmptyRows();
  wValues.setRowNums();
  wValues.optWidth( true );

  wDefaultTarget.setText( input.getDefaultTargetTransform() == null ? "" : input.getDefaultTargetTransform().getName() );

  wTransformName.selectAll();
  wTransformName.setFocus();
}
 
Example 2
Source Project: pentaho-kettle   Source File: TransDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void getTransLogTableOptions() {

    if ( previousLogTableIndex == LOG_INDEX_TRANS ) {
      // The connection...
      //
      transLogTable.setConnectionName( wLogconnection.getText() );
      transLogTable.setSchemaName( wLogSchema.getText() );
      transLogTable.setTableName( wLogTable.getText() );
      transLogTable.setLogInterval( wLogInterval.getText() );
      transLogTable.setLogSizeLimit( wLogSizeLimit.getText() );
      transLogTable.setTimeoutInDays( wLogTimeout.getText() );

      for ( int i = 0; i < transLogTable.getFields().size(); i++ ) {
        TableItem item = wOptionFields.table.getItem( i );

        LogTableField field = transLogTable.getFields().get( i );
        field.setEnabled( item.getChecked() );
        field.setFieldName( item.getText( 1 ) );
        if ( field.isSubjectAllowed() ) {
          field.setSubject( transMeta.findStep( item.getText( 2 ) ) );
        }
      }
    }
  }
 
Example 3
private void column2TableItem(NormalColumn referencedColumn) {
	TableItem tableItem = new TableItem(this.comparisonTable, SWT.NONE);

	tableItem.setText(0, Format.null2blank(referencedColumn
			.getLogicalName()));

	List<NormalColumn> foreignKeyList = this.referencedMap
			.get(referencedColumn.getRootReferencedColumn());

	TableEditor tableEditor = new TableEditor(this.comparisonTable);
	tableEditor.grabHorizontal = true;

	tableEditor.setEditor(this.createForeignKeyCombo(foreignKeyList),
			tableItem, 1);
	this.tableEditorList.add(tableEditor);
	this.editorReferencedMap.put(tableEditor, foreignKeyList);
}
 
Example 4
Source Project: pentaho-kettle   Source File: JobDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void getJobLogTableOptions( JobLogTable jobLogTable ) {

    // The connection...
    //
    jobLogTable.setConnectionName( wLogconnection.getText() );
    jobLogTable.setSchemaName( wLogSchema.getText() );
    jobLogTable.setTableName( wLogTable.getText() );
    jobLogTable.setLogInterval( wLogInterval.getText() );
    jobLogTable.setLogSizeLimit( wLogSizeLimit.getText() );
    jobLogTable.setTimeoutInDays( wLogTimeout.getText() );

    for ( int i = 0; i < jobLogTable.getFields().size(); i++ ) {
      TableItem item = wOptionFields.table.getItem( i );

      LogTableField field = jobLogTable.getFields().get( i );
      field.setEnabled( item.getChecked() );
      field.setFieldName( item.getText( 1 ) );
    }
  }
 
Example 5
Source Project: hop   Source File: PipelineRunConfigurationDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Copy data from the metadata into the dialog.
 */
private void getData() {

  wName.setText( Const.NVL( workingConfiguration.getName(), "" ) );
  wDescription.setText( Const.NVL( workingConfiguration.getDescription(), "" ) );
  if ( workingConfiguration.getEngineRunConfiguration() != null ) {
    wPluginType.setText( Const.NVL( workingConfiguration.getEngineRunConfiguration().getEnginePluginName(), "" ) );
    guiCompositeWidgets.setWidgetsContents( workingConfiguration.getEngineRunConfiguration(), wPluginSpecificComp,
      PipelineRunConfiguration.GUI_PLUGIN_ELEMENT_PARENT_ID );
  } else {
    wPluginType.setText( "" );
  }

  for ( int i = 0; i < workingConfiguration.getConfigurationVariables().size(); i++ ) {
    VariableValueDescription vvd = workingConfiguration.getConfigurationVariables().get( i );
    TableItem item = wVariables.table.getItem( i );
    int col = 1;
    item.setText( col++, Const.NVL( vvd.getName(), "" ) );
    item.setText( col++, Const.NVL( vvd.getValue(), "" ) );
    item.setText( col++, Const.NVL( vvd.getDescription(), "" ) );
  }
  wVariables.setRowNums();
  wVariables.optWidth( true );
}
 
Example 6
Source Project: olca-app   Source File: ParameterRedefTable.java    License: Mozilla Public License 2.0 6 votes vote down vote up
public void bindActions(Section section) {
	Action add = Actions.onAdd(this::add);
	Action remove = Actions.onRemove(this::remove);
	Action copy = TableClipboard.onCopy(table);
	Action paste = TableClipboard.onPaste(table, this::onPaste);
	Action usage = Actions.create(M.Usage, Icon.LINK.descriptor(), () -> {
		ParameterRedef redef = Viewers.getFirstSelected(table);
		if (redef != null) {
			ParameterUsagePage.show(redef.name);
		}
	});
	CommentAction.bindTo(section, "parameterRedefs",
			editor.getComments(), add, remove);
	Actions.bind(table, add, remove, copy, paste, usage);
	Tables.onDeletePressed(table, (e) -> remove());
	Tables.onDoubleClick(table, (event) -> {
		TableItem item = Tables.getItem(table, event);
		if (item == null)
			add();
	});
}
 
Example 7
Source Project: kettle-beam   Source File: BeamConsumeDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void getInfo( BeamConsumeMeta in ) {
  stepname = wStepname.getText(); // return value

  in.setBootstrapServers( wBootstrapServers.getText() );
  in.setTopics( wTopics.getText() );
  in.setKeyField( wKeyField.getText() );
  in.setMessageField( wMessageField.getText() );
  in.setGroupId( wGroupId.getText() );

  in.setUsingProcessingTime( wUseProcessingTime.getSelection() );
  in.setUsingLogAppendTime( wUseLogAppendTime.getSelection() );
  in.setUsingCreateTime( wUseCreateTime.getSelection() );
  in.setRestrictedToCommitted( wRestrictToCommitted.getSelection() );
  in.setAllowingCommitOnConsumedOffset( wAllowCommitConsumed.getSelection() );
  int nr = wConfigOptions.nrNonEmpty();
  in.getConfigOptions().clear();
  for (int i=0;i<nr;i++) {
    TableItem item = wConfigOptions.getNonEmpty( i );
    String parameter = item.getText( 1 );
    String value = item.getText( 2 );
    ConfigOption.Type type = ConfigOption.Type.getTypeFromName( item.getText( 3 ) );
    in.getConfigOptions().add(new ConfigOption(parameter, value, type));
  }

  input.setChanged();
}
 
Example 8
Source Project: pentaho-kettle   Source File: StarModelDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void addLogicalColumnToFactAttributesList(LogicalColumn column) {
  TableItem item = new TableItem(wFactAttributes.table, SWT.NONE);

  //  name, description, physical column name, data type, length, precision, source db, source table, source column, conversion remarks
  //
  int col=1;
  item.setText(col++, Const.NVL(ConceptUtil.getName(column,locale), ""));
  item.setText(col++, Const.NVL(ConceptUtil.getDescription(column, locale), ""));
  item.setText(col++, ConceptUtil.getAttributeType(column).name());
  item.setText(col++, Const.NVL((String)column.getProperty(DefaultIDs.LOGICAL_COLUMN_PHYSICAL_COLUMN_NAME), ""));
  DataType dataType = (DataType) column.getProperty(DefaultPropertyID.DATA_TYPE.getId());
  item.setText(col++, dataType==null ? "" : dataType.name() );
  item.setText(col++, Const.NVL(ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_DIMENSION_NAME), ""));
  item.setText(col++, Const.NVL(ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_LENGTH), ""));
  item.setText(col++, Const.NVL(ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_PRECISION), ""));
  item.setText(col++, Const.NVL(ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_DB), ""));
  item.setText(col++, Const.NVL(ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_TABLE), ""));
  item.setText(col++, Const.NVL(ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_COLUMN), ""));
  item.setText(col++, Const.NVL(ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_CONVERSION_REMARKS), ""));
}
 
Example 9
Source Project: pentaho-kettle   Source File: JobEntryJobDialog.java    License: Apache License 2.0 6 votes vote down vote up
protected void getParameters( JobMeta inputJobMeta ) {
  try {
    if ( inputJobMeta == null ) {
      JobEntryJob jej = new JobEntryJob();
      getInfo( jej );
      inputJobMeta = jej.getJobMeta( rep, metaStore, jobMeta );
    }
    String[] parameters = inputJobMeta.listParameters();

    String[] existing = wParameters.getItems( 1 );

    for ( int i = 0; i < parameters.length; i++ ) {
      if ( Const.indexOfString( parameters[i], existing ) < 0 ) {
        TableItem item = new TableItem( wParameters.table, SWT.NONE );
        item.setText( 1, parameters[i] );
      }
    }
    wParameters.removeEmptyRows();
    wParameters.setRowNums();
    wParameters.optWidth( true );
  } catch ( Exception e ) {
    new ErrorDialog(
      shell, BaseMessages.getString( PKG, "JobEntryJobDialog.Exception.UnableToLoadJob.Title" ), BaseMessages
      .getString( PKG, "JobEntryJobDialog.Exception.UnableToLoadJob.Message" ), e );
  }
}
 
Example 10
Source Project: pentaho-kettle   Source File: GetVariableDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void getInfo( GetVariableMeta input ) throws KettleException {

    stepname = wStepname.getText(); // return value
    // Table table = wFields.table;

    int count = wFields.nrNonEmpty();
    input.allocate( count );

    //CHECKSTYLE:Indentation:OFF
    for ( int i = 0; i < count; i++ ) {
      TableItem item = wFields.getNonEmpty( i );

      FieldDefinition currentField = input.getFieldDefinitions()[i];
      int index = 1;
      currentField.setFieldName( item.getText( index++ ) );
      currentField.setVariableString( item.getText( index++ ) );
      currentField.setFieldType( ValueMetaFactory.getIdForValueMeta( item.getText( index++ ) ) );
      currentField.setFieldFormat( item.getText( index++ ) );
      currentField.setFieldLength( Const.toInt( item.getText( index++ ), -1 ) );
      currentField.setFieldPrecision( Const.toInt( item.getText( index++ ), -1 ) );
      currentField.setCurrency( item.getText( index++ ) );
      currentField.setDecimal( item.getText( index++ ) );
      currentField.setGroup( item.getText( index++ ) );
      currentField.setTrimType( ValueMetaString.getTrimTypeByDesc( item.getText( index++ ) ) );
    }
  }
 
Example 11
Source Project: pentaho-kettle   Source File: DimensionLookupDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Get the fields from the previous step and use them as "update fields". Only get the the fields which are not yet in
 * use as key, or in the field table. Also ignore technical key, version, fromdate, todate.
 */
private void getUpdate() {
  try {
    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null && !r.isEmpty() ) {
      BaseStepDialog.getFieldsFromPrevious(
        r, wUpIns, 2, new int[] { 1, 2 }, new int[] {}, -1, -1, new TableItemInsertListener() {
          public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
            tableItem
              .setText( 3, BaseMessages.getString( PKG, "DimensionLookupDialog.TableItem.Insert.Label" ) );

            int idx = wKey.indexOfString( v.getName(), 2 );
            return idx < 0
              && !v.getName().equalsIgnoreCase( wTk.getText() )
              && !v.getName().equalsIgnoreCase( wVersion.getText() )
              && !v.getName().equalsIgnoreCase( wFromdate.getText() )
              && !v.getName().equalsIgnoreCase( wTodate.getText() );
          }
        } );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog(
      shell, BaseMessages.getString( PKG, "DimensionLookupDialog.FailedToGetFields.DialogTitle" ),
      BaseMessages.getString( PKG, "DimensionLookupDialog.FailedToGetFields.DialogMessage" ), ke );
  }
}
 
Example 12
Source Project: hop   Source File: PrioritizeStreamsDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void ok() {

    if ( Utils.isEmpty( wTransformName.getText() ) ) {
      return;
    }
    transformName = wTransformName.getText(); // return value

    int nrTransforms = wFields.nrNonEmpty();
    input.allocate( nrTransforms );
    for ( int i = 0; i < nrTransforms; i++ ) {
      TableItem ti = wFields.getNonEmpty( i );
      TransformMeta tm = pipelineMeta.findTransform( ti.getText( 1 ) );
      if ( tm != null ) {
        //CHECKSTYLE:Indentation:OFF
        input.getTransformName()[ i ] = tm.getName();
      }

    }
    dispose();
  }
 
Example 13
Source Project: pentaho-kettle   Source File: IfNullDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void get() {
  try {
    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null ) {
      TableItemInsertListener insertListener = new TableItemInsertListener() {
        public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
          return true;
        }
      };

      BaseStepDialog
        .getFieldsFromPrevious( r, wFields, 1, new int[] { 1 }, new int[] {}, -1, -1, insertListener );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.GetFieldsFailed.Title" ), BaseMessages
      .getString( PKG, "System.Dialog.GetFieldsFailed.Message" ), ke );
  }

}
 
Example 14
Source Project: hop   Source File: TableView.java    License: Apache License 2.0 6 votes vote down vote up
private void applyComboChange( TableItem row, int rownr, int colnr ) {
  String textData;
  if ( combo instanceof ComboVar ) {
    textData = ( (ComboVar) combo ).getText();
  } else {
    textData = ( (CCombo) combo ).getText();
  }
  row.setText( colnr, textData );
  combo.dispose();

  String[] afterEdit = getItemText( row );
  checkChanged( new String[][] { beforeEdit }, new String[][] { afterEdit }, new int[] { rownr } );

  selectionStart = -1;

  fireContentChangedListener( rownr, colnr, textData );
}
 
Example 15
Source Project: pentaho-kettle   Source File: OraBulkLoaderDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void getUpdate() {
  try {
    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null ) {
      TableItemInsertListener listener = new TableItemInsertListener() {
        public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
          if ( v.getType() == ValueMetaInterface.TYPE_DATE ) {
            // The default is date mask.
            tableItem.setText( 3, BaseMessages.getString( PKG, "OraBulkLoaderDialog.DateMask.Label" ) );
          } else {
            tableItem.setText( 3, "" );
          }
          return true;
        }
      };
      BaseStepDialog.getFieldsFromPrevious( r, wReturn, 1, new int[] { 1, 2 }, new int[] {}, -1, -1, listener );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog(
      shell, BaseMessages.getString( PKG, "OraBulkLoaderDialog.FailedToGetFields.DialogTitle" ), BaseMessages
        .getString( PKG, "OraBulkLoaderDialog.FailedToGetFields.DialogMessage" ), ke );
  }
}
 
Example 16
Source Project: hop   Source File: DataSetDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @param set The data set to load the dialog information into
 */
public void getInfo( DataSet set ) {
  set.setName( wName.getText() );
  set.setDescription( wDescription.getText() );
  set.setFolderName( wFolderName.getText() );
  set.setBaseFilename( wBaseFilename.getText() );
  set.getFields().clear();
  int nrFields = wFieldMapping.nrNonEmpty();
  for ( int i = 0; i < nrFields; i++ ) {
    TableItem item = wFieldMapping.getNonEmpty( i );
    int colnr = 1;
    String fieldName = item.getText( colnr++ );
    int type = ValueMetaFactory.getIdForValueMeta( item.getText( colnr++ ) );
    String format = item.getText( colnr++ );
    int length = Const.toInt( item.getText( colnr++ ), -1 );
    int precision = Const.toInt( item.getText( colnr++ ), -1 );
    String comment = item.getText( colnr++ );

    DataSetField field = new DataSetField( fieldName, type, length, precision, comment, format );
    set.getFields().add( field );
  }

}
 
Example 17
Source Project: kettle-beam   Source File: FileDefinitionDialog.java    License: Apache License 2.0 6 votes vote down vote up
public void getData() {
  wName.setText( Const.NVL( fileDefinition.getName(), "" ) );
  wDescription.setText( Const.NVL( fileDefinition.getDescription(), "" ) );
  wSeparator.setText( Const.NVL( fileDefinition.getSeparator(), "" ) );
  wEnclosure.setText( Const.NVL( fileDefinition.getEnclosure(), "" ) );

  List<FieldDefinition> fields = fileDefinition.getFieldDefinitions();
  for (int i=0;i<fields.size();i++) {
    FieldDefinition field = fields.get( i );
    TableItem item = wFields.table.getItem( i );
    item.setText(1, Const.NVL(field.getName(), ""));
    item.setText(2, Const.NVL(field.getKettleType(), ""));
    item.setText(3, Const.NVL(field.getFormatMask(), ""));
    item.setText(4, field.getLength()<0 ? "" : Integer.toString(field.getLength()));
    item.setText(5, field.getPrecision()<0 ? "" : Integer.toString(field.getPrecision()));
  }

  wName.selectAll();
  wName.setFocus();
}
 
Example 18
Source Project: arx   Source File: ComponentFilterTable.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns the item at the given location.
 * 
 * @param x
 * @param y
 * @return
 */
private int getItemColumnAt(int x, int y) {
    Point pt = new Point(x, y);
    int index = table.getTopIndex();
    while (index < table.getItemCount()) {
        final TableItem item = table.getItem(index);
        for (int i = 0; i < table.getColumns().length; i++) {
            final Rectangle rect = item.getBounds(i);
            if (rect.contains(pt)) {
                return i;
            }
        }
        index++;
    }
    return -1;
}
 
Example 19
Source Project: hop   Source File: ActionFilesExistDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Copy information from the meta-data input to the dialog fields.
 */
public void getData() {
  if ( action.getName() != null ) {
    wName.setText( action.getName() );
  }

  if ( action.getArguments() != null ) {
    for ( int i = 0; i < action.getArguments().length; i++ ) {
      TableItem ti = wFields.table.getItem( i );
      if ( action.getArguments()[ i ] != null ) {
        ti.setText( 1, action.getArguments()[ i ] );
      }
    }
    wFields.setRowNums();
    wFields.optWidth( true );
  }

  if ( action.getFilename() != null ) {
    wFilename.setText( action.getFilename() );
  }

  wName.selectAll();
  wName.setFocus();
}
 
Example 20
private void getVariablesData() {
  wVariables.clearAll( false );
  List<String> variableNames = new ArrayList<String>( configuration.getVariables().keySet() );
  Collections.sort( variableNames );

  for ( int i = 0; i < variableNames.size(); i++ ) {
    String variableName = variableNames.get( i );
    String variableValue = configuration.getVariables().get( variableName );

    if ( Const.indexOfString( variableName, abstractMeta.listParameters() ) < 0 ) {

      TableItem tableItem = new TableItem( wVariables.table, SWT.NONE );
      tableItem.setText( 1, variableName );
      tableItem.setText( 2, Const.NVL( variableValue, "" ) );
    }
  }
  wVariables.removeEmptyRows();
  wVariables.setRowNums();
  wVariables.optWidth( true );
}
 
Example 21
Source Project: hop   Source File: FileDefinitionDialog.java    License: Apache License 2.0 6 votes vote down vote up
public void getData() {
  wName.setText( Const.NVL( fileDefinition.getName(), "" ) );
  wDescription.setText( Const.NVL( fileDefinition.getDescription(), "" ) );
  wSeparator.setText( Const.NVL( fileDefinition.getSeparator(), "" ) );
  wEnclosure.setText( Const.NVL( fileDefinition.getEnclosure(), "" ) );

  List<FieldDefinition> fields = fileDefinition.getFieldDefinitions();
  for (int i=0;i<fields.size();i++) {
    FieldDefinition field = fields.get( i );
    TableItem item = wFields.table.getItem( i );
    item.setText(1, Const.NVL(field.getName(), ""));
    item.setText(2, Const.NVL(field.getHopType(), ""));
    item.setText(3, Const.NVL(field.getFormatMask(), ""));
    item.setText(4, field.getLength()<0 ? "" : Integer.toString(field.getLength()));
    item.setText(5, field.getPrecision()<0 ? "" : Integer.toString(field.getPrecision()));
  }

  wName.selectAll();
  wName.setFocus();
}
 
Example 22
private void createItems() {
	// Create the items for the table.
	regTable.removeAll();
	for (RegEntry regEntry : regEntries) {
		TableItem item = new TableItem(regTable, SWT.NONE);
		item.setData(regEntry);
		
		item.setText(0, regEntry.address);
		item.setText(1, regEntry.username);
		
		if (supportsPushReg) {
			item.setText(2, regEntry.namespace == null ? "" : regEntry.namespace); //$NON-NLS-1$
			item.setForeground(2, regEntry.isPushReg ? item.getForeground() : getGray(item));
			if (regEntry.isPushReg) {
				item.setText(3, Messages.RegMgmtPushRegSet);
			}
		}
	}
}
 
Example 23
public static boolean getPropertyNameTypePrimary( TableItem item, ValueMetaInterface valueMeta, int[] nameColumns, int[] typeColumns, int primaryColumn ) {

    for ( int nameColumn : nameColumns ) {
      // Initcap the names in there, remove spaces and weird characters, lowercase first character
      // Issue #13
      //   Text Area 1 --> textArea1
      //   My_Silly_Column --> mySillyColumn
      //
      String propertyName = Neo4jUtil.standardizePropertyName( valueMeta );

      item.setText( nameColumn, propertyName );
    }

    for ( int typeColumn : typeColumns ) {
      GraphPropertyType type = GraphPropertyType.getTypeFromKettle( valueMeta );
      item.setText( typeColumn, type.name() );
    }

    if ( primaryColumn > 0 ) {
      item.setText( primaryColumn, "N" );
    }

    return true;
  }
 
Example 24
Source Project: pentaho-kettle   Source File: AddXMLDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void getInfo( AddXMLMeta tfoi ) {
  tfoi.setEncoding( wEncoding.getText() );
  tfoi.setValueName( wOutputValue.getText() );
  tfoi.setRootNode( wRepeatElement.getText() );

  tfoi.setOmitXMLheader( wOmitXMLHeader.getSelection() );
  tfoi.setOmitNullValues( wOmitNullValues.getSelection() );

  // Table table = wFields.table;

  int nrfields = wFields.nrNonEmpty();

  tfoi.allocate( nrfields );

  for ( int i = 0; i < nrfields; i++ ) {
    XMLField field = new XMLField();

    TableItem item = wFields.getNonEmpty( i );
    field.setFieldName( item.getText( 1 ) );
    field.setElementName( item.getText( 2 ) );

    if ( field.getFieldName().equals( field.getElementName() ) ) {
      field.setElementName( "" );
    }

    field.setType( item.getText( 3 ) );
    field.setFormat( item.getText( 4 ) );
    field.setLength( Const.toInt( item.getText( 5 ), -1 ) );
    field.setPrecision( Const.toInt( item.getText( 6 ), -1 ) );
    field.setCurrencySymbol( item.getText( 7 ) );
    field.setDecimalSymbol( item.getText( 8 ) );
    field.setGroupingSymbol( item.getText( 9 ) );
    field.setNullString( item.getText( 10 ) );
    field.setAttribute( BaseMessages.getString( PKG, "System.Combo.Yes" ).equals( item.getText( 11 ) ) );
    field.setAttributeParentName( item.getText( 12 ) );

    // CHECKSTYLE:Indentation:OFF
    tfoi.getOutputFields()[i] = field;
  }
}
 
Example 25
Source Project: lapse-plus   Source File: SinkView.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void addCalls(TableItem[] items, StringBuffer buf) {
    for (int i = 0; i < items.length; i++) {
        TableItem item = items[i];
        SinkView.ViewMatch match = (SinkView.ViewMatch) item.getData();
        buf.append(match.toLongString());
        buf.append('\n');
    }
}
 
Example 26
Source Project: hop   Source File: IGetFieldsCapableTransformDialog.java    License: Apache License 2.0 5 votes vote down vote up
default Set<String> repopulateFields( final TransformMetaType meta, final Map<String, List<String>> previousFieldValues,
                                      final boolean reloadAllFields ) {
  // incoming field names
  final String[] incomingFieldNames = getFieldNames( meta );
  final Set<String> newFieldNames = new HashSet();
  for ( final String incomingFieldName : incomingFieldNames ) {
    final TableItem item = new TableItem( getFieldsTable().table, SWT.NONE );
    int columnIndexOffset = getFieldsTable().hasIndexColumn() ? 1 : 0;
    item.setText( columnIndexOffset, incomingFieldName );
    if ( previousFieldValues.containsKey( incomingFieldName ) ) {
      // remove the values corresponding to this field from previousFieldValues, that way, all that remains in the
      // previousFieldValues map is field names that are not incoming from other transforms, but rather may have been
      // entered manually by the user
      final List<String> values = previousFieldValues.remove( incomingFieldName );
      int columnIndex = 0;
      if ( !reloadAllFields && values != null ) {
        for ( final String value : values ) {
          item.setText( columnIndex++ + columnIndexOffset, value );
        }
      }
    } else {
      newFieldNames.add( incomingFieldName );
    }
  }
  // whatever is left in previousFieldValues represents user defined fields that may have been entered manually. If
  // we are not clearing and reloading, we should preserve these fields
  if ( !reloadAllFields ) {
    loadRemainingFields( previousFieldValues );
  }
  return newFieldNames;
}
 
Example 27
Source Project: ermasterr   Source File: EditAllAttributesDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void resetNormalColumn(final NormalColumn normalColumn) {
    for (int i = 0; i < columnList.size(); i++) {
        if (columnList.get(i) == normalColumn) {
            final TableItem tableItem = attributeTable.getItem(i);
            column2TableItem(null, normalColumn, tableItem);
            break;
        }
    }

    final List<NormalColumn> foreignKeyList = normalColumn.getForeignKeyList();

    for (final NormalColumn foreignKey : foreignKeyList) {
        resetNormalColumn(foreignKey);
    }
}
 
Example 28
Source Project: hop   Source File: WorkflowDialog.java    License: Apache License 2.0 5 votes vote down vote up
public String[] listParameterNames() {
  int count = wParamFields.nrNonEmpty();
  java.util.List<String> list = new ArrayList<>();
  for ( int i = 0; i < count; i++ ) {
    TableItem item = wParamFields.getNonEmpty( i );
    String parameterName = item.getText( 1 );
    if ( !Utils.isEmpty( parameterName ) ) {
      if ( !list.contains( parameterName ) ) {
        list.add( parameterName );
      }
    }
  }
  return list.toArray( new String[ list.size() ] );
}
 
Example 29
Source Project: arx   Source File: ViewClipboard.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns the index of the given item.
 *
 * @param item
 * @return
 */
private int getItemIndex(TableItem item) {
    int index = -1;
    for (int i = 0; i < table.getItemCount(); i++) {
        if (table.getItem(i) == item) {
            index = i;
            break;
        }
    }
    return index;
}
 
Example 30
Source Project: jenerate   Source File: OrderableFieldDialogImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private void handleTableSelectionChanged() {
    Table fieldTable = fieldViewer.getTable();
    TableItem[] items = fieldTable.getSelection();
    boolean validSelection = items != null && items.length > 0;
    boolean enableUp = validSelection;
    boolean enableDown = validSelection;
    if (validSelection) {
        int indices[] = fieldTable.getSelectionIndices();
        int max = fieldTable.getItemCount();
        enableUp = indices[0] != 0;
        enableDown = indices[indices.length - 1] < max - 1;
    }
    upButton.setEnabled(enableUp);
    downButton.setEnabled(enableDown);
}