Details
Description
I have development a page,
this page struct:
SettingsPage
---> Table | |
---> Form | |
----> Select | |
---> Option (Only one option from DataProvider) | |
----> TextField | |
---> Submit ( my logic call onConfigFromSubmit) |
when I select option, and input some content to TextField, and click Submit,
the method onConfigFromSubmit invoke, and I check Form isValid() , the select return false.
My Code fragment:
package com.vhly.servers.innerstore.pages;
import com.vhly.servers.innerstore.InnerConfigUtil;
import com.vhly.servers.innerstore.model.ConfigValuePair;
import org.apache.click.Page;
import org.apache.click.control.*;
import org.apache.click.dataprovider.DataProvider;
import org.apache.click.extras.control.FieldColumn;
import org.apache.click.util.Bindable;
import java.util.LinkedList;
import java.util.List;
/**
- Created by IntelliJ IDEA.
- User: vhly[FR]
- Date: 13-8-13
- Email: vhly@163.com
*/
public class SettingsPage extends Page {
private Form configForm = new Form("configEditor");
private Table table = new Table("configs");
public SettingsPage() {
table.setClass(Table.CLASS_ITS);
table.addColumn(new Column("name"));
table.addColumn(new Column("value"));
table.setDataProvider(new DataProvider() {
@Override
public Iterable getData()
});
addControl(table);
addControl(configForm);
Select select = new Select("property", true);
select.setDataProvider(new DataProvider() {
@Override
public Iterable getData() {
InnerConfigUtil configUtil = InnerConfigUtil.getInstance();
List<ConfigValuePair> allProperties = configUtil.getAllProperties();
List<Option> options = new LinkedList<Option>();
for (ConfigValuePair valuePair : allProperties)
return options;
}
});
configForm.add(select);
configForm.add(new TextField("value", true));
configForm.add(new Submit("OK"));
configForm.setListener(this, "onConfigFromSubmit");
}
public boolean onConfigFromSubmit() {
boolean bret = false;
if (configForm.isValid())
return bret;
}
}