~smaioli/azureus/ubuntu-experimental

« back to all changes in this revision

Viewing changes to org/gudy/azureus2/ui/swt/views/tableitems/files/ProgressGraphItem.java

MergedĀ VuzeĀ 4.2.0.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
import org.eclipse.swt.graphics.GC;
24
24
import org.eclipse.swt.graphics.Image;
 
25
 
25
26
import org.gudy.azureus2.core3.disk.DiskManager;
26
27
import org.gudy.azureus2.core3.disk.DiskManagerFileInfo;
27
28
import org.gudy.azureus2.core3.disk.DiskManagerPiece;
29
30
import org.gudy.azureus2.core3.peer.PEPeerManager;
30
31
import org.gudy.azureus2.core3.peer.PEPiece;
31
32
import org.gudy.azureus2.core3.util.SystemTime;
32
 
import org.gudy.azureus2.plugins.ui.Graphic;
33
 
import org.gudy.azureus2.plugins.ui.tables.*;
34
33
import org.gudy.azureus2.ui.swt.mainwindow.Colors;
35
34
import org.gudy.azureus2.ui.swt.mainwindow.SWTThread;
36
35
import org.gudy.azureus2.ui.swt.plugins.UISWTGraphic;
38
37
import org.gudy.azureus2.ui.swt.views.table.TableCellSWT;
39
38
import org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn;
40
39
 
 
40
import org.gudy.azureus2.plugins.ui.Graphic;
 
41
import org.gudy.azureus2.plugins.ui.tables.*;
 
42
 
41
43
/**
42
44
 * Torrent Completion Level Graphic Cell for My Torrents.
43
45
 * 
54
56
                setMinWidth(100);
55
57
        }
56
58
 
 
59
        public void fillTableColumnInfo(TableColumnInfo info) {
 
60
                info.addCategories(new String[] {
 
61
                        CAT_PROGRESS,
 
62
                });
 
63
        }
 
64
 
57
65
        public void cellAdded(TableCell cell) {
58
66
                new Cell(cell);
59
67
        }
117
125
                        // we want to run through the image part once one the transition from with a disk manager (running)
118
126
                        // to without a disk manager (stopped) in order to clear the pieces view
119
127
                        boolean running = manager != null;
120
 
                        final boolean bImageBufferValid = (lastPercentDone == percentDone) && cell.isValid() && bNoRed && running == was_running;
 
128
                        boolean hasGraphic = false;
 
129
                        Graphic graphic = cell.getGraphic();
 
130
                        if (graphic instanceof UISWTGraphic) {
 
131
                                Image img = ((UISWTGraphic) graphic).getImage();
 
132
                                hasGraphic = img != null && !img.isDisposed();
 
133
                        }
 
134
                        final boolean bImageBufferValid = (lastPercentDone == percentDone)
 
135
                                        && cell.isValid() && bNoRed && running == was_running && hasGraphic;
121
136
                        
122
137
                        if (bImageBufferValid)
123
138
                                return;
126
141
                        lastPercentDone = percentDone;
127
142
                        Image piecesImage = null;
128
143
                        
129
 
                        Graphic graphic = cell.getGraphic();
130
144
                        if (graphic instanceof UISWTGraphic)
131
145
                                piecesImage = ((UISWTGraphic) graphic).getImage();
132
146
                        if (piecesImage != null && !piecesImage.isDisposed())