@Override
 public void buttonClick(ClickEvent event) {
   try {
     if (userSvc.markUserActive(this.activationId)) {
       String baseUrl = AccountsApplication.getInstance().getURL().toString().split("\\?")[0];
       AccountsApplication.getInstance()
           .getMainWindow()
           .open(new ExternalResource(baseUrl + "?restartApplication"));
     } else {
       AccountsApplication.getInstance().nav.loadNewView(new AccountsLoginView());
       Messenger.genericMessage(
           MessageSeverity.WARNING,
           STRINGS.getString(AccountsMessages.ACTIVATE_USER_FAILED),
           "Warning thrown while trying to activate with [" + this.activationId + "]",
           null);
     }
   } catch (AccountsBaseException e) {
     Messenger.genericMessage(
         MessageSeverity.ERROR,
         STRINGS.getString(AccountsMessages.MSGR_UNRECOVERABLE_ERROR),
         "Wrapped Exception thrown while trying to activate user",
         e);
   }
 }
예제 #2
0
  private Panel generateMyBalanceSheetContent() {
    mainContent = new Panel();
    mainContent.setSizeFull();

    VerticalLayout mainPanelVl = new VerticalLayout();

    List<BalanceSheet> myBalSheets = null;
    try {
      myBalSheets =
          accSvc.getMyBalanceSheets((AccountsUser) AccountsApplication.getInstance().getUser());
      Collections.sort(
          myBalSheets,
          new Comparator<BalanceSheet>() {
            @Override
            public int compare(BalanceSheet o1, BalanceSheet o2) {
              if (o1.isActive() == o2.isActive()) return 0;
              else if (o1.isActive() && !o2.isActive()) return -1;
              else return 1;
            }
          });
    } catch (AccountsSheetException e) {
      log.log(Level.SEVERE, "Error trying to query number of balance sheets", e);
      mainContent.addComponent(
          new Label(STRINGS.getString(AccountsMessages.MSGR_UNRECOVERABLE_ERROR)));

      return mainContent;
    }

    myBalSheetDetails = new Label();
    myBalSheetDetails.setData(myBalSheets.size());

    mainPanelVl.addComponent(myBalSheetDetails);
    mainPanelVl.addComponent(displayMyBalSheetsInRows(myBalSheets));

    mainContent.addComponent(mainPanelVl);

    return mainContent;
  }