本文整理汇总了Java中org.eclipse.jface.viewers.CellLabelProvider类的典型用法代码示例。如果您正苦于以下问题:Java CellLabelProvider类的具体用法?Java CellLabelProvider怎么用?Java CellLabelProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CellLabelProvider类属于org.eclipse.jface.viewers包,在下文中一共展示了CellLabelProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DecoratingColumLabelProvider
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* Constructor.
*
* @param labelProvider
* the {@link ILabelProvider} to decorate
* @param labelDecorator
* the {@link ILabelDecorator} adding decoration
*/
public DecoratingColumLabelProvider(ILabelProvider labelProvider, ILabelDecorator labelDecorator) {
this.labelProvider = labelProvider;
if (labelProvider instanceof IFontProvider) {
this.fontProvider = (IFontProvider)labelProvider;
} else {
this.fontProvider = null;
}
if (labelProvider instanceof IColorProvider) {
this.colorProvider = (IColorProvider)labelProvider;
} else {
this.colorProvider = null;
}
this.labelDecorator = labelDecorator;
if (labelDecorator instanceof CellLabelProvider) {
this.cellLabelProvider = (CellLabelProvider)labelDecorator;
} else {
this.cellLabelProvider = null;
}
}
示例2: defineColumn_Powertrain_AvgRightTorqueEffectiveness
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* column: AvgRightTorqueEffectiveness
*/
private void defineColumn_Powertrain_AvgRightTorqueEffectiveness() {
final TreeColumnDefinition colDef = TreeColumnFactory.POWERTRAIN_AVG_RIGHT_TORQUE_EFFECTIVENESS.createColumn(
_columnManager,
_pc);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
final double value = ((TVITourBookItem) element).colPower_AvgRightTorqueEffectiveness;
colDef.printDoubleValue(cell, value, element instanceof TVITourBookTour);
setCellColor(cell, element);
}
});
}
示例3: defineColumn_Speed
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* column: speed
*/
private void defineColumn_Speed() {
final TreeColumnDefinition colDef = TreeColumnFactory.MOTION_AVG_SPEED.createColumn(_columnManager, _pc);
colDef.setIsDefaultColumn();
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
if (element instanceof TVICatalogComparedTour) {
final double value = ((TVICatalogComparedTour) element).tourSpeed / UI.UNIT_VALUE_DISTANCE;
colDef.printDoubleValue(cell, value, element instanceof TVICatalogComparedTour);
}
}
});
}
示例4: defineColumn_Time_TimeZoneDifference
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* column: Timezone difference
*/
private void defineColumn_Time_TimeZoneDifference() {
_timeZoneOffsetColDef = TableColumnFactory.TIME_TIME_ZONE_DIFFERENCE.createColumn(_columnManager, _pc);
_timeZoneOffsetColDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final TourData tourData = (TourData) cell.getElement();
final TourDateTime tourDateTime = tourData.getTourDateTime();
cell.setText(tourDateTime.timeZoneOffsetLabel);
}
});
}
示例5: defineColumn_10_Checkbox
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* Column: Show only the checkbox
*/
private void defineColumn_10_Checkbox() {
final TableViewerColumn tvc = new TableViewerColumn(_colorViewer, SWT.LEAD);
final TableColumn tc = tvc.getColumn();
tc.setWidth(_pc.convertWidthInCharsToPixels(COLUMN_WITH_NAME));
tvc.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
if (element instanceof Map3GradientColorProvider) {
final Map3ColorProfile colorProfile = ((Map3GradientColorProvider) (element)).getMap3ColorProfile();
cell.setText(colorProfile.getProfileName());
}
}
});
}
示例6: defineColumn_Altitude_Up
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* 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);
}
});
}
示例7: defineColumn_30_ColorImage
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* Column: Color image
*/
private void defineColumn_30_ColorImage() {
final TableViewerColumn tvc = new TableViewerColumn(_colorViewer, SWT.LEAD);
final TableColumn tc = tvc.getColumn();
tc.setWidth(_pc.convertWidthInCharsToPixels(COLUMN_WITH_COLOR_IMAGE));
_tcProfileImage = tc;
_columnIndexProfileImage = _colorViewer.getTable().getColumnCount() - 1;
tc.addControlListener(new ControlAdapter() {
@Override
public void controlResized(final ControlEvent e) {
onResizeImageColumn();
}
});
tvc.setLabelProvider(new CellLabelProvider() {
// !!! set dummy label provider, otherwise an error occures !!!
@Override
public void update(final ViewerCell cell) {}
});
}
示例8: defineColumn_Motion_Distance
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* column: distance
*/
private void defineColumn_Motion_Distance() {
final TreeColumnDefinition colDef = TreeColumnFactory.MOTION_DISTANCE.createColumn(_columnManager, _pc);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
if (element instanceof TVICompareResultComparedTour) {
final TVICompareResultComparedTour compareItem = (TVICompareResultComparedTour) element;
final float value = compareItem.compareDistance / (1000 * net.tourbook.ui.UI.UNIT_VALUE_DISTANCE);
colDef.printDetailValue(cell, value);
setCellColor(cell, element);
}
}
});
}
示例9: defineColumn_Altitude
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* Column: Altitude
*/
private void defineColumn_Altitude() {
final ColumnDefinition colDef = TableColumnFactory.ALTITUDE_ALTITUDE.createColumn(_columnManager, _pc);
// overwrite column id to identify the column when table is sorted
colDef.setColumnId(COLUMN_ALTITUDE);
colDef.setColumnSelectionListener(_columnSortListener);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
String valueText;
final float altitude = ((TourMarkerItem) cell.getElement()).altitude;
if (altitude == TourDatabase.DEFAULT_FLOAT) {
valueText = UI.EMPTY_STRING;
} else {
valueText = _nf1.format(altitude / net.tourbook.ui.UI.UNIT_VALUE_ALTITUDE);
}
cell.setText(valueText);
}
});
}
示例10: defineColumn_Motion_AvgSpeed
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* column: avg speed km/h - mph
*/
private void defineColumn_Motion_AvgSpeed() {
final TreeColumnDefinition colDef = TreeColumnFactory.MOTION_AVG_SPEED.createColumn(_columnManager, _pc);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
final double value = ((TVITourBookItem) element).colAvgSpeed / net.tourbook.ui.UI.UNIT_VALUE_DISTANCE;
colDef.printDoubleValue(cell, value, element instanceof TVITourBookTour);
setCellColor(cell, element);
}
});
}
示例11: defineColumn_Power_Max
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* Column: max power
*/
private void defineColumn_Power_Max() {
final TreeColumnDefinition colDef = TreeColumnFactory.POWER_MAX.createColumn(_columnManager, _pc);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
final int value = ((TVITourBookItem) element).colPower_Max;
colDef.printDoubleValue(cell, value, element instanceof TVITourBookTour);
setCellColor(cell, element);
}
});
}
示例12: defineColumn_Body_Person
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* column: person
*/
private void defineColumn_Body_Person() {
final TreeColumnDefinition colDef = TreeColumnFactory.BODY_PERSON.createColumn(_columnManager, _pc);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
if (element instanceof TVITourBookTour) {
final long dbPersonId = ((TVITourBookTour) element).colPersonId;
cell.setText(PersonManager.getPersonName(dbPersonId));
}
}
});
}
示例13: defineColumn_Description
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* Column: Description
*/
private void defineColumn_Description(final TableColumnLayout tableLayout) {
final TableViewerColumn tvc = new TableViewerColumn(_markerViewer, SWT.CENTER);
final TableColumn tc = tvc.getColumn();
tc.setText(Messages.Tour_Marker_Column_Description_ShortCut);
tc.setToolTipText(Messages.Tour_Marker_Column_Description_Tooltip);
tvc.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final TourMarker tourMarker = (TourMarker) cell.getElement();
final String description = tourMarker.getDescription();
cell.setText(description.length() == 0 ? UI.EMPTY_STRING : UI.SYMBOL_STAR);
}
});
tableLayout.setColumnData(tc, new ColumnPixelData(_pc.convertWidthInCharsToPixels(4), false));
}
示例14: defineColumn_Powertrain_Gear_RearShiftCount
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* Column: Rear shift count.
*/
private void defineColumn_Powertrain_Gear_RearShiftCount() {
final TreeColumnDefinition colDef = TreeColumnFactory.POWERTRAIN_GEAR_REAR_SHIFT_COUNT.createColumn(
_columnManager,
_pc);
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
final int value = ((TVICollatedTour) element).colRearShiftCount;
colDef.printValue_0(cell, value);
setCellColor(cell, element);
}
});
}
示例15: defineColumn_Waypoint_Description
import org.eclipse.jface.viewers.CellLabelProvider; //导入依赖的package包/类
/**
* 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());
}
});
}