gt: 						if (composite != null && !composite.isDisposed()) {
context: package org.gudy.azureus2.ui.swt.views.table.painted;
  
  import org.eclipse.swt.graphics.*;
  import org.eclipse.swt.widgets.Composite;
  import org.eclipse.swt.widgets.Display;
  
  import org.gudy.azureus2.core3.util.AERunnable;
  import org.gudy.azureus2.core3.util.Debug;
  import org.gudy.azureus2.core3.util.SystemTime;
  import org.gudy.azureus2.plugins.ui.Graphic;
  import org.gudy.azureus2.plugins.ui.tables.TableColumn;
  import org.gudy.azureus2.plugins.ui.tables.TableRow;
  import org.gudy.azureus2.ui.swt.Utils;
  import org.gudy.azureus2.ui.swt.pluginsimpl.UISWTGraphicImpl;
  import org.gudy.azureus2.ui.swt.views.table.TableRowSWT;
  import org.gudy.azureus2.ui.swt.views.table.TableViewSWT;
  import org.gudy.azureus2.ui.swt.views.table.impl.TableCellSWTBase;
  
  import com.aelitis.azureus.ui.common.table.TableColumnCore;
  import com.aelitis.azureus.ui.common.table.TableRowCore;
  
  public class TableCellPainted
  	extends TableCellSWTBase
  {
  	private static final boolean DEBUG_CELLPAINT = false;
  
  	private Rectangle bounds;
  
  	private String text = "";
  
  	private int marginWidth;
  
  	private int marginHeight;
  
  	private boolean redrawScheduled;
  
  	private Color colorFG;
  
  	// private Color colorBG;
  
  	public TableCellPainted(TableRowSWT row, TableColumnCore column, int pos) {
  		super(row, column);
  		constructionCompleter();
  	}
  
  	protected void
  	constructionCompleter()
  	{
  		constructionComplete();
  		
  		tableColumn.invokeCellAddedListeners(TableCellPainted.this);
  	}
  	  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#getDataSource()
  	 */
  	public Object getDataSource() {
  		// remove this because if a disposal-listener needs to get its hands on teh datasource to clean up
  		// properly we need to return it to them! (happens with the peers view PiecesItem for example)
  		//if (isDisposed()) {
  		//	return null;
  		//}
  		TableRowCore row = tableRow;
  		TableColumnCore col = tableColumn;
  
  		if (row == null || col == null) {
  			return (null);
  		}
  		return row.getDataSource(col.getUseCoreDataSource());
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#getTableColumn()
  	 */
  	public TableColumn getTableColumn() {
  		return tableColumn;
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#getTableRow()
  	 */
  	public TableRow getTableRow() {
  		return tableRow;
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#getTableID()
  	 */
  	public String getTableID() {
  		return tableRow==null?null:tableRow.getTableID();
  	}
  
  	@SuppressWarnings("null")
  	public static boolean stringEquals(String s0, String s1) {
  		boolean s0Null = s0 == null;
  		boolean s1Null = s1 == null;
  		if (s0Null || s1Null) {
  			return s0Null == s1Null;
  		}
  		return s0.equals(s1);
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#getText()
  	 */
  	public String getText() {
  		if (hasFlag(FLAG_SORTVALUEISTEXT) && sortValue instanceof String) {
  			return (String) sortValue;
  		}
  
  		return text;
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#getSortValue()
  	 */
  	public Comparable<?> getSortValue() {
  		Comparable<?> value = super.getSortValue();
  		return value == null ? "" : value;
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#isShown()
  	 */
  	public boolean isShown() {
  		return !isDisposed() && tableRow != null && tableRow.getView().isColumnVisible(tableColumn);
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#getMaxLines()
  	 */
  	public int getMaxLines() {
  		// TODO
  		return 1;
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#getWidth()
  	 */
  	public int getWidth() {
  		if (isDisposed()) {
  			return -1;
  		}
  		return tableColumn.getWidth() - 2 - (getMarginWidth() * 2);
  	}
  
  	public int getWidthRaw() {
  		if (isDisposed()) {
  			return -1;
  		}
  		return tableColumn.getWidth() - 2;
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#getHeight()
  	 */
  	public int getHeight() {
  		if (bounds == null) {
  			return tableRow.getView().getRowDefaultHeight();
  		}
  		return bounds.height - (getMarginHeight() * 2);
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#getMarginHeight()
  	 */
  	public int getMarginHeight() {
  		return marginHeight;
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#setMarginHeight(int)
  	 */
  	public void setMarginHeight(int height) {
  		marginHeight = height;
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#getMarginWidth()
  	 */
  	public int getMarginWidth() {
  		return marginWidth;
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#setMarginWidth(int)
  	 */
  	public void setMarginWidth(int width) {
  		marginWidth = width;
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.plugins.ui.tables.TableCell#getBackgroundGraphic()
  	 */
  	public Graphic getBackgroundGraphic() {
  		// WARNING: requires SWT Thread!
  		return new UISWTGraphicImpl(getBackgroundImage());
  	}
  
  	/* (non-Javadoc)
  	 * @see com.aelitis.azureus.ui.common.table.TableCellCore#locationChanged()
  	 */
  	public void locationChanged() {
  	}
  
  	/* (non-Javadoc)
  	 * @see org.gudy.azureus2.ui.swt.views.table.impl.TableCellSWTBase#setCursorID(int)
  	 */
  	@Override
  	public boolean setCursorID(int cursorID) {
  		if (!super.setCursorID(cursorID)) {
  			return false;
  		}
  		Utils.execSWTThread(new AERunnable() {
  			public void runSupport() {
  				if (isDisposed() || tableRow == null) {
  					return;
  				}
  				if (isMouseOver()) {
  					TableViewSWT<?> view = (TableViewSWT<?>) tableRow.getView();
  					if (view != null) {
  						Composite composite = view.getComposite();
  