Patches item #1297449, was opened at 2005-09-21 09:26
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=684977&aid=1297449&group_id=119783

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: examples
Group: 1.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Sven Meier (svenmeier)
Assigned to: Nobody/Anonymous (nobody)
Summary: Improve hangman letter images

Initial Comment:
The letter images in the hangman example are currently
difficult to understand (why two images for each letter
?) and dependent on questionable behaviour of the Link
component (see
http://sourceforge.net/tracker/index.php?func=detail&aid=1297446&group_id=119783&atid=684975
).

I propose to use an alternative implementation,  that
needs minor changes to the hangman example code:

diff -u original/Guess.html patched/Guess.html
--- original/Guess.html 2005-09-11 21:21:52.000000000 +0200
+++ patched/Guess.html  2005-09-21 09:35:01.347387600 +0200
@@ -10,7 +10,7 @@
        <p>
                <div style="width:250px">
                        <span wicket:id="letters">
-                               <a wicket:id="letter" href="#"><img type="image"
wicket:id="enabled"/><img type="image"
wicket:id="disabled"/></a>
+                               <a wicket:id="letter" href="#"><img type="image"
wicket:id="image"/></a>
                        </span>
                </div>
        </p>
diff -u original/Guess.java patched/Guess.java
--- original/Guess.java 2005-09-11 21:21:50.000000000 +0200
+++ patched/Guess.java  2005-09-21 09:41:24.780696000 +0200
@@ -83,8 +83,7 @@
                                        }
                                };
                                link.add(new AttributeModifier("id", true, new
Model("letter_" + letter.asString())));
-                               link.add(new Image("enabled",
letter.getSharedImageResource(true)));
-                               link.add(new Image("disabled",
letter.getSharedImageResource(false)));
+                               link.add(new Image("image",
letter.getSharedImageResource()));
                                listItem.add(link);
                        }
                });
diff -u original/Letter.java patched/Letter.java
--- original/Letter.java        2005-09-11 21:21:52.000000000
+0200
+++ patched/Letter.java 2005-09-21 09:35:48.412297200 +0200
@@ -71,21 +71,20 @@
        }
 
        /**
-        * @param enabled
-        *            True to get the enabled resource, false
to get the disabled
-        *            resource
         * @return ResourceReference token for this letter
         */
-       public ResourceReference getSharedImageResource(final
boolean enabled)
+       public ResourceReference getSharedImageResource()
        {
-               return new ResourceReference(Letter.class,
asString() + (enabled ? "_enabled" : "_disabled"))
+               return new ResourceReference(Letter.class,
asString() + (isGuessed ? "_disabled" : "_enabled"))
                {
+                       private final boolean disabled = isGuessed;
+                       
                        protected Resource newResource()
                        {
                                // Lazy loading of shared resource
                                final DefaultButtonImageResource buttonResource 
=
new DefaultButtonImageResource(30, 30,
                                                asString());
-                               if (!enabled)
+                               if (disabled)
                                {
                                        buttonResource.setColor(Color.GRAY);
                                }


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=684977&aid=1297449&group_id=119783


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to