Esempio n. 1
0
  @Override
  protected void onInit() {
    if (!isInitialized) {
      super.onInit();

      this.setWidth100();
      this.setHeight100();

      this.addMember(buildEditForm());
      buildPortlets();

      isInitialized = true;
    }
  }
  @Override
  protected void onInit() {
    if (!isInitialized()) {
      super.onInit();

      // first async call to get global permissions
      new PermissionsLoader()
          .loadExplicitGlobalPermissions(
              new PermissionsLoadedListener() {

                public void onPermissionsLoaded(Set<Permission> permissions) {
                  globalPermissions = permissions;

                  // now make async call to look for customized dash for this user and entity
                  DashboardCriteria criteria = new DashboardCriteria();
                  criteria.addFilterCategory(DashboardCategory.RESOURCE);
                  criteria.addFilterResourceId(resourceComposite.getResource().getId());
                  dashboardService.findDashboardsByCriteria(
                      criteria,
                      new AsyncCallback<PageList<Dashboard>>() {
                        public void onFailure(Throwable caught) {
                          CoreGUI.getErrorHandler()
                              .handleError(MSG.view_dashboardsManager_error1(), caught);
                        }

                        public void onSuccess(final PageList<Dashboard> result) {
                          Dashboard dashboard =
                              result.isEmpty() ? getDefaultDashboard() : result.get(0);
                          setDashboard(dashboard);

                          isInitialized = true;

                          // draw() may be done since onInit finishes asynchronously, if so redraw
                          if (isDrawn()) {
                            markForRedraw();
                          }
                        }
                      });
                }
              });
    }
  }