use of com.google.gwt.user.client.ui.Label in project perun by CESNET.
the class SetAttribute method testSetting.
/**
* Tests the values, if the process can continue
*
* @return true/false for continue/stop
*/
private boolean testSetting() {
boolean result = true;
String errorMsg = "";
if (this.ids.isEmpty()) {
errorMsg += "Wrong attribute type value.\n";
result = false;
}
// skip attribute with empty or null value
if (attribute.getValue() == null || attribute.getValue().equalsIgnoreCase("")) {
errorMsg += "Can't save attribute with null or empty value.\n";
result = false;
}
if (errorMsg.length() > 0) {
Confirm c = new Confirm("Error while setting attribute", new Label(errorMsg), true);
c.show();
}
return result;
}
use of com.google.gwt.user.client.ui.Label in project gerrit by GerritCodeReview.
the class ProjectListPopup method createWidgets.
private void createWidgets(final String popupText, final String currentPageLink) {
filterPanel = new HorizontalPanel();
filterPanel.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
final Label filterLabel = new Label(com.google.gerrit.client.admin.AdminConstants.I.projectFilter());
filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
filterPanel.add(filterLabel);
filterTxt = new NpTextBox();
filterTxt.addKeyUpHandler(new KeyUpHandler() {
@Override
public void onKeyUp(KeyUpEvent event) {
Query q = new Query(filterTxt.getValue());
if (!match.equals(q.qMatch)) {
if (query == null) {
q.run();
}
query = q;
}
}
});
filterPanel.add(filterTxt);
projectsTab = new HighlightingProjectsTable() {
@Override
protected void movePointerTo(final int row, final boolean scroll) {
super.movePointerTo(row, scroll);
onMovePointerTo(getRowItem(row).name());
}
@Override
protected void onOpenRow(final int row) {
super.onOpenRow(row);
openRow(getRowItem(row).name());
}
};
projectsTab.setSavePointerId(currentPageLink);
closeTop = createCloseButton();
closeBottom = createCloseButton();
popup = new DialogBox();
popup.setModal(false);
popup.setText(popupText);
}
use of com.google.gwt.user.client.ui.Label in project gerrit by GerritCodeReview.
the class MyWatchesTable method populate.
protected void populate(final int row, final ProjectWatchInfo info) {
final FlowPanel fp = new FlowPanel();
fp.add(new ProjectLink(info.project(), new Project.NameKey(info.project())));
if (info.filter() != null) {
Label filter = new Label(info.filter());
filter.setStyleName(Gerrit.RESOURCES.css().watchedProjectFilter());
fp.add(filter);
}
table.setWidget(row, 1, new CheckBox());
table.setWidget(row, 2, fp);
addNotifyButton(ProjectWatchInfo.Type.NEW_CHANGES, info, row, 3);
addNotifyButton(ProjectWatchInfo.Type.NEW_PATCHSETS, info, row, 4);
addNotifyButton(ProjectWatchInfo.Type.ALL_COMMENTS, info, row, 5);
addNotifyButton(ProjectWatchInfo.Type.SUBMITTED_CHANGES, info, row, 6);
addNotifyButton(ProjectWatchInfo.Type.ABANDONED_CHANGES, info, row, 7);
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().iconCell());
fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell());
fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell());
fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().dataCell());
fmt.addStyleName(row, 5, Gerrit.RESOURCES.css().dataCell());
fmt.addStyleName(row, 6, Gerrit.RESOURCES.css().dataCell());
fmt.addStyleName(row, 7, Gerrit.RESOURCES.css().dataCell());
setRowItem(row, info);
}
use of com.google.gwt.user.client.ui.Label in project gerrit by GerritCodeReview.
the class ProjectAccessScreen method onCommit.
@UiHandler("commit")
void onCommit(@SuppressWarnings("unused") ClickEvent event) {
final ProjectAccess access = driver.flush();
if (driver.hasErrors()) {
Window.alert(AdminConstants.I.errorsMustBeFixed());
return;
}
String message = commitMessage.getText().trim();
if ("".equals(message)) {
message = null;
}
enable(false);
//
Util.PROJECT_SVC.changeProjectAccess(//
getProjectKey(), //
access.getRevision(), //
message, //
access.getLocal(), //
access.getInheritsFrom(), new GerritCallback<ProjectAccess>() {
@Override
public void onSuccess(ProjectAccess newAccess) {
enable(true);
commitMessage.setText("");
error.clear();
final Set<String> diffs = getDiffs(access, newAccess);
if (diffs.isEmpty()) {
displayReadOnly(newAccess);
} else {
error.add(new Label(Gerrit.C.projectAccessError()));
for (final String diff : diffs) {
error.add(new Label(diff));
}
if (access.canUpload()) {
error.add(new Label(Gerrit.C.projectAccessProposeForReviewHint()));
}
}
}
private Set<String> getDiffs(ProjectAccess wantedAccess, ProjectAccess newAccess) {
List<AccessSection> wantedSections = mergeSections(removeEmptyPermissionsAndSections(wantedAccess.getLocal()));
List<AccessSection> newSections = removeEmptyPermissionsAndSections(newAccess.getLocal());
HashSet<AccessSection> same = new HashSet<>(wantedSections);
HashSet<AccessSection> different = new HashSet<>(wantedSections.size() + newSections.size());
different.addAll(wantedSections);
different.addAll(newSections);
same.retainAll(newSections);
different.removeAll(same);
Set<String> differentNames = new HashSet<>();
for (AccessSection s : different) {
differentNames.add(s.getName());
}
return differentNames;
}
@Override
public void onFailure(Throwable caught) {
error.clear();
enable(true);
if (caught instanceof RemoteJsonException && caught.getMessage().startsWith(UpdateParentFailedException.MESSAGE)) {
new ErrorDialog(Gerrit.M.parentUpdateFailed(caught.getMessage().substring(UpdateParentFailedException.MESSAGE.length() + 1))).center();
} else {
super.onFailure(caught);
}
}
});
}
use of com.google.gwt.user.client.ui.Label in project gerrit by GerritCodeReview.
the class ProjectInfoScreen method renderListBox.
private ListBox renderListBox(LabeledWidgetsGrid g, ConfigParameterInfo param) {
if (param.permittedValues() == null) {
return null;
}
ListBox listBox = new ListBox();
if (param.inheritable()) {
listBox.addItem(AdminMessages.I.pluginProjectInheritedListValue(param.inheritedValue()));
if (param.configuredValue() == null) {
listBox.setSelectedIndex(0);
}
for (int i = 0; i < param.permittedValues().length(); i++) {
String pv = param.permittedValues().get(i);
listBox.addItem(pv);
if (pv.equals(param.configuredValue())) {
listBox.setSelectedIndex(i + 1);
}
}
} else {
for (int i = 0; i < param.permittedValues().length(); i++) {
String pv = param.permittedValues().get(i);
listBox.addItem(pv);
if (pv.equals(param.value())) {
listBox.setSelectedIndex(i);
}
}
}
if (param.editable()) {
saveEnabler.listenTo(listBox);
addWidget(g, listBox, param);
} else {
listBox.setEnabled(false);
if (param.inheritable() && listBox.getSelectedIndex() != 0) {
// the inherited value is not selected,
// since the listBox is disabled the inherited value cannot be
// seen and we have to display it explicitly
Label inheritedLabel = new Label(AdminMessages.I.pluginProjectInheritedValue(param.inheritedValue()));
inheritedLabel.setStyleName(Gerrit.RESOURCES.css().pluginProjectConfigInheritedValue());
HorizontalPanel p = new HorizontalPanel();
p.add(listBox);
p.add(inheritedLabel);
addWidget(g, p, param);
} else {
addWidget(g, listBox, param);
}
}
return listBox;
}
Aggregations