本文整理汇总了Java中org.eclipse.swt.widgets.TableItem.setForeground方法的典型用法代码示例。如果您正苦于以下问题:Java TableItem.setForeground方法的具体用法?Java TableItem.setForeground怎么用?Java TableItem.setForeground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.TableItem
的用法示例。
在下文中一共展示了TableItem.setForeground方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initPrimarySectionFromModel
import org.eclipse.swt.widgets.TableItem; //导入方法依赖的package包/类
@Override
protected void initPrimarySectionFromModel() {
Table table = getPrimaryTable();
table.removeAll();
MBeanAttributeModel model = getModel();
MBeanAttribute attribute = model.getData();
String valueString = attribute.getValueAsString();
String valueError = attribute.getValueRetrievalErrorMessage();
TableItem item = new TableItem(table, SWT.NONE);
item.setText(0, attribute.getName());
if (valueError != null) {
item.setText(1, valueError);
item.setForeground(1, table.getDisplay().getSystemColor(SWT.COLOR_RED));
}
else {
item.setText(1, valueString);
}
packTable(table, DEFAULT_NAME_VALUE_COLUMN_WIDTHS);
}
示例2: update
import org.eclipse.swt.widgets.TableItem; //导入方法依赖的package包/类
@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);
}
示例3: initPropertiesSectionFromModel
import org.eclipse.swt.widgets.TableItem; //导入方法依赖的package包/类
/**
* TODO: Comment.
*
*/
protected void initPropertiesSectionFromModel() {
Table table = getPropertiesSectionTable();
table.removeAll();
Map<String, String> properties = getZooKeeperConnectionProperties();
for (String key : properties.keySet()) {
TableItem item = new TableItem(table, SWT.NONE);
String value = properties.get(key);
item.setText(0, key);
item.setText(1, value);
Color valueTextColor = table.getForeground();
if (key.equals(ZooKeeperConnectionModelElementType.PROPERTY_NAME_STATE)) {
if (!States.CONNECTED.name().equals(value)) {
valueTextColor = table.getDisplay().getSystemColor(SWT.COLOR_RED);
}
// else {
// valueTextColor = table.getDisplay().getSystemColor(SWT.COLOR_GREEN);
// }
}
item.setForeground(1, valueTextColor);
}
packTable(table, PROPERTIES_COLUMN_WIDTHS);
}
示例4: highlightDropFields
import org.eclipse.swt.widgets.TableItem; //导入方法依赖的package包/类
private void highlightDropFields(){
TableItem[] items = avaliableFieldTableViewer.getTable().getItems();
for(TableItem item : items){
item.setForeground(new Color(null, 0,0,0));
for(String draggedItem : draggedFields){
if(StringUtils.equals(draggedItem, item.getText())){
item.setForeground(new Color(null, 128,0,0));
}
}
}
}
示例5: setBlackColor
import org.eclipse.swt.widgets.TableItem; //导入方法依赖的package包/类
private void setBlackColor(TableItem tableItem){
tableItem.setForeground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 0, 0, 0));
isRowInvalid=false;
}
示例6: setRedColor
import org.eclipse.swt.widgets.TableItem; //导入方法依赖的package包/类
private void setRedColor(TableItem tableItem){
tableItem.setForeground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 0, 0));
isRowInvalid=true;
}
示例7: setProperties
import org.eclipse.swt.widgets.TableItem; //导入方法依赖的package包/类
private void
setProperties(
TableItem item,
ChatParticipant p )
{
if ( p.isIgnored() || p.isSpammer()){
item.setForeground( 0, Colors.grey );
}else{
if ( p.isPinned()){
item.setForeground( 0, Colors.fadedGreen );
}else{
if ( p.isMe()){
item.setForeground( 0, Colors.fadedGreen );
item.setFont( 0, italic_font );
}else if ( p.isNickClash()){
item.setForeground( 0, Colors.red );
}else{
if ( p.hasNickname()){
item.setForeground( 0, Colors.blues[Colors.FADED_DARKEST] );
}else{
item.setForeground( 0, Colors.black );
}
}
}
}
}