geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r571626 - /geronimo/sandbox/gshell/trunk/gshell-ansi/src/main/java/org/apache/geronimo/gshell/ansi/RenderMessageSource.java
Date Fri, 31 Aug 2007 22:32:10 GMT
Author: jdillon
Date: Fri Aug 31 15:32:08 2007
New Revision: 571626

URL: http://svn.apache.org/viewvc?rev=571626&view=rev
Log:
Make the render msg wrap instead of extend

Modified:
    geronimo/sandbox/gshell/trunk/gshell-ansi/src/main/java/org/apache/geronimo/gshell/ansi/RenderMessageSource.java

Modified: geronimo/sandbox/gshell/trunk/gshell-ansi/src/main/java/org/apache/geronimo/gshell/ansi/RenderMessageSource.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-ansi/src/main/java/org/apache/geronimo/gshell/ansi/RenderMessageSource.java?rev=571626&r1=571625&r2=571626&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-ansi/src/main/java/org/apache/geronimo/gshell/ansi/RenderMessageSource.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-ansi/src/main/java/org/apache/geronimo/gshell/ansi/RenderMessageSource.java
Fri Aug 31 15:32:08 2007
@@ -22,33 +22,35 @@
 import org.apache.geronimo.gshell.i18n.MessageSource;
 
 /**
- * Message source implementation which supports automatic ANSI color rendering.
+ * Message source adapter which supports automatic ANSI color rendering.
  *
  * @version $Rev$ $Date$
  */
 public class RenderMessageSource
-    extends MessageSource
+    implements MessageSource
 {
     private final Renderer renderer = new Renderer();
 
-    public RenderMessageSource(final String[] names) {
-        super(names);
-    }
+    private final MessageSource source;
 
-    public RenderMessageSource(final String name) {
-        super(name);
-    }
+    public RenderMessageSource(final MessageSource source) {
+        assert source != null;
 
-    public RenderMessageSource(final Class[] types) {
-        super(types);
+        this.source = source;
     }
+    
+    public String getMessage(final String code) {
+        String msg = source.getMessage(code);
 
-    public RenderMessageSource(final Class type) {
-        super(type);
+        if (Renderer.test(msg)) {
+            return renderer.render(msg);
+        }
+
+        return msg;
     }
 
-    public String getMessage(final String code) {
-        final String msg = super.getMessage(code);
+    public String format(String code, Object... args) {
+        String msg = source.format(code, args);
 
         if (Renderer.test(msg)) {
             return renderer.render(msg);



Mime
View raw message