Debian Codegraph @

framework/qa/complex/loadAllDocuments/StatusIndicator.java

raw
1 /*
2 * This file is part of the LibreOffice project.
3 *
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/.
7 *
8 * This file incorporates work covered by the following license notice:
9 *
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 .
17 */
18 package complex.loadAllDocuments;
19
20 // __________ Imports __________
21
22
23
24 // __________ Implementation __________
25
26 /**
27 * Implements a simple status indicator, which
28 * provide information about state of a load request.
29 * It can be used as an argument e.g. for loadComponentFromURL().
30 */
31 public class StatusIndicator implements com.sun.star.task.XStatusIndicator
32 {
33
34 private boolean m_bWasUsed ;
35
36
37
38 /**
39 * ctor
40 * It's initialize an object of this class with default values.
41 */
42 public StatusIndicator()
43 {
44 m_bWasUsed = false;
45 }
46
47
48
49 /**
50 * It starts the progress and set the initial text and range.
51 *
52 * @param sText
53 * the initial text for showing
54 *
55 * @param nRange
56 * the new range for following progress
57 */
58 public void start( /*IN*/String sText, /*IN*/int nRange )
59 {
60 synchronized(this)
61 {
62 m_bWasUsed = true;
63 }
64 impl_show();
65 }
66
67
68
69 /**
70 * Finish the progress and reset internal members.
71 */
72 public void end()
73 {
74 synchronized(this)
75 {
76 m_bWasUsed = true;
77 }
78 impl_show();
79 }
80
81
82
83 /**
84 * Set the new description text.
85 *
86 * @param sText
87 * the new text for showing
88 */
89 public void setText( /*IN*/String sText )
90 {
91 synchronized(this)
92 {
93 m_bWasUsed = true;
94 }
95 impl_show();
96 }
97
98
99
100 /**
101 * Set the new progress value.
102 *
103 * @param nValue
104 * the new progress value
105 * Must fit the range!
106 */
107 public void setValue( /*IN*/int nValue )
108 {
109 synchronized(this)
110 {
111 m_bWasUsed = true;
112 }
113 impl_show();
114 }
115
116
117
118 /**
119 * Reset text and progress value to her defaults.
120 */
121 public void reset()
122 {
123 synchronized(this)
124 {
125 m_bWasUsed = true;
126 }
127 impl_show();
128 }
129
130
131
132 /*
133 * Internal helper to show the status.
134 * Currently it's implement as normal text out on stdout.
135 * But of course other things are possible here too.
136 * e.g. a dialog
137 */
138 private void impl_show()
139 {
140 }
141
142 public boolean wasUsed() {
143 return m_bWasUsed;
144 }
145 }