Java 类org.eclipse.jface.viewers.ViewerCell 实例源码

项目:ide-plugins    文件:PluginsSWT.java   
@Override
protected Composite createViewerToolTipContentArea(Event event, ViewerCell cell, Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    composite.setBackground(rowColorBack);
    Plugin plugin = (Plugin) cell.getElement();

    Hyperlink button = new Hyperlink(composite, SWT.FLAT);
    button.setText("\uf05A");
    button.setFont(fontAwesome);
    button.setBackground(composite.getBackground());
    button.setForeground(rowColorTitle);
    button.setUnderlined(false);
    button.addListener (SWT.MouseDown, e -> Program.launch(GLUON_PLUGIN_URL + plugin.getUrl()));
    button.setToolTipText("Click to access the service's JavaDoc");

    Label text = new Label(composite, SWT.LEFT);
    final String description = plugin.getDescription();
    text.setText(description.contains(".") ? description.substring(0, description.indexOf(".")) : description);
    text.setBackground(composite.getBackground());
    text.setForeground(rowColorTitle);
    composite.pack();
    return composite;
}
项目:neoscada    文件:LabelProviderImpl.java   
@Override
public void update ( final ViewerCell cell )
{
    final Object ele = cell.getElement ();
    if ( ele instanceof KeyProviderFactory )
    {
        cell.setText ( ele.toString () );
    }
    else if ( ele instanceof KeyProvider )
    {
        final KeyProvider keyProvider = (KeyProvider)ele;
        cell.setText ( keyProvider.toString () );
        cell.setImage ( keyProvider.isLocked () ? this.locked : null );
    }
    else if ( ele instanceof org.eclipse.scada.sec.ui.providers.Key )
    {
        final org.eclipse.scada.sec.ui.providers.Key key = (org.eclipse.scada.sec.ui.providers.Key)ele;
        cell.setText ( key.toString () );
        cell.setImage ( key.isLocked () ? this.locked : null );
    }
}
项目:neoscada    文件:VariantLabelProvider.java   
@Override
public void update ( final ViewerCell cell )
{
    final DecoratedEvent event = (DecoratedEvent)cell.getElement ();

    if ( this.decoration != null )
    {
        switch ( this.decoration )
        {
        case ACTOR:
            this.labelProviderSupport.decorateWithActorType ( event, cell );
            break;
        case MONITOR:
            this.labelProviderSupport.decorateWithMonitorState ( event, cell );
            break;
        }
    }

    if ( this.key != null && !this.key.isEmpty () )
    {
        cell.setText ( this.labelProviderSupport.toLabel ( event, this.key ) );
    }

}
项目:neoscada    文件:LabelProviderSupport.java   
public void decorateWithActorType ( final DecoratedEvent event, final ViewerCell cell )
{
    final String value = Variant.valueOf ( event.getEvent ().getField ( Fields.ACTOR_TYPE ) ).asString ( "" );
    if ( "USER".equalsIgnoreCase ( value ) ) //$NON-NLS-1$
    {
        cell.setImage ( this.userImage );
    }
    else if ( "SYSTEM".equalsIgnoreCase ( value ) ) //$NON-NLS-1$
    {
        cell.setImage ( this.systemImage );
    }
    else
    {
        cell.setImage ( null );
    }
}
项目:neoscada    文件:FlagsDetailsPart.java   
@Override
public void update ( final ViewerCell cell )
{
    final Object ele = cell.getElement ();
    if ( ele instanceof GroupEntry )
    {
        cell.setText ( String.format ( Messages.FlagsDetailsPart_GroupSumFormat, ( (GroupEntry)ele ).getActiveCount (), ( (GroupEntry)ele ).getCount () ) );
    }
    else if ( ele instanceof AttributeEntry )
    {
        final StyledString str = new StyledString ();

        if ( ( (AttributeEntry)ele ).isActive () )
        {
            str.append ( Messages.FlagsDetailsPart_ActiveMarker, this.activeStyler );
        }
        else
        {
            str.append ( Messages.FlagsDetailsPart_InactiveMarker, this.inactiveStyler );
        }

        cell.setText ( str.getString () );
        cell.setStyleRanges ( str.getStyleRanges () );
    }
}
项目:neoscada    文件:FactoryCellLabelProvider.java   
@Override
public void update ( final ViewerCell cell )
{
    final ConfigurationDescriptor cfg = (ConfigurationDescriptor)cell.getElement ();
    switch ( cell.getColumnIndex () )
    {
    case 0:
        cell.setText ( cfg.getConfigurationInformation ().getId () );
        break;
    case 1:
        cell.setText ( "" + cfg.getConfigurationInformation ().getState () );
        break;
    }

    if ( cfg.getConfigurationInformation ().getErrorInformation () != null )
    {
        cell.setBackground ( Display.getCurrent ().getSystemColor ( SWT.COLOR_RED ) );
    }
    else
    {
        cell.setBackground ( null );
    }

    super.update ( cell );
}
项目:neoscada    文件:ConnectionAnalyzer.java   
@Override
public void update ( final ViewerCell cell )
{
    final Entry entry = (Entry)cell.getElement ();
    switch ( cell.getColumnIndex () )
    {
    case 0:
        cell.setText ( entry.getHandlerName () );
        break;
    case 1:
        cell.setText ( entry.getState ().toString () );
        break;
    case 2:
        final String errorText = makeError ( entry.getError () );
        // only update when we have an error to prevent
        // the error from disapearing
        if ( errorText != null )
        {
            cell.setText ( errorText );
        }
        break;
    }
}
项目:neoscada    文件:ItemCellLabelProvider.java   
private void updateAttributePair ( final AttributePair attributePair, final ViewerCell cell )
{
    switch ( cell.getColumnIndex () )
    {
        case 0:
            cell.setText ( attributePair.key );
            break;
        case 2:
            if ( attributePair.value != null )
            {
                cell.setText ( attributePair.value.getType ().name () );
            }
            break;
        case 3:
            if ( attributePair.value != null )
            {
                cell.setText ( attributePair.value.asString ( "<null>" ) ); //$NON-NLS-1$
            }
            break;
        default:
            break;
    }
}
项目:neoscada    文件:NameLabelProviderImpl.java   
@Override
public void update ( final ViewerCell cell )
{
    final Object element = cell.getElement ();
    if ( element instanceof TreeNode )
    {
        final TreeNode node = (TreeNode)element;
        cell.setText ( node.getName () );

        final CurrentStyle style = node.getStyle ();
        cell.setImage ( style.image );
        cell.setFont ( style.font );
        cell.setForeground ( style.foreground );
        cell.setBackground ( style.background );
    }
}
项目:neoscada    文件:ServerLabelProvider.java   
protected void update ( final ViewerCell cell, final ServerEndpoint element )
{
    final StyledString str = new StyledString ();

    final boolean running = element.isRunning ();

    str.append ( element.getLabel () );

    cell.setText ( str.getString () );
    cell.setStyleRanges ( str.getStyleRanges () );

    if ( element.getError () != null )
    {
        cell.setImage ( this.errorImage );
    }
    else
    {
        cell.setImage ( running ? this.runningImage : this.stoppedImage );
    }
}
项目:eclipse-plugin-commander    文件:KaviListColumns.java   
@SuppressWarnings("unchecked")
private RankedItem<T> applyCellDefaultStyles(final ColumnOptions<T> options, ViewerCell cell) {
    final RankedItem<T> rankedItem = (RankedItem<T>) cell.getElement();
    cell.setForeground(fromRegistry(options.getFontColor()));
    int rowState = rowStateResolver.apply(rankedItem);

    if ((rowState & RowState.SELECTED.value) != 0 && options.isEnableBackgroundSelection()) {
        cell.setBackground(fromRegistry(new RGB(225,226,206)));
    } else {
        cell.setBackground(fromRegistry(options.getBackgroundColor()));
    }
    if ((rowState & RowState.CURSOR.value) != 0 && options.isEnableBackgroundSelection()) {
        cell.setBackground(fromRegistry(ColorUtil.blend(cell.getBackground().getRGB(), new RGB(200,200,200))));
    }
    Font font = createColumnFont(options, cell);
    cell.setFont(font);
    return rankedItem;
}
项目:Hydrograph    文件:InputFieldColumnLabelProvider.java   
@Override
public void update(ViewerCell cell) {
      TableItem item = (TableItem) cell.getItem();

      Pattern pattern = Pattern.compile("^[a-zA-Z0-9 _]*$");

        if (!pattern.matcher(((InputField)cell.getElement()).getFieldName()).matches()) {
              item.setBackground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
              item.setForeground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_RED));
              ((InputField)cell.getElement()).getErrorObject().setErrorMessage("Input field should match regular expression- \"^[a-zA-Z0-9_]*$\" ");
              ((InputField)cell.getElement()).getErrorObject().setHasError(true);
        }else{

            if(((InputField)cell.getElement()).getFieldName().trim().equalsIgnoreCase("")){
                item.setBackground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_RED));
                ((InputField)cell.getElement()).getErrorObject().setErrorMessage("Input field should not be empty");
                  ((InputField)cell.getElement()).getErrorObject().setHasError(true);
            }else{
                  ((InputField)cell.getElement()).getErrorObject().setHasError(false);
            }


        }
    super.update(cell);
}
项目:vertigo-chroma-kspplugin    文件:KspOutlinePage.java   
private void setStyledText(ViewerCell cell, TreeObject obj) {
    /* Calcul du texte. */
    String mainText = obj.getMainText();
    if (mainText == null) {
        return;
    }
    String subText = obj.getSubText();
    String subTextFinal = subText == null ? "" : (" : " + subText);
    String fullText = mainText + subTextFinal;
    cell.setText(fullText);

    /* Calcul du style. */
    List<StyleRange> styles = new ArrayList<>();
    StyleRange styleMainText = new StyleRange(0, mainText.length(), null, null);
    styles.add(styleMainText);
    if (!subTextFinal.isEmpty()) {
        Display display = Display.getCurrent();
        Color blue = display.getSystemColor(SWT.COLOR_DARK_YELLOW);
        StyleRange styleSubText = new StyleRange(mainText.length(), subTextFinal.length(), blue, null);
        styles.add(styleSubText);
    }
    cell.setStyleRanges(styles.toArray(new StyleRange[0]));
}
项目:avro-schema-editor    文件:SchemaViewerStyledCellLabelProvider.java   
@Override
  public void update(ViewerCell cell) {

      AvroNode node = nodeConverter.convertToAvroNode(cell.getElement());

String text = labelProvider.getText(node);
      Image image = labelProvider.getImage(node);
      StyleRange[] styleRanges = labelProvider.getStyleRanges(node);

      cell.setText(text);
cell.setImage(image);
      cell.setStyleRanges(styleRanges);

      Color backgroundColor = labelProvider.getBackgroundColor(node);
      if (backgroundColor != null) {
        cell.setBackground(backgroundColor);
      }

      super.update(cell);
  }
