use of com.google.gwt.user.client.ui.InlineLabel in project gerrit by GerritCodeReview.
the class Gerrit method whoAmI.
private static void whoAmI(boolean canLogOut) {
AccountInfo account = getUserAccount();
final UserPopupPanel userPopup = new UserPopupPanel(account, canLogOut, true);
final FlowPanel userSummaryPanel = new FlowPanel();
class PopupHandler implements KeyDownHandler, ClickHandler {
private void showHidePopup() {
if (userPopup.isShowing() && userPopup.isVisible()) {
userPopup.hide();
} else {
userPopup.showRelativeTo(userSummaryPanel);
}
}
@Override
public void onClick(ClickEvent event) {
showHidePopup();
}
@Override
public void onKeyDown(KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
showHidePopup();
event.preventDefault();
}
}
}
final PopupHandler popupHandler = new PopupHandler();
final InlineLabel l = new InlineLabel(FormatUtil.name(account));
l.setStyleName(RESOURCES.css().menuBarUserName());
final AvatarImage avatar = new AvatarImage(account, 26, false);
avatar.setStyleName(RESOURCES.css().menuBarUserNameAvatar());
userSummaryPanel.setStyleName(RESOURCES.css().menuBarUserNamePanel());
userSummaryPanel.add(l);
userSummaryPanel.add(avatar);
// "BLACK DOWN-POINTING SMALL TRIANGLE"
userSummaryPanel.add(new InlineLabel(" ▾"));
userPopup.addAutoHidePartner(userSummaryPanel.getElement());
FocusPanel fp = new FocusPanel(userSummaryPanel);
fp.setStyleName(RESOURCES.css().menuBarUserNameFocusPanel());
fp.addKeyDownHandler(popupHandler);
fp.addClickHandler(popupHandler);
menuRight.add(fp);
}
use of com.google.gwt.user.client.ui.InlineLabel in project openremote by openremote.
the class AdminUserNotificationEditorImpl method buildAlertNotification.
protected AlertNotification buildAlertNotification() {
errorPanel.clear();
String notificationTitle = notificationTitleInput.getText();
String notificationMessage = notificationMessageInput.getText();
String notificationAppUrl = notificationAppUrlInput.getText();
if (isNullOrEmpty(notificationTitle) || isNullOrEmpty(notificationMessage) || isNullOrEmpty(notificationAppUrl)) {
errorPanel.add(new IconLabel("warning"));
InlineLabel errorMessage = new InlineLabel(managerMessages.enterTitleMessageAppurlForNotification());
errorPanel.add(errorMessage);
errorPanel.setVisible(true);
return null;
}
errorPanel.setVisible(false);
alertNotification.setTitle(notificationTitle);
alertNotification.setMessage(notificationMessage);
alertNotification.setAppUrl(notificationAppUrl);
return alertNotification;
}
use of com.google.gwt.user.client.ui.InlineLabel in project opentsdb by OpenTSDB.
the class MetricForm method assembleUi.
private void assembleUi() {
setWidth("100%");
{
// Left hand-side panel.
final HorizontalPanel hbox = new HorizontalPanel();
final InlineLabel l = new InlineLabel();
l.setText("Metric:");
hbox.add(l);
final SuggestBox suggest = RemoteOracle.newSuggestBox("metrics", metric);
suggest.setLimit(40);
hbox.add(suggest);
hbox.setWidth("100%");
metric.setWidth("100%");
tagtable.setWidget(0, 0, hbox);
tagtable.getFlexCellFormatter().setColSpan(0, 0, 3);
addTag();
tagtable.setText(1, 0, "Tags");
add(tagtable);
}
{
// Right hand-side panel.
final VerticalPanel vbox = new VerticalPanel();
{
final HorizontalPanel hbox = new HorizontalPanel();
hbox.add(rate);
hbox.add(rate_counter);
hbox.add(x1y2);
vbox.add(hbox);
}
{
final HorizontalPanel hbox = new HorizontalPanel();
final InlineLabel l = new InlineLabel("Rate Ctr Max:");
hbox.add(l);
hbox.add(counter_max);
vbox.add(hbox);
}
{
final HorizontalPanel hbox = new HorizontalPanel();
final InlineLabel l = new InlineLabel("Rate Ctr Reset:");
hbox.add(l);
hbox.add(counter_reset_value);
vbox.add(hbox);
}
{
final HorizontalPanel hbox = new HorizontalPanel();
final InlineLabel l = new InlineLabel();
l.setText("Aggregator:");
hbox.add(l);
hbox.add(aggregators);
vbox.add(hbox);
}
vbox.add(downsample);
{
final HorizontalPanel hbox = new HorizontalPanel();
hbox.add(downsampler);
hbox.add(interval);
hbox.add(fill_policy);
vbox.add(hbox);
}
add(vbox);
}
}
use of com.google.gwt.user.client.ui.InlineLabel in project opentsdb by OpenTSDB.
the class QueryUi method makeKeyPanel.
/**
* Builds the panel containing the customizations for the key of the graph.
*/
private Widget makeKeyPanel() {
final Grid grid = new Grid(5, 5);
addKeyRadioButton(grid, 0, 0, "out left top");
addKeyRadioButton(grid, 0, 2, "out center top");
addKeyRadioButton(grid, 0, 4, "out right top");
addKeyRadioButton(grid, 1, 1, "top left");
addKeyRadioButton(grid, 1, 2, "top center");
addKeyRadioButton(grid, 1, 3, "top right").setValue(true);
addKeyRadioButton(grid, 2, 0, "out center left");
addKeyRadioButton(grid, 2, 1, "center left");
addKeyRadioButton(grid, 2, 2, "center");
addKeyRadioButton(grid, 2, 3, "center right");
addKeyRadioButton(grid, 2, 4, "out center right");
addKeyRadioButton(grid, 3, 1, "bottom left");
addKeyRadioButton(grid, 3, 2, "bottom center");
addKeyRadioButton(grid, 3, 3, "bottom right");
addKeyRadioButton(grid, 4, 0, "out bottom left");
addKeyRadioButton(grid, 4, 2, "out bottom center");
addKeyRadioButton(grid, 4, 4, "out bottom right");
final Grid.CellFormatter cf = grid.getCellFormatter();
cf.getElement(1, 1).getStyle().setProperty("borderLeft", "1px solid #000");
cf.getElement(1, 1).getStyle().setProperty("borderTop", "1px solid #000");
cf.getElement(1, 2).getStyle().setProperty("borderTop", "1px solid #000");
cf.getElement(1, 3).getStyle().setProperty("borderTop", "1px solid #000");
cf.getElement(1, 3).getStyle().setProperty("borderRight", "1px solid #000");
cf.getElement(2, 1).getStyle().setProperty("borderLeft", "1px solid #000");
cf.getElement(2, 3).getStyle().setProperty("borderRight", "1px solid #000");
cf.getElement(3, 1).getStyle().setProperty("borderLeft", "1px solid #000");
cf.getElement(3, 1).getStyle().setProperty("borderBottom", "1px solid #000");
cf.getElement(3, 2).getStyle().setProperty("borderBottom", "1px solid #000");
cf.getElement(3, 3).getStyle().setProperty("borderBottom", "1px solid #000");
cf.getElement(3, 3).getStyle().setProperty("borderRight", "1px solid #000");
final VerticalPanel vbox = new VerticalPanel();
vbox.add(new InlineLabel("Key location:"));
vbox.add(grid);
vbox.add(horizontalkey);
keybox.setValue(true);
vbox.add(keybox);
vbox.add(nokey);
return vbox;
}
use of com.google.gwt.user.client.ui.InlineLabel in project opentsdb by OpenTSDB.
the class QueryUi method asyncGetJson.
private void asyncGetJson(final String url, final GotJsonCallback callback) {
final RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
try {
builder.sendRequest(null, new RequestCallback() {
public void onError(final Request request, final Throwable e) {
displayError("Failed to get " + url + ": " + e.getMessage());
// Since we don't call the callback we've been given, reset this
// bit of state as we're not going to retry anything right now.
pending_requests = 0;
}
public void onResponseReceived(final Request request, final Response response) {
final int code = response.getStatusCode();
if (code == Response.SC_OK) {
clearError();
callback.got(JSONParser.parse(response.getText()));
return;
} else if (code >= Response.SC_BAD_REQUEST) {
// 400+ => Oops.
// Since we don't call the callback we've been given, reset this
// bit of state as we're not going to retry anything right now.
pending_requests = 0;
String err = response.getText();
// an error message.
if (!err.isEmpty() && err.charAt(0) == '{') {
final JSONValue json = JSONParser.parse(err);
final JSONObject result = json == null ? null : json.isObject();
final JSONValue jerr = result == null ? null : result.get("err");
final JSONString serr = jerr == null ? null : jerr.isString();
err = serr.stringValue();
// If the error message has multiple lines (which is common if
// it contains a stack trace), show only the first line and
// hide the rest in a panel users can expand.
final int newline = err.indexOf('\n', 1);
final String msg = "Request failed: " + response.getStatusText();
if (newline < 0) {
displayError(msg + ": " + err);
} else {
displayError(msg);
final DisclosurePanel dp = new DisclosurePanel(err.substring(0, newline));
// Attach the widget.
RootPanel.get("queryuimain").add(dp);
final InlineLabel content = new InlineLabel(err.substring(newline, err.length()));
// For readable stack traces.
content.addStyleName("fwf");
dp.setContent(content);
current_error.getElement().appendChild(dp.getElement());
}
} else {
displayError("Request failed while getting " + url + ": " + response.getStatusText());
// Since we don't call the callback we've been given, reset this
// bit of state as we're not going to retry anything right now.
pending_requests = 0;
}
graphstatus.setText("");
}
}
});
} catch (RequestException e) {
displayError("Failed to get " + url + ": " + e.getMessage());
}
}
Aggregations