Re: Component doesn't disappear when removing it via an ajax link

2009-02-03 Thread Thomas Mäder
And don't forget that you have to add any components you want updated to the
AjaxRequestTarget you get passed into the onClick() method.

Thomas

On Tue, Feb 3, 2009 at 7:43 AM, Jeremy Thomerson
jer...@wickettraining.comwrote:

 A couple of problems:

 1 - don't remove it. You should make it invisible (setVisible(false))

 2 - you're trying to remove the container from the link, but it was added
 to the panel.  You would have to call IngredientPanel.this.remove (but
 don't)


 Jeremy Thomerson
 http://www.wickettraining.com
 -- sent from a wireless device


 -Original Message-
 From: Martin Makundi martin.maku...@koodaripalvelut.com
 Sent: Tuesday, February 03, 2009 12:16 AM
 To: users@wicket.apache.org
 Subject: Re: Component doesn't disappear when removing it via an ajax link

 Run Wicket in development mode and investigate what happens in the
 Wicket Ajax Debug dialog (right bottom corner of your browser).

 **
 Martin

 2009/2/3 Azzeddine Daddah waarhei...@gmail.com:
  Hi,
  I've two text fields wrapped in a container. What I want to do is to let
 the
  user remove these fields via a link. This is my code which does not work.
  The wrapper container stills appear even the link is submitted:
 
  html xmlns:wicket
 wicket:panel
 div wicket:id=container
 input type=text wicket:id=recipeIngredientQty style=width: 15%;
  float: left; margin-right: 10px;/
 input type=text wicket:id=recipeIngredient style=width: 80%;
  margin-bottom: 7px;/
 a wicket:id=removeLink[x]/a
 /div
 /wicket:panel
  /html
 
  public class IngredientPanel extends Panel {
 
 /**
  * Creates a new {...@link IngredientPanel}.
  *
  * @param id the panel id; may not be codenull/code
  * @param model the panel model; may not be codenull/code
  */
 public IngredientPanel(String id, IModelRecipeIngredient model) {
 super(id, model);
 RecipeIngredient recipeIngredient = model.getObject();
 
 final WebMarkupContainer container = new
  WebMarkupContainer(container, model);
 container.setOutputMarkupId(true);
 container.add(new RequiredTextFieldString(recipeIngredientQty,
  new ModelString(recipeIngredient.getQuantity(;
 container.add(new RequiredTextFieldString(recipeIngredient,
 new
  ModelString(recipeIngredient.getIngredient().getName(;
 container.add(new AjaxLinkVoid(removeLink) {
 @Override
 public void onClick(AjaxRequestTarget target) {
 remove(container);
 }
 });
 add(container);
 }
  }
 
  Kind regards,
 
  Hbiloo
 

 -
 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




-- 
Thomas Mäder
www.devotek-it.ch


Re: Component doesn't disappear when removing it via an ajax link

2009-02-03 Thread Azzeddine Daddah
Thanks guys. The setVisible(false) has solved the problem :).I want now to
let the user add a number of this panel dynamically. Any help is welcome.

My code till now:

private void addIngredientsPart(Recipe recipe) {
if (recipe.getRecipeIngredients().size() == 0 ) {
for (int i = 0; i  3; i++) {
recipe.addRecipeIngredient(new RecipeIngredient(recipe, new
Ingredient(), ));
}
}

final WebMarkupContainer container = new
WebMarkupContainer(container);
container.setOutputMarkupId(true);

container.add(new ListViewRecipeIngredient(ingredients,
recipe.getRecipeIngredients()) {
@Override
protected void populateItem(final ListItemRecipeIngredient
item) {
RecipeIngredient recipeIngredient = item.getModelObject();
item.add(new IngredientPanel(ingredientPanel, new
ModelRecipeIngredient(recipeIngredient)));
}
});

add(new AjaxLinkVoid(addLink) {
@Override
public void onClick(AjaxRequestTarget target) {
// How can I now add a new IngredientPanel to the ListView?
target.addComponent(container);
}
});

add(container);
}

Gr. Hbiloo

On Tue, Feb 3, 2009 at 10:36 AM, Thomas Mäder
thomas.mae...@devotek-it.chwrote:

 And don't forget that you have to add any components you want updated to
 the
 AjaxRequestTarget you get passed into the onClick() method.

 Thomas

 On Tue, Feb 3, 2009 at 7:43 AM, Jeremy Thomerson
 jer...@wickettraining.comwrote:

  A couple of problems:
 
  1 - don't remove it. You should make it invisible (setVisible(false))
 
  2 - you're trying to remove the container from the link, but it was added
  to the panel.  You would have to call IngredientPanel.this.remove (but
  don't)
 
 
  Jeremy Thomerson
  http://www.wickettraining.com
  -- sent from a wireless device
 
 
  -Original Message-
  From: Martin Makundi martin.maku...@koodaripalvelut.com
  Sent: Tuesday, February 03, 2009 12:16 AM
  To: users@wicket.apache.org
  Subject: Re: Component doesn't disappear when removing it via an ajax
 link
 
  Run Wicket in development mode and investigate what happens in the
  Wicket Ajax Debug dialog (right bottom corner of your browser).
 
  **
  Martin
 
  2009/2/3 Azzeddine Daddah waarhei...@gmail.com:
   Hi,
   I've two text fields wrapped in a container. What I want to do is to
 let
  the
   user remove these fields via a link. This is my code which does not
 work.
   The wrapper container stills appear even the link is submitted:
  
   html xmlns:wicket
  wicket:panel
  div wicket:id=container
  input type=text wicket:id=recipeIngredientQty style=width:
 15%;
   float: left; margin-right: 10px;/
  input type=text wicket:id=recipeIngredient style=width: 80%;
   margin-bottom: 7px;/
  a wicket:id=removeLink[x]/a
  /div
  /wicket:panel
   /html
  
   public class IngredientPanel extends Panel {
  
  /**
   * Creates a new {...@link IngredientPanel}.
   *
   * @param id the panel id; may not be codenull/code
   * @param model the panel model; may not be codenull/code
   */
  public IngredientPanel(String id, IModelRecipeIngredient model) {
  super(id, model);
  RecipeIngredient recipeIngredient = model.getObject();
  
  final WebMarkupContainer container = new
   WebMarkupContainer(container, model);
  container.setOutputMarkupId(true);
  container.add(new
 RequiredTextFieldString(recipeIngredientQty,
   new ModelString(recipeIngredient.getQuantity(;
  container.add(new RequiredTextFieldString(recipeIngredient,
  new
   ModelString(recipeIngredient.getIngredient().getName(;
  container.add(new AjaxLinkVoid(removeLink) {
  @Override
  public void onClick(AjaxRequestTarget target) {
  remove(container);
  }
  });
  add(container);
  }
   }
  
   Kind regards,
  
   Hbiloo
  
 
  -
  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
 
 


 --
 Thomas Mäder
 www.devotek-it.ch



Component doesn't disappear when removing it via an ajax link

2009-02-02 Thread Azzeddine Daddah
Hi,
I've two text fields wrapped in a container. What I want to do is to let the
user remove these fields via a link. This is my code which does not work.
The wrapper container stills appear even the link is submitted:

html xmlns:wicket
wicket:panel
div wicket:id=container
input type=text wicket:id=recipeIngredientQty style=width: 15%;
float: left; margin-right: 10px;/
input type=text wicket:id=recipeIngredient style=width: 80%;
margin-bottom: 7px;/
a wicket:id=removeLink[x]/a
/div
/wicket:panel
/html

public class IngredientPanel extends Panel {

/**
 * Creates a new {...@link IngredientPanel}.
 *
 * @param id the panel id; may not be codenull/code
 * @param model the panel model; may not be codenull/code
 */
public IngredientPanel(String id, IModelRecipeIngredient model) {
super(id, model);
RecipeIngredient recipeIngredient = model.getObject();

final WebMarkupContainer container = new
WebMarkupContainer(container, model);
container.setOutputMarkupId(true);
container.add(new RequiredTextFieldString(recipeIngredientQty,
new ModelString(recipeIngredient.getQuantity(;
container.add(new RequiredTextFieldString(recipeIngredient, new
ModelString(recipeIngredient.getIngredient().getName(;
container.add(new AjaxLinkVoid(removeLink) {
@Override
public void onClick(AjaxRequestTarget target) {
remove(container);
}
});
add(container);
}
}

Kind regards,

Hbiloo


Re: Component doesn't disappear when removing it via an ajax link

2009-02-02 Thread Martin Makundi
Run Wicket in development mode and investigate what happens in the
Wicket Ajax Debug dialog (right bottom corner of your browser).

**
Martin

2009/2/3 Azzeddine Daddah waarhei...@gmail.com:
 Hi,
 I've two text fields wrapped in a container. What I want to do is to let the
 user remove these fields via a link. This is my code which does not work.
 The wrapper container stills appear even the link is submitted:

 html xmlns:wicket
wicket:panel
div wicket:id=container
input type=text wicket:id=recipeIngredientQty style=width: 15%;
 float: left; margin-right: 10px;/
input type=text wicket:id=recipeIngredient style=width: 80%;
 margin-bottom: 7px;/
a wicket:id=removeLink[x]/a
/div
/wicket:panel
 /html

 public class IngredientPanel extends Panel {

/**
 * Creates a new {...@link IngredientPanel}.
 *
 * @param id the panel id; may not be codenull/code
 * @param model the panel model; may not be codenull/code
 */
public IngredientPanel(String id, IModelRecipeIngredient model) {
super(id, model);
RecipeIngredient recipeIngredient = model.getObject();

final WebMarkupContainer container = new
 WebMarkupContainer(container, model);
container.setOutputMarkupId(true);
container.add(new RequiredTextFieldString(recipeIngredientQty,
 new ModelString(recipeIngredient.getQuantity(;
container.add(new RequiredTextFieldString(recipeIngredient, new
 ModelString(recipeIngredient.getIngredient().getName(;
container.add(new AjaxLinkVoid(removeLink) {
@Override
public void onClick(AjaxRequestTarget target) {
remove(container);
}
});
add(container);
}
 }

 Kind regards,

 Hbiloo


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



RE: Component doesn't disappear when removing it via an ajax link

2009-02-02 Thread Jeremy Thomerson
A couple of problems:

1 - don't remove it. You should make it invisible (setVisible(false))

2 - you're trying to remove the container from the link, but it was added to 
the panel.  You would have to call IngredientPanel.this.remove (but don't)


Jeremy Thomerson
http://www.wickettraining.com
-- sent from a wireless device


-Original Message-
From: Martin Makundi martin.maku...@koodaripalvelut.com
Sent: Tuesday, February 03, 2009 12:16 AM
To: users@wicket.apache.org
Subject: Re: Component doesn't disappear when removing it via an ajax link

Run Wicket in development mode and investigate what happens in the
Wicket Ajax Debug dialog (right bottom corner of your browser).

**
Martin

2009/2/3 Azzeddine Daddah waarhei...@gmail.com:
 Hi,
 I've two text fields wrapped in a container. What I want to do is to let the
 user remove these fields via a link. This is my code which does not work.
 The wrapper container stills appear even the link is submitted:

 html xmlns:wicket
wicket:panel
div wicket:id=container
input type=text wicket:id=recipeIngredientQty style=width: 15%;
 float: left; margin-right: 10px;/
input type=text wicket:id=recipeIngredient style=width: 80%;
 margin-bottom: 7px;/
a wicket:id=removeLink[x]/a
/div
/wicket:panel
 /html

 public class IngredientPanel extends Panel {

/**
 * Creates a new {...@link IngredientPanel}.
 *
 * @param id the panel id; may not be codenull/code
 * @param model the panel model; may not be codenull/code
 */
public IngredientPanel(String id, IModelRecipeIngredient model) {
super(id, model);
RecipeIngredient recipeIngredient = model.getObject();

final WebMarkupContainer container = new
 WebMarkupContainer(container, model);
container.setOutputMarkupId(true);
container.add(new RequiredTextFieldString(recipeIngredientQty,
 new ModelString(recipeIngredient.getQuantity(;
container.add(new RequiredTextFieldString(recipeIngredient, new
 ModelString(recipeIngredient.getIngredient().getName(;
container.add(new AjaxLinkVoid(removeLink) {
@Override
public void onClick(AjaxRequestTarget target) {
remove(container);
}
});
add(container);
}
 }

 Kind regards,

 Hbiloo


-
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