项目:team-explorer-everywhere    文件:MultiRowHighlighter.java   
@Override
protected void focusCellChanged(final ViewerCell newCell, final ViewerCell oldCell) {
    super.focusCellChanged(newCell, oldCell);

    /*
     * When the focus is changed, we merely tell the table to redraw the
     * affected row(s).
     */
    if (newCell != null) {
        newCell.getViewerRow().getControl().redraw();
    }

    if (oldCell != null) {
        oldCell.getViewerRow().getControl().redraw();
    }
}
项目:team-explorer-everywhere    文件:CellEditorAccessibility.java   
public static final Point getFocusCellIndex(final TableViewer viewer) {
    try {
        if (viewer.getColumnViewerEditor() != null) {
            final ViewerCell focusCell = viewer.getColumnViewerEditor().getFocusCell();

            if (focusCell != null) {
                final int x = focusCell.getColumnIndex();
                final int y = viewer.getTable().indexOf((TableItem) focusCell.getItem());

                return new Point(x, y);
            }
        }
    } catch (final Exception e) {
        log.warn("Could not determine cell index", e); //$NON-NLS-1$
    }

    return new Point(-1, -1);
}
项目:team-explorer-everywhere    文件:GitImportWizardSelectProjectsPage.java   
@Override
public void update(final ViewerCell cell) {
    final Object element = cell.getElement();

    if (element instanceof ImportEclipseProject) {
        final ImportEclipseProject project = (ImportEclipseProject) element;

        if (project.isDamaged()) {
            cell.setText(Messages.getString("GitImportWizardSelectProjectsPage.ProjectDamaged")); //$NON-NLS-1$
            setCellFontStyle(cell, SWT.ITALIC);
        } else {
            cell.setText(project.getProjectName());
        }

        if (!canImport(project)) {
            setCellForeground(cell, SWT.COLOR_GRAY);
        }
    }
}
项目:tlaplus    文件:FilteredItemsSelectionDialog.java   
public void update(ViewerCell cell) {
    Object element = cell.getElement();

    if (!(element instanceof ItemsListSeparator)
            && provider instanceof IStyledLabelProvider) {
        IStyledLabelProvider styledLabelProvider = (IStyledLabelProvider) provider;
        StyledString styledString = getStyledText(element,
                styledLabelProvider);

        cell.setText(styledString.getString());
        cell.setStyleRanges(styledString.getStyleRanges());
        cell.setImage(styledLabelProvider.getImage(element));
    } else {
        cell.setText(getText(element));
        cell.setImage(getImage(element));
    }
    cell.setFont(getFont(element));
    cell.setForeground(getForeground(element));
    cell.setBackground(getBackground(element));

    super.update(cell);
}
项目:fluentmark    文件:FocusBorderCellHighlighter.java   
private void hookListener(final ColumnViewer viewer) {

        Listener listener = new Listener() {

            @Override
            public void handleEvent(Event event) {
                if ((event.detail & SWT.SELECTED) > 0) {
                    ViewerCell focusCell = getFocusCell();
                    ViewerRow row = focusCell.getViewerRow();

                    Assert.isNotNull(row, "Internal structure invalid. Item without associated row is not possible."); //$NON-NLS-1$

                    ViewerCell cell = row.getCell(event.index);

                    if (focusCell == null || !cell.equals(focusCell)) {
                        removeSelectionInformation(event, cell);
                    } else {
                        markFocusedCell(event, cell);
                    }
                }
            }
        };
        viewer.getControl().addListener(SWT.EraseItem, listener);
    }
