Revision | b6aeff0fa5bce4d51bd80aad0ea490e88f5733d9 (tree) |
---|---|
Time | 2013-04-03 20:10:44 |
Author | nekora <nekora@user...> |
Commiter | nekora |
ログの出力先をlogディレクトリ配下に変更。処理終了時にBEEP。処理中は「実行」ボタンを無効化。
@@ -6,3 +6,5 @@ | ||
6 | 6 | /MDPSprocess3.log |
7 | 7 | /MDPSprocess4.log |
8 | 8 | /MDPSprocess5.log |
9 | +/MDPSprocess6.log | |
10 | +/log |
@@ -1,2 +1 @@ | ||
1 | 1 | /nekora |
2 | -/makejar.bat |
@@ -0,0 +1 @@ | ||
1 | +jar cvf cwnprint.jar nekora | |
\ No newline at end of file |
@@ -1,7 +1,6 @@ | ||
1 | 1 | package nekora.cwn; |
2 | 2 | |
3 | 3 | import java.awt.Point; |
4 | -import java.awt.Rectangle; | |
5 | 4 | import java.io.File; |
6 | 5 | import java.io.IOException; |
7 | 6 | import java.util.ArrayList; |
@@ -36,9 +35,7 @@ import javafx.scene.text.Text; | ||
36 | 35 | import javafx.scene.text.TextAlignment; |
37 | 36 | import javafx.stage.DirectoryChooser; |
38 | 37 | import javafx.stage.Stage; |
39 | - | |
40 | 38 | import jfx.messagebox.MessageBox; |
41 | - | |
42 | 39 | import nekora.cwn.align.PageAlign; |
43 | 40 | import nekora.cwn.align.PageAlignFactory; |
44 | 41 | import nekora.cwn.ext.ExtCmd; |
@@ -106,7 +103,7 @@ public class MDPSMain extends Application{ | ||
106 | 103 | Stage rootStage; |
107 | 104 | |
108 | 105 | public MDPSMain(){ |
109 | - String logname ="MDPSprocess"; | |
106 | + String logname ="log/MDPSprocess"; | |
110 | 107 | logger = Logger.getLogger(logname); |
111 | 108 | try{ |
112 | 109 | Handler fileHandler = new FileHandler(logname+"%g.log", 100000, 9); |
@@ -140,12 +137,10 @@ public class MDPSMain extends Application{ | ||
140 | 137 | // 入力画像ファイル設定一覧読み取り |
141 | 138 | File dir = new File(INPUT_CONFIG_DIR); |
142 | 139 | inputFileConfigs = dir.listFiles(); |
143 | - logger.info("inputfiles="+inputFileConfigs.toString()); | |
144 | 140 | |
145 | 141 | // 出力用紙設定ファイル一覧予備撮り |
146 | 142 | File diro = new File(OUTPUT_CONFIG_DIR); |
147 | 143 | outputFileConfigs = diro.listFiles(); |
148 | - logger.info("outputfiles="+outputFileConfigs.toString()); | |
149 | 144 | |
150 | 145 | this.rootStage = rootStage; // イベントハンドラから参照のため |
151 | 146 | rootStage.setTitle(ROOT_TITLE); |
@@ -535,20 +530,19 @@ public class MDPSMain extends Application{ | ||
535 | 530 | progressBar.progressProperty().bind(task.progressProperty()); |
536 | 531 | statusBar.textProperty().bind(task.messageProperty()); |
537 | 532 | |
538 | - //execButton.setDisable(true); //ボタンを無効化すると戻した後にループする。バグ。 | |
539 | - executing_flg=true; | |
540 | - exec.submit(task); | |
541 | - | |
542 | 533 | task.addEventHandler(WorkerStateEvent.WORKER_STATE_SUCCEEDED, |
543 | 534 | new EventHandler<WorkerStateEvent>(){ |
544 | 535 | @Override |
545 | 536 | public void handle(WorkerStateEvent t){ |
546 | 537 | exec.shutdown(); |
547 | - // execButton.setDisable(false); //ボタンを無効化すると戻した後にループする。バグ。 | |
538 | + execButton.setDisable(false); //実行ボタンを有効化する。 | |
548 | 539 | executing_flg=false; |
549 | - //java.awt.Toolkit.getDefaultToolkit().beep(); | |
540 | + java.awt.Toolkit.getDefaultToolkit().beep(); | |
550 | 541 | } |
551 | 542 | }); |
543 | + executing_flg=true; | |
544 | + execButton.setDisable(true); //実行ボタンを無効化する | |
545 | + exec.submit(task); | |
552 | 546 | |
553 | 547 | } |
554 | 548 |
@@ -63,24 +63,29 @@ class MDPSTask extends Task<String> { | ||
63 | 63 | |
64 | 64 | @Override |
65 | 65 | protected String call() throws Exception { |
66 | - logger.info("start"); | |
66 | + logger.info("start "+Thread.currentThread().getName()); | |
67 | 67 | updateMessage("開始"); |
68 | + logger.info("Before pa.exec "+pa); | |
68 | 69 | List<File> alignList = pa.exec(); |
69 | 70 | int max = alignList.size(); |
71 | + logger.info("Before updateProgress"); | |
70 | 72 | updateProgress(0, max); |
71 | 73 | |
72 | 74 | File workDir = new File(outputDirName); |
73 | 75 | ExecutorService exec = Executors.newFixedThreadPool(1); // 白黒化コマンドキック用プロセスを待つスレッド |
74 | 76 | List<Future<String>> resultList = new ArrayList<Future<String>>(); |
77 | + logger.info("Before createMixOut"); | |
75 | 78 | MixOut mx = pa.createMixOut(ip, baseSize, max, logger); |
76 | 79 | |
77 | 80 | int pagenum =1; |
81 | + logger.info("Before for loop. size="+alignList.size()); | |
78 | 82 | for(int i=0; i<alignList.size(); i+=2){ |
79 | 83 | String outputFilePre = outputDirName+File.separator+ outsizeName+"_"+pa.getFileName(pagenum); |
80 | 84 | File lastFile = new File(outputFilePre+cmd.getExt()); //最終的な目的の出力ファイル |
81 | 85 | File fL = alignList.get(i); |
82 | 86 | File fR = alignList.get(i+1); |
83 | 87 | String msg = fL.getName()+" , "+fR.getName()+" ⇒ "+ pa.getFileName(pagenum)+cmd.getExt(); |
88 | + logger.info(msg + " を処理中…"); | |
84 | 89 | updateMessage(msg + " を処理中…"); |
85 | 90 | if(lastFile.lastModified()>fL.lastModified() && lastFile.lastModified()>fR.lastModified()){ |
86 | 91 | // 素材ファイルより、最終成果物ファイルの方が新しいなら処理はスキップ |
@@ -26,6 +26,7 @@ public class PageAlignCenterBend extends PageAlign { | ||
26 | 26 | @Override |
27 | 27 | public List<File> exec() { |
28 | 28 | //左右反転して、ファイル数が4の倍数で無い場合は最後にnullを足す。 |
29 | + logger.info(name + " 開始"); | |
29 | 30 | int num = flist.size(); |
30 | 31 | if(num % 4 != 0){ |
31 | 32 | int add = 4-num%4; |
@@ -36,6 +37,7 @@ public class PageAlignCenterBend extends PageAlign { | ||
36 | 37 | |
37 | 38 | List<File> ret = new ArrayList<>(); |
38 | 39 | int count = flist.size(); |
40 | + logger.info("回数="+count); | |
39 | 41 | for( int i=0; i< count; i+=4 ){ |
40 | 42 | File AL = flist.get(i); |
41 | 43 | File AR = flist.get(count-1 -i); |
@@ -48,6 +50,7 @@ public class PageAlignCenterBend extends PageAlign { | ||
48 | 50 | ret.add(BR); |
49 | 51 | } |
50 | 52 | |
53 | + logger.info(name + " 終了"); | |
51 | 54 | return ret; |
52 | 55 | } |
53 | 56 |
@@ -25,6 +25,7 @@ public class PageAlignCutDouble extends PageAlign { | ||
25 | 25 | |
26 | 26 | @Override |
27 | 27 | public List<File> exec() { |
28 | + logger.info(name + " 開始"); | |
28 | 29 | //基本的にそのままコピーするだけだが、ファイル数が2の倍数で無い場合は最後にnullを足す。 |
29 | 30 | int num = flist.size(); |
30 | 31 | if(num % 2 != 0){ |
@@ -36,6 +37,7 @@ public class PageAlignCutDouble extends PageAlign { | ||
36 | 37 | ret.add(f); |
37 | 38 | } |
38 | 39 | |
40 | + logger.info(name + " 終了"); | |
39 | 41 | return ret; |
40 | 42 | } |
41 | 43 |
@@ -49,7 +51,10 @@ public class PageAlignCutDouble extends PageAlign { | ||
49 | 51 | InputPaper ip, |
50 | 52 | Point baseSize, int borderPixel, Logger logger) { |
51 | 53 | // 原稿2枚を1枚の紙にする |
52 | - return new MixOut2in1( ip, baseSize, borderPixel, logger); | |
54 | + logger.info("Before MixOut "+Thread.currentThread().getName()); | |
55 | + MixOut ret = new MixOut2in1( ip, baseSize, borderPixel, logger); //<--ここでストールしている | |
56 | + logger.info("After MixOut"); | |
57 | + return ret; | |
53 | 58 | } |
54 | 59 | |
55 | 60 | } |
@@ -1,7 +1,6 @@ | ||
1 | 1 | package nekora.cwn.mix; |
2 | 2 | |
3 | 3 | import java.awt.Point; |
4 | -import java.awt.Rectangle; | |
5 | 4 | import java.util.logging.Logger; |
6 | 5 | |
7 | 6 | import nekora.cwn.paper.InputPaper; |
@@ -23,10 +22,12 @@ public abstract class MixOut { | ||
23 | 22 | InputPaper ip, |
24 | 23 | Point baseSize, int borderPixel, |
25 | 24 | Logger logger) { |
25 | + this.logger = logger; | |
26 | + logger.info("start"); | |
26 | 27 | this.ip = ip; |
27 | 28 | this.baseSize = baseSize; |
28 | 29 | this.borderPixel = borderPixel; |
29 | - this.logger = logger; | |
30 | + logger.info("end"); | |
30 | 31 | } |
31 | 32 | |
32 | 33 | public abstract String make(String outputFileName, String leftFileName, String rightFileName); |
@@ -25,7 +25,9 @@ public class MixOut2in1 extends MixOut { | ||
25 | 25 | InputPaper ip, |
26 | 26 | Point baseSize, int borderPixel, Logger logger) { |
27 | 27 | super(ip, baseSize, borderPixel, logger); |
28 | + logger.info("start"); | |
28 | 29 | this.ip.computeLR(this.baseSize.x , this.baseSize.y); |
30 | + logger.info("end"); | |
29 | 31 | } |
30 | 32 | |
31 | 33 | @Override |
@@ -3,6 +3,7 @@ package nekora.cwn.paper; | ||
3 | 3 | import java.io.File; |
4 | 4 | |
5 | 5 | public class PaperFormException extends Exception { |
6 | + private static final long serialVersionUID = 429826601647993344L; | |
6 | 7 | String filename; |
7 | 8 | int dpi; |
8 | 9 | String tag; |