Related: tdf#89131 draw up/down spins disabled if value is at max/min
[LibreOffice.git] / qadevOOo / runner / stats / SimpleLogWriter.java
blob46e18527bdd255cba7fa7c221f5b74a3c185126c
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 package stats;
20 import share.LogWriter;
22 import java.io.PrintWriter;
23 import java.text.DecimalFormat;
24 import java.util.Calendar;
25 import java.util.GregorianCalendar;
27 public class SimpleLogWriter extends PrintWriter implements LogWriter {
29 private boolean m_bLogging = false;
30 private share.DescEntry entry = null;
31 private share.Watcher ow = null;
33 public SimpleLogWriter() {
34 super(System.out);
35 Calendar cal = new GregorianCalendar();
36 DecimalFormat dfmt = new DecimalFormat("00");
37 super.println("LOG> Log started " +
38 dfmt.format(cal.get(Calendar.DAY_OF_MONTH)) + "." +
39 dfmt.format(cal.get(Calendar.MONTH)) + "." +
40 dfmt.format(cal.get(Calendar.YEAR)) + " - " +
41 dfmt.format(cal.get(Calendar.HOUR_OF_DAY)) + ":" +
42 dfmt.format(cal.get(Calendar.MINUTE)) + ":" +
43 dfmt.format(cal.get(Calendar.SECOND)));
44 super.flush();
47 public boolean initialize(share.DescEntry _entry, boolean _bLogging) {
48 m_bLogging = _bLogging;
49 entry = _entry;
51 return true;
54 @Override
55 public void println(String msg) {
56 if ((ow == null) && (entry != null))
58 this.ow = (share.Watcher) entry.UserDefinedParams.get("Watcher");
59 if (this.ow != null)
61 this.ow.ping();
64 else
66 if (ow != null)
68 this.ow.ping();
70 else
72 // special case: ow == null && entry == null
73 System.out.println(msg);
77 if (m_bLogging) {
78 super.println("LOG> " + msg);
79 super.flush();
83 public boolean summary(share.DescEntry entry) {
84 return true;
87 public void setWatcher(Object watcher)
89 if (watcher != null)
91 entry.UserDefinedParams.put("Watcher", watcher);