项目:mytourbook    文件:TourBookView.java   
/**
 * Column: Device name
 */
private void defineColumn_Device_Name() {

    final TreeColumnDefinition colDef = TreeColumnFactory.DEVICE_NAME.createColumn(_columnManager, _pc);

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();
            final String dbValue = ((TVITourBookItem) element).col_DeviceName;

            if (dbValue == null) {
                cell.setText(UI.EMPTY_STRING);
            } else {
                cell.setText(dbValue);
            }

            setCellColor(cell, element);
        }
    });
}
项目:mytourbook    文件:ImageGallery.java   
/**
 * column: image direction degree
 */
private void defineColumn_ImageDirectionText() {

    final ColumnDefinition colDef = TableColumnFactory.PHOTO_FILE_IMAGE_DIRECTION_TEXT//
            .createColumn(_columnManager, _pc);

    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Photo photo = (Photo) cell.getElement();
            final double imageDirection = photo.getImageDirection();

            if (imageDirection == Double.MIN_VALUE) {
                cell.setText(UI.EMPTY_STRING);
            } else {
                final int imageDirectionInt = (int) imageDirection;
                cell.setText(getDirectionText(imageDirectionInt));
            }
        }
    });
}
项目:mytourbook    文件:TourDataEditorView.java   
/**
 * Column: Gear ratio
 */
