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