Java Code Examples for org.eclipse.swt.widgets.TableItem#setText()

The following examples show how to use org.eclipse.swt.widgets.TableItem#setText() . 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 check out the related API usage on the sidebar.
Example 1
Source File: AbstractGeneratorConfigurationBlock.java    From sarl with Apache License 2.0 6 votes vote down vote up
private void refreshItem(final TableItem item) {
	final TableItemData data = (TableItemData) item.getData();
	item.setText(1, data.getSourceFolder());
	final String outputDirectory = getOutputDirectory(item);
	if ("".equals(outputDirectory)) { //$NON-NLS-1$
		item.setForeground(2, Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
		item.setText(2, getValue(data.getDefaultOutputDirectoryKey()));
	} else {
		item.setForeground(2, null);
		item.setText(2, outputDirectory);
	}
	if (isIgnored(item)) {
		item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
	} else {
		item.setForeground(null);
	}
}
 
Example 2
Source File: TableView.java    From hop with 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 3
Source File: SwitchCaseDialog.java    From pentaho-kettle with 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.caseTargetStep == null ? "" : target.caseTargetStep.getName() ); // The target step name
    }
  }
  wValues.removeEmptyRows();
  wValues.setRowNums();
  wValues.optWidth( true );

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

  wStepname.selectAll();
  wStepname.setFocus();
}
 
Example 4
Source File: UpdateDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void get() {
  try {
    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null && !r.isEmpty() ) {
      TableItemInsertListener listener = new TableItemInsertListener() {
        public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
          tableItem.setText( 2, "=" );
          return true;
        }
      };
      BaseStepDialog.getFieldsFromPrevious( r, wKey, 1, new int[] { 1, 3 }, new int[] {}, -1, -1, listener );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog(
      shell, BaseMessages.getString( PKG, "UpdateDialog.FailedToGetFields.DialogTitle" ), BaseMessages
        .getString( PKG, "UpdateDialog.FailedToGetFields.DialogMessage" ), ke );
  }
}
 
Example 5
Source File: ExtnlResBindSection.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * Bind button - enabled only when one dependency is selected, and one External Resource, not
 * already bound to this key, is selected.
 */
private void handleBind() {
  TreeItem xrItem = tree.getSelection()[0];
  if (null != xrItem.getParentItem())
    xrItem = xrItem.getParentItem();
  ExternalResourceDescription xrd = getXRDescriptionFromTreeItem(xrItem);

  TableItem keyItem = resourceDependencySection.getTable().getSelection()[0];

  ExternalResourceBinding xrb = new ExternalResourceBinding_impl();
  String key = keyItem.getText(ResourceDependencySection.KEY_COL);
  xrb.setKey(key);
  xrb.setResourceName(xrd.getName());
  getResourceManagerConfiguration().addExternalResourceBinding(xrb);
  addBindingToGUI(xrItem, key, xrb);
  xrItem.setExpanded(true);
  keyItem.setText(0, "Bound");
  keyItem.getParent().getColumn(0).pack();
  setFileDirty();
}
 
Example 6
Source File: FieldsTab.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void populateFieldData() {
  TableItem messageItem = fieldsTable.getTable().getItem( 0 );
  messageItem.setText( 1, BaseMessages.getString( PKG, "JmsConsumerDialog.InputName.Message" ) );
  messageItem.setText( 2, message );
  messageItem.setText( 3, STRING_DESC );

  TableItem topicItem = fieldsTable.getTable().getItem( 1 );
  topicItem.setText( 1, BaseMessages.getString( PKG, "JmsConsumerDialog.InputName.Destination" ) );
  topicItem.setText( 2, destination );
  topicItem.setText( 3, STRING_DESC );

  TableItem messageIdItem = fieldsTable.getTable().getItem( 2 );
  messageIdItem.setText( 1, BaseMessages.getString( PKG, "JmsConsumerDialog.InputName.MessageId" ) );
  messageIdItem.setText( 2, messageId );
  messageIdItem.setText( 3, STRING_DESC );

  TableItem jmsTimestampIdItem = fieldsTable.getTable().getItem( 3 );
  jmsTimestampIdItem.setText( 1, BaseMessages.getString( PKG, "JmsConsumerDialog.InputName.JMSTimestamp" ) );
  jmsTimestampIdItem.setText( 2, jmsTimestamp );
  jmsTimestampIdItem.setText( 3, STRING_DESC );

  TableItem jmsRedeliveredItem = fieldsTable.getTable().getItem( 4 );
  jmsRedeliveredItem.setText( 1, BaseMessages.getString( PKG, "JmsConsumerDialog.InputName.JMSRedelivered" ) );
  jmsRedeliveredItem.setText( 2, jmsRedelivered );
  jmsRedeliveredItem.setText( 3, STRING_DESC );
}
 
