All client to server communication of ComboBox is now done with RPC. There is still an empty changeVariables() methods to override the default behavior in AbstractSelect. Change-Id: Ic11ea48cac1846272609f6e4107bb0006d18494cfeature/eventbus
@@ -395,8 +395,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements | |||
*/ | |||
public void requestFirstPage() { | |||
sendSelection(null); | |||
getConnection().updateVariable(getConnectorId(), "filter", "", false); | |||
getConnection().updateVariable(getConnectorId(), "page", 0, true); | |||
requestPage("", 0); | |||
} | |||
/** | |||
@@ -413,10 +412,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements | |||
* the page number to get | |||
*/ | |||
public void requestPage(String filter, int page) { | |||
getConnection().updateVariable(getConnectorId(), "filter", filter, | |||
false); | |||
getConnection().updateVariable(getConnectorId(), "page", page, | |||
immediate); | |||
rpc.requestPage(filter, page); | |||
} | |||
/** |
@@ -103,6 +103,19 @@ public class ComboBox extends AbstractSelect implements | |||
} | |||
} | |||
} | |||
@Override | |||
public void requestPage(String filter, int page) { | |||
filterstring = filter; | |||
if (filterstring != null) { | |||
filterstring = filterstring.toLowerCase(getLocale()); | |||
} | |||
currentPage = page; | |||
// TODO this should trigger a data-only update instead of a full | |||
// repaint | |||
requestRepaint(); | |||
} | |||
}; | |||
FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl(this) { | |||
@@ -732,16 +745,7 @@ public class ComboBox extends AbstractSelect implements | |||
// Not calling super.changeVariables due the history of select | |||
// component hierarchy | |||
String newFilter; | |||
if ((newFilter = (String) variables.get("filter")) != null) { | |||
// this is a filter request | |||
currentPage = ((Integer) variables.get("page")).intValue(); | |||
filterstring = newFilter; | |||
if (filterstring != null) { | |||
filterstring = filterstring.toLowerCase(getLocale()); | |||
} | |||
requestRepaint(); | |||
} | |||
// all the client to server requests are now handled by RPC | |||
} | |||
@Override |
@@ -39,4 +39,15 @@ public interface ComboBoxServerRpc extends ServerRpc { | |||
* the id of a single item or null to deselect the current value | |||
*/ | |||
public void setSelectedItem(String item); | |||
/** | |||
* Request the server to send a page of the item list. | |||
* | |||
* @param filter | |||
* filter string interpreted according to the current filtering | |||
* mode | |||
* @param page | |||
* zero based page number | |||
*/ | |||
public void requestPage(String filter, int page); | |||
} |