OSDN Git Service

テーブルのツールチップにサムネイル情報を表示
authoryukihane <yukihane.feather@gmail.com>
Sun, 18 Sep 2011 06:49:49 +0000 (15:49 +0900)
committeryukihane <yukihane.feather@gmail.com>
Sun, 18 Sep 2011 06:49:49 +0000 (15:49 +0900)
frontend/src/yukihane/inqubus/gui/MainFrame.java
frontend/src/yukihane/inqubus/thumbnail/Repository.java

index f78c80a..8f76527 100644 (file)
@@ -15,6 +15,7 @@ import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.awt.event.KeyEvent;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
 import java.beans.PropertyChangeEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
 import java.beans.PropertyChangeEvent;
@@ -56,6 +57,7 @@ import javax.swing.LayoutStyle.ComponentPlacement;
 import javax.swing.SwingUtilities;
 import javax.swing.WindowConstants;
 import javax.swing.border.BevelBorder;
 import javax.swing.SwingUtilities;
 import javax.swing.WindowConstants;
 import javax.swing.border.BevelBorder;
+import javax.swing.table.TableModel;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.lang.builder.ToStringBuilder;
 import saccubus.MainFrame_AboutBox;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.lang.builder.ToStringBuilder;
 import saccubus.MainFrame_AboutBox;
@@ -86,6 +88,8 @@ import yukihane.inqubus.manager.TaskManageListener;
 import yukihane.inqubus.manager.TaskStatus;
 import yukihane.inqubus.model.Target;
 import yukihane.inqubus.model.TargetsTableModel;
 import yukihane.inqubus.manager.TaskStatus;
 import yukihane.inqubus.model.Target;
 import yukihane.inqubus.model.TargetsTableModel;
+import yukihane.inqubus.thumbnail.Repository;
+import yukihane.inqubus.thumbnail.Thumbnail;
 
 /**
  *
 
 /**
  *
@@ -95,6 +99,7 @@ public class MainFrame extends JFrame {
 
     private static final long serialVersionUID = 1L;
     private static final Logger logger = LoggerFactory.getLogger(MainFrame.class);
 
     private static final long serialVersionUID = 1L;
     private static final Logger logger = LoggerFactory.getLogger(MainFrame.class);
+    private final Repository thumbRepository = new Repository();
     private final TargetsTableModel targetModel = new TargetsTableModel();
     private final TaskManage taskManager;
     private final Thread videoFileWatcherThread;
     private final TargetsTableModel targetModel = new TargetsTableModel();
     private final TaskManage taskManager;
     private final Thread videoFileWatcherThread;
@@ -150,7 +155,20 @@ public class MainFrame extends JFrame {
 
         final JPanel pnlMain = new JPanel();
         final JScrollPane scrDisplay = new JScrollPane();
 
         final JPanel pnlMain = new JPanel();
         final JScrollPane scrDisplay = new JScrollPane();
-        tblDisplay = new JTable(targetModel, new TargetsColumnModel());
+        tblDisplay = new JTable(targetModel, new TargetsColumnModel()) {
+
+            @Override
+            public String getToolTipText(MouseEvent e) {
+                int row = convertRowIndexToModel(rowAtPoint(e.getPoint()));
+                TableModel m = getModel();
+                final String videoId = (String) m.getValueAt(row, 0);
+                final Thumbnail thumbnail = thumbRepository.getThumnail(videoId);
+                if(thumbnail == null){
+                    return "動画情報取得中...";
+                }
+                return "<html>" + videoId + ":" + thumbnail.getTitle() + "</html>";
+            }
+        };
         tblDisplay.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
         final JPanel pnlButton = new JPanel();
         final JPanel pnlInputMain = new JPanel();
         tblDisplay.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
         final JPanel pnlButton = new JPanel();
         final JPanel pnlInputMain = new JPanel();
@@ -576,6 +594,9 @@ public class MainFrame extends JFrame {
                 final InqubusConvertProfile convProf = new InqubusConvertProfile();
                 logger.debug(downProf.toString());
                 logger.debug(convProf.toString());
                 final InqubusConvertProfile convProf = new InqubusConvertProfile();
                 logger.debug(downProf.toString());
                 logger.debug(convProf.toString());
+
+                thumbRepository.request(downProf.getProxyProfile(), id);
+
                 final RequestProcess rp = new RequestProcess(downProf, id, convProf);
                 taskManager.add(rp);
                 targetModel.addTarget(new Target(rp));
                 final RequestProcess rp = new RequestProcess(downProf, id, convProf);
                 taskManager.add(rp);
                 targetModel.addTarget(new Target(rp));
index cd2f545..adc9370 100644 (file)
@@ -21,9 +21,8 @@ import saccubus.worker.profile.ProxyProfile;
  *
  * @author yuki
  */
  *
  * @author yuki
  */
-public enum Repository {
+public class Repository {
 
 
-    INSTANCE;
     private static final Logger logger = LoggerFactory.getLogger(Repository.class);
     private final ExecutorService executorService = Executors.newCachedThreadPool();
     private final Map<String, Thumbnail> thumbnailMap = new HashMap<>();
     private static final Logger logger = LoggerFactory.getLogger(Repository.class);
     private final ExecutorService executorService = Executors.newCachedThreadPool();
     private final Map<String, Thumbnail> thumbnailMap = new HashMap<>();