Example 7
Source File: SetValueFieldDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Copy information from the meta-data input to the dialog fields.
 */
public void getData() {
  wStepname.setText( stepname );

  for ( int i = 0; i < input.getFieldName().length; i++ ) {
    TableItem item = wFields.table.getItem( i );
    String name = input.getFieldName()[i];
    String type = input.getReplaceByFieldValue()[i];

    if ( name != null ) {
      item.setText( 1, name );
    }
    if ( type != null ) {
      item.setText( 2, type );
    }
  }

  wFields.setRowNums();
  wFields.optWidth( true );

  wStepname.selectAll();
  wStepname.setFocus();
}
 
Example 8
Source File: ResourceChartDialogEx.java    From logbook with MIT License 5 votes vote down vote up
/**
 * テーブルボディーをセットする
 */
private void setTableBody() {
    for (int i = 0; i < this.body.size(); i++) {
        String[] line = this.body.get(i);
        TableItem item = new TableItem(this.table, SWT.NONE);
        item.setText(line);
        // 偶数行に背景色を付ける
        if ((i % 2) != 0) {
            item.setBackground(SWTResourceManager.getColor(AppConstants.ROW_BACKGROUND));
        } else {
            item.setBackground(null);
        }
    }
}
 
Example 9
Source File: SqlStatementsDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Copy information from the meta-data input to the dialog fields.
 */
public void getData() {
  for ( int i = 0; i < stats.size(); i++ ) {
    SqlStatement stat = stats.get( i );
    TableItem ti = wFields.table.getItem( i );

    String name = stat.getTransformName();
    DatabaseMeta dbinfo = stat.getDatabase();
    String sql = stat.getSql();
    String error = stat.getError();

    if ( name != null ) {
      ti.setText( 1, name );
    }
    if ( dbinfo != null ) {
      ti.setText( 2, dbinfo.getName() );
    }
    if ( sql != null ) {
      ti.setText( 3, sql );
    }
    if ( error != null ) {
      ti.setText( 4, error );
    }

    Color col = ti.getBackground();
    if ( stat.hasError() ) {
      col = red;
    }
    ti.setBackground( col );
  }
  wFields.setRowNums();
  wFields.optWidth( true );
}
 
Example 10
Source File: BonitaContentProposalAdapter.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void handleSetData(final Event event) {
    final TableItem item = (TableItem) event.item;
    final int index = proposalTable.indexOf(item);

    if (0 <= index && index < proposals.length) {
        final IContentProposal current = proposals[index];
        item.setText(getString(current));
        item.setImage(getImage(current));
        item.setData(current);
    } else {
        // this should not happen, but does on win32
    }
}
 
Example 11
Source File: TableView.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void setRowNums() {
  for ( int i = 0; i < table.getItemCount(); i++ ) {
    TableItem item = table.getItem( i );
    if ( item != null ) {
      String num = "" + ( i + 1 );
      // for(int j=num.length();j<3;j++) num="0"+num;
      if ( !item.getText( 0 ).equals( num ) ) {
        item.setText( 0, num );
      }
    }
  }
}
 
Example 12
Source File: TableComboViewer.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void doResetItem(Item item) {
    TableItem tableItem = (TableItem) item;
    int columnCount = Math.max(1, tableCombo.getTable().getColumnCount());
    for (int i = 0; i < columnCount; i++) {
        tableItem.setText(i, ""); //$NON-NLS-1$
        if (tableItem.getImage(i) != null) {
            tableItem.setImage(i, null);
        }
    }
}
 
Example 13
Source File: ActionPipelineDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
private void getParameters(PipelineMeta inputPipelineMeta) {
    try {
        if (inputPipelineMeta == null) {
            ActionPipeline jet = new ActionPipeline();
            getInfo(jet);
            inputPipelineMeta = jet.getPipelineMeta(metadataProvider, workflowMeta);
        }
        String[] parameters = inputPipelineMeta.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, "ActionPipelineDialog.Exception.UnableToLoadPipeline.Title"),
                BaseMessages.getString(PKG, "ActionPipelineDialog.Exception.UnableToLoadPipeline.Message"), e);
    }

}
 
