Stuck: Can't get Checkboxes in DataTable to update model

2010-10-19 Thread leech

Summary: I have a DefaultDataTable that is embedded in a form.  In the table
is a checkbox column that I setup using a panel inside the cell.  That
works.

When run, the table displays fine. The model get method is accessed.  When I
click on some of the checkboxes and click the submit button,
The model is not updated.  The set method on the model is not accessed.
Here is my code.

Can someone please help me find the problem.


public class PanelCfgListComp extends SysAdminBasePanel implements
Serializable {

private DefaultDataTablePanelCfg dataTable;
private ListIColumnPanelCfg columns;
private ListPanelCfg modelList = new ArrayList();
private ISortableDataProviderPanelCfg dataProvider;

public PanelCfgListComp(String id) {
super(id);

dataProvider = new SortableDataProviderPanelCfg() {

@Override
public Iterator? extends PanelCfg iterator(int first, int
count) {
Iterator itr =
getGuiService().getPanelConfigServ().extractSubRange(Status.active, first,
count);
itr =
getGuiService().getPanelConfigServ().extractSubRange(Status.active, first,
count);
return itr;

}

@Override
public int size() {
return
getGuiService().getPanelConfigServ().getMatches(Status.active);
}

@Override
public IModelPanelCfg model(PanelCfg object) {
return new ModelPanelCfg(object);
}
};

columns = new ArrayListIColumnPanelCfg();



columns.add(new AbstractColumn(new ModelString(Selected) ) {


@Override
public void populateItem(Item cellItem, String componentId,
IModel rowModel) {
 CheckBoxPanel selectedPanel = new
CheckBoxPanel(componentId, rowModel);
cellItem.add(selectedPanel);
}

});

columns.add(new PropertyColumn(new ModelString(
Id), id));

columns.add(
new PropertyColumn(new ModelString(
Class Name), canonicalClassName));
columns.add(
new PropertyColumn(new ModelString(
Short Name), shortName));

dataTable = new DefaultDataTablePanelCfg(dataTable,
getColumns(), getDataProvider(), 10);
dataTable.setItemReuseStrategy(new ReuseIfModelsEqualStrategy() );


add(dataTable);
}

/**
 * @return the dataTable
 */
public DefaultDataTablePanelCfg getDataTable() {
return dataTable;
}

/**
 * @param dataTable the dataTable to set
 */
public void setDataTable(DefaultDataTablePanelCfg dataTable) {
this.setDataTable(dataTable);
}

/**
 * @return the columns
 */
public ListIColumnPanelCfg getColumns() {
return columns;
}

/**
 * @param columns the columns to set
 */
public void setColumns(ListIColumnPanelCfg columns) {
this.setColumns(columns);
}

/**
 * @return the dataProvider
 */
public ISortableDataProviderPanelCfg getDataProvider() {
return dataProvider;
}

/**
 * @param dataProvider the dataProvider to set
 */
public void setDataProvider(ISortableDataProviderPanelCfg
dataProvider) {
this.setDataProvider(dataProvider);
}

/**
 * @return the modelList
 */
public ListPanelCfg getModelList() {
return modelList;
}

/**
 * @param modelList the modelList to set
 */
public void setModelList(ListPanelCfg modelList) {
this.modelList = modelList;
}
}

public class CheckBoxPanel extends Panel  {


public CheckBoxPanel(String id, final IModelPanelCfg model) {
super(id, model);


final PanelCfg panelCfg = model.getObject();

add(new CheckBox(isSelected,  new Model() {

@Override
public Boolean getObject() {
System.out.println(Im reading the object in checkbox Model);
System.out.println(in class =  +
panelCfg.getCanonicalClassName() );
return panelCfg.isSelected();
}

@Override 
public void setObject(Object choice) {
System.out.println(Im setting the object in checkBox model);
System.out.println(in class =  +
panelCfg.getCanonicalClassName() );
panelCfg.setSelected((Boolean) choice);
}
}));



public class ListPanelCfgCp extends SysAdminBasePanel {

public ListPanelCfgCp() {
super();
}

public ListPanelCfgCp(String id) {
super(id);

final FeedbackPanel feedback = new FeedbackPanel(feedback);
//add(feedback);
InputForm inputForm = new InputForm(inputForm, feedback);
add(inputForm);
}

/** form for processing the input. */
private class InputForm extends Form {

private PanelCfgListComp panelCfgListComp;

public InputForm(String 

Re: Stuck: Can't get Checkboxes in DataTable to update model

2010-10-19 Thread leech

You Be The Man James!

Thankyou. That did it.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Stuck-Can-t-get-Checkboxes-in-DataTable-to-update-model-tp3002773p3002826.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



Need help with Nested DataTable in Form - finding values in submit method

2010-10-18 Thread leech

I think I posted this message to the wrong forum. So I'm correcting my
mistake.

I'm just getting started with Wicket.  I've looked at every example I can
find related to checkboxes in forms but none of them answer my question. 
The wicket examples have nothing in the submit button code to describe how
to do this.


I have a form.  Inside the form is a nested datatable.  In the datatable is
a column that has a check box
in it.  I accomplished this by putting a panel in the cell and then a
checkbox within the panel.  This is working fine. It runs, and the
checkboxes are displayed properly.

The problems start when I try to figure out what checkboxes were selected.

When the submit button on the form is clicked, I want to know what
checkboxes were selected.
I want to do this within the submit button because there will be other
buttons that do other tasks.

How do I find the values I'm looking for?

Lee

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Need-help-with-Nested-DataTable-in-Form-finding-values-in-submit-method-tp3000718p3000718.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