FileDocCategorySizeDatePackage
TableColumnImpl.javaAPI DocAzureus 3.0.3.426140Sun Sep 23 04:57:40 BST 2007com.aelitis.azureus.ui.common.table.impl

TableColumnImpl

public class TableColumnImpl extends Object implements com.aelitis.azureus.ui.common.table.TableColumnCore
Table Column definition and modification routines. Implements both the plugin API and the core API.

A column is defined in relation to a table. When one column is in multiple tables of different table ids, each table has it's own column instance

author
TuxPaper
see
org.gudy.azureus2.ui.swt.views.table.utils.TableColumnManager

Fields Summary
private String
sName
Internal Name/ID of the column
private String
sTitleLanguageKey
key of the displayed title for the column. If null, uses default calc
private int
iAlignment
private int
iType
private int
iPosition
private int
iWidth
private int
iInterval
private long
lLastSortValueChange
private String
sTableID
Table the column belongs to
private boolean
bColumnAdded
private boolean
bCoreDataSource
private ArrayList
cellRefreshListeners
private ArrayList
cellAddedListeners
private ArrayList
cellDisposeListeners
private ArrayList
cellToolTipListeners
private ArrayList
cellMouseListeners
private ArrayList
cellMouseMoveListeners
private ArrayList
cellVisibilityListeners
private int
iConsecutiveErrCount
private ArrayList
menuItems
private boolean
bObfusticateData
protected AEMonitor
this_mon
private boolean
bSortValueLive
private long
lStatsRefreshTotalTime
private long
lStatsRefreshCount
private long
lStatsRefreshZeroCount
private boolean
bSortAscending
private int
iMinWidth
private int
iMaxWidth
private boolean
bVisible
private boolean
bMaxWidthAuto
private boolean
bWidthAuto
private int
iPreferredWidth
private boolean
bPreferredWidthAuto
private int
iPreferredWidthMax
Constructors Summary
public TableColumnImpl(String tableID, String columnID)
Create a column object for the specified table.

param
tableID table in which the column belongs to
param
columnID name/id of the column


	                       	 
	     
		sTableID = tableID;
		sName = columnID;
		iType = TYPE_TEXT_ONLY;
		iWidth = 50;
		iAlignment = ALIGN_LEAD;
		bColumnAdded = false;
		bCoreDataSource = false;
		iInterval = INTERVAL_INVALID_ONLY;
		iConsecutiveErrCount = 0;
		lLastSortValueChange = 0;
		bVisible = true;
		iMinWidth = 16;
		setPosition(POSITION_INVISIBLE);
	
Methods Summary
public voidaddCellAddedListener(TableCellAddedListener listener)

		try {
			this_mon.enter();

			if (cellAddedListeners == null) {
				cellAddedListeners = new ArrayList(1);
			}

			cellAddedListeners.add(listener);

		} finally {

			this_mon.exit();
		}
	
public voidaddCellDisposeListener(TableCellDisposeListener listener)

		try {
			this_mon.enter();

			if (cellDisposeListeners == null) {
				cellDisposeListeners = new ArrayList(1);
			}

			cellDisposeListeners.add(listener);
		} finally {

			this_mon.exit();
		}
	
public voidaddCellMouseListener(TableCellMouseListener listener)

		try {
			this_mon.enter();

			if (cellMouseListeners == null) {
				cellMouseListeners = new ArrayList(1);
			}

			cellMouseListeners.add(listener);

		} finally {
			this_mon.exit();
		}
	
public voidaddCellMouseMoveListener(TableCellMouseMoveListener listener)

		try {
			this_mon.enter();

			if (cellMouseMoveListeners == null) {
				cellMouseMoveListeners = new ArrayList(1);
			}

			cellMouseMoveListeners.add(listener);

		} finally {
			this_mon.exit();
		}
	
