use of com.google.gwt.event.dom.client.ClickHandler 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.gwt.event.dom.client.ClickHandler in project gerrit by GerritCodeReview.
the class AccountGroupInfoScreen method initGroupOptions.
private void initGroupOptions() {
final VerticalPanel groupOptionsPanel = new VerticalPanel();
final VerticalPanel vp = new VerticalPanel();
vp.setStyleName(Gerrit.RESOURCES.css().groupOptionsPanel());
vp.add(new SmallHeading(AdminConstants.I.headingGroupOptions()));
visibleToAllCheckBox = new CheckBox(AdminConstants.I.isVisibleToAll());
vp.add(visibleToAllCheckBox);
groupOptionsPanel.add(vp);
saveGroupOptions = new Button(AdminConstants.I.buttonSaveGroupOptions());
saveGroupOptions.setEnabled(false);
saveGroupOptions.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
GroupApi.setGroupOptions(getGroupUUID(), visibleToAllCheckBox.getValue(), new GerritCallback<VoidResult>() {
@Override
public void onSuccess(final VoidResult result) {
saveGroupOptions.setEnabled(false);
}
});
}
});
groupOptionsPanel.add(saveGroupOptions);
add(groupOptionsPanel);
final OnEditEnabler enabler = new OnEditEnabler(saveGroupOptions);
enabler.listenTo(visibleToAllCheckBox);
}
use of com.google.gwt.event.dom.client.ClickHandler in project rstudio by rstudio.
the class PathBreadcrumbWidget method addAnchor.
private Widget addAnchor(final FileSystemItem item, boolean browseable) {
boolean isHome = context_.isRoot(item);
String text = isHome ? "Home" : item.getName();
Widget link = null;
if (browseable || isHome) {
Anchor anchor = new Anchor(text, false);
anchor.addStyleName(ThemeResources.INSTANCE.themeStyles().handCursor());
anchor.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
SelectionCommitEvent.fire(PathBreadcrumbWidget.this, item);
}
});
link = anchor;
} else {
link = new InlineLabel(text);
}
link.setTitle(item.getPath());
if (isHome)
link.addStyleName(RES.styles().home());
pathPanel_.add(link);
return link;
}
use of com.google.gwt.event.dom.client.ClickHandler in project rstudio by rstudio.
the class PathBreadcrumbWidget method maybeAddProjectIcon.
private void maybeAddProjectIcon() {
if (projectIconsAdded_)
return;
if (pSession_ == null || pSession_.get() == null)
return;
final FileSystemItem projDir = pSession_.get().getSessionInfo().getActiveProjectDir();
if (projDir != null) {
Image projIcon = new Image(new ImageResource2x(RES.projectImage2x()));
projIcon.addStyleName(ThemeResources.INSTANCE.themeStyles().handCursor());
projIcon.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
SelectionCommitEvent.fire(PathBreadcrumbWidget.this, projDir);
}
});
projIcon.addStyleName(RES.styles().project());
projIcon.setTitle("Go to project directory");
eastFrame_.insert(projIcon, 0);
// TODO: infer from contents
double width = 42;
frame_.setWidgetSize(eastFrame_, width);
projectIconsAdded_ = true;
}
}
use of com.google.gwt.event.dom.client.ClickHandler in project rstudio by rstudio.
the class MinimizedModuleTabLayoutPanel method setTabs.
public void setTabs(String[] tabNames) {
HorizontalPanel horiz = (HorizontalPanel) getExtraWidget();
horiz.clear();
ThemeStyles styles = ThemeResources.INSTANCE.themeStyles();
for (int i = 0; i < tabNames.length; i++) {
String tabName = tabNames[i];
if (tabName == null)
continue;
ModuleTabLayoutPanel.ModuleTab tab = new ModuleTabLayoutPanel.ModuleTab(tabName, styles, false);
tab.addStyleName("gwt-TabLayoutPanelTab");
final Integer thisIndex = i;
tab.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
event.preventDefault();
SelectionEvent.fire(MinimizedModuleTabLayoutPanel.this, thisIndex);
}
});
horiz.add(tab);
}
}
Aggregations