the only drawback is that it makes your markup longer and that it will
take slightly more cpu because the page-relative path has to be
computed for every component on the page.

-igor

On Thu, Oct 15, 2009 at 9:04 AM, Douglas Ferguson
<doug...@douglasferguson.us> wrote:
> Is there any drawback to using this in production?
>
>
> On Oct 15, 2009, at 10:53 AM, Igor Vaynberg wrote:
>
>> see idebugsettings.setoutputcomponentpath, this will add
>> wicket:path='component's page relative path' attribute which is stable
>> as long as you do not change the hierarchy and can be used for writing
>> selenium tests.
>>
>> -igor
>>
>> On Thu, Oct 15, 2009 at 4:14 AM, Per Lundholm
>> <per.lundh...@gmail.com> wrote:
>>> Looks like a patch to make it easier to use Selenium to test your
>>> webapplication.
>>>
>>> Selenium is very fond of id in tags.
>>>
>>> /Per
>>>
>>> On Thu, Oct 15, 2009 at 9:58 AM, Daniel Frisk <dan...@jalbum.net>
>>> wrote:
>>>> Ok, I'm lazy and couldn't decipher that code at a glance. What
>>>> does it do?
>>>>
>>>> // Daniel
>>>> jalbum.net
>>>>
>>>>
>>>>
>>>> On 2009-10-15, at 03:09, Douglas Ferguson wrote:
>>>>
>>>>> Has anybody seen this:
>>>>>
>>>>> http://www.onehippo.org/cms7/integration_testing.html
>>>>>
>>>>> Seems like a nice alternative vs. having to set markupIds on all
>>>>> components.
>>>>>
>>>>> Thoughts?
>>>>>
>>>>> ............
>>>>>
>>>>> They have a patch for wicket:
>>>>>
>>>>>> Index: jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java
>>>>>> =
>>>>>> ==================================================================
>>>>>> *** jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java
>>>>>> (revision 724306)
>>>>>> --- jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java
>>>>>> (working copy)
>>>>>> ***************
>>>>>> *** 1475,1478 ****
>>>>>> --- 1475,1489 ----
>>>>>>        {
>>>>>>                return sequence++;
>>>>>>        }
>>>>>> +
>>>>>> +       /**
>>>>>> +        * Retrieves the next available session-unique value for
>>>>>> the
>>>>>> supplied Component
>>>>>> +        *
>>>>>> +        * @param component
>>>>>> +        *            the component which requests the
>>>>>> generation of a
>>>>>> markup identifier
>>>>>> +        * @return session-unique value
>>>>>> +        */
>>>>>> +       public Object getMarkupId(Component component) {
>>>>>> +               return new Integer(nextSequenceValue());
>>>>>> +       }
>>>>>>  }
>>>>>> Index: jdk-1.4/wicket/src/main/java/org/apache/wicket/
>>>>>> Component.java
>>>>>> =
>>>>>> ==================================================================
>>>>>> *** jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java
>>>>>> (revision 724306)
>>>>>> --- jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java
>>>>>> (working copy)
>>>>>> ***************
>>>>>> *** 1426,1437 ****
>>>>>>                        return null;
>>>>>>                }
>>>>>>
>>>>>> !               final int generatedMarkupId = storedMarkupId
>>>>>> instanceof
>>>>>> Integer
>>>>>> !                       ? ((Integer)storedMarkupId).intValue() :
>>>>>> Session.get
>>>>>> ().nextSequenceValue();
>>>>>> !
>>>>>> !               if (storedMarkupId == null)
>>>>>> !               {
>>>>>> !                       setMarkupIdImpl(new Integer
>>>>>> (generatedMarkupId));
>>>>>>                }
>>>>>>
>>>>>>                // try to read from markup
>>>>>> --- 1426,1445 ----
>>>>>>                        return null;
>>>>>>                }
>>>>>>
>>>>>> !               String markupIdPostfix;
>>>>>> !               if (!(storedMarkupId instanceof Integer)) {
>>>>>> !                       Object markupIdFromSession =
>>>>>> Session.get().getMarkupId(this);
>>>>>> !                       if (storedMarkupId == null &&
>>>>>> markupIdFromSession
>>>>>> != null) {
>>>>>> !                               setMarkupIdImpl
>>>>>> (markupIdFromSession);
>>>>>> !                       }
>>>>>> !                       storedMarkupId = markupIdFromSession;
>>>>>> !               }
>>>>>> !               if (storedMarkupId instanceof Integer) {
>>>>>> !                       markupIdPostfix = Integer.toHexString
>>>>>> (((Integer)
>>>>>> storedMarkupId).intValue()).toLowerCase();
>>>>>> !               } else if (storedMarkupId instanceof String) {
>>>>>> !                       return (String) storedMarkupId;
>>>>>> !               } else {
>>>>>> !                       markupIdPostfix = storedMarkupId.toString
>>>>>> ();
>>>>>>                }
>>>>>>
>>>>>>                // try to read from markup
>>>>>> ***************
>>>>>> *** 1449,1455 ****
>>>>>>                        markupIdPrefix = getId();
>>>>>>                }
>>>>>>
>>>>>> -               String markupIdPostfix = Integer.toHexString
>>>>>> (generatedMarkupId).toLowerCase();
>>>>>>                markupIdPostfix = RequestContext.get
>>>>>> ().encodeMarkupId
>>>>>> (markupIdPostfix);
>>>>>>
>>>>>>                String markupId = markupIdPrefix + markupIdPostfix;
>>>>>> --- 1457,1462 ----
>>>>>
>>>>>
>>>>> Then in their session, they return stable ids
>>>>>
>>>>>>   private Map<String,Integer> pluginComponentCounters = new
>>>>>> HashMap<String,Integer>();
>>>>>>
>>>>>>   // Do not add the @Override annotation on this
>>>>>>   public Object getMarkupId(Component component) {
>>>>>>       String markupId = null;
>>>>>>       for (Component ancestor=component.getParent(); ancestor!
>>>>>> =null && markupId==null; ancestor=ancestor.getParent()) {
>>>>>>           if (ancestor instanceof IPlugin || ancestor instanceof
>>>>>> Home) {
>>>>>>               markupId = ancestor.getMarkupId(true);
>>>>>>               break;
>>>>>>           }
>>>>>>       }
>>>>>>       if (markupId == null) {
>>>>>>           return "root";
>>>>>>       }
>>>>>>       int componentNum = 0;
>>>>>>       if (pluginComponentCounters.containsKey(markupId)) {
>>>>>>           componentNum = pluginComponentCounters.get
>>>>>> (markupId).intValue();
>>>>>>       }
>>>>>>       ++componentNum;
>>>>>>       pluginComponentCounters.put(markupId, new Integer
>>>>>> (componentNum));
>>>>>>       return markupId + "_" + componentNum;
>>>>>>   }
>>>>>> }
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to