Methods Summary |
---|
public void | addCellAddedListener(TableCellAddedListener listener)
try {
this_mon.enter();
if (cellAddedListeners == null) {
cellAddedListeners = new ArrayList(1);
}
cellAddedListeners.add(listener);
} finally {
this_mon.exit();
}
|
public void | addCellDisposeListener(TableCellDisposeListener listener)
try {
this_mon.enter();
if (cellDisposeListeners == null) {
cellDisposeListeners = new ArrayList(1);
}
cellDisposeListeners.add(listener);
} finally {
this_mon.exit();
}
|
public void | addCellMouseListener(TableCellMouseListener listener)
try {
this_mon.enter();
if (cellMouseListeners == null) {
cellMouseListeners = new ArrayList(1);
}
cellMouseListeners.add(listener);
} finally {
this_mon.exit();
}
|
public void | addCellMouseMoveListener(TableCellMouseMoveListener listener)
try {
this_mon.enter();
if (cellMouseMoveListeners == null) {
cellMouseMoveListeners = new ArrayList(1);
}
cellMouseMoveListeners.add(listener);
} finally {
this_mon.exit();
}
|
public void | addCellRefreshListener(TableCellRefreshListener listener)
try {
this_mon.enter();
if (cellRefreshListeners == null) {
cellRefreshListeners = new ArrayList(1);
}
cellRefreshListeners.add(listener);
//System.out.println(this + " :: addCellRefreshListener " + listener + ". " + cellRefreshListeners.size());
} finally {
this_mon.exit();
}
|
public void | addCellToolTipListener(TableCellToolTipListener listener)
try {
this_mon.enter();
if (cellToolTipListeners == null) {
cellToolTipListeners = new ArrayList(1);
}
cellToolTipListeners.add(listener);
} finally {
this_mon.exit();
}
|
public void | addCellVisibilityListener(TableCellVisibilityListener listener)
try {
this_mon.enter();
if (cellVisibilityListeners == null) {
cellVisibilityListeners = new ArrayList(1);
}
cellVisibilityListeners.add(listener);
} finally {
this_mon.exit();
}
|
public TableContextMenuItem | addContextMenuItem(java.lang.String key)
if (menuItems == null) {
menuItems = new ArrayList();
}
// Hack.. should be using our own implementation..
TableContextMenuItemImpl item = new TableContextMenuItemImpl("", key);
menuItems.add(item);
return item;
|
public void | addListeners(java.lang.Object listenerObject)
if (listenerObject instanceof TableCellDisposeListener) {
addCellDisposeListener((TableCellDisposeListener) listenerObject);
}
if (listenerObject instanceof TableCellRefreshListener) {
addCellRefreshListener((TableCellRefreshListener) listenerObject);
}
if (listenerObject instanceof TableCellToolTipListener) {
addCellToolTipListener((TableCellToolTipListener) listenerObject);
}
if (listenerObject instanceof TableCellAddedListener) {
addCellAddedListener((TableCellAddedListener) listenerObject);
}
if (listenerObject instanceof TableCellMouseMoveListener) {
addCellMouseMoveListener((TableCellMouseMoveListener) listenerObject);
}
if (listenerObject instanceof TableCellMouseListener) {
addCellMouseListener((TableCellMouseListener) listenerObject);
}
if (listenerObject instanceof TableCellVisibilityListener) {
addCellVisibilityListener((TableCellVisibilityListener) listenerObject);
}
|
public void | addRefreshTime(long ms)
if (ms == 0) {
lStatsRefreshZeroCount++;
} else {
lStatsRefreshTotalTime += ms;
lStatsRefreshCount++;
}
|
public int | compare(java.lang.Object arg0, java.lang.Object arg1)
TableCellCore cell0 = ((TableRowCore) arg0).getTableCellCore(sName);
TableCellCore cell1 = ((TableRowCore) arg1).getTableCellCore(sName);
Comparable c0 = (cell0 == null) ? "" : cell0.getSortValue();
Comparable c1 = (cell1 == null) ? "" : cell1.getSortValue();
try {
boolean c0isString = c0 instanceof String;
boolean c1isString = c1 instanceof String;
if (c0isString && c1isString) {
if (bSortAscending) {
return ((String) c0).compareToIgnoreCase((String) c1);
}
return ((String) c1).compareToIgnoreCase((String) c0);
}
int val;
if (c1 == null) {
if (c0 == null) {
return 0;
}
// always place nulls at bottom
return -1;
} else if (c0 == null) {
// always place nulls at bottom
return 1;
} else if (c0isString && !c1isString) {
val = -1;
} else if (c1isString && !c0isString) {
val = 1;
} else {
val = c1.compareTo(c0);
}
return bSortAscending ? -val : val;
} catch (ClassCastException e) {
System.err.println("Can't compare " + c0.getClass().getName() + "("
+ c0.toString() + ") from row #" + cell0.getTableRowCore().getIndex()
+ " to " + c1.getClass().getName() + "(" + c1.toString()
+ ") from row #" + cell1.getTableRowCore().getIndex()
+ " while sorting column " + sName);
e.printStackTrace();
return 0;
}
|
public void | generateDiagnostics(IndentWriter writer)
writer.println("Column " + sTableID + ":" + sName
+ (bSortValueLive ? " (Live Sort)" : ""));
try {
writer.indent();
if (lStatsRefreshCount > 0) {
writer.println("Avg refresh time (" + lStatsRefreshCount
+ " samples): " + (lStatsRefreshTotalTime / lStatsRefreshCount)
+ " (" + lStatsRefreshZeroCount
+ " zero ms refreshes not included)");
}
writer.println("Listeners: refresh="
+ getListCountString(cellRefreshListeners) + "; dispose="
+ getListCountString(cellDisposeListeners) + "; mouse="
+ getListCountString(cellMouseListeners) + "; mm="
+ getListCountString(cellMouseMoveListeners) + "; vis="
+ getListCountString(cellVisibilityListeners) + "; added="
+ getListCountString(cellAddedListeners) + "; tooltip="
+ getListCountString(cellToolTipListeners));
writer.println("lLastSortValueChange=" + lLastSortValueChange);
} catch (Exception e) {
} finally {
writer.exdent();
}
|
public int | getAlignment()
return iAlignment;
|
public java.util.List | getCellAddedListeners()
try {
this_mon.enter();
if (cellAddedListeners == null) {
return (new ArrayList(0));
}
return (new ArrayList(cellAddedListeners));
} finally {
this_mon.exit();
}
|
public java.util.List | getCellRefreshListeners()
try {
this_mon.enter();
if (cellRefreshListeners == null) {
return (new ArrayList(0));
}
return (new ArrayList(cellRefreshListeners));
} finally {
this_mon.exit();
}
|
public boolean | getColumnAdded()
return bColumnAdded;
|
public int | getConsecutiveErrCount()
return iConsecutiveErrCount;
|
public TableContextMenuItem[] | getContextMenuItems()
if (menuItems == null) {
return new TableContextMenuItem[0];
}
return (TableContextMenuItem[]) menuItems.toArray(new TableContextMenuItem[0]);
|
public long | getLastSortValueChange()
if (bSortValueLive) {
return SystemTime.getCurrentTime();
}
return lLastSortValueChange;
|
private java.lang.String | getListCountString(java.util.List l)
if (l == null) {
return "-0";
}
return "" + l.size();
|
public int | getMaxWidth()
return iMaxWidth;
|
public int | getMinWidth()
if (iMinWidth < 0) {
return iWidth;
}
return iMinWidth;
|
public java.lang.String | getName()
return sName;
|
public int | getPosition()
return iPosition;
|
public int | getPreferredWidth()
return iPreferredWidth;
|
public int | getPreferredWidthMax()
return iPreferredWidthMax;
|
public int | getRefreshInterval()
return iInterval;
|
public java.lang.String | getTableID()
return sTableID;
|
public java.lang.String | getTitleLanguageKey()
try {
this_mon.enter();
if (sTitleLanguageKey == null) {
sTitleLanguageKey = sTableID + ".column." + sName;
if (MessageText.keyExists(sTitleLanguageKey)) {
return sTitleLanguageKey;
}
String sKeyPrefix;
// Try a generic one of "TableColumn." + columnid
sKeyPrefix = "TableColumn.header.";
if (MessageText.keyExists(sKeyPrefix + sName)) {
sTitleLanguageKey = sKeyPrefix + sName;
return sTitleLanguageKey;
}
// Support "Old Style" language keys, which have a prefix of TableID + "View."
// Also, "MySeeders" is actually stored in "MyTorrents"..
sKeyPrefix = (sTableID.equals(TableManager.TABLE_MYTORRENTS_COMPLETE)
? TableManager.TABLE_MYTORRENTS_INCOMPLETE : sTableID)
+ "View.";
if (MessageText.keyExists(sKeyPrefix + sName)) {
sTitleLanguageKey = sKeyPrefix + sName;
return sTitleLanguageKey;
}
// The "all peers" view should just share the same peer columns, so reuse them.
if (sTableID.equals(TableManager.TABLE_ALL_PEERS)) {
sKeyPrefix = TableManager.TABLE_TORRENT_PEERS + ".column.";
if (MessageText.keyExists(sKeyPrefix + sName)) {
sTitleLanguageKey = sKeyPrefix + sName;
return sTitleLanguageKey;
}
// Or try "PeersView".
sKeyPrefix = "PeersView.";
if (MessageText.keyExists(sKeyPrefix + sName)) {
sTitleLanguageKey = sKeyPrefix + sName;
return sTitleLanguageKey;
}
}
}
return sTitleLanguageKey;
} finally {
this_mon.exit();
}
|
public int | getType()
return iType;
|
public boolean | getUseCoreDataSource()
return bCoreDataSource;
|
public int | getWidth()
return iWidth;
|
public boolean | hasCellMouseMoveListener()
return cellMouseMoveListeners != null && cellMouseMoveListeners.size() > 0;
|
public boolean | hasCellRefreshListener()
return cellRefreshListeners != null && cellRefreshListeners.size() > 0;
|
public void | initialize(int iAlignment, int iPosition, int iWidth, int iInterval)
if (bColumnAdded) {
throw (new UIRuntimeException("Can't set properties. Column '" + sName
+ " already added"));
}
this.iAlignment = iAlignment;
setPosition(iPosition);
this.iWidth = iWidth;
this.iMinWidth = 16;
this.iInterval = iInterval;
|
public void | initialize(int iAlignment, int iPosition, int iWidth)
if (bColumnAdded) {
throw (new UIRuntimeException("Can't set properties. Column '" + sName
+ " already added"));
}
this.iAlignment = iAlignment;
setPosition(iPosition);
this.iWidth = iWidth;
this.iMinWidth = 16;
|
public void | invalidateCell(java.lang.Object data_source)
TableStructureEventDispatcher tsed = TableStructureEventDispatcher.getInstance(sTableID);
tsed.cellInvalidate(this, data_source);
|
public void | invalidateCells()
TableStructureEventDispatcher tsed = TableStructureEventDispatcher.getInstance(sTableID);
tsed.columnInvalidate(this);
|
public void | invokeCellAddedListeners(com.aelitis.azureus.ui.common.table.TableCellCore cell)
if (cellAddedListeners == null) {
return;
}
for (int i = 0; i < cellAddedListeners.size(); i++) {
try {
((TableCellAddedListener) (cellAddedListeners.get(i))).cellAdded(cell);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
|
public void | invokeCellDisposeListeners(com.aelitis.azureus.ui.common.table.TableCellCore cell)
if (cellDisposeListeners == null) {
return;
}
for (int i = 0; i < cellDisposeListeners.size(); i++) {
try {
((TableCellDisposeListener) (cellDisposeListeners.get(i))).dispose(cell);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
|
public void | invokeCellMouseListeners(TableCellMouseEvent event)
ArrayList listeners = event.eventType == TableCellMouseEvent.EVENT_MOUSEMOVE
? cellMouseMoveListeners : this.cellMouseListeners;
if (listeners == null) {
return;
}
for (int i = 0; i < listeners.size(); i++) {
try {
TableCellMouseListener l = (TableCellMouseListener) (listeners.get(i));
l.cellMouseTrigger(event);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
|
public void | invokeCellRefreshListeners(com.aelitis.azureus.ui.common.table.TableCellCore cell, boolean fastRefresh)
//System.out.println(this + " :: invokeCellRefreshListeners" + cellRefreshListeners);
if (cellRefreshListeners == null) {
return;
}
Throwable firstError = null;
//System.out.println(this + " :: invokeCellRefreshListeners" + cellRefreshListeners.size());
for (int i = 0; i < cellRefreshListeners.size(); i++) {
TableCellRefreshListener l = (TableCellRefreshListener)cellRefreshListeners.get(i);
try {
if(l instanceof TableCellLightRefreshListener)
((TableCellLightRefreshListener)l).refresh(cell, fastRefresh);
else
l.refresh(cell);
} catch (Throwable e) {
if (firstError == null) {
firstError = e;
}
Debug.printStackTrace(e);
}
}
if (firstError != null) {
throw firstError;
}
|
public void | invokeCellToolTipListeners(com.aelitis.azureus.ui.common.table.TableCellCore cell, int type)
if (cellToolTipListeners == null) {
return;
}
if (type == TableCellCore.TOOLTIPLISTENER_HOVER) {
for (int i = 0; i < cellToolTipListeners.size(); i++) {
try {
((TableCellToolTipListener) (cellToolTipListeners.get(i))).cellHover(cell);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
} else {
for (int i = 0; i < cellToolTipListeners.size(); i++) {
try {
((TableCellToolTipListener) (cellToolTipListeners.get(i))).cellHoverComplete(cell);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
}
|
public void | invokeCellVisibilityListeners(com.aelitis.azureus.ui.common.table.TableCellCore cell, int visibility)
if (cellVisibilityListeners == null) {
return;
}
for (int i = 0; i < cellVisibilityListeners.size(); i++) {
try {
TableCellVisibilityListener l = (TableCellVisibilityListener) (cellVisibilityListeners.get(i));
l.cellVisibilityChanged(cell, visibility);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
|
public boolean | isMaxWidthAuto()
return bMaxWidthAuto;
|
public boolean | isMinWidthAuto()
return bWidthAuto;
|
public boolean | isObfusticated()
return bObfusticateData;
|
public boolean | isPreferredWidthAuto()
return bPreferredWidthAuto;
|
public boolean | isSortAscending()
return bSortAscending;
|
public boolean | isSortValueLive()
return bSortValueLive;
|
public boolean | isVisible()
return bVisible;
|
public void | loadSettings()
String sItemPrefix = "Table." + sTableID + "." + sName;
setWidth(COConfigurationManager.getIntParameter(sItemPrefix + ".width",
iWidth));
setPositionNoShift(COConfigurationManager.getIntParameter(sItemPrefix
+ ".position", iPosition));
|
public void | removeCellAddedListener(TableCellAddedListener listener)
try {
this_mon.enter();
if (cellAddedListeners == null) {
return;
}
cellAddedListeners.remove(listener);
} finally {
this_mon.exit();
}
|
public void | removeCellDisposeListener(TableCellDisposeListener listener)
try {
this_mon.enter();
if (cellDisposeListeners == null) {
return;
}
cellDisposeListeners.remove(listener);
} finally {
this_mon.exit();
}
|
public void | removeCellMouseListener(TableCellMouseListener listener)
try {
this_mon.enter();
if (cellMouseListeners == null) {
return;
}
cellMouseListeners.remove(listener);
} finally {
this_mon.exit();
}
|
public void | removeCellMouseMoveListener(TableCellMouseMoveListener listener)
try {
this_mon.enter();
if (cellMouseMoveListeners == null) {
return;
}
cellMouseMoveListeners.remove(listener);
} finally {
this_mon.exit();
}
|
public void | removeCellRefreshListener(TableCellRefreshListener listener)
try {
this_mon.enter();
if (cellRefreshListeners == null) {
return;
}
cellRefreshListeners.remove(listener);
} finally {
this_mon.exit();
}
|
public void | removeCellToolTipListener(TableCellToolTipListener listener)
try {
this_mon.enter();
if (cellToolTipListeners == null) {
return;
}
cellToolTipListeners.remove(listener);
} finally {
this_mon.exit();
}
|
public void | removeCellVisibilityListener(TableCellVisibilityListener listener)
try {
this_mon.enter();
if (cellVisibilityListeners == null) {
return;
}
cellVisibilityListeners.remove(listener);
} finally {
this_mon.exit();
}
|
public void | removeContextMenuItem(TableContextMenuItem menuItem)
if (menuItems == null) {
return;
}
menuItems.remove(menuItem);
|
public void | saveSettings()
String sItemPrefix = "Table." + sTableID + "." + sName;
COConfigurationManager.setParameter(sItemPrefix + ".position", iPosition);
COConfigurationManager.setParameter(sItemPrefix + ".width", iWidth);
|
public void | setAlignment(int alignment)
if (bColumnAdded) {
throw (new UIRuntimeException("Can't set properties. Column '" + sName
+ " already added"));
}
iAlignment = alignment;
|
public void | setColumnAdded(boolean bAdded)
bColumnAdded = bAdded;
|
public void | setConsecutiveErrCount(int iCount)
iConsecutiveErrCount = iCount;
|
public void | setLastSortValueChange(long lastSortValueChange)
lLastSortValueChange = lastSortValueChange;
|
public void | setMaxWidth(int maxwidth)
if (maxwidth >= 0 && maxwidth < iMinWidth) {
iMinWidth = maxwidth;
}
if (iPreferredWidth > maxwidth) {
iPreferredWidth = maxwidth;
}
iMaxWidth = maxwidth;
if (maxwidth >= 0 && iWidth > iMaxWidth) {
setWidth(maxwidth);
}
|
public void | setMaxWidthAuto(boolean automaxwidth)
bMaxWidthAuto = automaxwidth;
|
public void | setMinWidth(int minwidth)
if (minwidth > iMaxWidth && iMaxWidth >= 0) {
iMaxWidth = minwidth;
}
if (iPreferredWidth > 0 && iPreferredWidth < minwidth) {
iPreferredWidth = minwidth;
}
iMinWidth = minwidth;
if (iWidth < minwidth) {
setWidth(minwidth);
}
|
public void | setMinWidthAuto(boolean autominwidth)
bWidthAuto = autominwidth;
|
public void | setObfustication(boolean hideData)
bObfusticateData = hideData;
|
public void | setPosition(int position)
if (bColumnAdded) {
throw (new UIRuntimeException("Can't set properties. Column '" + sName
+ " already added"));
}
if (iPosition < 0 && position >= 0) {
setVisible(true);
}
iPosition = position;
if (position < 0) {
setVisible(false);
}
|
public void | setPositionNoShift(int position)
if (iPosition < 0 && position >= 0) {
setVisible(true);
}
iPosition = position;
if (position < 0) {
setVisible(false);
}
|
public void | setPreferredWidth(int width)
if (iPreferredWidthMax > 0 && width > iPreferredWidthMax) {
width = iPreferredWidthMax;
}
if (width < iMinWidth) {
iPreferredWidth = iMinWidth;
} else if (iMaxWidth > 0 && width > iMaxWidth) {
iPreferredWidth = iMaxWidth;
} else {
iPreferredWidth = width;
}
if (bColumnAdded && iPosition != POSITION_INVISIBLE) {
triggerColumnSizeChange();
}
|
public void | setPreferredWidthAuto(boolean auto)
bPreferredWidthAuto = auto;
|
public void | setPreferredWidthMax(int maxprefwidth)
iPreferredWidthMax = maxprefwidth;
if (iPreferredWidth > iPreferredWidthMax) {
setPreferredWidth(maxprefwidth);
}
|
public void | setRefreshInterval(int interval)
iInterval = interval;
|
public void | setSortAscending(boolean bAscending)
if (this.bSortAscending == bAscending) {
return;
}
setLastSortValueChange(SystemTime.getCurrentTime());
this.bSortAscending = bAscending;
|
public void | setSortValueLive(boolean live)
// if (live && !bSortValueLive) {
// System.out.println("Setting " + sTableID + ": " + sName + " to live sort value");
// }
bSortValueLive = live;
|
public void | setTableID(java.lang.String tableID)
sTableID = tableID;
|
public void | setType(int type)
if (bColumnAdded) {
throw (new UIRuntimeException("Can't set properties. Column '" + sName
+ " already added"));
}
iType = type;
|
public void | setUseCoreDataSource(boolean bCoreDataSource)
this.bCoreDataSource = bCoreDataSource;
|
public void | setVisible(boolean visible)
if (bVisible == visible) {
return;
}
bVisible = visible;
invalidateCells();
|
public void | setWidth(int width)
if (width == iWidth || width < 0) {
return;
}
if (iMinWidth > 0 && width < iMinWidth) {
return;
}
if (iMaxWidth > 0 && width > iMaxWidth) {
if (width == iMaxWidth) {
return;
}
width = iMaxWidth;
}
if (iMinWidth < 0) {
iMinWidth = width;
}
// if (iPreferredWidth <= 0) {
// iPreferredWidth = iWidth;
// }
iWidth = width;
if (bColumnAdded && iPosition != POSITION_INVISIBLE) {
triggerColumnSizeChange();
}
|
public void | setWidthLimits(int min, int max)
setMinWidth(min);
setMaxWidth(max);
|
public void | triggerColumnSizeChange()
TableStructureEventDispatcher tsed = TableStructureEventDispatcher.getInstance(sTableID);
tsed.columnSizeChanged(this);
if (iType == TYPE_GRAPHIC) {
invalidateCells();
}
|