private void defineColumn_Powertrain_GearRatio() {

    final ColumnDefinition colDef = TableColumnFactory.POWERTRAIN_GEAR_RATIO.createColumn(_sliceColumnManager, _pc);

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            if (_serieGears == null) {

                cell.setText(UI.EMPTY_STRING);

            } else {

                final int serieIndex = ((TimeSlice) cell.getElement()).serieIndex;
                final float gearRatio = _serieGears[0][serieIndex];

                cell.setText(_nf2.format(gearRatio));
            }
        }
    });
}
项目:mytourbook    文件:RawDataView.java   
/**
 * column: import file path
 */
private void defineColumn_Data_ImportFilePath() {

    final ColumnDefinition colDef = TableColumnFactory.DATA_IMPORT_FILE_PATH.createColumn(_columnManager, _pc);

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourData tourData = (TourData) cell.getElement();
            final String importFilePath = tourData.getImportFilePath();

            if (importFilePath != null) {
                cell.setText(importFilePath);
            }
        }
    });
}
项目:mytourbook    文件:TourBookView.java   
/**
 * column: avg pulse
 */
private void defineColumn_Body_AvgPulse() {

    final TreeColumnDefinition colDef = TreeColumnFactory.BODY_PULSE_AVG.createColumn(_columnManager, _pc);

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();
            final double value = ((TVITourBookItem) element).colAvgPulse;

            colDef.printDoubleValue(cell, value, element instanceof TVITourBookTour);

            setCellColor(cell, element);
        }
    });
}
项目:mytourbook    文件:CollatedToursView.java   
/**
 * column: number of photos
 */
