📄 tablecellimpl.java
字号:
if (bDebug)
debug("Calling Refresh from Refresh :) Skipping.");
return ret;
}
long now;
boolean flag;
bInRefresh = true;
if (!ret)
break MISSING_BLOCK_LABEL_214;
now = SystemTime.getCurrentTime();
if (now - lastRefresh >= (long)MAX_REFRESHES_WITHIN_MS)
break MISSING_BLOCK_LABEL_203;
numFastRefreshes++;
if (numFastRefreshes < MAX_REFRESHES)
break MISSING_BLOCK_LABEL_214;
if (numFastRefreshes % MAX_REFRESHES == 0)
pluginError((new StringBuilder()).append("this plugin is crazy. tried to refresh ").append(numFastRefreshes).append(" times in ").append(now - lastRefresh).append("ms").toString());
flag = ret;
bInRefresh = false;
return flag;
numFastRefreshes = 0;
lastRefresh = now;
if (bCellVisible && !isUpToDate())
{
if (bDebug)
debug("Setting Invalid because visible & not up to date");
clearFlag(1);
setFlag(8);
} else
if (!bCellVisible && isUpToDate())
{
if (bDebug)
debug((new StringBuilder()).append("Setting not up to date because cell not visible ").append(Debug.getCompressedStackTrace()).toString());
clearFlag(8);
}
if (bDebug)
debug((new StringBuilder()).append("Cell Valid?").append(hasFlag(1)).append("; Visible?").append(tableRow.isVisible()).append("/").append(bufferedTableItem.isShown()).toString());
int iInterval = tableColumn.getRefreshInterval();
if (iInterval == -3 && !hasFlag(33) && hasFlag(2) && sortValue != null && tableColumn.getType() == 3)
{
if (bCellVisible)
{
if (bDebug)
debug("fast refresh: setText");
ret = setText((String)sortValue);
setFlag(1);
}
} else
if (iInterval == -2 || iInterval == -1 && bDoGraphics || iInterval > 0 && loopFactor % iInterval == 0 || !hasFlag(1) || hasFlag(32))
{
boolean bWasValid = isValid();
if (hasFlag(32))
clearFlag(32);
if (bDebug)
debug((new StringBuilder()).append("invoke refresh; wasValid? ").append(bWasValid).toString());
long lTimeStart = SystemTime.getMonotonousTime();
tableColumn.invokeCellRefreshListeners(this, !bCellVisible);
if (refreshListeners != null)
{
for (int i = 0; i < refreshListeners.size(); i++)
{
TableCellRefreshListener l = (TableCellRefreshListener)refreshListeners.get(i);
if (l instanceof TableCellLightRefreshListener)
((TableCellLightRefreshListener)l).refresh(this, !bCellVisible);
else
l.refresh(this);
}
}
long lTimeEnd = SystemTime.getMonotonousTime();
tableColumn.addRefreshTime(lTimeEnd - lTimeStart);
if (!bWasValid && !hasFlag(32))
setFlag(1);
}
loopFactor++;
refreshErrLoopCount = 0;
if (iErrCount > 0)
tableColumn.setConsecutiveErrCount(0);
ret = getVisuallyChangedSinceRefresh();
if (bDebug)
debug((new StringBuilder()).append("refresh done; visual change? ").append(ret).append(";").append(Debug.getCompressedStackTrace()).toString());
bInRefresh = false;
break MISSING_BLOCK_LABEL_875;
Throwable e;
e;
refreshErrLoopCount++;
if (tableColumn != null)
tableColumn.setConsecutiveErrCount(++iErrCount);
pluginError(e);
if (refreshErrLoopCount > 2)
Logger.log(new LogEvent(LOGID, 3, "TableCell will not be refreshed anymore this session."));
bInRefresh = false;
break MISSING_BLOCK_LABEL_875;
Exception exception;
exception;
bInRefresh = false;
throw exception;
if (childCells != null)
{
Object childCellsArray[] = childCells.toArray();
for (int i = 0; i < childCellsArray.length; i++)
{
TableCellImpl childCell = (TableCellImpl)childCellsArray[i];
childCell.refresh(bDoGraphics, bRowVisible, bCellVisible);
}
}
return ret;
}
public boolean getVisuallyChangedSinceRefresh()
{
return hasFlag(64);
}
public void dispose()
{
setFlag(16);
tableColumn.invokeCellDisposeListeners(this);
if (disposeListeners != null)
try
{
TableCellDisposeListener listener;
for (Iterator iter = disposeListeners.iterator(); iter.hasNext(); listener.dispose(this))
listener = (TableCellDisposeListener)iter.next();
disposeListeners = null;
}
catch (Throwable e)
{
pluginError(e);
}
if (bufferedTableItem != null)
{
bufferedTableItem.setForeground(null);
bufferedTableItem.dispose();
}
refreshListeners = null;
bufferedTableItem = null;
tableColumn = null;
tableRow = null;
sortValue = null;
}
public boolean setIcon(Image img)
{
if (isInvisibleAndCanRefresh())
{
return false;
} else
{
bufferedTableItem.setIcon(img);
graphic = null;
setFlag(64);
return true;
}
}
public Image getIcon()
{
if (bufferedTableItem == null)
return null;
else
return bufferedTableItem.getIcon();
}
public boolean needsPainting()
{
if (cellSWTPaintListeners != null || tableColumn.hasCellOtherListeners("SWTPaint"))
return true;
if (bufferedTableItem == null)
return false;
else
return bufferedTableItem.needsPainting();
}
public void doPaint(GC gc)
{
if (bDebug)
debug((new StringBuilder()).append("doPaint up2date:").append(hasFlag(8)).append(";v:").append(hasFlag(1)).append(";rl=").append(refreshListeners).toString());
invokeSWTPaintListeners(gc);
bufferedTableItem.doPaint(gc);
if (childCells != null)
{
Object childCellsArray[] = childCells.toArray();
for (int i = 0; i < childCellsArray.length; i++)
{
TableCellImpl childCell = (TableCellImpl)childCellsArray[i];
childCell.doPaint(gc);
}
}
}
public void locationChanged()
{
if (bufferedTableItem != null)
bufferedTableItem.locationChanged();
}
public TableRowCore getTableRowCore()
{
return tableRow;
}
public TableRowSWT getTableRowSWT()
{
if (tableRow instanceof TableRowSWT)
return (TableRowSWT)tableRow;
else
return null;
}
public String toString()
{
return (new StringBuilder()).append("TableCell {").append(tableColumn.getName()).append(",").append(bufferedTableItem != null ? (new StringBuilder()).append("").append(bufferedTableItem.getPosition()).toString() : "null").append(",").append(getText()).append(",").append(getSortValue()).append("}").toString();
}
public int compareTo(Object o)
{
Comparable ourSortValue;
Comparable otherSortValue;
Collator collator;
ourSortValue = getSortValue();
otherSortValue = ((TableCellImpl)o).getSortValue();
if (!(ourSortValue instanceof String) || !(otherSortValue instanceof String))
break MISSING_BLOCK_LABEL_43;
collator = Collator.getInstance(Locale.getDefault());
return collator.compare(ourSortValue, otherSortValue);
return ourSortValue.compareTo(otherSortValue);
ClassCastException e;
e;
break MISSING_BLOCK_LABEL_69;
Exception e;
e;
System.out.println("Could not compare cells");
Debug.printStackTrace(e);
return 0;
}
public void invokeToolTipListeners(int type)
{
if (tableColumn == null)
return;
tableColumn.invokeCellToolTipListeners(this, type);
if (tooltipListeners == null || tooltipErrLoopCount > 2)
return;
int iErrCount = tableColumn.getConsecutiveErrCount();
if (iErrCount > 10)
return;
try
{
if (type == 0)
{
for (int i = 0; i < tooltipListeners.size(); i++)
((TableCellToolTipListener)(TableCellToolTipListener)tooltipListeners.get(i)).cellHover(this);
} else
{
for (int i = 0; i < tooltipListeners.size(); i++)
((TableCellToolTipListener)(TableCellToolTipListener)tooltipListeners.get(i)).cellHoverComplete(this);
}
tooltipErrLoopCount = 0;
}
catch (Throwable e)
{
tooltipErrLoopCount++;
tableColumn.setConsecutiveErrCount(++iErrCount);
pluginError(e);
if (tooltipErrLoopCount > 2)
Logger.log(new LogEvent(LOGID, 3, "TableCell's tooltip will not be refreshed anymore this session."));
}
}
public void invokeMouseListeners(TableCellMouseEvent event)
{
ArrayList listeners = event.eventType != 3 ? cellMouseListeners : cellMouseMoveListeners;
if (listeners == null)
return;
if (event.cell != null && event.row == null)
event.row = event.cell.getTableRow();
for (int i = 0; i < listeners.size(); i++)
try
{
TableCellMouseListener l = (TableCellMouseListener)(TableCellMouseListener)listeners.get(i);
l.cellMouseTrigger(event);
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
}
public void invokeVisibilityListeners(int visibility, boolean invokeColumnListeners)
{
if (invokeColumnListeners)
tableColumn.invokeCellVisibilityListeners(this, visibility);
if (cellVisibilityListeners == null)
return;
for (int i = 0; i < cellVisibilityListeners.size(); i++)
try
{
TableCellVisibilityListener l = (TableCellVisibilityListener)(TableCellVisibilityListener)cellVisibilityListeners.get(i);
l.cellVisibilityChanged(this, visibility);
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
}
public void setUpToDate(boolean upToDate)
{
if (bDebug)
debug((new StringBuilder()).append("set up to date to ").append(upToDate).toString());
if (upToDate)
setFlag(8);
else
clearFlag(8);
}
public boolean isUpToDate()
{
return hasFlag(8);
}
public void debug(final String s)
{
Utils.execSWTThread(new AERunnable() {
final String val$s;
final TableCellImpl this$0;
public void runSupport()
{
System.out.println((new StringBuilder()).append(SystemTime.getCurrentTime()).append(": r").append(tableRow.getIndex()).append("c").append(tableColumn.getPosition()).append("r.v?").append(tableRow.isVisible() ? "Y" : "N").append(";").append(s).toString());
}
{
this$0 = TableCellImpl.this;
s = s1;
super();
}
}, true);
}
public Rectangle getBounds()
{
if (isDisposed())
return new Rectangle(0, 0, 0, 0);
Rectangle bounds = bufferedTableItem.getBounds();
if (bounds == null)
return new Rectangle(0, 0, 0, 0);
else
return bounds;
}
private void setOrientationViaColumn()
{
if (!(bufferedTableItem instanceof BufferedGraphicTableItem))
{
return;
} else
{
int align = tableColumn.getAlignment();
BufferedGraphicTableItem ti = (BufferedGraphicTableItem)bufferedTableItem;
ti.setOrientation(TableColumnSWTUtils.convertColumnAlignmentToSWT(align));
return;
}
}
public String getObfusticatedText()
{
if (tableColumn.isObfusticated())
{
if (tableColumn instanceof ObfusticateCellText)
return ((ObfusticateCellText)tableColumn).getObfusticatedText(this);
else
return "";
} else
{
return null;
}
}
public Graphic getBackgroundGraphic()
{
if (bufferedTableItem == null)
return null;
else
return new UISWTGraphicImpl(bufferedTableItem.getBackgroundImage());
}
public Image getBackgroundImage()
{
if (bufferedTableItem == null)
return null;
else
return bufferedTableItem.getBackgroundImage();
}
public BufferedTableItem getBufferedTableItem()
{
return bufferedTableItem;
}
public int getCursorID()
{
return iCursorID;
}
public void setCursorID(int cursorID)
{
iCursorID = cursorID;
Utils.execSWTThread(new AERunnable() {
final TableCellImpl this$0;
public void runSupport()
{
if (isMouseOver())
bufferedTableItem.setCursor(iCursorID);
}
{
this$0 = TableCellImpl.this;
super();
}
});
}
public boolean isMouseOver()
{
if (bufferedTableItem == null)
return false;
else
return bufferedTableItem.isMouseOver();
}
public int[] getMouseOffset()
{
Point ofs = ((TableViewSWT)tableRow.getView()).getTableCellMouseOffset(this);
return ofs != null ? (new int[] {
ofs.x, ofs.y
}) : null;
}
private boolean hasFlag(int flag)
{
return (flags & flag) != 0;
}
private void setFlag(int flag)
{
flags |= flag;
}
private void clearFlag(int flag)
{
flags &= ~flag;
}
public void addChildCell(TableCellImpl childCell)
{
if (childCells == null)
childCells = new ArrayList(1);
childCells.add(childCell);
}
public int getTextAlpha()
{
return textAlpha;
}
public void setTextAlpha(int textOpacity)
{
textAlpha = textOpacity;
}
static
{
LOGID = LogIDs.GUI;
COConfigurationManager.addAndFireParameterListener("GUI_SWT_bAlternateTablePainting", new ParameterListener() {
public void parameterChanged(String parameterName)
{
TableCellImpl.bAlternateTablePainting = COConfigurationManager.getBooleanParameter("GUI_SWT_bAlternateTablePainting");
}
});
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -