ComentariosUtils.java 975 Bytes
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
package circusRefine.util;


import java.util.ArrayList;

import javax.swing.JOptionPane;

import circusRefine.gui.Comentario;

public class ComentariosUtils {
/* Padrao Singleton*/
private static ArrayList<Comentario> comentarios = null;
private ComentariosUtils() {
}
public static void setComments (ArrayList<Comentario> cmts) {
comentarios = cmts;
}
public static boolean getComentarioTxt (int identificador, StringBuffer text) {
boolean result = false;
if (comentarios != null) {
if (!comentarios.isEmpty()){
for (Comentario com : comentarios) {
if (com.getIdentificador() == identificador) {
result = true;
String[] res = com.getTexto().split("\n");
for (int i=0;i<res.length;i++) {
text.append(res[i]);
}
}
}
}
}
return result;
}
public static boolean isNull () {
if (comentarios == null) {
return true;
}
return false;
}
}