private void defineColumn_Tour_Photos() {

    final TreeColumnDefinition colDef = TreeColumnFactory.TOUR_NUM_PHOTOS.createColumn(_columnManager, _pc);
    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();
            final int value = ((TVICollatedTour) element).colNumberOfPhotos;

            colDef.printValue_0(cell, value);

            setCellColor(cell, element);
        }
    });
}
项目:mytourbook    文件:TourSegmenterView.java   
/**
 * Column: Altitude segment up
 */
private void defineColumn_Altitude_Segment_Up(final SelectionAdapter defaultColumnSelectionListener) {

    final ColumnDefinition colDef;

    colDef = TableColumnFactory.ALTITUDE_ELEVATION_SEGMENT_UP.createColumn(_columnManager, _pc);

    colDef.setIsDefaultColumn();
    colDef.setColumnSelectionListener(defaultColumnSelectionListener);

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourSegment segment = (TourSegment) cell.getElement();

            final double value = segment.altitude_Segment_Up;

            colDef.printValue_0(cell, value);

            if (segment.isTotal) {
                setTotalStyle(cell);
            }
        }
    });
}
项目:mytourbook    文件:TourMarkerView.java   
/**
 * Column: Description
 */
private void defineColumn_Waypoint_Description() {

    final ColumnDefinition colDef = TableColumnFactory.WAYPOINT_DESCRIPTION.createColumn(_columnManager, _pc);

    colDef.setIsDefaultColumn();

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourMarker marker = (TourMarker) cell.getElement();
            cell.setText(marker.getDescription());
        }
    });
}
项目:mytourbook    文件:RawDataView.java   
/**
 * column: import file name
 */
private void defineColumn_Data_ImportFileName() {

    final ColumnDefinition colDef = TableColumnFactory.DATA_IMPORT_FILE_NAME.createColumn(_columnManager, _pc);

    colDef.setColumnSelectionListener(_columnSortListener);
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourData tourData = (TourData) cell.getElement();
            final String importFileName = tourData.getImportFileName();

            if (importFileName != null) {
                cell.setText(importFileName);
            }
        }
    });

    _columnId_ImportFileName = colDef.getColumnId();
}
项目:mytourbook    文件:TaggingView.java   
/**
 * column: altitude up (m)
 */
