Exemple #1
0
 /**
  * Called if: URL changed manually by the visitor in the browser. Reload button pressed. NOT
  * called because of an updateUri button click (important ;-).
  */
 @Override
 public void paramChanged(NavigationEvent navigationEvent) {
   lastParamsDetectedLabel.setValue("Last parameters detected: " + navigationEvent.getParams());
   if (navigationEvent.getParams() == null) {
     tf.setValue("");
     details.setVisible(false);
   } else {
     tf.setValue(navigationEvent.getParams());
     details.setVisible(true);
     details.setCaption("Ticket #" + navigationEvent.getParams());
   }
 }
Exemple #2
0
 @Override
 public void buttonClick(Button.ClickEvent event) {
   if (event.getButton() == btDetails) {
     if (detailsPanel.isVisible()) {
       detailsPanel.setVisible(false);
       btDetails.setCaption("Show Details");
       layout.setExpandRatio(detailsPanel, 0.0f);
       layout.setExpandRatio(actionsLayout, 1.0f);
     } else {
       detailsPanel.setVisible(true);
       btDetails.setCaption("Hide Details");
       layout.setExpandRatio(detailsPanel, 1.0f);
       layout.setExpandRatio(actionsLayout, 0.0f);
     }
   } else if (event.getButton() == btClose) {
     this.close();
   } else if (event.getButton() == btReportBug) {
     this.close();
     UI ui = UI.getCurrent();
     if (ui instanceof SearchUI) {
       ((SearchUI) ui).reportBug(cause);
     }
   }
 }
Exemple #3
0
  public ExceptionDialog(Throwable ex, String caption) {
    this.cause = ex;
    Preconditions.checkNotNull(ex);

    layout = new VerticalLayout();
    setContent(layout);
    layout.setWidth("100%");
    layout.setHeight("-1");

    if (caption == null) {
      setCaption("Unexpected error");
    } else {
      setCaption(caption);
    }

    Label lblInfo =
        new Label("An unexpected error occured.<br />The error message was:", ContentMode.HTML);
    lblInfo.setHeight("-1px");
    lblInfo.setWidth("100%");
    layout.addComponent(lblInfo);
    lblInfo.addStyleName("exception-message-caption");

    String message = ex.getMessage();
    if (message == null || message.isEmpty()) {
      message = "<no message>";
    }
    Label lblMessage = new Label(message);
    lblMessage.addStyleName("exception-message-content");
    lblMessage.setHeight("-1px");
    lblMessage.setWidth("100%");
    layout.addComponent(lblMessage);

    actionsLayout = new HorizontalLayout();
    actionsLayout.addStyleName("exception-dlg-details");
    actionsLayout.setWidth("100%");
    actionsLayout.setHeight("-1px");
    layout.addComponent(actionsLayout);

    btDetails = new Button("Show Details", this);
    btDetails.setStyleName(BaseTheme.BUTTON_LINK);
    actionsLayout.addComponent(btDetails);

    btReportBug = new Button("Report Problem", this);
    btReportBug.setStyleName(BaseTheme.BUTTON_LINK);
    btReportBug.setVisible(false);
    btReportBug.setIcon(FontAwesome.ENVELOPE_O);
    UI ui = UI.getCurrent();
    if (ui instanceof SearchUI) {
      btReportBug.setVisible(((SearchUI) ui).canReportBugs());
    }
    actionsLayout.addComponent(btReportBug);
    actionsLayout.setComponentAlignment(btDetails, Alignment.TOP_LEFT);
    actionsLayout.setComponentAlignment(btReportBug, Alignment.TOP_RIGHT);

    lblStacktrace = new Label(Helper.convertExceptionToMessage(ex), ContentMode.PREFORMATTED);
    detailsPanel = new Panel(lblStacktrace);
    detailsPanel.setWidth("100%");
    detailsPanel.setHeight("300px");
    detailsPanel.setVisible(false);
    lblStacktrace.setSizeUndefined();
    lblStacktrace.setVisible(true);
    layout.addComponent(detailsPanel);

    btClose = new Button("OK", this);
    layout.addComponent(btClose);

    layout.setComponentAlignment(btClose, Alignment.BOTTOM_CENTER);
    layout.setExpandRatio(detailsPanel, 0.0f);
    layout.setExpandRatio(actionsLayout, 1.0f);
  }