import javax.swing.TransferHandler;
import javax.swing.WindowConstants;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.builder.ToStringBuilder;
import saccubus.MainFrame_AboutBox;
import saccubus.util.WayBackTimeParser;
-import saccubus.worker.Download;
+import saccubus.worker.convert.ConvertProgress;
+import saccubus.worker.download.DownloadProgress;
+import saccubus.worker.WorkerListener;
import saccubus.worker.profile.CommentProfile;
import saccubus.worker.profile.DownloadProfile;
import saccubus.worker.profile.GeneralProfile;
import saccubus.worker.profile.VideoProfile;
import yukihane.Util;
import yukihane.inqubus.Config;
+import yukihane.inqubus.manager.TaskManage;
import yukihane.inqubus.model.Target;
import yukihane.inqubus.model.TargetsTableModel;
private static final String FILE_OUTPUTFIELD_TOOLTIP
= "ファイル命名規則入力します。";
private final TargetsTableModel targetModel = new TargetsTableModel();
+ private final TaskManage taskManager;
+ private final DownloadProgressListener downloadProgressListener = new DownloadProgressListener();
+ private final ConvertProgressListener convertProgressListener = new ConvertProgressListener();
/** Creates new form MainFrame */
public MainFrame() {
initInputPanel();
pnlMain.setTransferHandler(new DownloadListTransferHandler());
tblDisplay.setTransferHandler(new TableTransferHandler());
+
+ final Config p = Config.INSTANCE;
+ // TODO コンフィグからスレッド数
+ taskManager = new TaskManage(1, 1);
+
}
private class ApplyActionListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
final DownloadProfile prof = new InqubusDownloadProfile();
final String id = Util.getVideoId(fldId.getText());
-
- new Download(prof, id).execute();
+ logger.log(Level.INFO, prof.toString());
+ // TODO 処理開始
+// new Download(prof, id).execute();
}
}
/** This method is called from within the constructor to
private void initComponents() {
}// </editor-fold>//GEN-END:initComponents
- private File searchFileMatchId(final File dir, final String id) throws UnsupportedOperationException {
+ private File searchFileMatchId(final File dir, final String id) {
// TODO 候補は複数返すようにして、その後の対処は呼び出しもとで行ってもらった方が良いかも
if (id.isEmpty()) {
return null;
return menuBar;
}
+ private class DownloadProgressListener implements WorkerListener<DownloadProgress> {
+
+ @Override
+ public void process(DownloadProgress progress) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ }
+
+ private class ConvertProgressListener implements WorkerListener<ConvertProgress> {
+
+ @Override
+ public void process(ConvertProgress progress) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ }
+
+
+
private class DownloadListTransferHandler extends TransferHandler {
private static final long serialVersionUID = 1L;
public GeneralProfile getGeneralProfile() {
return this.generalProfile;
}
+
+ @Override
+ public String toString(){
+ return ToStringBuilder.reflectionToString(this);
+ }
}
private class InqubusLoginProfile implements LoginProfile {
public String getPassword() {
return this.password;
}
+
+ @Override
+ public String toString(){
+ return ToStringBuilder.reflectionToString(this);
+ }
}
private class InqubusProxyProfile implements ProxyProfile {
public int getPort() {
return this.port;
}
+
+ @Override
+ public String toString(){
+ return ToStringBuilder.reflectionToString(this);
+ }
}
private class InqubusVideoProfile implements VideoProfile {
public File getLocalFile() {
return this.localFile;
}
+
+ @Override
+ public String toString(){
+ return ToStringBuilder.reflectionToString(this);
+ }
}
private class InqubusCommentProfile implements CommentProfile {
public long getBackLogPoint() {
return this.backLogPoint;
}
+
+ @Override
+ public String toString(){
+ return ToStringBuilder.reflectionToString(this);
+ }
}
private class InqubusGeneralProfile implements GeneralProfile {
-// private final String replaceFrom;
+ private final String replaceFrom;
+ private final String replaceTo;
private InqubusGeneralProfile() {
final Config p = Config.INSTANCE;
- // TODO 置換文字設定コンフィグが無い
-// this.replaceFrom = p.get
+ this.replaceFrom = p.getReplaceFrom();
+ this.replaceTo = p.getReplaceTo();
}
@Override
public String getReplaceFrom() {
-// return this.replaceFrom;
- throw new UnsupportedOperationException("Not supported yet.");
+ return this.replaceFrom;
}
@Override
public String getReplaceTo() {
- throw new UnsupportedOperationException("Not supported yet.");
+ return this.replaceTo;
}
+ @Override
+ public String toString(){
+ return ToStringBuilder.reflectionToString(this);
+ }
}
}