Methods Summary |
---|
protected java.util.List | _refresh(boolean bDoGraphics, boolean bVisible)
// If this were called from a plugin, we'd have to refresh the sorted column
// even if we weren't visible
if (!bVisible) {
setUpToDate(false);
return new ArrayList();
}
ArrayList list = new ArrayList();
Iterator iter = mapTableCells.values().iterator();
while (iter.hasNext()) {
TableCellSWT cell = (TableCellSWT) iter.next();
Rectangle bounds = cell.getBounds();
TableColumn column = cell.getTableColumn();
if (bounds != null && column.isVisible()) {
boolean thisChanged = cell.refresh(bDoGraphics, bVisible);
if (thisChanged) {
list.add(cell);
}
}
}
if (bRowVisuallyChangedSinceRefresh) {
list.add(0, this);
}
bRowVisuallyChangedSinceRefresh = false;
return list;
|
public void | addMouseListener(TableRowMouseListener listener)
try {
this_mon.enter();
if (mouseListeners == null)
mouseListeners = new ArrayList(1);
mouseListeners.add(listener);
} finally {
this_mon.exit();
}
|
private void | checkCellForSetting()
if (bDisposed) {
throw new UIRuntimeException("ListRow is disposed.");
}
|
private boolean | colorsEqual(Color color1, Color color2)
if (color1 == color2) {
return true;
}
if (color1 == null || color2 == null) {
return false;
}
return color1.equals(color2);
|
public void | delete()
bDisposed = true;
Iterator iter = mapTableCells.values().iterator();
while (iter.hasNext()) {
TableCellSWT item = (TableCellSWT) iter.next();
try {
item.dispose();
} catch (Exception e) {
Debug.out("Disposing ListRow Column", e);
}
}
|
public void | doPaint(GC gc)
if (bDisposed) {
return;
}
doPaint(gc, isVisible());
|
public void | doPaint(GC gc, boolean bVisible)
doPaint(gc, bVisible, false);
|
public void | doPaint(GC gc, boolean bVisible, boolean bListCellPaint)
// XXX Copied from TableRowImpl
if (bDisposed || !bVisible) {
return;
}
TableColumnCore[] visibleColumns = view.getVisibleColumns();
long lTimeStart = System.currentTimeMillis();
Rectangle oldClipping = gc.getClipping();
try {
gc.setForeground(getForeground());
gc.setBackground(getBackground());
//gc.setBackground(Display.getDefault().getSystemColor((int)(Math.random() * 16)));
Rectangle clientArea = view.getClientArea();
gc.fillRectangle(0, view.rowGetVisibleYOffset(this), clientArea.width,
ROW_HEIGHT);
if (isFocused()) {
gc.setLineStyle(SWT.LINE_DOT);
gc.drawRectangle(0, view.rowGetVisibleYOffset(this),
clientArea.width - 1, ROW_HEIGHT - 1);
}
for (int i = 0; i < visibleColumns.length; i++) {
TableColumnCore column = visibleColumns[i];
TableCellSWT cell = (TableCellSWT) mapTableCells.get(column.getName());
if (cell == null) {
continue;
}
try {
if (cell.needsPainting()) {
Rectangle bounds = cell.getBounds();
if (bounds != null) {
Rectangle clipping = bounds.intersection(oldClipping);
gc.setClipping(clipping);
if (bListCellPaint) {
ListCell listcell = (ListCell) cell.getBufferedTableItem();
listcell.doPaint(gc);
} else {
cell.doPaint(gc);
}
}
}
} catch (Exception e) {
//Debug.out(e);
System.err.println("column " + column.getName() + ";" + cell);
}
}
} finally {
gc.setClipping(oldClipping);
}
long diff = System.currentTimeMillis() - lTimeStart;
if (diff > 60) {
view.log("doPaint took " + diff + "ms. " + this.toString());
}
|
public boolean | fixupPosition()Fixes up row's layout. Does not check if rows next to it are correct,
even if some layout information changed
int iRowPos = getIndex();
setBackgroundColor(iRowPos);
if (parent == null || parent.isDisposed()) {
return false;
}
return true;
|
private Color | getAlternatingColor()
boolean bOdd = ((getIndex() + 1) % 2) == 0;
if (skinProperties != null) {
String sColorID = (bOdd) ? "color.row.odd.bg" : "color.row.even.bg";
Color color = skinProperties.getColor(sColorID);
if (color != null) {
return color;
}
}
return parent.getBackground();
|
public Color | getBackground()
if (bg == null) {
setBackgroundColor(getIndex());
}
return bg;
|
public java.lang.Object | getDataSource()
return getDataSource(false);
|
public java.lang.Object | getDataSource(boolean bCoreObject)
if (bCoreObject) {
return coreDataSource;
}
if (pluginDataSource != null) {
return pluginDataSource;
}
if (coreDataSource instanceof DownloadManager) {
DownloadManager dm = (DownloadManager) coreDataSource;
if (dm != null) {
try {
pluginDataSource = DownloadManagerImpl.getDownloadStatic(dm);
} catch (DownloadException e) { /* Ignore */
}
}
}
if (coreDataSource instanceof PEPeer) {
PEPeer peer = (PEPeer) coreDataSource;
if (peer != null) {
pluginDataSource = PeerManagerImpl.getPeerForPEPeer(peer);
}
}
if (coreDataSource instanceof PEPiece) {
// XXX There is no Piece object for plugins yet
PEPiece piece = (PEPiece) coreDataSource;
if (piece != null) {
pluginDataSource = null;
}
}
if (coreDataSource instanceof DiskManagerFileInfo) {
DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) coreDataSource;
if (fileInfo != null) {
try {
pluginDataSource = new DiskManagerFileInfoImpl(
DownloadManagerImpl.getDownloadStatic(fileInfo.getDownloadManager()),
fileInfo);
} catch (DownloadException e) { /* Ignore */
}
}
}
if (coreDataSource instanceof TRHostTorrent) {
TRHostTorrent item = (TRHostTorrent) coreDataSource;
if (item != null) {
pluginDataSource = new TrackerTorrentImpl(item);
}
}
return pluginDataSource;
|
public Color | getForeground()
if (fg == null) {
setBackgroundColor(getIndex());
}
return fg;
|
public int | getIndex()
return view.indexOf(this);
|
public TableCell | getTableCell(java.lang.String sColumnName)
if (bDisposed) {
return null;
}
return (TableCell) mapTableCells.get(sColumnName);
|
public com.aelitis.azureus.ui.common.table.TableCellCore | getTableCellCore(java.lang.String field)
if (bDisposed) {
return null;
}
return (TableCellCore) mapTableCells.get(field);
|
public org.gudy.azureus2.ui.swt.views.table.TableCellSWT | getTableCellSWT(java.lang.String sColumnName)
if (bDisposed) {
return null;
}
return (TableCellSWT) mapTableCells.get(sColumnName);
|
public org.gudy.azureus2.ui.swt.views.table.TableCellSWT | getTableCellSWT(int x, int y)
Iterator iter = mapTableCells.values().iterator();
while (iter.hasNext()) {
TableCellSWT cell = (TableCellSWT) iter.next();
if (cell.isShown()) {
Rectangle bounds = cell.getBounds();
if (bounds != null && bounds.contains(x, bounds.y)) {
return cell;
}
}
}
return null;
|
public java.lang.String | getTableID()
return view.getTableID();
|
public com.aelitis.azureus.ui.common.table.TableView | getView()
return view;
|
public int | getVisibleYOffset()
return view.rowGetVisibleYOffset(this);
|
public boolean | getVisuallyChangedSinceLastRefresh()
if (bDisposed) {
return true;
}
if (bRowVisuallyChangedSinceRefresh) {
return true;
}
Iterator iter = mapTableCells.values().iterator();
while (iter.hasNext()) {
TableCellSWT cell = (TableCellSWT) iter.next();
if (cell != null) {
if (cell.getVisuallyChangedSinceRefresh()) {
return true;
}
}
}
return false;
|
public void | invalidate()
if (bDisposed) {
return;
}
long lTimeStart = System.currentTimeMillis();
Iterator iter = mapTableCells.values().iterator();
while (iter.hasNext()) {
TableCellSWT cell = (TableCellSWT) iter.next();
if (cell != null) {
cell.invalidate(true);
}
}
long diff = System.currentTimeMillis() - lTimeStart;
if (diff >= 10) {
System.out.println("invalidate: " + diff + "ms");
}
|
public void | invalidateGraphic()
if (bDisposed) {
return;
}
long lTimeStart = System.currentTimeMillis();
Iterator iter = mapTableCells.values().iterator();
while (iter.hasNext()) {
TableCellSWT cell = (TableCellSWT) iter.next();
if (cell.getTableColumn().getType() == TableColumn.TYPE_GRAPHIC) {
cell.invalidate(true);
}
}
long diff = System.currentTimeMillis() - lTimeStart;
if (diff >= 10) {
System.out.println("invalidate: " + diff + "ms");
}
|
public void | invokeMouseListeners(TableRowMouseEvent event)
ArrayList listeners = mouseListeners;
if (listeners == null)
return;
for (int i = 0; i < listeners.size(); i++) {
try {
TableRowMouseListener l = (TableRowMouseListener) (listeners.get(i));
l.rowMouseTrigger(event);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
|
public boolean | isFocused()
return this.equals(view.getRowFocused());
|
public boolean | isRowDisposed()
return bDisposed;
|
public boolean | isSelected()
return bSelected;
|
public boolean | isValid()
if (bDisposed) {
return true;
}
boolean valid = true;
Iterator iter = mapTableCells.values().iterator();
while (iter.hasNext()) {
TableCellSWT cell = (TableCellSWT) iter.next();
if (cell != null) {
valid &= cell.isValid();
}
}
return valid;
|
public boolean | isVisible()
return view.isRowVisible(this);
|
public void | locationChanged(int iStartColumn)
// TODO Auto-generated method stub
|
public void | redraw()
view.rowRefreshAsync(this, true, true);
|
public java.util.List | refresh(boolean bDoGraphics)
if (bDisposed) {
return new ArrayList();
}
boolean bVisible = isVisible();
return refresh(bDoGraphics, bVisible);
|
public java.util.List | refresh(boolean bDoGraphics, boolean bVisible)
if (bDisposed) {
return new ArrayList();
}
return view.rowRefresh(this, bDoGraphics, bVisible);
|
public void | removeMouseListener(TableRowMouseListener listener)
try {
this_mon.enter();
if (mouseListeners == null)
return;
mouseListeners.remove(listener);
} finally {
this_mon.exit();
}
|
public void | setAlternatingBGColor(boolean bEvenIfNotVisible)
setBackgroundColor(getIndex());
|
private void | setBackgroundColor(int iPosition)
checkCellForSetting();
boolean bOdd = ((iPosition + 1) % 2) == 0;
if (bSelected) {
if (skinProperties == null) {
bg = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION);
fg = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
} else {
String sColorID = (bOdd) ? "color.row.odd.selected.bg"
: "color.row.even.selected.bg";
Color color = skinProperties == null ? null
: skinProperties.getColor(sColorID);
if (color != null) {
bg = color;
} else {
bg = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION);
}
sColorID = (bOdd) ? "color.row.odd.selected.fg"
: "color.row.even.selected.fg";
Color cText = skinProperties == null ? null
: skinProperties.getColor(sColorID);
if (cText == null) {
sColorID = (bOdd) ? "color.row.odd.fg" : "color.row.even.fg";
cText = skinProperties == null ? null
: skinProperties.getColor(sColorID);
if (cText == null) {
cText = parent.getDisplay().getSystemColor(
SWT.COLOR_LIST_SELECTION_TEXT);
}
}
fg = cText;
}
bRowVisuallyChangedSinceRefresh = true;
invalidateGraphic();
if (isVisible()) {
redraw();
}
} else {
boolean bChanged = false;
if (skinProperties != null) {
String sColorID = (bOdd) ? "color.row.odd.bg" : "color.row.even.bg";
Color color = skinProperties.getColor(sColorID);
if (color != null && !colorsEqual(color, bg)) {
bChanged = true;
bg = color;
}
} else {
Color oldColor = bg;
bg = bOdd ? bg = parent.getDisplay().getSystemColor(
SWT.COLOR_LIST_BACKGROUND) : Colors.colorAltRow;
if (!colorsEqual(oldColor, bg)) {
bChanged = true;
}
}
String sColorID = (bOdd) ? "color.row.odd.fg" : "color.row.even.fg";
Color cText = skinProperties == null ? null
: skinProperties.getColor(sColorID);
if (cText == null) {
cText = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
}
if (!colorsEqual(cText, fg)) {
bChanged = true;
fg = cText;
}
if (bChanged) {
bRowVisuallyChangedSinceRefresh = true;
invalidateGraphic();
if (isVisible()) {
redraw();
}
}
}
// 1160681379555: r54c4r.v?N;Invalidate Cell;true from ListRow::setBackgroundColor::316,ListRow::setIndex::468,ListView::notifyIndexChanges::385,ListView$3::run::344,Utils::execSWTThread::590,Utils::execSWTThread::618,ListView::addDataSources::313,ListView::processDataSourceQueue::242,ListView::updateUI::660,UIUpdaterImpl::update::139,UIUpdaterImpl::access$0::126,UIUpdaterImpl$1::runSupport::72,AERunnable::run::38,RunnableLock::run::35,Synchronizer::runAsyncMessages::123,Display::runAsyncMessages::3325,Display::readAndDispatch::2971,SWTThread::<init>::130,SWTThread::createInstance::64,Initializer::<init>::169,Initializer::main::147
|
public void | setFocused(boolean b)
ListRow oldRow = view.getRowFocused();
if (b) {
view.rowSetFocused(this);
} else if (isFocused()) {
view.rowSetFocused(null);
}
if (oldRow != null) {
oldRow.redraw();
}
redraw();
|
public void | setForeground(Color c)
Iterator iter = mapTableCells.values().iterator();
while (iter.hasNext()) {
TableCellSWT item = (TableCellSWT) iter.next();
item.setForeground(c);
}
|
public boolean | setHeight(int iHeight)
// TODO Auto-generated method stub
bRowVisuallyChangedSinceRefresh = true;
return false;
|
public boolean | setIconSize(Point pt)
// TODO Auto-generated method stub
bRowVisuallyChangedSinceRefresh = true;
return false;
|
public void | setSelected(boolean bSelected)
if (this.bSelected == bSelected) {
return;
}
this.bSelected = bSelected;
setBackgroundColor(getIndex());
view.rowSetSelected(this, bSelected);
|
public boolean | setTableItem(int iRowPos)Fixes up layout, and if something changed, it makes sure items near it
are fixed up
if (!fixupPosition()) {
return false;
}
ListRow row = view.getRow(iRowPos + 1);
if (row != null) {
row.fixupPosition();
}
bRowVisuallyChangedSinceRefresh = true;
return true;
|
public void | setUpToDate(boolean upToDate)
if (bDisposed) {
return;
}
long lTimeStart = System.currentTimeMillis();
Iterator iter = mapTableCells.values().iterator();
while (iter.hasNext()) {
TableCellSWT cell = (TableCellSWT) iter.next();
if (cell != null) {
boolean bOldUpToDate = cell.isUpToDate();
if (bOldUpToDate != upToDate) {
cell.setUpToDate(upToDate);
// hack.. a call to ListCell.isShown will trigger Visibility Listener
ListCell listcell = (ListCell) cell.getBufferedTableItem();
listcell.isShown();
}
}
}
long diff = System.currentTimeMillis() - lTimeStart;
if (diff >= 50) {
System.out.println("sutd: " + upToDate + " for " + getIndex() + "; "
+ diff + "ms");
}
|
public java.lang.String | toString()
return "ListRow {" + getIndex() + (bDisposed ? ", Disposed" : "") + ","
+ view.getTableID() + "}";
|