root / branches / v2_0_0_prep / libraries / libUIComponent / src / org / gvsig / gui / beans / progresspanel / LogControl.java @ 31952
History | View | Annotate | Download (1.82 KB)
1 |
package org.gvsig.gui.beans.progresspanel; |
---|---|
2 |
|
3 |
/* gvSIG. Geographic Information System of the Valencian Government
|
4 |
*
|
5 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
6 |
* of the Valencian Government (CIT)
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or
|
9 |
* modify it under the terms of the GNU General Public License
|
10 |
* as published by the Free Software Foundation; either version 2
|
11 |
* of the License, or (at your option) any later version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful,
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
* GNU General Public License for more details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License
|
19 |
* along with this program; if not, write to the Free Software
|
20 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
21 |
* MA 02110-1301, USA.
|
22 |
*
|
23 |
*/
|
24 |
|
25 |
/**
|
26 |
* <code>LogControl</code>. Objeto para un control b?sico de un log. Para a?adir
|
27 |
* y reemplazar la ?ltima l?nea a?adida.
|
28 |
*
|
29 |
* @version 27/03/2007
|
30 |
* @author BorSanZa - Borja Sanchez Zamorano (borja.sanchez@iver.es)
|
31 |
*/
|
32 |
public class LogControl { |
33 |
String text = ""; |
34 |
|
35 |
/**
|
36 |
* A?ade una l?nea al log.
|
37 |
* @param line
|
38 |
*/
|
39 |
public void addLine(String line) { |
40 |
if (text.length() > 0) |
41 |
text += "\n";
|
42 |
text += line; |
43 |
} |
44 |
|
45 |
/**
|
46 |
* Reemplaza la ?ltima l?nea a?adida al log.
|
47 |
* @param line
|
48 |
*/
|
49 |
public void replaceLastLine(String line) { |
50 |
int index = text.lastIndexOf("\n"); |
51 |
if (index < 0) |
52 |
index = 0;
|
53 |
text = text.substring(0, index);
|
54 |
addLine(line); |
55 |
} |
56 |
|
57 |
/**
|
58 |
* Establece el texto completo del log.
|
59 |
* @param value
|
60 |
*/
|
61 |
public void setText(String value) { |
62 |
text = value; |
63 |
} |
64 |
|
65 |
/**
|
66 |
* Devuelve el contenido del log.
|
67 |
* @return String
|
68 |
*/
|
69 |
public String getText() { |
70 |
return text;
|
71 |
} |
72 |
} |