use of com.google.gwt.user.client.ui.FlowPanel in project gerrit by GerritCodeReview.
the class AccountGroupMembersScreen method initMemberList.
private void initMemberList() {
addMemberBox = new AddMemberBox(AdminConstants.I.buttonAddGroupMember(), AdminConstants.I.defaultAccountName(), new AccountSuggestOracle());
addMemberBox.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
doAddNewMember();
}
});
members = new MemberTable();
members.addStyleName(Gerrit.RESOURCES.css().groupMembersTable());
delMember = new Button(AdminConstants.I.buttonDeleteGroupMembers());
delMember.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
members.deleteChecked();
}
});
memberPanel = new FlowPanel();
memberPanel.add(new SmallHeading(AdminConstants.I.headingMembers()));
memberPanel.add(addMemberBox);
memberPanel.add(members);
memberPanel.add(delMember);
add(memberPanel);
}
use of com.google.gwt.user.client.ui.FlowPanel in project gerrit by GerritCodeReview.
the class MyOAuthTokenScreen method onInitUI.
@Override
protected void onInitUI() {
super.onInitUI();
tokenLabel = new CopyableLabel("");
tokenLabel.addStyleName(Gerrit.RESOURCES.css().oauthToken());
expiresLabel = new Label("");
expiresLabel.addStyleName(Gerrit.RESOURCES.css().oauthExpires());
grid = new Grid(2, 2);
grid.setStyleName(Gerrit.RESOURCES.css().infoBlock());
grid.addStyleName(Gerrit.RESOURCES.css().oauthInfoBlock());
add(grid);
expiredNote = new Label(Util.C.labelOAuthExpired());
expiredNote.setVisible(false);
add(expiredNote);
row(grid, 0, Util.C.labelOAuthToken(), tokenLabel);
row(grid, 1, Util.C.labelOAuthExpires(), expiresLabel);
CellFormatter fmt = grid.getCellFormatter();
fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().bottomheader());
flow = new FlowPanel();
flow.setStyleName(Gerrit.RESOURCES.css().oauthPanel());
add(flow);
Label netrcLabel = new Label(Util.C.labelOAuthNetRCEntry());
netrcLabel.setStyleName(Gerrit.RESOURCES.css().oauthPanelNetRCHeading());
flow.add(netrcLabel);
netrcValue = new CopyableLabel("");
netrcValue.setStyleName(Gerrit.RESOURCES.css().oauthPanelNetRCEntry());
flow.add(netrcValue);
Label cookieLabel = new Label(Util.C.labelOAuthGitCookie());
cookieLabel.setStyleName(Gerrit.RESOURCES.css().oauthPanelCookieHeading());
flow.add(cookieLabel);
cookieValue = new CopyableLabel("");
cookieValue.setStyleName(Gerrit.RESOURCES.css().oauthPanelCookieEntry());
flow.add(cookieValue);
}
use of com.google.gwt.user.client.ui.FlowPanel in project gerrit by GerritCodeReview.
the class MyPasswordScreen method onInitUI.
@Override
protected void onInitUI() {
super.onInitUI();
String url = Gerrit.info().auth().httpPasswordUrl();
if (url != null) {
Anchor link = new Anchor();
link.setText(Util.C.linkObtainPassword());
link.setHref(url);
link.setTarget("_blank");
add(link);
return;
}
password = new CopyableLabel("(click 'generate' to revoke an old password)");
password.addStyleName(Gerrit.RESOURCES.css().accountPassword());
generatePassword = new Button(Util.C.buttonGeneratePassword());
generatePassword.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
doGeneratePassword();
}
});
final Grid userInfo = new Grid(2, 2);
final CellFormatter fmt = userInfo.getCellFormatter();
userInfo.setStyleName(Gerrit.RESOURCES.css().infoBlock());
userInfo.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());
add(userInfo);
row(userInfo, 0, Util.C.userName(), new UsernameField());
row(userInfo, 1, Util.C.password(), password);
fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().bottomheader());
final FlowPanel buttons = new FlowPanel();
buttons.add(generatePassword);
add(buttons);
}
use of com.google.gwt.user.client.ui.FlowPanel in project gerrit by GerritCodeReview.
the class MyPreferencesScreen method onInitUI.
@Override
protected void onInitUI() {
super.onInitUI();
showSiteHeader = new CheckBox(Util.C.showSiteHeader());
useFlashClipboard = new CheckBox(Util.C.useFlashClipboard());
maximumPageSize = new ListBox();
for (final int v : PAGESIZE_CHOICES) {
maximumPageSize.addItem(Util.M.rowsPerPage(v), String.valueOf(v));
}
reviewCategoryStrategy = new ListBox();
reviewCategoryStrategy.addItem(Util.C.messageShowInReviewCategoryNone(), GeneralPreferencesInfo.ReviewCategoryStrategy.NONE.name());
reviewCategoryStrategy.addItem(Util.C.messageShowInReviewCategoryName(), GeneralPreferencesInfo.ReviewCategoryStrategy.NAME.name());
reviewCategoryStrategy.addItem(Util.C.messageShowInReviewCategoryEmail(), GeneralPreferencesInfo.ReviewCategoryStrategy.EMAIL.name());
reviewCategoryStrategy.addItem(Util.C.messageShowInReviewCategoryUsername(), GeneralPreferencesInfo.ReviewCategoryStrategy.USERNAME.name());
reviewCategoryStrategy.addItem(Util.C.messageShowInReviewCategoryAbbrev(), GeneralPreferencesInfo.ReviewCategoryStrategy.ABBREV.name());
emailStrategy = new ListBox();
emailStrategy.addItem(Util.C.messageCCMeOnMyComments(), GeneralPreferencesInfo.EmailStrategy.CC_ON_OWN_COMMENTS.name());
emailStrategy.addItem(Util.C.messageEnabled(), GeneralPreferencesInfo.EmailStrategy.ENABLED.name());
emailStrategy.addItem(Util.C.messageDisabled(), GeneralPreferencesInfo.EmailStrategy.DISABLED.name());
emailFormat = new ListBox();
emailFormat.addItem(Util.C.messagePlaintextOnly(), GeneralPreferencesInfo.EmailFormat.PLAINTEXT.name());
emailFormat.addItem(Util.C.messageHtmlPlaintext(), GeneralPreferencesInfo.EmailFormat.HTML_PLAINTEXT.name());
defaultBaseForMerges = new ListBox();
defaultBaseForMerges.addItem(Util.C.autoMerge(), GeneralPreferencesInfo.DefaultBase.AUTO_MERGE.name());
defaultBaseForMerges.addItem(Util.C.firstParent(), GeneralPreferencesInfo.DefaultBase.FIRST_PARENT.name());
diffView = new ListBox();
diffView.addItem(com.google.gerrit.client.changes.Util.C.sideBySide(), GeneralPreferencesInfo.DiffView.SIDE_BY_SIDE.name());
diffView.addItem(com.google.gerrit.client.changes.Util.C.unifiedDiff(), GeneralPreferencesInfo.DiffView.UNIFIED_DIFF.name());
Date now = new Date();
dateFormat = new ListBox();
for (GeneralPreferencesInfo.DateFormat fmt : GeneralPreferencesInfo.DateFormat.values()) {
StringBuilder r = new StringBuilder();
r.append(DateTimeFormat.getFormat(fmt.getShortFormat()).format(now));
r.append(" ; ");
r.append(DateTimeFormat.getFormat(fmt.getLongFormat()).format(now));
dateFormat.addItem(r.toString(), fmt.name());
}
timeFormat = new ListBox();
for (GeneralPreferencesInfo.TimeFormat fmt : GeneralPreferencesInfo.TimeFormat.values()) {
StringBuilder r = new StringBuilder();
r.append(DateTimeFormat.getFormat(fmt.getFormat()).format(now));
timeFormat.addItem(r.toString(), fmt.name());
}
FlowPanel dateTimePanel = new FlowPanel();
final int labelIdx;
final int fieldIdx;
if (LocaleInfo.getCurrentLocale().isRTL()) {
labelIdx = 1;
fieldIdx = 0;
dateTimePanel.add(timeFormat);
dateTimePanel.add(dateFormat);
} else {
labelIdx = 0;
fieldIdx = 1;
dateTimePanel.add(dateFormat);
dateTimePanel.add(timeFormat);
}
highlightAssigneeInChangeTable = new CheckBox(Util.C.highlightAssigneeInChangeTable());
relativeDateInChangeTable = new CheckBox(Util.C.showRelativeDateInChangeTable());
sizeBarInChangeTable = new CheckBox(Util.C.showSizeBarInChangeTable());
legacycidInChangeTable = new CheckBox(Util.C.showLegacycidInChangeTable());
muteCommonPathPrefixes = new CheckBox(Util.C.muteCommonPathPrefixes());
signedOffBy = new CheckBox(Util.C.signedOffBy());
publishCommentsOnPush = new CheckBox(Util.C.publishCommentsOnPush());
boolean flashClippy = !UserAgent.hasJavaScriptClipboard() && UserAgent.Flash.isInstalled();
final Grid formGrid = new Grid(15 + (flashClippy ? 1 : 0), 2);
int row = 0;
formGrid.setText(row, labelIdx, Util.C.reviewCategoryLabel());
formGrid.setWidget(row, fieldIdx, reviewCategoryStrategy);
row++;
formGrid.setText(row, labelIdx, Util.C.maximumPageSizeFieldLabel());
formGrid.setWidget(row, fieldIdx, maximumPageSize);
row++;
formGrid.setText(row, labelIdx, Util.C.dateFormatLabel());
formGrid.setWidget(row, fieldIdx, dateTimePanel);
row++;
formGrid.setText(row, labelIdx, Util.C.emailFieldLabel());
formGrid.setWidget(row, fieldIdx, emailStrategy);
row++;
formGrid.setText(row, labelIdx, Util.C.emailFormatFieldLabel());
formGrid.setWidget(row, fieldIdx, emailFormat);
row++;
formGrid.setText(row, labelIdx, Util.C.defaultBaseForMerges());
formGrid.setWidget(row, fieldIdx, defaultBaseForMerges);
row++;
formGrid.setText(row, labelIdx, Util.C.diffViewLabel());
formGrid.setWidget(row, fieldIdx, diffView);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, showSiteHeader);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, highlightAssigneeInChangeTable);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, relativeDateInChangeTable);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, sizeBarInChangeTable);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, legacycidInChangeTable);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, muteCommonPathPrefixes);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, signedOffBy);
row++;
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, publishCommentsOnPush);
row++;
if (flashClippy) {
formGrid.setText(row, labelIdx, "");
formGrid.setWidget(row, fieldIdx, useFlashClipboard);
}
add(formGrid);
save = new Button(Util.C.buttonSaveChanges());
save.setEnabled(false);
save.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
doSave();
}
});
myMenus = new MyMenuPanel(save);
add(myMenus);
add(save);
final OnEditEnabler e = new OnEditEnabler(save);
e.listenTo(showSiteHeader);
e.listenTo(useFlashClipboard);
e.listenTo(maximumPageSize);
e.listenTo(dateFormat);
e.listenTo(timeFormat);
e.listenTo(highlightAssigneeInChangeTable);
e.listenTo(relativeDateInChangeTable);
e.listenTo(sizeBarInChangeTable);
e.listenTo(legacycidInChangeTable);
e.listenTo(muteCommonPathPrefixes);
e.listenTo(signedOffBy);
e.listenTo(publishCommentsOnPush);
e.listenTo(diffView);
e.listenTo(reviewCategoryStrategy);
e.listenTo(emailStrategy);
e.listenTo(emailFormat);
e.listenTo(defaultBaseForMerges);
}
use of com.google.gwt.user.client.ui.FlowPanel 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);
}
Aggregations