private void defineColumn_Altitude_Up() {

    final TreeColumnDefinition colDef = TreeColumnFactory.ALTITUDE_UP.createColumn(_columnManager, _pc);
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();
            if (element instanceof TVITagViewTagCategory) {
                return;
            }

            final long dbAltitudeUp = ((TVITagViewItem) element).colAltitudeUp;
            final double value = dbAltitudeUp / UI.UNIT_VALUE_ALTITUDE;

            colDef.printValue_0(cell, value);

            setCellColor(cell, element);
        }
    });
}
项目:PDFReporter-Studio    文件:GalleryTreeViewer.java   
public void editElement(Object element, int column) {
    if (element instanceof TreePath) {
        setSelection(new TreeSelection((TreePath) element));
        GalleryItem[] items = gallery.getSelection();

        if (items.length == 1) {
            ViewerRow row = getViewerRowFromItem(items[0]);

            if (row != null) {
                ViewerCell cell = row.getCell(column);
                if (cell != null) {
                    getControl().setRedraw(false);
                    triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(cell));
                    getControl().setRedraw(true);
                }
            }
        }
    } else {
        super.editElement(element, column);
    }
}
项目:mytourbook    文件:TourBookView.java   
/**
 * column: number of photos
 */
private void defineColumn_Tour_Photos() {

    final TreeColumnDefinition colDef = TreeColumnFactory.TOUR_NUM_PHOTOS.createColumn(_columnManager, _pc);

    colDef.setIsDefaultColumn();
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();
            final int value = ((TVITourBookItem) element).colNumberOfPhotos;

            colDef.printValue_0(cell, value);

            setCellColor(cell, element);
        }
    });
}
项目:mytourbook    文件:TaggingView.java   
/**
 * column: altitude down (m)
 */
private void defineColumn_Altitude_Down() {

    final TreeColumnDefinition colDef = TreeColumnFactory.ALTITUDE_DOWN.createColumn(_columnManager, _pc);
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();
            if (element instanceof TVITagViewTagCategory) {
                return;
            }

            final double dbAltitudeDown = ((TVITagViewItem) element).colAltitudeDown;
            final double value = -dbAltitudeDown / UI.UNIT_VALUE_ALTITUDE;

            colDef.printValue_0(cell, value);

            setCellColor(cell, element);
        }
    });
}
项目:mytourbook    文件:CollatedToursView.java   
/**
 * column: avg temperature
 */
private void defineColumn_Weather_AvgTemperature() {

    final TreeColumnDefinition colDef = TreeColumnFactory.WEATHER_AVG_TEMPERATURE.createColumn(_columnManager, _pc);

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();
            float value = ((TVICollatedTour) element).colAvgTemperature;

            if (net.tourbook.ui.UI.UNIT_VALUE_TEMPERATURE != 1) {

                value = value //
                        * net.tourbook.ui.UI.UNIT_FAHRENHEIT_MULTI
                        + net.tourbook.ui.UI.UNIT_FAHRENHEIT_ADD;
            }

            colDef.printDoubleValue(cell, value, element instanceof TVITourBookTour);

            setCellColor(cell, element);
        }
    });
}
项目:mytourbook    文件:TourCompareResultView.java   
/**
 * column: time interval
 */
private void defineColumn_Data_TimeInterval() {

    final TreeColumnDefinition colDef = TreeColumnFactory.DATA_TIME_INTERVAL.createColumn(_columnManager, _pc);

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {
            final Object element = cell.getElement();
            if (element instanceof TVICompareResultComparedTour) {

                cell.setText(Integer.toString(((TVICompareResultComparedTour) element).timeIntervall));
                setCellColor(cell, element);
            }
        }
    });
}
项目:mytourbook    文件:CollatedToursView.java   
/**
 * column: avg cadence
 */
private void defineColumn_Powertrain_AvgCadence() {

    final TreeColumnDefinition colDef = TreeColumnFactory.POWERTRAIN_AVG_CADENCE.createColumn(_columnManager, _pc);

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();
            final float value = ((TVICollatedTour) element).colAvgCadence;

            colDef.printDoubleValue(cell, value, element instanceof TVICollatedTour_Tour);

            setCellColor(cell, element);
        }
    });
}
项目:gama    文件:CSVLabelProvider.java   
/**
 * @see org.eclipse.jface.viewers.StyledCellLabelProvider#update(org.eclipse.jface.viewers.ViewerCell)
 */
