From 21e66ed1ac25f8ddffd94a7da4b35730fb890aea Mon Sep 17 00:00:00 2001 From: Diogo Neves Date: Wed, 10 Feb 2010 12:05:19 +0000 Subject: [PATCH] git-svn-id: https://svn.coded.pt/svn/SIPRP@1178 bb69d46d-e84e-40c8-a05a-06db0d633741 --- .../print/PlanoActuacaoPrintDataProvider.java | 5 ++ .../print/StringConverterUtils.java | 63 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 trunk/SIPRPSoft/src/siprp/planoactuacao/print/StringConverterUtils.java diff --git a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPrintDataProvider.java b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPrintDataProvider.java index 16223321..57d9c462 100644 --- a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPrintDataProvider.java +++ b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/PlanoActuacaoPrintDataProvider.java @@ -652,6 +652,11 @@ public class PlanoActuacaoPrintDataProvider Vector postos = getPostosToPrintByMedidaId( id ); if( postos.size() > 0 && isPlanoActuacao) { + if ( web ) + { + descricao = StringConverterUtils.convertHTMLToText( descricao ); + descricao = StringConverterUtils.stripHTMLTags( descricao ); + } medidas.add( new MedidaToPrint( descricao, postos ) ); } } diff --git a/trunk/SIPRPSoft/src/siprp/planoactuacao/print/StringConverterUtils.java b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/StringConverterUtils.java new file mode 100644 index 00000000..2dc66422 --- /dev/null +++ b/trunk/SIPRPSoft/src/siprp/planoactuacao/print/StringConverterUtils.java @@ -0,0 +1,63 @@ +package siprp.planoactuacao.print; + +public class StringConverterUtils +{ + public static String stripHTMLTags( String text ) + { + String output = text; + + output = output.replaceAll( "
", "" ); + output = output.replaceAll( "

", "" ); + output = output.replaceAll( "

", "" ); + + return output; + } + + + public static String convertHTMLToText( String text ) + { + String output = text; + + output = output.replaceAll( "À", "À" ); + output = output.replaceAll( "Á", "Á" ); + output = output.replaceAll( "Â", "Â" ); + output = output.replaceAll( "Ã", "Ã" ); + output = output.replaceAll( "Ç", "Ç" ); + output = output.replaceAll( "È", "È" ); + output = output.replaceAll( "É", "É" ); + output = output.replaceAll( "Ó", "Ó" ); + output = output.replaceAll( "Ò", "Ò" ); + + output = output.replaceAll( "Ê", "Ê" ); + output = output.replaceAll( "Ì", "Ì" ); + output = output.replaceAll( "Í", "Í" ); + output = output.replaceAll( "Î", "Î" ); + output = output.replaceAll( "Ô", "Ô" ); + output = output.replaceAll( "Õ", "Õ" ); + output = output.replaceAll( "Ù", "Ù" ); + output = output.replaceAll( "Ú", "Ú" ); + output = output.replaceAll( "Û", "Û" ); + + output = output.replaceAll( "à", "à" ); + output = output.replaceAll( "á", "á" ); + output = output.replaceAll( "â", "â" ); + output = output.replaceAll( "ã", "ã" ); + output = output.replaceAll( "ç", "ç" ); + output = output.replaceAll( "è", "è" ); + output = output.replaceAll( "é", "é" ); + output = output.replaceAll( "ê", "ê" ); + output = output.replaceAll( "ì", "ì" ); + output = output.replaceAll( "í", "í" ); + output = output.replaceAll( "î", "î" ); + output = output.replaceAll( "ò", "ò" ); + output = output.replaceAll( "ó", "ó" ); + output = output.replaceAll( "ô", "ô" ); + output = output.replaceAll( "õ", "õ" ); + output = output.replaceAll( "ù", "ù" ); + output = output.replaceAll( "ú", "ú" ); + output = output.replaceAll( "û", "û" ); + + output = output.replaceAll( " ", " " ); + return output; + } +}