use of com.google.gwtexpui.globalkey.client.NpTextBox in project gerrit by GerritCodeReview.
the class CreateGroupScreen method addCreateGroupPanel.
private void addCreateGroupPanel() {
VerticalPanel addPanel = new VerticalPanel();
addPanel.setStyleName(Gerrit.RESOURCES.css().addSshKeyPanel());
addPanel.add(new SmallHeading(AdminConstants.I.headingCreateGroup()));
addTxt = new NpTextBox() {
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
if (event.getTypeInt() == Event.ONPASTE) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
if (addTxt.getValue().trim().length() != 0) {
addNew.setEnabled(true);
}
}
});
}
}
};
addTxt.sinkEvents(Event.ONPASTE);
addTxt.setVisibleLength(60);
addTxt.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent event) {
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
doCreateGroup();
}
}
});
addPanel.add(addTxt);
addNew = new Button(AdminConstants.I.buttonCreateGroup());
addNew.setEnabled(false);
addNew.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
doCreateGroup();
}
});
addPanel.add(addNew);
add(addPanel);
new OnEditEnabler(addNew, addTxt);
}
use of com.google.gwtexpui.globalkey.client.NpTextBox in project gerrit by GerritCodeReview.
the class CreateProjectScreen method initCreateTxt.
private void initCreateTxt() {
project = new NpTextBox() {
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
if (event.getTypeInt() == Event.ONPASTE) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
if (project.getValue().trim().length() != 0) {
create.setEnabled(true);
}
}
});
}
}
};
project.sinkEvents(Event.ONPASTE);
project.setVisibleLength(50);
project.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent event) {
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
doCreateProject();
}
}
});
new OnEditEnabler(create, project);
}
use of com.google.gwtexpui.globalkey.client.NpTextBox in project gerrit by GerritCodeReview.
the class ContactPanelShort method onInitUI.
protected void onInitUI() {
if (LocaleInfo.getCurrentLocale().isRTL()) {
labelIdx = 1;
fieldIdx = 0;
} else {
labelIdx = 0;
fieldIdx = 1;
}
nameTxt = new NpTextBox();
nameTxt.setVisibleLength(60);
nameTxt.setReadOnly(!canEditFullName());
emailPick = new ListBox();
final Grid infoPlainText = new Grid(2, 2);
infoPlainText.setStyleName(Gerrit.RESOURCES.css().infoBlock());
infoPlainText.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());
body.add(infoPlainText);
registerNewEmail = new Button(Util.C.buttonOpenRegisterNewEmail());
registerNewEmail.setEnabled(false);
registerNewEmail.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
doRegisterNewEmail();
}
});
final FlowPanel emailLine = new FlowPanel();
emailLine.add(emailPick);
if (canRegisterNewEmail()) {
emailLine.add(registerNewEmail);
}
int row = 0;
if (!Gerrit.info().auth().canEdit(AccountFieldName.USER_NAME) && Gerrit.info().auth().siteHasUsernames()) {
infoPlainText.resizeRows(infoPlainText.getRowCount() + 1);
row(infoPlainText, row++, Util.C.userName(), new UsernameField());
}
if (!canEditFullName()) {
FlowPanel nameLine = new FlowPanel();
nameLine.add(nameTxt);
if (Gerrit.info().auth().editFullNameUrl() != null) {
Button edit = new Button(Util.C.linkEditFullName());
edit.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Window.open(Gerrit.info().auth().editFullNameUrl(), "_blank", null);
}
});
nameLine.add(edit);
}
Button reload = new Button(Util.C.linkReloadContact());
reload.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Window.Location.replace(Gerrit.loginRedirect(PageLinks.SETTINGS_CONTACT));
}
});
nameLine.add(reload);
row(infoPlainText, row++, Util.C.contactFieldFullName(), nameLine);
} else {
row(infoPlainText, row++, Util.C.contactFieldFullName(), nameTxt);
}
row(infoPlainText, row++, Util.C.contactFieldEmail(), emailLine);
infoPlainText.getCellFormatter().addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
infoPlainText.getCellFormatter().addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
infoPlainText.getCellFormatter().addStyleName(row - 1, 0, Gerrit.RESOURCES.css().bottomheader());
save = new Button(Util.C.buttonSaveChanges());
save.setEnabled(false);
save.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
doSave();
}
});
emailPick.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(final ChangeEvent event) {
final int idx = emailPick.getSelectedIndex();
final String v = 0 <= idx ? emailPick.getValue(idx) : null;
if (Util.C.buttonOpenRegisterNewEmail().equals(v)) {
for (int i = 0; i < emailPick.getItemCount(); i++) {
if (currentEmail.equals(emailPick.getValue(i))) {
emailPick.setSelectedIndex(i);
break;
}
}
doRegisterNewEmail();
} else {
save.setEnabled(true);
}
}
});
onEditEnabler = new OnEditEnabler(save, nameTxt);
}
use of com.google.gwtexpui.globalkey.client.NpTextBox in project gerrit by GerritCodeReview.
the class ProjectBranchesScreen method initPageHeader.
private void initPageHeader() {
parseToken();
HorizontalPanel hp = new HorizontalPanel();
hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
Label filterLabel = new Label(AdminConstants.I.projectFilter());
filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
hp.add(filterLabel);
filterTxt = new NpTextBox();
filterTxt.setValue(match);
filterTxt.addKeyUpHandler(new KeyUpHandler() {
@Override
public void onKeyUp(KeyUpEvent event) {
Query q = new Query(filterTxt.getValue());
if (match.equals(q.qMatch)) {
q.start(start);
} else {
if (query == null) {
q.run();
}
query = q;
}
}
});
hp.add(filterTxt);
add(hp);
}
use of com.google.gwtexpui.globalkey.client.NpTextBox in project gerrit by GerritCodeReview.
the class ProjectListScreen method initPageHeader.
private void initPageHeader() {
final HorizontalPanel hp = new HorizontalPanel();
hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
final Label filterLabel = new Label(AdminConstants.I.projectFilter());
filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
hp.add(filterLabel);
filterTxt = new NpTextBox();
filterTxt.setValue(match);
filterTxt.addKeyUpHandler(new KeyUpHandler() {
@Override
public void onKeyUp(KeyUpEvent event) {
Query q = new Query(filterTxt.getValue()).open(event.getNativeKeyCode() == KeyCodes.KEY_ENTER);
if (match.equals(q.qMatch)) {
q.start(start);
}
if (q.open || !match.equals(q.qMatch)) {
if (query == null) {
q.run();
}
query = q;
}
}
});
hp.add(filterTxt);
add(hp);
}
Aggregations