本文整理匯總了Java中org.eclipse.jface.viewers.ViewerCell.setBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewerCell.setBackground方法的具體用法?Java ViewerCell.setBackground怎麽用?Java ViewerCell.setBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.viewers.ViewerCell
的用法示例。
在下文中一共展示了ViewerCell.setBackground方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: update
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@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 );
}
示例2: update
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@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 );
}
}
示例3: applyCellDefaultStyles
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@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;
}
示例4: update
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@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);
}
示例5: update
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
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);
}
示例6: update
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update(ViewerCell cell) {
try {
Object element = cell.getElement();
StyledString st = getStyledText(element);
cell.setText(st.getString());
cell.setStyleRanges(getStyledText(element).getStyleRanges());
cell.setImage(getImage(element));
cell.setBackground(getBackground(element));
cell.setForeground(getForeground(element));
cell.setFont(getFont(element));
} catch (Exception e) {
e.printStackTrace();
}
}
示例7: getDummyColumn
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private CellLabelProvider getDummyColumn(final TableViewer tableViewer, final List<Condition> conditionsList, final Integer columnIndex,final TreeMap<Integer, List<List<Integer>>> groupSelectionMap) {
return new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
final TableItem item = (TableItem) cell.getItem();
List<List<Integer>> checkedGrpRowIndices = groupSelectionMap.get(columnIndex);
if (cell.getColumnIndex() == (columnIndex + 3)) {
if (null != checkedGrpRowIndices
&& !checkedGrpRowIndices.isEmpty()) {
List tempList = new ArrayList();
for (List<Integer> checkedIndex : checkedGrpRowIndices) {
tempList.addAll(checkedIndex);
}
int indexOf = tableViewer.getTable().indexOf(item);
if(tempList.contains(indexOf)){
for (int i = 0; i < checkedGrpRowIndices.size(); i++) {
if((checkedGrpRowIndices.get(i)).contains(indexOf)){
cell.setBackground(FilterHelper.INSTANCE.getColor(i));
break;
}
}
}
else{
cell.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,255,255));
}
}
}
}
};
}
示例8: update
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
public void update(ViewerCell cell) {
// labels
cell.setText(getColumnText(cell.getElement(), cell.getColumnIndex()));
// images
cell.setImage(getColumnImage(cell.getElement(), cell.getColumnIndex()));
// font
cell.setFont(getFont(cell.getElement(), cell.getColumnIndex()));
// colors
cell.setForeground(getForeground(cell.getElement(), cell.getColumnIndex()));
cell.setBackground(getBackground(cell.getElement(), cell.getColumnIndex()));
}
示例9: update
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update(ViewerCell cell) {
this.cell = cell;
Object o = cell.getElement();
if (o instanceof ResourceChangesFilePatch
&& ((ResourceChangesFilePatch) o).isSynchronized()) {
cell.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_GRAY));
} else {
cell.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_WHITE));
}
if (headID == 0) {
cell.setImage(new ResourceChangesLabelProvider().getImage(o));
if (o instanceof ResourceChangesFilePatch) {
cell.setText(((ResourceChangesFilePatch) o).getStatus()
+ " " + ((ResourceChangesFilePatch) o).getTime());
} else {
cell.setText(new ResourceChangesLabelProvider().getText(o));
}
}
if (headID == 1 && o instanceof ResourceChangesFilePatch) {
IProject project = ((ResourceChangesFilePatch) o).getProject();
if (project != null) {
cell.setText(project.getName());
}
}
if (headID == 2 && o instanceof ResourceChangesFilePatch) {
patch = (ResourceChangesFilePatch) o;
projectController.getProjectNames(patch);
}
if (headID == 3 && o instanceof ResourceChangesFilePatch) {
patch = (ResourceChangesFilePatch) o;
synchronizationController.getSynchronizedProjects(patch);
}
}
示例10: setBackgroundColor
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void setBackgroundColor(ViewerCell cell, final RowState state) {
switch (state) {
case INCLUDED:
cell.setBackground(clrIncludes);
break;
case EXCLUDED:
cell.setBackground(clrExcludes);
break;
default:
if (cell.getElement() instanceof MetamodelNode) {
final MetamodelNode mn = (MetamodelNode)cell.getElement();
if (store.getInclusionRules().containsRow(mn.label) || store.getExclusionRules().containsRow(mn.label)) {
cell.setBackground(clrPartial);
} else {
cell.setBackground(null);
}
} else if (cell.getElement() instanceof TypeNode) {
final TypeNode tn = (TypeNode)cell.getElement();
if (store.getInclusionRules().contains(tn.parent.label, tn.label) || store.getExclusionRules().contains(tn.parent.label, tn.label)) {
cell.setBackground(clrPartial);
} else {
cell.setBackground(null);
}
} else {
cell.setBackground(null);
}
break;
}
}
示例11: update
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
/**************************************************************************
*
*************************************************************************/
@Override
public void update(ViewerCell cell)
{
Object element = cell.getElement();
cell.setText(getText(element));
cell.setBackground(getBackground(element));
cell.setForeground(getForeground(element));
cell.setImage(getImage(element));
cell.setFont(getFont(element));
}
示例12: update
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update(ViewerCell cell) {
if (cell.getElement() instanceof AttributeNode) {
AttributeNode node = (AttributeNode) cell.getElement();
String[] rgb = node.getResource().getColorName().split(",");
if (node.getResource().getChildren().isEmpty()) {
cell.setBackground(new Color(Display.getDefault(), Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2])));
} else {
cell.setBackground(null);
}
}
super.update(cell);
}
示例13: update
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update(ViewerCell cell) {
if (cell.getElement() instanceof Attribute) {
Attribute attribute = (Attribute) cell.getElement();
String[] rgb = attribute.getColorName().split(",");
if (attribute.getChildren().isEmpty()) {
cell.setBackground(new Color(Display.getDefault(), Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2])));
} else {
cell.setBackground(null);
}
}
super.update(cell);
}
示例14: updateListEntry
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void updateListEntry ( final ListEntry listEntry, final ViewerCell cell )
{
cell.setFont ( listEntry.getFont () );
cell.setForeground ( listEntry.getForeground () );
cell.setBackground ( listEntry.getBackground () );
switch ( cell.getColumnIndex () )
{
case 0:
cell.setImage ( listEntry.getImage () );
cell.setText ( listEntry.getDataItem ().getItem ().getId () );
break;
case 1:
if ( listEntry.getSubscriptionError () != null )
{
cell.setText ( String.format ( "%s (%s)", listEntry.getSubscriptionState (), listEntry.getSubscriptionError ().getMessage () ) ); //$NON-NLS-1$
}
else
{
cell.setText ( listEntry.getSubscriptionState ().name () );
}
break;
case 2:
if ( listEntry.getValue () != null )
{
cell.setText ( listEntry.getValue ().getType ().name () );
}
break;
case 3:
if ( listEntry.getValue () != null )
{
cell.setText ( listEntry.getValue ().asString ( "<null>" ) ); //$NON-NLS-1$
}
break;
case 4:
if ( listEntry.getItemValue () != null )
{
final Calendar timestamp = listEntry.getItemValue ().getTimestamp ();
if ( timestamp != null )
{
cell.setText ( formatTimestamp ( timestamp ) );
}
else
{
cell.setText ( null );
}
}
break;
default:
break;
}
}
示例15: setCellColor
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void setCellColor(final ViewerCell cell, final double value) {
if (value == 0) {
cell.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
} else if (value > 0) {
cell.setBackground(_colorCache.get(STATE_COLOR_ALTITUDE_UP));
} else if (value < 0) {
cell.setBackground(_colorCache.get(STATE_COLOR_ALTITUDE_DOWN));
}
}