|
| 1 | +/* |
| 2 | + * Copyright (C) Azureus Software, Inc, All Rights Reserved. |
| 3 | + * |
| 4 | + * This program is free software; you can redistribute it and/or |
| 5 | + * modify it under the terms of the GNU General Public License |
| 6 | + * as published by the Free Software Foundation; either version 2 |
| 7 | + * of the License, or (at your option) any later version. |
| 8 | + * This program is distributed in the hope that it will be useful, |
| 9 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | + * GNU General Public License for more details. |
| 12 | + * You should have received a copy of the GNU General Public License |
| 13 | + * along with this program; if not, write to the Free Software |
| 14 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 15 | + * |
| 16 | + */ |
| 17 | + |
| 18 | +package com.biglybt.ui.swt.columns.searchsubs; |
| 19 | + |
| 20 | + |
| 21 | +import com.biglybt.core.subs.util.SearchSubsResultBase; |
| 22 | +import com.biglybt.pif.ui.tables.*; |
| 23 | + |
| 24 | + |
| 25 | +public class ColumnSearchSubResultGrabbed |
| 26 | + implements TableCellRefreshListener, TableColumnExtraInfoListener |
| 27 | +{ |
| 28 | + public static String COLUMN_ID = "grabbed"; |
| 29 | + |
| 30 | + |
| 31 | + @Override |
| 32 | + public void fillTableColumnInfo(TableColumnInfo info) { |
| 33 | + info.addCategories(new String[] { |
| 34 | + TableColumn.CAT_CONTENT, |
| 35 | + }); |
| 36 | + info.setProficiency(TableColumnInfo.PROFICIENCY_INTERMEDIATE); |
| 37 | + } |
| 38 | + |
| 39 | + /** Default Constructor */ |
| 40 | + public ColumnSearchSubResultGrabbed(TableColumn column) { |
| 41 | + column.initialize(TableColumn.ALIGN_CENTER, TableColumn.POSITION_INVISIBLE, 60 ); |
| 42 | + column.setRefreshInterval(TableColumn.INTERVAL_INVALID_ONLY); |
| 43 | + column.addListeners(this); |
| 44 | + } |
| 45 | + |
| 46 | + @Override |
| 47 | + public void refresh(TableCell cell) { |
| 48 | + SearchSubsResultBase result = (SearchSubsResultBase) cell.getDataSource(); |
| 49 | + |
| 50 | + long num = result.getNbCompleted(); |
| 51 | + |
| 52 | + if ( !cell.setSortValue(num) && cell.isValid()){ |
| 53 | + |
| 54 | + return; |
| 55 | + } |
| 56 | + |
| 57 | + if (!cell.isShown()) { |
| 58 | + return; |
| 59 | + } |
| 60 | + |
| 61 | + cell.setText( String.valueOf( num )); |
| 62 | + |
| 63 | + return; |
| 64 | + |
| 65 | + } |
| 66 | +} |
0 commit comments