Example 14
Source File: TableView.java    From hop with Apache License 2.0 5 votes vote down vote up
public void add( String... string ) {
  TableItem item = new TableItem( table, SWT.NONE );
  for ( int i = 0; i < string.length && i + 1 < table.getColumnCount(); i++ ) {
    if ( string[ i ] != null ) {
      item.setText( i + 1, string[ i ] );
    }
  }
}
 
Example 15
Source File: TableView.java    From hop with Apache License 2.0 5 votes vote down vote up
private void addItem( int pos, String[] str ) {
  TableItem item = new TableItem( table, SWT.NONE, pos );
  for ( int i = 0; i < str.length; i++ ) {
    item.setText( i + 1, str[ i ] );
  }
  setModified();
}
 
Example 16
Source File: InjectorDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Copy information from the meta-data input to the dialog fields.
 */
public void getData() {
  for ( int i = 0; i < input.getFieldname().length; i++ ) {
    TableItem item = wFields.table.getItem( i );
    item.setText( 1, input.getFieldname()[i] );
    item.setText( 2, ValueMetaFactory.getValueMetaName( input.getType()[i] ) );
    int len = input.getLength()[i];
    int prc = input.getPrecision()[i];
    item.setText( 3, len >= 0 ? "" + len : "" );
    item.setText( 4, prc >= 0 ? "" + prc : "" );
  }

  wStepname.selectAll();
  wStepname.setFocus();
}
 
Example 17
Source File: Leistungscodes.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * (re)build the table for the billing systems, populate the table with items
 */
public void reload(){
	// *** remove all items first
	table.removeAll();
	// *** and rebuild the table contents
	if (systeme != null) {
		for (String s : systeme) {
			String cfgkey = Preferences.LEISTUNGSCODES_CFG_KEY + "/" + s + "/"; //$NON-NLS-1$ //$NON-NLS-2$
			TableItem it = new TableItem(table, SWT.NONE);
			String name = CoreHub.globalCfg.get(cfgkey + "name", "default"); //$NON-NLS-1$ //$NON-NLS-2$
			it.setText(0, name);
			String code = CoreHub.globalCfg.get(cfgkey + "leistungscodes", "?");//$NON-NLS-1$ //$NON-NLS-2$
			String ausgabe =  CoreHub.globalCfg.get(cfgkey + "standardausgabe", "?");//$NON-NLS-1$ //$NON-NLS-2$
			it.setText(1,  getLocalizedLeistungscode(code)); //$NON-NLS-1$ //$NON-NLS-2$
			it.setText(2, getLocalizedAusgabe(ausgabe)); 
			StringBuilder sql = new StringBuilder();
			TimeTool actdat = new TimeTool();
			MultiplikatorList multis = new MultiplikatorList("VK_PREISE", name); //$NON-NLS-1$
			String tp = Double.toString(multis.getMultiplikator(actdat));
			if (StringTool.isNothing(tp)) {
				if (CoreHub.getSystemLogLevel() > Log.INFOS) {
					SWTHelper.alert(Messages.Leistungscodes_didNotFindMulitplier,
						Messages.Leistungscodes_query + sql.toString());
				}
				tp = "1.0"; //$NON-NLS-1$
			}
			it.setText(3, tp);
		}
	}
}
 