@Override
public void update(final ViewerCell cell) {
    final CSVRow element = (CSVRow) cell.getElement();
    final int index = cell.getColumnIndex();
    final String columnText = getColumnText(element, index);
    cell.setText(columnText);
    cell.setImage(null);
    if (searchText != null && searchText.length() > 0) {
        final int intRangesCorrectSize[] = SearchResultStyle.getSearchTermOccurrences(searchText, columnText);
        final List<StyleRange> styleRange = new ArrayList<StyleRange>();
        for (int i = 0; i < intRangesCorrectSize.length / 2; i++) {
            final StyleRange myStyleRange = new StyleRange(0, 0, null, searchColor);
            myStyleRange.start = intRangesCorrectSize[i];
            myStyleRange.length = intRangesCorrectSize[++i];
            styleRange.add(myStyleRange);
        }
        cell.setStyleRanges(styleRange.toArray(new StyleRange[styleRange.size()]));
    } else {
        cell.setStyleRanges(null);
    }

    super.update(cell);
}
项目:mytourbook    文件:TourBookView.java   
/**
 * column: week year
 */
private void defineColumn_Time_WeekYear() {

    final TreeColumnDefinition colDef = TreeColumnFactory.TIME_WEEKYEAR.createColumn(_columnManager, _pc);

    colDef.setLabelProvider(new CellLabelProvider() {

        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();
            final int week = ((TVITourBookItem) element).colWeekYear;

            if (week == 0) {
                cell.setText(UI.EMPTY_STRING);
            } else {
                cell.setText(Integer.toString(week));
            }

            setCellColor(cell, element);
        }
    });
}
项目:mytourbook    文件:TaggingView.java   
/**
 * column: max pulse
 */
private void defineColumn_Body_MaxPulse() {

    final TreeColumnDefinition colDef = TreeColumnFactory.BODY_PULSE_MAX.createColumn(_columnManager, _pc);
    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final Object element = cell.getElement();
            if (element instanceof TVITagViewTagCategory) {
                return;
            }

            final long value = ((TVITagViewItem) element).colMaxPulse;

            colDef.printValue_0(cell, value);

            setCellColor(cell, element);
        }
    });
}
项目:mytourbook    文件:TourSegmenterView.java   
/**
 * column: pace difference
 */
private void defineColumn_Motion_AvgPace_Difference() {

    final ColumnDefinition colDef;

    colDef = TableColumnFactory.MOTION_AVG_PACE_DIFFERENCE.createColumn(_columnManager, _pc);

    colDef.setIsDefaultColumn();

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourSegment segment = (TourSegment) cell.getElement();
            final float paceDiff = segment.pace_Diff;

            if (paceDiff == 0) {
                cell.setText(UI.EMPTY_STRING);
            } else {
                cell.setText(net.tourbook.common.UI.format_mm_ss((long) paceDiff));
            }
        }
    });
}
项目:mytourbook    文件:TourSegmenterView.java   
/**
 * Column: Altitude segment down
 */
private void defineColumn_Altitude_Segment_Down(final SelectionAdapter defaultColumnSelectionListener) {

    final ColumnDefinition colDef;

    colDef = TableColumnFactory.ALTITUDE_ELEVATION_SEGMENT_DOWN.createColumn(_columnManager, _pc);

    colDef.setIsDefaultColumn();
    colDef.setColumnSelectionListener(defaultColumnSelectionListener);

    colDef.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(final ViewerCell cell) {

            final TourSegment segment = (TourSegment) cell.getElement();

            final double value = segment.altitude_Segment_Down;

            colDef.printValue_0(cell, value);

            if (segment.isTotal) {
                setTotalStyle(cell);
            }
        }
    });
}