public voidaddCellRefreshListener(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 voidaddCellToolTipListener(TableCellToolTipListener listener)

		try {
			this_mon.enter();

			if (cellToolTipListeners == null) {
				cellToolTipListeners = new ArrayList(1);
			}

			cellToolTipListeners.add(listener);

		} finally {
			this_mon.exit();
		}
	
public voidaddCellVisibilityListener(TableCellVisibilityListener listener)

		try {
			this_mon.enter();

			if (cellVisibilityListeners == null) {
				cellVisibilityListeners = new ArrayList(1);
			}

			cellVisibilityListeners.add(listener);

		} finally {
			this_mon.exit();
		}
	
public TableContextMenuItemaddContextMenuItem(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 voidaddListeners(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 voidaddRefreshTime(long ms)

		if (ms == 0) {
			lStatsRefreshZeroCount++;
		} else {
			lStatsRefreshTotalTime += ms;
			lStatsRefreshCount++;
		}
	
public intcompare(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 voidgenerateDiagnostics(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 intgetAlignment()

		return iAlignment;
	
public java.util.ListgetCellAddedListeners()

		try {
			this_mon.enter();

			if (cellAddedListeners == null) {
				return (new ArrayList(0));
			}

			return (new ArrayList(cellAddedListeners));

		} finally {

			this_mon.exit();
		}
	
public java.util.ListgetCellRefreshListeners()

		try {
			this_mon.enter();

			if (cellRefreshListeners == null) {
				return (new ArrayList(0));
			}

			return (new ArrayList(cellRefreshListeners));

		} finally {

			this_mon.exit();
		}
	
public booleangetColumnAdded()

		return bColumnAdded;
	
public intgetConsecutiveErrCount()

		return iConsecutiveErrCount;
	
public TableContextMenuItem[]getContextMenuItems()

		if (menuItems == null) {
			return new TableContextMenuItem[0];
		}

		return (TableContextMenuItem[]) menuItems.toArray(new TableContextMenuItem[0]);
	
public longgetLastSortValueChange()

		if (bSortValueLive) {
			return SystemTime.getCurrentTime();
		}
		return lLastSortValueChange;
	
private java.lang.StringgetListCountString(java.util.List l)

		if (l == null) {
			return "-0";
		}
		return "" + l.size();
	
public intgetMaxWidth()

		return iMaxWidth;
	
public intgetMinWidth()

		if (iMinWidth < 0) {
			return iWidth;
		}

		return iMinWidth;
	
public java.lang.StringgetName()

		return sName;
	
public intgetPosition()

		return iPosition;
	
public intgetPreferredWidth()

		return iPreferredWidth;
	
public intgetPreferredWidthMax()

		return iPreferredWidthMax;
	
public intgetRefreshInterval()

		return iInterval;
	
public java.lang.StringgetTableID()

		return sTableID;
	
public java.lang.StringgetTitleLanguageKey()

		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 intgetType()

		return iType;
	
public booleangetUseCoreDataSource()

		return bCoreDataSource;
	
public intgetWidth()

		return iWidth;
	
public booleanhasCellMouseMoveListener()

		return cellMouseMoveListeners != null && cellMouseMoveListeners.size() > 0;
	
public booleanhasCellRefreshListener()

		return cellRefreshListeners != null && cellRefreshListeners.size() > 0;
	
public voidinitialize(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 voidinitialize(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 voidinvalidateCell(java.lang.Object data_source)

		TableStructureEventDispatcher tsed = TableStructureEventDispatcher.getInstance(sTableID);
		tsed.cellInvalidate(this, data_source);
	
public voidinvalidateCells()

		TableStructureEventDispatcher tsed = TableStructureEventDispatcher.getInstance(sTableID);
		tsed.columnInvalidate(this);
	
public voidinvokeCellAddedListeners(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 voidinvokeCellDisposeListeners(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 voidinvokeCellMouseListeners(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 voidinvokeCellRefreshListeners(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 voidinvokeCellToolTipListeners(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 voidinvokeCellVisibilityListeners(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 booleanisMaxWidthAuto()

		return bMaxWidthAuto;
	
public booleanisMinWidthAuto()

		return bWidthAuto;
	
public booleanisObfusticated()

		return bObfusticateData;
	
public booleanisPreferredWidthAuto()

		return bPreferredWidthAuto;
	
public booleanisSortAscending()

return
Returns the bAscending.

		return bSortAscending;
	
public booleanisSortValueLive()

		return bSortValueLive;
	
public booleanisVisible()

		return bVisible;
	
public voidloadSettings()

		String sItemPrefix = "Table." + sTableID + "." + sName;
		setWidth(COConfigurationManager.getIntParameter(sItemPrefix + ".width",
				iWidth));
		setPositionNoShift(COConfigurationManager.getIntParameter(sItemPrefix
				+ ".position", iPosition));
	
public voidremoveCellAddedListener(TableCellAddedListener listener)

		try {
			this_mon.enter();

			if (cellAddedListeners == null) {
				return;
			}

			cellAddedListeners.remove(listener);

		} finally {

			this_mon.exit();
		}
	
public voidremoveCellDisposeListener(TableCellDisposeListener listener)

		try {
			this_mon.enter();

			if (cellDisposeListeners == null) {
				return;
			}

			cellDisposeListeners.remove(listener);
		} finally {

			this_mon.exit();
		}
	
public voidremoveCellMouseListener(TableCellMouseListener listener)

		try {
			this_mon.enter();

			if (cellMouseListeners == null) {
				return;
			}

			cellMouseListeners.remove(listener);

		} finally {
			this_mon.exit();
		}
	
public voidremoveCellMouseMoveListener(TableCellMouseMoveListener listener)

		try {
			this_mon.enter();

			if (cellMouseMoveListeners == null) {
				return;
			}

			cellMouseMoveListeners.remove(listener);

		} finally {
			this_mon.exit();
		}
	
public voidremoveCellRefreshListener(TableCellRefreshListener listener)

		try {
			this_mon.enter();

			if (cellRefreshListeners == null) {
				return;
			}

			cellRefreshListeners.remove(listener);
		} finally {
			this_mon.exit();
		}
	
public voidremoveCellToolTipListener(TableCellToolTipListener listener)

		try {
			this_mon.enter();

			if (cellToolTipListeners == null) {
				return;
			}

			cellToolTipListeners.remove(listener);
		} finally {
			this_mon.exit();
		}
	
public voidremoveCellVisibilityListener(TableCellVisibilityListener listener)

		try {
			this_mon.enter();

			if (cellVisibilityListeners == null) {
				return;
			}

			cellVisibilityListeners.remove(listener);

		} finally {
			this_mon.exit();
		}
	
public voidremoveContextMenuItem(TableContextMenuItem menuItem)

		if (menuItems == null) {
			return;
		}

		menuItems.remove(menuItem);
	
public voidsaveSettings()

		String sItemPrefix = "Table." + sTableID + "." + sName;
		COConfigurationManager.setParameter(sItemPrefix + ".position", iPosition);
		COConfigurationManager.setParameter(sItemPrefix + ".width", iWidth);
	
public voidsetAlignment(int alignment)

		if (bColumnAdded) {
			throw (new UIRuntimeException("Can't set properties. Column '" + sName
					+ " already added"));
		}

		iAlignment = alignment;
	
public voidsetColumnAdded(boolean bAdded)

		bColumnAdded = bAdded;
	
public voidsetConsecutiveErrCount(int iCount)

		iConsecutiveErrCount = iCount;
	
public voidsetLastSortValueChange(long lastSortValueChange)

		lLastSortValueChange = lastSortValueChange;
	
public voidsetMaxWidth(int maxwidth)

		if (maxwidth >= 0 && maxwidth < iMinWidth) {
			iMinWidth = maxwidth;
		}
		if (iPreferredWidth > maxwidth) {
			iPreferredWidth = maxwidth;
		}
		iMaxWidth = maxwidth;
		if (maxwidth >= 0 && iWidth > iMaxWidth) {
			setWidth(maxwidth);
		}
	
public voidsetMaxWidthAuto(boolean automaxwidth)

		bMaxWidthAuto = automaxwidth;
	
public voidsetMinWidth(int minwidth)

		if (minwidth > iMaxWidth && iMaxWidth >= 0) {
			iMaxWidth = minwidth;
		}
		if (iPreferredWidth > 0 && iPreferredWidth < minwidth) {
			iPreferredWidth = minwidth;
		}
		iMinWidth = minwidth;
		if (iWidth < minwidth) {
			setWidth(minwidth);
		}
	
public voidsetMinWidthAuto(boolean autominwidth)

		bWidthAuto = autominwidth;
	
public voidsetObfustication(boolean hideData)

		bObfusticateData = hideData;
	
public voidsetPosition(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 voidsetPositionNoShift(int position)

		if (iPosition < 0 && position >= 0) {
			setVisible(true);
		}
		iPosition = position;
		if (position < 0) {
			setVisible(false);
		}
	
public voidsetPreferredWidth(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 voidsetPreferredWidthAuto(boolean auto)

		bPreferredWidthAuto = auto;
	
public voidsetPreferredWidthMax(int maxprefwidth)

		iPreferredWidthMax = maxprefwidth;
		if (iPreferredWidth > iPreferredWidthMax) {
			setPreferredWidth(maxprefwidth);
		}
	
public voidsetRefreshInterval(int interval)

		iInterval = interval;
	
public voidsetSortAscending(boolean bAscending)

param
bAscending The bAscending to set.

		if (this.bSortAscending == bAscending) {
			return;
		}
		setLastSortValueChange(SystemTime.getCurrentTime());

		this.bSortAscending = bAscending;
	
public voidsetSortValueLive(boolean live)

		//		if (live && !bSortValueLive) {
		//			System.out.println("Setting " + sTableID + ": " + sName + " to live sort value");
		//		}
		bSortValueLive = live;
	
public voidsetTableID(java.lang.String tableID)

		sTableID = tableID;
	
public voidsetType(int type)

		if (bColumnAdded) {
			throw (new UIRuntimeException("Can't set properties. Column '" + sName
					+ " already added"));
		}

		iType = type;
	
public voidsetUseCoreDataSource(boolean bCoreDataSource)

		this.bCoreDataSource = bCoreDataSource;
	
public voidsetVisible(boolean visible)

		if (bVisible == visible) {
			return;
		}

		bVisible = visible;
		invalidateCells();
	
public voidsetWidth(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 voidsetWidthLimits(int min, int max)

		setMinWidth(min);
		setMaxWidth(max);
	
public voidtriggerColumnSizeChange()

		TableStructureEventDispatcher tsed = TableStructureEventDispatcher.getInstance(sTableID);
		tsed.columnSizeChanged(this);
		if (iType == TYPE_GRAPHIC) {
			invalidateCells();
		}