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 List<TDokar> 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 List<TDokar> getTDokarList();
}
############################## TDokarDocTypeDropDownChoice
#############''''''''''''''''''
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]