3,6 → 3,7 |
import org.tela_botanica.del.client.i18n.I18n; |
|
import com.google.gwt.i18n.client.NumberFormat; |
import com.google.gwt.user.client.Window; |
|
public class StringUtils { |
|
49,17 → 50,17 |
return NumberFormat.getFormat(patternNb.toString()).format(valeur); |
} |
|
public static String getCorrespondanceChaineEvenementObs(String evenement, int nb) { |
public static String getCorrespondanceChaineEvenementObs(String evenement) { |
String trad = ""; |
|
// Arghhhh pourquoi on ne peut pas faire de switch sur une string !!!!!! |
// arggh arrrghghhhhhh |
if(evenement.equals("nouveau_vote")) { |
trad = nb > 1 ? I18n.getMessages().nouveauxVotes(nb+"") : I18n.getVocabulary().nouveauVote(); |
trad = I18n.getVocabulary().nouveauVote(); |
} |
|
if(evenement.equals("nouveau_commentaire")) { |
trad = nb > 1 ? I18n.getMessages().nouveauxCommentaires(nb+"") : I18n.getVocabulary().nouveauCommentaire(); |
trad = I18n.getVocabulary().nouveauCommentaire(); |
} |
|
if(evenement.equals("nouvelle_observation")) { |
112,4 → 113,31 |
|
return trad; |
} |
|
public static String getClasseEvenementObs(String evenement) { |
String classeEvt = ""; |
if(evenement.equals("nouveau_commentaire_vous_a_obs_autre") || |
evenement.equals("nouveau_commentaire_autre_sur_obs_vous") || |
evenement.equals("nouvelle_reponse_autre_sur_commentaire_vous") || |
evenement.equals("nouvelle_reponse_autre_sur_proposition_vous")) { |
classeEvt = "evtObsCitation"; |
} else { |
classeEvt = "evtObsAction"; |
} |
return classeEvt; |
} |
|
/** |
* Puts ellipses in input strings that are longer than than maxCharacters. Shorter strings or |
* null is returned unchanged. |
* @param input the input string that may be subjected to shortening |
* @param maxCharacters the maximum characters that are acceptable for the unshortended string. Must be at least 3, otherwise a string with ellipses is too long already. |
* @param the number of characters that should appear after the ellipsis (0 or larger) |
*/ |
public static String ellipsize(String input, int maxCharacters, int charactersAfterEllipsis) { |
if (input == null || input.length() < maxCharacters) { |
return input; |
} |
return input.substring(0, maxCharacters - 3 - charactersAfterEllipsis) + "..." + input.substring(input.length() - charactersAfterEllipsis); |
} |
} |