You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2010/11/22 22:54:55 UTC

svn commit: r1037902 - in /wicket/trunk/wicket/src: main/java/org/apache/wicket/markup/resolver/ test/java/org/apache/wicket/markup/html/basic/ test/java/org/apache/wicket/markup/resolver/

Author: jdonnerstag
Date: Mon Nov 22 21:54:55 2010
New Revision: 1037902

URL: http://svn.apache.org/viewvc?rev=1037902&view=rev
Log: (empty)

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java
    wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html
    wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/resolver/SimplePageExpectedResult_1.html

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java?rev=1037902&r1=1037901&r2=1037902&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java Mon Nov 22 21:54:55 2010
@@ -72,7 +72,7 @@ import org.slf4j.LoggerFactory;
  * 
  * <pre>
  * add(new Label(&quot;amount&quot;, new Model&lt;String&gt;(&quot;$5.00&quot;)));
- * add(new BookmarkablePageLink<Void>(&quot;link&quot;, DetailsPage.class));
+ * add(new BookmarkablePageLink&lt;Void&gt;(&quot;link&quot;, DetailsPage.class));
  * </pre>
  * 
  * This will output
@@ -166,6 +166,8 @@ public class WicketMessageResolver imple
 	{
 		private static final long serialVersionUID = 1L;
 
+		private static final String NOT_FOUND = "[Warning: Property for 'myKeyNotExsts' not found]";
+
 		/**
 		 * Construct.
 		 * 
@@ -232,6 +234,20 @@ public class WicketMessageResolver imple
 				}
 
 				log.warn("No value found for wicket:message tag with key: {}", key);
+
+				// If open tag was open-close
+				if (markupStream.hasMore() == false)
+				{
+					getResponse().write(NOT_FOUND);
+				}
+// else if (markupStream.get() instanceof RawMarkup)
+// {
+// String text = markupStream.get().toString().trim();
+// if (Strings.isEmpty(text))
+// {
+// getResponse().write(NOT_FOUND);
+// }
+// }
 				super.onComponentTagBody(markupStream, openTag);
 			}
 		}

Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html?rev=1037902&r1=1037901&r2=1037902&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html Mon Nov 22 21:54:55 2010
@@ -2,7 +2,7 @@
 <body>
   <wicket:message key="myKeyNotExsts">Default Text</wicket:message>
   <wicket:message key="myKey">myValue</wicket:message>
-  <wicket:message key="myKeyNotExsts"></wicket:message>
+  <wicket:message key="myKeyNotExsts">[Warning: Property for 'myKeyNotExsts' not found]</wicket:message>
   <wicket:message key="myKey">myValue</wicket:message>
   <span wicket:id="message">here it goes</span>
   <span wicket:message="attr-name:i18n-key" attr-name="my i18n key">test 2</span>

Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/resolver/SimplePageExpectedResult_1.html
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/resolver/SimplePageExpectedResult_1.html?rev=1037902&r1=1037901&r2=1037902&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/resolver/SimplePageExpectedResult_1.html (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/resolver/SimplePageExpectedResult_1.html Mon Nov 22 21:54:55 2010
@@ -2,7 +2,7 @@
 <body>
   <wicket:message key="myKeyNotExsts">Default Text</wicket:message>
   <wicket:message key="myKey">myValue</wicket:message>
-  <wicket:message key="myKeyNotExsts"></wicket:message>
+  <wicket:message key="myKeyNotExsts">[Warning: Property for 'myKeyNotExsts' not found]</wicket:message>
   <wicket:message key="myKey">myValue</wicket:message>
 
   <!-- wicket message with some raw markup -->



Re: svn commit: r1037902 - in /wicket/trunk/wicket/src: main/java/org/apache/wicket/markup/resolver/ test/java/org/apache/wicket/markup/html/basic/ test/java/org/apache/wicket/markup/resolver/

Posted by Martin Grigorov <mg...@apache.org>.
Improved with r1038170

On Tue, Nov 23, 2010 at 2:36 PM, Juergen Donnerstag <
juergen.donnerstag@gmail.com> wrote:

> ahhh. Yes, of course. You are right.
>
> Juergen
>
> On Tue, Nov 23, 2010 at 10:13 AM, Martin Grigorov <mg...@apache.org>
> wrote:
> > I mean only the key name should be dynamic.
> >
> > Currently it is:
> >  private static final String NOT_FOUND = "[Warning: Property for
> > 'myKeyNotExsts' not found]";
> >
> >                   ^^^^^^^^^^^^^^
> > Few lines below we have:
> >   log.warn("No value found for wicket:message tag with key: {}", key);
> >
> >          ^^^^^^^
> >
> > I.e. we can make it:
> >  private static final String NOT_FOUND = "[Warning: Property for '%s' not
> > found]";
> > and then
> > getResponse().write(String.format(NOT_FOUND, key));
> >
> > so it will become the correct one:
> > "[Warning: Property for '<any key name>' not found]";
> >
> > What do you think ?
> >
> >
> > On Tue, Nov 23, 2010 at 9:56 AM, Juergen Donnerstag <
> > juergen.donnerstag@gmail.com> wrote:
> >
> >> I don't think it's necessary to provide users the option to change the
> >> warning if a key was not found.  If you really want to, use a
> >> property. IMO that would be overkill.
> >>
> >> Juergen
> >>
> >
>

Re: svn commit: r1037902 - in /wicket/trunk/wicket/src: main/java/org/apache/wicket/markup/resolver/ test/java/org/apache/wicket/markup/html/basic/ test/java/org/apache/wicket/markup/resolver/

Posted by Juergen Donnerstag <ju...@gmail.com>.
ahhh. Yes, of course. You are right.

Juergen

On Tue, Nov 23, 2010 at 10:13 AM, Martin Grigorov <mg...@apache.org> wrote:
> I mean only the key name should be dynamic.
>
> Currently it is:
>  private static final String NOT_FOUND = "[Warning: Property for
> 'myKeyNotExsts' not found]";
>
>                   ^^^^^^^^^^^^^^
> Few lines below we have:
>   log.warn("No value found for wicket:message tag with key: {}", key);
>
>          ^^^^^^^
>
> I.e. we can make it:
>  private static final String NOT_FOUND = "[Warning: Property for '%s' not
> found]";
> and then
> getResponse().write(String.format(NOT_FOUND, key));
>
> so it will become the correct one:
> "[Warning: Property for '<any key name>' not found]";
>
> What do you think ?
>
>
> On Tue, Nov 23, 2010 at 9:56 AM, Juergen Donnerstag <
> juergen.donnerstag@gmail.com> wrote:
>
>> I don't think it's necessary to provide users the option to change the
>> warning if a key was not found.  If you really want to, use a
>> property. IMO that would be overkill.
>>
>> Juergen
>>
>

Re: svn commit: r1037902 - in /wicket/trunk/wicket/src: main/java/org/apache/wicket/markup/resolver/ test/java/org/apache/wicket/markup/html/basic/ test/java/org/apache/wicket/markup/resolver/

Posted by Martin Grigorov <mg...@apache.org>.
I mean only the key name should be dynamic.

Currently it is:
  private static final String NOT_FOUND = "[Warning: Property for
'myKeyNotExsts' not found]";

                   ^^^^^^^^^^^^^^
Few lines below we have:
   log.warn("No value found for wicket:message tag with key: {}", key);

          ^^^^^^^

I.e. we can make it:
  private static final String NOT_FOUND = "[Warning: Property for '%s' not
found]";
and then
getResponse().write(String.format(NOT_FOUND, key));

so it will become the correct one:
"[Warning: Property for '<any key name>' not found]";

What do you think ?


On Tue, Nov 23, 2010 at 9:56 AM, Juergen Donnerstag <
juergen.donnerstag@gmail.com> wrote:

> I don't think it's necessary to provide users the option to change the
> warning if a key was not found.  If you really want to, use a
> property. IMO that would be overkill.
>
> Juergen
>

Re: svn commit: r1037902 - in /wicket/trunk/wicket/src: main/java/org/apache/wicket/markup/resolver/ test/java/org/apache/wicket/markup/html/basic/ test/java/org/apache/wicket/markup/resolver/

Posted by Juergen Donnerstag <ju...@gmail.com>.
I don't think it's necessary to provide users the option to change the
warning if a key was not found.  If you really want to, use a
property. IMO that would be overkill.

Juergen

Re: svn commit: r1037902 - in /wicket/trunk/wicket/src: main/java/org/apache/wicket/markup/resolver/ test/java/org/apache/wicket/markup/html/basic/ test/java/org/apache/wicket/markup/resolver/

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Nov 22, 2010 at 10:54 PM, <jd...@apache.org> wrote:

> Author: jdonnerstag
> Date: Mon Nov 22 21:54:55 2010
> New Revision: 1037902
>
> URL: http://svn.apache.org/viewvc?rev=1037902&view=rev
> Log: (empty)
>
> Modified:
>
>  wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java
>
>  wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html
>
>  wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/resolver/SimplePageExpectedResult_1.html
>
> Modified:
> wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java
> URL:
> http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java?rev=1037902&r1=1037901&r2=1037902&view=diff
>
> ==============================================================================
> ---
> wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java
> (original)
> +++
> wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/WicketMessageResolver.java
> Mon Nov 22 21:54:55 2010
> @@ -72,7 +72,7 @@ import org.slf4j.LoggerFactory;
>  *
>  * <pre>
>  * add(new Label(&quot;amount&quot;, new
> Model&lt;String&gt;(&quot;$5.00&quot;)));
> - * add(new BookmarkablePageLink<Void>(&quot;link&quot;,
> DetailsPage.class));
> + * add(new BookmarkablePageLink&lt;Void&gt;(&quot;link&quot;,
> DetailsPage.class));
>  * </pre>
>  *
>  * This will output
> @@ -166,6 +166,8 @@ public class WicketMessageResolver imple
>        {
>                private static final long serialVersionUID = 1L;
>
> +               private static final String NOT_FOUND = "[Warning: Property
> for 'myKeyNotExsts' not found]";
>
This hardcoded key doesn't look correct.
I'll improved it later if no one else do it before me.

> +
>                /**
>                 * Construct.
>                 *
> @@ -232,6 +234,20 @@ public class WicketMessageResolver imple
>                                }
>
>                                log.warn("No value found for wicket:message
> tag with key: {}", key);
> +
> +                               // If open tag was open-close
> +                               if (markupStream.hasMore() == false)
> +                               {
> +                                       getResponse().write(NOT_FOUND);
> +                               }
> +// else if (markupStream.get() instanceof RawMarkup)
> +// {
> +// String text = markupStream.get().toString().trim();
> +// if (Strings.isEmpty(text))
> +// {
> +// getResponse().write(NOT_FOUND);
> +// }
> +// }
>                                super.onComponentTagBody(markupStream,
> openTag);
>                        }
>                }
>
> Modified:
> wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html
> URL:
> http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html?rev=1037902&r1=1037901&r2=1037902&view=diff
>
> ==============================================================================
> ---
> wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html
> (original)
> +++
> wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_7.html
> Mon Nov 22 21:54:55 2010
> @@ -2,7 +2,7 @@
>  <body>
>   <wicket:message key="myKeyNotExsts">Default Text</wicket:message>
>   <wicket:message key="myKey">myValue</wicket:message>
> -  <wicket:message key="myKeyNotExsts"></wicket:message>
> +  <wicket:message key="myKeyNotExsts">[Warning: Property for
> 'myKeyNotExsts' not found]</wicket:message>
>   <wicket:message key="myKey">myValue</wicket:message>
>   <span wicket:id="message">here it goes</span>
>   <span wicket:message="attr-name:i18n-key" attr-name="my i18n key">test
> 2</span>
>
> Modified:
> wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/resolver/SimplePageExpectedResult_1.html
> URL:
> http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/resolver/SimplePageExpectedResult_1.html?rev=1037902&r1=1037901&r2=1037902&view=diff
>
> ==============================================================================
> ---
> wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/resolver/SimplePageExpectedResult_1.html
> (original)
> +++
> wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/resolver/SimplePageExpectedResult_1.html
> Mon Nov 22 21:54:55 2010
> @@ -2,7 +2,7 @@
>  <body>
>   <wicket:message key="myKeyNotExsts">Default Text</wicket:message>
>   <wicket:message key="myKey">myValue</wicket:message>
> -  <wicket:message key="myKeyNotExsts"></wicket:message>
> +  <wicket:message key="myKeyNotExsts">[Warning: Property for
> 'myKeyNotExsts' not found]</wicket:message>
>   <wicket:message key="myKey">myValue</wicket:message>
>
>   <!-- wicket message with some raw markup -->
>
>
>