/**
* Adds a parameter to the current request uri tree and in consequence to the request parameter tree.
*/
public void addParam() {
TextBox requestUriTextBox = ReferenceManager.getRequestUriTextBox(requestString);
Uri uri = new Uri(requestUriTextBox.getText());
final HorizontalPanel containerPanel = new HorizontalPanel();
final TreeItem parameterItem = new TreeItem(containerPanel);
// parameter name textbox
final TextBox queryParamNameTextBox = new TextBox();
queryParamNameTextBox.setWidth("10em");
// parameter value textbox
final TextBox queryValueTextBox = new TextBox();
queryValueTextBox.setWidth("10em");
final String currentParameter = GuiFactory.strings.paramName();
final String currentValue = GuiFactory.strings.paramValue();
String newUri = uri.getScheme() + "://" + uri.getAuthority() + uri.getPath() + "?";
String[] queryParameters = uri.getQueryParameters();
String[] queryValues = uri.getQueryValues();
for (int i = 0; i < queryParameters.length; i++) {
if (i > 0) {
newUri += "&";
}
newUri += queryParameters[i] + "=" + queryValues[i];
}
newUri += "&" + currentParameter + "=" + currentValue + uri.getFragment();
updateReferences(requestUriTextBox, newUri);
queryParamNameTextBox.addKeyboardListener(new KeyboardListener() {
public void onKeyDown(Widget sender, char keyCode, int modifiers) {
// empty
}