1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 package convwatch;
29 
30 public class StatusHelper
31 {
32     final static public int DIFF_NOT_REALLY_INITIALISED =            1;
33     final static public int DIFF_NO_DIFFERENCES =                    2;
34     final static public int DIFF_DIFFERENCES_FOUND =                 3;
35     final static public int DIFF_AFTER_MOVE_DONE_NO_PROBLEMS =       4;
36     final static public int DIFF_AFTER_MOVE_DONE_DIFFERENCES_FOUND = 5;
37 
38     // public String m_sOutputPath;
39     public String m_sMainName;
40 
41     public String m_sOldGfx;
42     public String m_sNewGfx;
43     public String m_sDiffGfx;
44     public int nDiffStatus = DIFF_NOT_REALLY_INITIALISED;
45     public int nPercent = 0;
46 
47     // BorderMove Values
48     public int nPercent2 = 0;
49     public String m_sOld_BM_Gfx;
50     public String m_sNew_BM_Gfx;
51     public String m_sDiff_BM_Gfx;
52 
53     public StatusHelper(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
54         {
55             m_sOldGfx = _sOldGfx;
56             m_sNewGfx = _sNewGfx;
57             m_sDiffGfx = _sDiffGfx;
58         }
59     public void setFilesForBorderMove(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
60         {
61             m_sOld_BM_Gfx = _sOldGfx;
62             m_sNew_BM_Gfx = _sNewGfx;
63             m_sDiff_BM_Gfx = _sDiffGfx;
64 
65         }
66 
67     public void printStatus()
68         {
69             GlobalLogWriter.get().println("  Original file: " + m_sOldGfx);
70             GlobalLogWriter.get().println("       New file: " + m_sNewGfx);
71             GlobalLogWriter.get().println("Difference file: " + m_sDiffGfx);
72             if (nDiffStatus == DIFF_NOT_REALLY_INITIALISED)
73             {
74                 GlobalLogWriter.get().println("Early problem, may be the files doesn't exist.");
75             }
76             else if (nDiffStatus == DIFF_NO_DIFFERENCES)
77             {
78                 GlobalLogWriter.get().println("No differences found, ok.");
79             }
80             else if (nDiffStatus == DIFF_DIFFERENCES_FOUND)
81             {
82                 GlobalLogWriter.get().println("Files differ by " + String.valueOf(nPercent) + "%");
83             }
84             else if (nDiffStatus == DIFF_AFTER_MOVE_DONE_NO_PROBLEMS)
85             {
86                 GlobalLogWriter.get().println("No differences found, after move picture.");
87             }
88             else if (nDiffStatus == DIFF_AFTER_MOVE_DONE_DIFFERENCES_FOUND)
89             {
90                 GlobalLogWriter.get().println("A picture move is done, the files differ by " + String.valueOf(nPercent2) + " old was " + String.valueOf(nPercent) + "%");
91             }
92             else
93             {
94                 GlobalLogWriter.get().println("Unknown DIFF_ values used, not handles yet.");
95             }
96         }
97 
98 
99 
100 
101 
102 //  TODO: stream output
103 //     public stream& statusline(stream)
104 //         {
105 //             stream << name << "PASS" << nDiff==0?"PASS":"FAIL" << endl;
106 //             return stream;
107 //         }
108 }
109