1 19 20 package com.sslexplorer.vfs.forms; 21 22 import java.util.Collection ; 23 24 import javax.servlet.http.HttpSession ; 25 26 import com.sslexplorer.table.AbstractTableItemTableModel; 27 import com.sslexplorer.table.TableItem; 28 import com.sslexplorer.table.forms.AbstractPagerForm; 29 import com.sslexplorer.vfs.VFSFileLock; 30 31 34 public final class ShowVfsLocksForm extends AbstractPagerForm { 35 38 public ShowVfsLocksForm() { 39 super(new VfsLockTableModel()); 40 } 41 42 47 public void initialize(HttpSession session, Collection <VFSFileLock> currentLocks) { 48 super.initialize(session, "fileName"); 49 for (VFSFileLock entry : currentLocks) { 50 getModel().addItem(new VfsLockTableItem(entry)); 51 } 52 getPager().rebuild(getFilterText()); 53 } 54 55 private static final class VfsLockTableModel extends AbstractTableItemTableModel { 56 57 public int getColumnWidth(int col) { 58 return 0; 59 } 60 61 public String getId() { 62 return "files"; 63 } 64 65 public int getColumnCount() { 66 return 2; 67 } 68 69 public String getColumnName(int col) { 70 switch(col) 71 { 72 case 0: 73 return "fileName"; 74 case 1: 75 return "isActive"; 76 } 77 return ""; 78 } 79 80 public Class getColumnClass(int col) { 81 if(col==1) 82 return Boolean .class; 83 return String .class; 84 } 85 } 86 87 90 public static final class VfsLockTableItem implements TableItem 91 { 92 private final VFSFileLock vfsFileLock_; 93 private VfsLockTableItem(VFSFileLock vfsFileLock) 94 { 95 vfsFileLock_ = vfsFileLock; 96 } 97 98 public Object getColumnValue(int col) { 99 switch(col) 100 { 101 case 0: 102 return vfsFileLock_.getFileName(); 103 case 1: 104 return vfsFileLock_.isActive(); 105 } 106 return ""; 107 } 108 109 112 public VFSFileLock getVFSFileLock () { 113 return vfsFileLock_; 114 } 115 } 116 } | Popular Tags |