wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Eugelink <t...@tbee.org>
Subject Re: focus locked in place
Date Thu, 19 Apr 2012 12:11:50 GMT

Ok, I've opened wicket's ajax debugger and there is NO ajax call. What I see is this:

INFO: focus set on
INFO: focus removed from
INFO: focus set on
INFO: focus removed from

So it seems to me the fields do not have names. However in the HTML I do see a name.
<input type="text" wicket:id="runtimeOs" style="width:100px;" value="ios" name="runtimesPanel:runtimes:1:runtimeOs">

However, there are more of these inputs with the same wicket:id; it's a make shift table build
using a RefreshingView
<input type="text" wicket:id="runtimeOs" style="width:100px;" value="bada" name="runtimesPanel:runtimes:2:runtimeOs">
<input type="text" wicket:id="runtimeOs" style="width:100px;" value="bada" name="runtimesPanel:runtimes:3:runtimeOs">
...

I believe I'm doing something wrong in building that make shift table.

             // the panel taking care of the ajax
             final MarkupContainer lRuntimesPanel = new WebMarkupContainer("runtimesPanel");
             lRuntimesPanel.setOutputMarkupId(true);
             lForm.add(lRuntimesPanel);

             // the list of runtimes
             final RefreshingView<com.service2media.licenseframework.service.license.jaxb.Runtime>
lRuntimeListView = new RefreshingView<com.service2media.licenseframework.service.license.jaxb.Runtime>("runtimes")
//LicenseModel.RUNTIMES_PROPERTY)
             {
                 @Override
                 protected Iterator<IModel<com.service2media.licenseframework.service.license.jaxb.Runtime>>
getItemModels()
                 {
                     return new ModelIteratorAdapter(lLicenseJAXB.getRuntimes().getRuntime().iterator())
                     {
                         @Override
                         protected final IModel model(final Object object)
                         {
                             return new CompoundPropertyModel((com.service2media.licenseframework.service.license.jaxb.Runtime)
object);
                         }
                     };
                 }

                 @Override
                 protected void populateItem(final Item<com.service2media.licenseframework.service.license.jaxb.Runtime>
item)
                 {
                     item.add( new DropDownChoice<String>("runtimeType", new PropertyModel<String>(item.getDefaultModel(),
"type"), License.RUNTIME_TYPES));
                     item.add( new TextField<String>("runtimeOs", new PropertyModel<String>(item.getDefaultModel(),
"os")));
                     item.add( new TextField<String>("runtimeOsVersion", new PropertyModel<String>(item.getDefaultModel(),
"osversion")));
                     item.add( new TextField<String>("runtimePoolId", new PropertyModel<String>(item.getDefaultModel(),
"poolid")));
                     item.add( new TextField<BigInteger>("runtimePoolSize", new PropertyModel<BigInteger>(item.getDefaultModel(),
"poolsize")));
                       // remove button
                       AjaxSubmitLink lRemoveRuntime = new AjaxSubmitLink("removeRuntime",
lForm)
                       {
                           @Override
                           protected void onError(AjaxRequestTarget target, Form<?>
form)
                           {
                           }

                           @Override
                           protected void onSubmit(AjaxRequestTarget target, Form<?>
form)
                           {
                               List<com.service2media.licenseframework.service.license.jaxb.Runtime>
lRuntimes = lLicenseJAXB.getRuntimes().getRuntime();
                               lRuntimes.remove(item.getModelObject());
                               if (target != null) target.add(lRuntimesPanel); // ajax update
                           }

                           @Override
                           protected IAjaxCallDecorator getAjaxCallDecorator()
                           {
                               return new JavascriptConfirmDecorator("Remove the runtime?");
                           }
                       };
                       lRemoveRuntime.setDefaultFormProcessing(false);
                       item.add(lRemoveRuntime);
                 }
             };
             lRuntimesPanel.add(lRuntimeListView);


On 16-4-2012 8:54, Martin Grigorov wrote:
> Hi Tom,
>
> Wicket keeps track of the last focused element only for Ajax requests.
> I.e. Wicket sends a header in the ajax requests with the id of the
> focused element when the Ajax call starter and later when the Ajax
> response is processed it re-focuses this element.
> Additionally there is AjaxRequestTarget#focusComponent(Component)
> method which may be used to focus another element.
>
> If you replace the focused element in the Ajax response then
> lastFocusedId will be obsolete and Wicket wont be able to find the old
> component.
>
> I hope this helps you find out what causes the jumps in the focused elements.
>
> On Fri, Apr 13, 2012 at 5:49 PM, Tom Eugelink<tbee@tbee.org>  wrote:
>> On 2012-04-13 11:58, Tom Eugelink wrote:
>>>
>>>
>>> The cursor can be placed in the date fields, but not in any of the
>>> textfield in the listview.
>>
>>
>> To add some additional information; the cursor can be placed in the
>> textfields by using the TAB key. A mouse click will always jump to the first
>> field. So it seems to be a RefreshingView in combination with a mouse click
>> problem.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>



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


Mime
View raw message