Re: problem with Dropdown List
Hello, Add your DDC to form and use SubmitLink instead Link. HTH form wicket:id=form select wicket:id=docType / [click me] /form FormVoid form = new FormVoid(form); add(form); form.add(getDocTypeDropDown(docType)); form.add(executeLink(execute)); private SubmitLink executeLink(String id) { return new SubmitLink(id) { @Override public void onSubmit() { System.out.println(docType.getDokar()); } }; } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/problem-with-Dropdown-List-tp3013404p3014954.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
problem with Dropdown List
Hello, I have a problem with dropdown list. Even if I select values in the Dropdown list (see picture below), the member variable docType is always null . Unfortunately I have found no error. I hope you can see why this is. Best regards, Mehmet //## class DocSearchPage ## ... public class DocSearchPage extends MainTemplate { private TDokar docType; ... public DocSearchPage() { add(getDocTypeDropDown(docType)); ... add(executeLink(execute)); } private TDokarDocTypeDropDownChoice getDocTypeDropDown(String id) { return new TDokarDocTypeDropDownChoice(id) { @Override protected ListTDokar getTDokarList() { return getDocTypeList(); } @Override protected TDokar getTDokar() { return docType; } @Override protected void setTDokar(TDokar dokart) { dokar = docType; } }; } private Link executeLink(String id) { return new Link(id) { @Override public void onClick() { disItemList = session().getUser().getUserDao().searchDIS(docType.getDokar(), ..); //docType is null } }; } } // end DocSearchPage ## class TDokarDocTypeDropDownChoice # package de.t_systems.dks.eba.pages.docsearch; import de.t_systems.dks.eba.beans.basedata.TDokar; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.markup.html.form.IChoiceRenderer; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import java.util.List; public abstract class TDokarDocTypeDropDownChoice extends DropDownChoice { public TDokarDocTypeDropDownChoice(String id) { super(id); setModel(model()); setChoices(getTDokarList()); setChoiceRenderer(RENDERER); } private IModel model() { return new Model() { @Override public Object getObject() { return getTDokar(); } @Override public void setObject(Object object) { setTDokar((TDokar) object); } }; } private static final IChoiceRenderer RENDERER = new IChoiceRenderer() { @Override public Object getDisplayValue(final Object object) { TDokar dokar = (TDokar) object; return dokar.getDokar(); } @Override public String getIdValue(final Object object, final int index) { return ((TDokar) object).getDokar(); } }; protected abstract TDokar getTDokar(); protected abstract void setTDokar(TDokar tDokar); protected abstract ListTDokar getTDokarList(); } ## TDokarDocTypeDropDownChoice #'' - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: problem with Dropdown List
Hi Mehmet, I think you need change this line: @Override protected void setTDokar(TDokar dokart) { dokar = *docType*; -- DocSearchPage.this.*docType *=* *dokart; } anyway, why are you delegating the set/get model calls to TDokarDocTypeDropDownChoice ? Won't be interest only use the parameter model to maintain the TDokar? On Tue, Oct 26, 2010 at 7:55 AM, mehmet.kaplanki...@t-systems.com wrote: Hello, I have a problem with dropdown list. Even if I select values in the Dropdown list (see picture below), the member variable *docType* is always null . Unfortunately I have found no error. I hope you can see why this is. Best regards, Mehmet //## class DocSearchPage ## ... public class DocSearchPage extends MainTemplate { private TDokar *docType*; ... public DocSearchPage() { add(*getDocTypeDropDown*(docType)); ... add(executeLink(execute)); } private *TDokarDocTypeDropDownChoice* *getDocTypeDropDown*(String id) { return new TDokarDocTypeDropDownChoice(id) { @Override protected ListTDokar getTDokarList() { return getDocTypeList(); } @Override protected TDokar getTDokar() { return *docType*; } @Override protected void setTDokar(TDokar dokart) { dokar = *docType*; } }; } private Link executeLink(String id) { return new Link(id) { @Override public void onClick() { disItemList = session().getUser().getUserDao().searchDIS(*docType*.getDokar(), ..);*//docType** **is null* } }; } } // end DocSearchPage ## class TDokarDocTypeDropDownChoice # package de.t_systems.dks.eba.pages.docsearch; import de.t_systems.dks.eba.beans.basedata.TDokar; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.markup.html.form.IChoiceRenderer; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import java.util.List; public abstract class TDokarDocTypeDropDownChoice extends DropDownChoice { public TDokarDocTypeDropDownChoice(String id) { super(id); setModel(model()); setChoices(getTDokarList()); setChoiceRenderer(RENDERER); } private IModel model() { return new Model() { @Override public Object getObject() { return getTDokar(); } @Override public void setObject(Object object) { setTDokar((TDokar) object); } }; } private static final IChoiceRenderer RENDERER = new IChoiceRenderer() { @Override public Object getDisplayValue(final Object object) { TDokar dokar = (TDokar) object; return dokar.getDokar(); } @Override public String getIdValue(final Object object, final int index) { return ((TDokar) object).getDokar(); } }; protected abstract TDokar getTDokar(); protected abstract void setTDokar(TDokar tDokar); protected abstract ListTDokar getTDokarList(); } ## TDokarDocTypeDropDownChoice #'' - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos
AW: problem with Dropdown List
sorry, in my Email is the folow method incorrect: @Override protected void setTDokar(TDokar dokart) { dokar = docType; } in source cod is in code looks like this: @Override protected void setTDokar(TDokar dokart) { docType = dokart; } docType is still null. -Ursprüngliche Nachricht- Von: Pedro Santos [mailto:pedros...@gmail.com] Gesendet: Dienstag, 26. Oktober 2010 12:37 An: users@wicket.apache.org Betreff: Re: problem with Dropdown List Hi Mehmet, I think you need change this line: @Override protected void setTDokar(TDokar dokart) { dokar = *docType*; -- DocSearchPage.this.*docType *=* *dokart; } anyway, why are you delegating the set/get model calls to TDokarDocTypeDropDownChoice ? Won't be interest only use the parameter model to maintain the TDokar? On Tue, Oct 26, 2010 at 7:55 AM, mehmet.kaplanki...@t-systems.com wrote: Hello, I have a problem with dropdown list. Even if I select values in the Dropdown list (see picture below), the member variable *docType* is always null . Unfortunately I have found no error. I hope you can see why this is. Best regards, Mehmet //## class DocSearchPage ## ... public class DocSearchPage extends MainTemplate { private TDokar *docType*; ... public DocSearchPage() { add(*getDocTypeDropDown*(docType)); ... add(executeLink(execute)); } private *TDokarDocTypeDropDownChoice* *getDocTypeDropDown*(String id) { return new TDokarDocTypeDropDownChoice(id) { @Override protected ListTDokar getTDokarList() { return getDocTypeList(); } @Override protected TDokar getTDokar() { return *docType*; } @Override protected void setTDokar(TDokar dokart) { dokar = *docType*; } }; } private Link executeLink(String id) { return new Link(id) { @Override public void onClick() { disItemList = session().getUser().getUserDao().searchDIS(*docType*.getDokar(), ..);*//docType** **is null* } }; } } // end DocSearchPage ## class TDokarDocTypeDropDownChoice # package de.t_systems.dks.eba.pages.docsearch; import de.t_systems.dks.eba.beans.basedata.TDokar; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.markup.html.form.IChoiceRenderer; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import java.util.List; public abstract class TDokarDocTypeDropDownChoice extends DropDownChoice { public TDokarDocTypeDropDownChoice(String id) { super(id); setModel(model()); setChoices(getTDokarList()); setChoiceRenderer(RENDERER); } private IModel model() { return new Model() { @Override public Object getObject() { return getTDokar(); } @Override public void setObject(Object object) { setTDokar((TDokar) object); } }; } private static final IChoiceRenderer RENDERER = new IChoiceRenderer() { @Override public Object getDisplayValue(final Object object) { TDokar dokar = (TDokar) object; return dokar.getDokar(); } @Override public String getIdValue(final Object object, final int index) { return ((TDokar) object).getDokar
Re: problem with Dropdown List
If you are not submitting an form to send the selected TDokar from browser to server, you can add an AjaxFormChoiceComponentUpdatingBehavior at TDokarDocTypeDropDownChoice. Than when the user click the executeLink, the selected TDokar will be at the DocSearchPage field. On Tue, Oct 26, 2010 at 8:58 AM, mehmet.kaplanki...@t-systems.com wrote: sorry, in my Email is the folow method incorrect: @Override protected void setTDokar(TDokar dokart) { dokar = docType; } in source cod is in code looks like this: @Override protected void setTDokar(TDokar dokart) { docType = dokart; } docType is still null. -Ursprüngliche Nachricht- Von: Pedro Santos [mailto:pedros...@gmail.com] Gesendet: Dienstag, 26. Oktober 2010 12:37 An: users@wicket.apache.org Betreff: Re: problem with Dropdown List Hi Mehmet, I think you need change this line: @Override protected void setTDokar(TDokar dokart) { dokar = *docType*; -- DocSearchPage.this.*docType *=* *dokart; } anyway, why are you delegating the set/get model calls to TDokarDocTypeDropDownChoice ? Won't be interest only use the parameter model to maintain the TDokar? On Tue, Oct 26, 2010 at 7:55 AM, mehmet.kaplanki...@t-systems.com wrote: Hello, I have a problem with dropdown list. Even if I select values in the Dropdown list (see picture below), the member variable *docType* is always null . Unfortunately I have found no error. I hope you can see why this is. Best regards, Mehmet //## class DocSearchPage ## ... public class DocSearchPage extends MainTemplate { private TDokar *docType*; ... public DocSearchPage() { add(*getDocTypeDropDown*(docType)); ... add(executeLink(execute)); } private *TDokarDocTypeDropDownChoice* *getDocTypeDropDown*(String id) { return new TDokarDocTypeDropDownChoice(id) { @Override protected ListTDokar getTDokarList() { return getDocTypeList(); } @Override protected TDokar getTDokar() { return *docType*; } @Override protected void setTDokar(TDokar dokart) { dokar = *docType*; } }; } private Link executeLink(String id) { return new Link(id) { @Override public void onClick() { disItemList = session().getUser().getUserDao().searchDIS(*docType*.getDokar(), ..);*//docType** **is null* } }; } } // end DocSearchPage ## class TDokarDocTypeDropDownChoice # package de.t_systems.dks.eba.pages.docsearch; import de.t_systems.dks.eba.beans.basedata.TDokar; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.markup.html.form.IChoiceRenderer; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import java.util.List; public abstract class TDokarDocTypeDropDownChoice extends DropDownChoice { public TDokarDocTypeDropDownChoice(String id) { super(id); setModel(model()); setChoices(getTDokarList()); setChoiceRenderer(RENDERER); } private IModel model() { return new Model() { @Override public Object getObject() { return getTDokar(); } @Override public void setObject(Object object) { setTDokar((TDokar) object); } }; } private static final IChoiceRenderer RENDERER = new IChoiceRenderer