Example 18
Source File: TextFileInputDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void getFixed() {
  TextFileInputMeta info = new TextFileInputMeta();
  getInfo( info );

  Shell sh = new Shell( shell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN );

  try {
    List<String> rows = getFirst( 50, false );
    fields = getFields( info, rows );

    final TextFileImportWizardPage1 page1 = new TextFileImportWizardPage1( "1", props, rows, fields );
    page1.createControl( sh );
    final TextFileImportWizardPage2 page2 = new TextFileImportWizardPage2( "2", props, rows, fields );
    page2.createControl( sh );

    Wizard wizard = new Wizard() {
      public boolean performFinish() {
        wFields.clearAll( false );

        for ( TextFileInputFieldInterface field1 : fields ) {
          TextFileInputField field = (TextFileInputField) field1;
          if ( !field.isIgnored() && field.getLength() > 0 ) {
            TableItem item = new TableItem( wFields.table, SWT.NONE );
            item.setText( 1, field.getName() );
            item.setText( 2, "" + field.getTypeDesc() );
            item.setText( 3, "" + field.getFormat() );
            item.setText( 4, "" + field.getPosition() );
            item.setText( 5, field.getLength() < 0 ? "" : "" + field.getLength() );
            item.setText( 6, field.getPrecision() < 0 ? "" : "" + field.getPrecision() );
            item.setText( 7, "" + field.getCurrencySymbol() );
            item.setText( 8, "" + field.getDecimalSymbol() );
            item.setText( 9, "" + field.getGroupSymbol() );
            item.setText( 10, "" + field.getNullString() );
            item.setText( 11, "" + field.getIfNullValue() );
            item.setText( 12, "" + field.getTrimTypeDesc() );
            item.setText( 13, field.isRepeated() ? BaseMessages.getString( PKG, "System.Combo.Yes" ) : BaseMessages
              .getString( PKG, "System.Combo.No" ) );
          }

        }
        int size = wFields.table.getItemCount();
        if ( size == 0 ) {
          new TableItem( wFields.table, SWT.NONE );
        }

        wFields.removeEmptyRows();
        wFields.setRowNums();
        wFields.optWidth( true );

        input.setChanged();

        return true;
      }
    };

    wizard.addPage( page1 );
    wizard.addPage( page2 );

    WizardDialog wd = new WizardDialog( shell, wizard );
    WizardDialog.setDefaultImage( GUIResource.getInstance().getImageWizard() );
    wd.setMinimumPageSize( 700, 375 );
    wd.updateSize();
    wd.open();
  } catch ( Exception e ) {
    new ErrorDialog( shell, BaseMessages.getString( PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogTitle" ),
      BaseMessages.getString( PKG, "TextFileInputDialog.ErrorShowingFixedWizard.DialogMessage" ), e );
  }
}
 
Example 19
Source File: InfoPage.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected void initContent(final PageContainer container,
		Composite composite) {
	mapBrowser.getGeoMap().addInternalGeoMapListener(this);

	addHeaderRow(container, composite, "Actions");
	addActionLink(container, composite, "<a>Back to main menu</a>",
			new SelectionAdapter() {
				@Override
				public void widgetSelected(SelectionEvent e) {
					container.showPage(0);
				}
			});

	addHeaderRow(container, composite, "Infos");
	addInfoText(container, composite,
			"The following search results were retrieved from openstreetmap.org. "
					+ "Double-click to open a location.");

	table = new Table(composite, SWT.FULL_SELECTION | SWT.MULTI
			| SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	table.setLayoutData(
			new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));

	table.setHeaderVisible(true);
	table.setLinesVisible(true);
	TableColumn column1 = new TableColumn(table, SWT.NONE);
	column1.setText("Place");
	column1.setWidth(120);
	TableColumn column2 = new TableColumn(table, SWT.NONE);
	column2.setText("Place");
	column2.setWidth(160);

	for (Spec spec : specs) {
		TableItem item = new TableItem(table, SWT.NONE);
		item.setText(0, spec.key);
	}

	addHeaderRow(container, composite, "Authors Remarks");
	addInfoText(container, composite,
			"The number of image fetcher threads determines how many background tasks are "
					+ "run simultaneously to fetch tiles. The search is also performed in the background. "
					+ "The tilecache fill never drops below its maximum size once its filled, but the eldest "
					+ "entries are discarded on a LRU (Least-Recently-Used) basis.");
	addInfoText(container, composite,
			"The MapWidget can be used without all of this quite useless showcase application. Its "
					+ "main purpose is to showcase the MapWidget.");

	addHeaderRow(container, composite, "Quick Help");
	addInfoText(container, composite,
			"Use the mouse wheel to zoom in and zoom out. Drag the mouse to change "
					+ "your position on the map");
	updateInfos();
}
 
Example 20
Source File: AbstractDesignElementPicker.java    From XPagesExtensionLibrary with Apache License 2.0 3 votes vote down vote up
/**
 * Helper to create a TableItem used to represent a design element in the table of design elements.
 *  
 * @param parent - the parent table to add the tableItem to
 * @param label - the label to display in the table
 * @param value - the value to set in source, if this tableItem is selected. 
 * @return
 */
private TableItem createTableItem(Table parent, String label, String value){
     TableItem tableItem = new TableItem(parent, SWT.NONE); // $NON-NLS-1$
     tableItem.setText(label);
     tableItem.setData(TABLE_ITEM_DATA_VALUE_STRING, value);
     return tableItem;
 }