Java Code Examples for org.eclipse.swt.widgets.TableItem#getBackground()
The following examples show how to use
org.eclipse.swt.widgets.TableItem#getBackground() .
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: SqlStatementsDialog.java From hop with Apache License 2.0 | 5 votes |
/** * 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 2
Source File: ViewList.java From arx with Apache License 2.0 | 5 votes |
/** * Creates an item in the list. * * @param item * @param index */ private void createItem(final TableItem item, final int index) { final ARXNode node = list.get(index); final String transformation = Arrays.toString(node.getTransformation()); item.setText(0, transformation); final String anonymity = node.getAnonymity().toString(); item.setText(2, anonymity); String min = null; if (node.getLowestScore() != null) { min = node.getLowestScore().toString() + " [" + SWTUtil.getPrettyString(asRelativeValue(node.getLowestScore())) + "%]"; //$NON-NLS-1$ //$NON-NLS-2$ } else { min = Resources.getMessage("ListView.7"); //$NON-NLS-1$ } item.setText(4, min); String max = null; if (node.getHighestScore() != null) { max = node.getHighestScore().toString() + " [" + SWTUtil.getPrettyString(asRelativeValue(node.getHighestScore())) + "%]"; //$NON-NLS-1$ //$NON-NLS-2$ } else { max = Resources.getMessage("ListView.10"); //$NON-NLS-1$ } item.setText(5, max); item.setData(node); item.setImage(1, getSymbol(super.getInnerColor(node))); item.setImage(3, getSymbol(super.getUtilityColor(node))); this.background = this.background != null ? this.background : item.getBackground(); }
Example 3
Source File: SQLStatementsDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * 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.getStepname(); 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 4
Source File: CheckResultDialog.java From hop with Apache License 2.0 | 4 votes |
/** * Copy information from the meta-data input to the dialog fields. */ public void getData() { wFields.table.removeAll(); for ( int i = 0; i < remarks.size(); i++ ) { ICheckResult cr = remarks.get( i ); if ( show_successful_results || cr.getType() != ICheckResult.TYPE_RESULT_OK ) { TableItem ti = new TableItem( wFields.table, SWT.NONE ); // MB - Support both Action and Transform Checking // 6/25/07 ICheckResultSource sourceMeta = cr.getSourceInfo(); if ( sourceMeta != null ) { ti.setText( 1, sourceMeta.getName() ); } else { ti.setText( 1, "<global>" ); } ti.setText( 2, cr.getType() + " - " + cr.getTypeDesc() ); ti.setText( 3, cr.getText() ); Color col = ti.getBackground(); switch ( cr.getType() ) { case ICheckResult.TYPE_RESULT_OK: col = green; break; case ICheckResult.TYPE_RESULT_ERROR: col = red; break; case ICheckResult.TYPE_RESULT_WARNING: col = yellow; break; case ICheckResult.TYPE_RESULT_COMMENT: default: break; } ti.setBackground( col ); } } if ( wFields.table.getItemCount() == 0 ) { wFields.clearAll( false ); } wFields.setRowNums(); wFields.optWidth( true ); if ( show_successful_results ) { wlFields.setText( STRING_HIDE_REMARKS ); wNoOK.setText( STRING_HIDE_SUCESSFUL ); } else { wlFields.setText( STRING_SHOW_REMARKS ); wNoOK.setText( STRING_SHOW_SUCESSFUL ); } shell.layout(); }
Example 5
Source File: TmfEventsTable.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
@Override public void handleEvent(Event event) { TableItem item = (TableItem) event.item; List<?> styleRanges = (List<?>) item.getData(Key.STYLE_RANGES); GC gc = event.gc; Color background = item.getBackground(event.index); /* * Paint the background if it is not the default system color. In * Windows, if you let the widget draw the background, it will not * show the item's background color if the item is selected or hot. * If there are no style ranges and the item background is the * default system color, we do not want to paint it or otherwise we * would override the platform theme (e.g. alternating colors). */ if (styleRanges != null || !background.equals(item.getParent().getBackground())) { // we will paint the table item's background event.detail &= ~SWT.BACKGROUND; // paint the item's default background gc.setBackground(background); gc.fillRectangle(event.x, event.y, event.width, event.height); } /* * We will paint the table item's foreground. In Windows, if you * paint the background but let the widget draw the foreground, it * will override your background, unless the item is selected or * hot. */ event.detail &= ~SWT.FOREGROUND; // paint the highlighted background for all style ranges if (styleRanges != null) { Rectangle textBounds = item.getTextBounds(event.index); String text = item.getText(event.index); for (Object o : styleRanges) { if (o instanceof StyleRange) { StyleRange styleRange = (StyleRange) o; if (styleRange.data.equals(event.index)) { int startIndex = styleRange.start; int endIndex = startIndex + styleRange.length; int startX = gc.textExtent(text.substring(0, startIndex)).x; int endX = gc.textExtent(text.substring(0, endIndex)).x; gc.setBackground(styleRange.background); gc.fillRectangle(textBounds.x + startX, textBounds.y, (endX - startX), textBounds.height); } } } } }
Example 6
Source File: CheckResultDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
/** * Copy information from the meta-data input to the dialog fields. */ public void getData() { wFields.table.removeAll(); for ( int i = 0; i < remarks.size(); i++ ) { CheckResultInterface cr = remarks.get( i ); if ( show_successful_results || cr.getType() != CheckResultInterface.TYPE_RESULT_OK ) { TableItem ti = new TableItem( wFields.table, SWT.NONE ); // MB - Support both JobEntry and Step Checking // 6/25/07 CheckResultSourceInterface sourceMeta = cr.getSourceInfo(); if ( sourceMeta != null ) { ti.setText( 1, sourceMeta.getName() ); } else { ti.setText( 1, "<global>" ); } ti.setText( 2, cr.getType() + " - " + cr.getTypeDesc() ); ti.setText( 3, cr.getText() ); Color col = ti.getBackground(); switch ( cr.getType() ) { case CheckResultInterface.TYPE_RESULT_OK: col = green; break; case CheckResultInterface.TYPE_RESULT_ERROR: col = red; break; case CheckResultInterface.TYPE_RESULT_WARNING: col = yellow; break; case CheckResultInterface.TYPE_RESULT_COMMENT: default: break; } ti.setBackground( col ); } } if ( wFields.table.getItemCount() == 0 ) { wFields.clearAll( false ); } wFields.setRowNums(); wFields.optWidth( true ); if ( show_successful_results ) { wlFields.setText( STRING_HIDE_REMARKS ); wNoOK.setText( STRING_HIDE_SUCESSFUL ); } else { wlFields.setText( STRING_SHOW_REMARKS ); wNoOK.setText( STRING_SHOW_SUCESSFUL ); } shell.layout(); }