FileDocCategorySizeDatePackage
DateAddedItem.javaAPI DocAzureus 3.0.3.42895Thu May 10 11:13:10 BST 2007org.gudy.azureus2.ui.swt.views.tableitems.mytorrents

DateAddedItem

public class DateAddedItem extends org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn implements TableCellRefreshListener

Fields Summary
Constructors Summary
public DateAddedItem(String sTableID)

		super("date_added", ALIGN_TRAIL, POSITION_INVISIBLE, 120, sTableID);

		TableContextMenuItem menuReset = addContextMenuItem("MyTorrentsView.date_added.menu.reset");
		menuReset.addListener(new MenuItemListener() {
			public void selected(MenuItem menu, Object target) {
				if (target instanceof TableRowCore) {
					TableRowCore row = (TableRowCore) target;
					Object dataSource = row.getDataSource(true);
					if (dataSource instanceof DownloadManager) {
						DownloadManager dm = (DownloadManager) dataSource;

						DownloadManagerState state = dm.getDownloadState();

						try {
							long add_time = new File(dm.getTorrentFileName()).lastModified();

							if (add_time >= 0) {
								state.setLongParameter(
										DownloadManagerState.PARAM_DOWNLOAD_ADDED_TIME, add_time);
							}

						} catch (Throwable e) {
						}
					}
					row.getTableCell("date_added").invalidate();
				}
			}
		});
	
Methods Summary
public voidrefresh(TableCell cell)

		DownloadManager dm = (DownloadManager) cell.getDataSource();
		long value = (dm == null) ? 0 : dm.getDownloadState().getLongParameter(
				DownloadManagerState.PARAM_DOWNLOAD_ADDED_TIME);

		if (!cell.setSortValue(value) && cell.isValid())
			return;

		cell.setText(DisplayFormatters.formatDate(value));