Package org.eclipse.emf.edit.provider

Examples of org.eclipse.emf.edit.provider.ITableItemColorProvider


      cell.setGraphic(graphic);
    }
  }

  void applyTableItemProviderColor(Object item, int columnIndex, Cell<?> cell, AdapterFactory adapterFactory) {
    ITableItemColorProvider colorProvider = (ITableItemColorProvider) adapterFactory.adapt(item, ITableItemColorProvider.class);
    if (colorProvider != null) {
      Color foreground = colorFromObject(colorProvider.getForeground(item, columnIndex));
      if (foreground != null)
        cell.setTextFill(foreground);

      String background = cssColorFromObject(colorProvider.getBackground(item, columnIndex));
      if (background != null)
        cell.setStyle("-fx-background-color: " + background);
    }
  }
View Full Code Here


  }

  @Test
  public void applyTableItemProviderColor() {
    Object item = mock(Object.class);
    ITableItemColorProvider itemProvider = mock(ITableItemColorProvider.class);
    when(itemProvider.getForeground(item, COLUMN_INDEX)).thenReturn(foregroundObject);
    when(itemProvider.getBackground(item, COLUMN_INDEX)).thenReturn(backgroundObject);
    when(adapterFactory.adapt(item, ITableItemColorProvider.class)).thenReturn(itemProvider);
    Cell cell = new Cell();
    cellFactory.applyTableItemProviderColor(item, COLUMN_INDEX, cell, adapterFactory);
    assertEquals(foregroundColor, cell.getTextFill());
    assertEquals("-fx-background-color: rgb(0, 255, 0)", cell.getStyle());
View Full Code Here

TOP

Related Classes of org.eclipse.emf.edit.provider.ITableItemColorProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.