*/
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
}
public void onKeyPress(Widget sender, char keyCode, int modifiers) {
// empty
}
public void onKeyUp(Widget sender, char keyCode, int modifiers) {
updateParameterName(queryParamNameTextBox.getText(), queryValueTextBox.getText());
}
});
queryParamNameTextBox.addChangeListener(new ChangeListener() {
public void onChange(Widget sender) {
updateParameterName(queryParamNameTextBox.getText(), queryValueTextBox.getText());
}
});
queryParamNameTextBox.setText(GuiFactory.strings.paramName());
containerPanel.add(queryParamNameTextBox);
queryParamNameTextBox.setSelectionRange(0, queryParamNameTextBox.getText().length());
HTML parameterName = new HTML("<nobr/> = </nobr>");
containerPanel.add(parameterName);
queryValueTextBox.addKeyboardListener(new KeyboardListener() {
public void onKeyDown(Widget sender, char keyCode, int modifiers) {
// empty
}
public void onKeyPress(Widget sender, char keyCode, int modifiers) {
// empty
}
public void onKeyUp(Widget sender, char keyCode, int modifiers) {
updateParameterValue(queryParamNameTextBox.getText(), queryValueTextBox.getText());
}
});
queryValueTextBox.addChangeListener(new ChangeListener() {
public void onChange(Widget sender) {
updateParameterValue(queryParamNameTextBox.getText(), queryValueTextBox.getText());
}
});
queryValueTextBox.setText(GuiFactory.strings.paramValue());
containerPanel.add(queryValueTextBox);
Hyperlink removeParameterLink = new Hyperlink(GuiFactory.strings.remove(), true, "");
removeParameterLink.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
removeHyperlink(parameterItem, queryValueTextBox.getText());
}
});
containerPanel.add(removeParameterLink);
requestItem.addItem(parameterItem);
parameterItem.setState(true);
}