if you only want one then you have to keep track of which one is currently replaced, and when the edit link is clicked you have to replace the currently editable one with a view only panel, and then replace the one currently clicked with an editable panel.

-Igor


On 4/26/06, Mats Norén <[EMAIL PROTECTED]> wrote:
Okey, I forget the setOptimizeRemoval(true) bit.
The problem now is that every link I click is replaced by a form, the
effect I was looking for is that only one date at a time should be
editable.

What am I missing?

On 4/26/06, Mats Norén <[EMAIL PROTECTED]> wrote:
> Hi,
> I'm trying to display a couple of dates in a listview.
> When the user clicks on one of the dates I would like to replace the
> link with simple form for editing the date.
> The list renders fine, I click on the editLink and the "replacing view
> with edit"-text appears in my log. *But* nothing else happens. The
> view stays the same.
> Is the edit-component I switched in replaced by the original listview
> at rendertime or what's going on?
>
>
> ListView listView = new ListView("timeslots", timeSlots) {
>             protected void populateItem(ListItem listItem) {
>                 final TimeslotInstance instance = (TimeslotInstance)
> listItem.getModelObject();
>                 String name = instance.getTimeslotDefinition().getDescription();
>                 listItem.add(new Label("name", name));
>                 listItem.add(new TimeslotViewPanel("plannedStartDate",
> instance.getPlannedStartDate()));
>                 listItem.add(new TimeslotViewPanel("actualStartDate",
> instance.getActualStartDate()));
>                 listItem.add(new TimeslotViewPanel("plannedEndDate",
> instance.getPlannedEndDate()));
>                 listItem.add(new TimeslotViewPanel("actualEndDate",
> instance.getActualEndDate()));
>             }
>         };
>         add(listView);
>
>
> class TimeslotViewPanel extends Panel {
>
>         public TimeslotViewPanel(final String id, final Date date) {
>             super(id, new Model(date));
>             //setRenderBodyOnly(true);
>             //setOutputMarkupId(true);
>             Link editLink = new Link("editLink") {
>                 public void onClick() {
>                     System.out.println("replacing view with edit");
>                     TimeslotViewPanel.this.getParent().replace(new
> TimeslotEditPanel(id, date));
>                 }
>             };
>             editLink.add(new Label("value", new Model(date)));
>             add(editLink);
>         }
>     }
>
>     class TimeslotEditPanel extends Panel {
>
>         public TimeslotEditPanel(String id, final Date date) {
>             super(id, new Model(date));
>             //setRenderBodyOnly(true);
>             Form form = new Form("editForm");
>             form.add(new TextField("value", new Model(date), Date.class));
>             add(form);
>         }
>     }
>


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmdlnk&kid0709&bid&3057&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to