~smaioli/azureus/ubuntu-experimental

« back to all changes in this revision

Viewing changes to com/aelitis/azureus/ui/swt/columns/subscriptions/ColumnSubscriptionLastChecked.java

MergedĀ VuzeĀ 4.0.0.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
package com.aelitis.azureus.ui.swt.columns.subscriptions;
19
19
 
20
 
import java.text.SimpleDateFormat;
21
 
import java.util.Date;
22
20
 
23
21
import org.gudy.azureus2.plugins.ui.tables.TableCell;
24
 
import org.gudy.azureus2.plugins.ui.tables.TableCellRefreshListener;
25
 
import org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn;
 
22
import org.gudy.azureus2.ui.swt.views.table.utils.TableColumnCreator;
 
23
import org.gudy.azureus2.ui.swt.views.tableitems.ColumnDateSizer;
26
24
 
27
25
import com.aelitis.azureus.core.subs.Subscription;
28
26
 
31
29
 * @created Oct 7, 2008
32
30
 *
33
31
 */
34
 
public class ColumnSubscriptionLastChecked
35
 
        extends CoreTableColumn
36
 
        implements TableCellRefreshListener
37
 
{
38
 
        
39
 
        SimpleDateFormat format = new SimpleDateFormat("MM/dd/yy hh:mm");
40
 
        
 
32
public class 
 
33
ColumnSubscriptionLastChecked
 
34
        extends ColumnDateSizer
 
35
{       
41
36
        public static String COLUMN_ID = "last-checked";
42
 
 
43
 
        /** Default Constructor */
44
 
        public ColumnSubscriptionLastChecked(String sTableID) {
45
 
                super(COLUMN_ID, POSITION_LAST, 100, sTableID);
 
37
        
 
38
        public 
 
39
        ColumnSubscriptionLastChecked(
 
40
                String sTableID ) 
 
41
        {
 
42
                super(COLUMN_ID, TableColumnCreator.DATE_COLUMN_WIDTH, sTableID );
 
43
                
46
44
                setMinWidth(100);
 
45
                
 
46
                setMultiline( false );
 
47
                
 
48
                setShowTime( true );
47
49
        }
48
50
 
49
 
        public void refresh(TableCell cell) {
50
 
                Date date = null;
51
 
                String dateText = "--";
 
51
        public void 
 
52
        refresh(
 
53
                TableCell       cell, 
 
54
                long            timestamp ) 
 
55
        {
 
56
                timestamp = 0;
 
57
                                
52
58
                Subscription sub = (Subscription) cell.getDataSource();
53
 
                if (sub != null) {
54
 
                        date =  new Date(sub.getHistory().getLastScanTime());
55
 
                }
56
59
                
57
 
                if (date != null) {
58
 
                        dateText = format.format(date);
 
60
                if ( sub != null ){
 
61
 
 
62
                        timestamp = sub.getHistory().getLastScanTime();
59
63
                }
60
64
 
61
 
                if (!cell.setSortValue(date) && cell.isValid()) {
 
65
                if (!cell.setSortValue(timestamp) && cell.isValid()) {
62
66
                        return;
63
67
                }
64
68
 
66
70
                        return;
67
71
                }
68
72
                
69
 
                cell.setText(dateText);
70
 
                return;
71
 
                
 
73
                if ( timestamp <= 0 ){
 
74
                
 
75
                        cell.setText( "--" );
 
76
                        
 
77
                }else{
 
78
                
 
79
                        super.refresh( cell, timestamp );
 
80
                }
72
81
        }
73
82
}