Merge changes I92ab1795,I3d2533c0

* changes:
  ChangeScreen: Preselect text in input box when editing topic
  ChangeScreen: Hide assignee link on edit
This commit is contained in:
David Pursehouse
2016-10-01 04:39:20 +00:00
committed by Gerrit Code Review
4 changed files with 21 additions and 10 deletions

View File

@@ -14,6 +14,7 @@
package com.google.gerrit.client.change;
import com.google.gerrit.client.FormatUtil;
import com.google.gerrit.client.NotSignedInDialog;
import com.google.gerrit.client.changes.ChangeApi;
import com.google.gerrit.client.changes.Util;
@@ -50,20 +51,18 @@ public class Assignee extends Composite {
private static final Binder uiBinder = GWT.create(Binder.class);
@UiField
InlineHyperlink assigneeLink;
@UiField
Image editAssigneeIcon;
@UiField
Element form;
@UiField
Element error;
@UiField Element show;
@UiField InlineHyperlink assigneeLink;
@UiField Image editAssigneeIcon;
@UiField Element form;
@UiField Element error;
@UiField(provided = true)
RemoteSuggestBox suggestBox;
private AssigneeSuggestOracle assigneeSuggestOracle;
private Change.Id changeId;
private boolean canEdit;
private AccountInfo currentAssignee;
Assignee() {
assigneeSuggestOracle = new AssigneeSuggestOracle();
@@ -98,18 +97,24 @@ public class Assignee extends Composite {
setAssignee(info.assignee());
assigneeSuggestOracle.setChange(changeId);
editAssigneeIcon.setVisible(canEdit);
if (!canEdit) {
show.setTitle(null);
}
}
void onOpenForm() {
UIObject.setVisible(form, true);
UIObject.setVisible(show, false);
UIObject.setVisible(error, false);
editAssigneeIcon.setVisible(false);
suggestBox.setFocus(true);
suggestBox.setText("");
suggestBox.setText(FormatUtil.nameEmail(currentAssignee));
suggestBox.selectAll();
}
void onCloseForm() {
UIObject.setVisible(form, false);
UIObject.setVisible(show, true);
UIObject.setVisible(error, false);
editAssigneeIcon.setVisible(true);
suggestBox.setFocus(false);
@@ -174,6 +179,7 @@ public class Assignee extends Composite {
}
private void setAssignee(AccountInfo assignee) {
currentAssignee = assignee;
assigneeLink.setText(assignee != null ? assignee.name() : null);
assigneeLink.setTargetHistoryToken(assignee != null
? PageLinks.toAssigneeQuery(assignee.name() != null

View File

@@ -38,7 +38,7 @@ limitations under the License.
}
</ui:style>
<g:HTMLPanel>
<div>
<div ui:field='show'>
<u:InlineHyperlink ui:field='assigneeLink'
title='Search for changes assigned to this user'/>
<g:Image ui:field='editAssigneeIcon'

View File

@@ -100,6 +100,7 @@ class Topic extends Composite {
input.setText(text.getText());
input.setFocus(true);
input.selectAll();
}
}

View File

@@ -134,4 +134,8 @@ public class RemoteSuggestBox extends Composite implements Focusable, HasText,
public HandlerRegistration addCloseHandler(CloseHandler<RemoteSuggestBox> h) {
return addHandler(h, CloseEvent.getType());
}
public void selectAll() {
suggestBox.getValueBox().selectAll();
}
}