Example #1
0
  private void navigateLeft() {
    if (selectedFolder == null || selectedImageId == null) {
      return;
    }
    int idx = -1;
    for (int i = 0; i < loadedImages.size(); i++) {
      if (loadedImages.get(i).getId().equals(selectedImageId)) {
        idx = i;
        break;
      }
    }
    if (idx == -1) {
      return;
    }

    if (idx == 0) {
      // this is first image
      if (!GWTUtils.isEmpty(prevImageId)) {
        // show prev chunk
        loadSmallImages(selectedFolder.getId(), prevImageId, false);
        History.newItem(selectedFolder.getId() + "/" + prevImageId, false);
      }
    } else {
      String imageIdToSelect = loadedImages.get(idx - 1).getId();
      History.newItem(selectedFolder.getId() + "/" + imageIdToSelect);
    }
  }
  public void onClick(ClickEvent event) {
    Widget source = (Widget) event.getSource();
    if (source == btnSubmit) {
      if (currentUser != null) {
        txtLogin.setValue(currentUser.getUsername());
        txtProject.setValue(lbProjects.getItemText(lbProjects.getSelectedIndex()));
        form.submit();
      }
    }
    if (source == hlBack) {
      if (currentUser.getUsertype().equalsIgnoreCase("user")) {
        History.newItem("userJobList");
      } else {
        if (tab == 0) {

          History.newItem("adminJobList");
        } else {
          History.newItem("jobList");
        }
        // AdminPage adminPage = new AdminPage(tab);
        // RootPanel.get("content").add(adminPage);
      }
      /*UserHistory userHistory = new UserHistory();
      userHistory.history();*/
    }
  }
Example #3
0
  /** This is the entry point method. */
  public void onModuleLoad() {
    mainWidget = new SimplePanel();
    RootPanel.get("main").add(mainWidget);

    History.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            LOGGER.info("history changed " + event.getValue());
            String token = event.getValue();
            if (token.equals("") || token.startsWith("list") || token.startsWith("home")) {
              doShowPortfolioList();
            } else if (token.startsWith("portfolio")) {
              Map<String, String> paramMap = constructParamMap(token.split(":")[1]);
              String id = paramMap.get("id");
              doShowPortfolio(id != null ? Integer.parseInt(id) : 1);
            } else {
              doShowPortfolio(1);
            }
          }
        });

    Window.addWindowClosingHandler(
        new ClosingHandler() {
          @Override
          public void onWindowClosing(ClosingEvent event) {
            event.setMessage("Are you sure you want to exit");
          }
        });

    History.fireCurrentHistoryState();
  }
  protected void setup() {
    RootPanel.get().add(mainPresenter.getDisplay().asWidget());

    mainPresenter.bind();
    History.addValueChangeHandler(this);

    eventBus.addHandler(
        LoginSuccessfulEvent.TYPE,
        new LoginSuccessfulEventHandler() {
          @Override
          public void loginSuccessful(LoginSuccessfulEvent event) {
            History.newItem(getPreviousHistoryToken());
          }
        });

    eventBus.addHandler(
        LoginRequiredEvent.TYPE,
        new LoginRequiredEventHandler() {
          @Override
          public void loginRequired(LoginRequiredEvent event) {
            if (!AppPlace.HOME.equals(getPlace(History.getToken()))) {
              History.newItem(AppPlace.HOME.getToken());
            }
          }
        });

    switchSection(History.getToken());
  }
  @Inject
  public ActivityManager(
      ApplicationLayout layout,
      FlexInjector injector,
      ActivityMap activityMap,
      @Named("DefaultHistoryToken") String defaultplace,
      LocationInfo locationInfo) {

    this.injector = injector;
    this.activityMap = activityMap;
    this.defaultplace = defaultplace;
    this.display = layout;
    this.locationInfo = locationInfo;
    /*
     * We create the initial GUI elements needed for displaying activities.
     */
    layout.go();
    History.addValueChangeHandler(this);

    /*
     * If we do not have anything in the history stack de go to the default
     * view TODO: Decide if we should redirect like here or just show it
     */
    if ("".equals(History.getToken())) {
      goHome();
    } else {
      /*
       * If we have a history token we fire the change event which handles
       * setup of the activity
       */
      History.fireCurrentHistoryState();
    }
  }
Example #6
0
  @Override
  protected void setupEvents() {
    AppController.setInstance(new AppController());
    AppController.getInstance().setMainView(this);

    History.addValueChangeHandler(AppController.getInstance().getValueChangeHandler());
    History.fireCurrentHistoryState();
  }
Example #7
0
  /** Sets up start page and initializes the history */
  public void loadBaseView() {
    // Consistently loaded upon launch content
    // RootPanel.get("body").add(new HomeView());
    RootPanel.get("body").add(allViews.get(ViewEnum.HOME));

    if (History.getToken().length() == 0) {
      History.newItem("HOME");
    }
  }
Example #8
0
 private void HistoryInitialization() {
   HistoryValueChangeHandler historyValueChangeHandler = new HistoryValueChangeHandler();
   History.addValueChangeHandler(historyValueChangeHandler);
   String token = History.getToken();
   if (token.isEmpty()) {
     History.newItem("list&1");
   } else {
     History.fireCurrentHistoryState();
   }
 }
 /**
  * This will return immediately if the token passed in the event object isn't the token currently
  * on the History stack, or if the static back variable is true. If those aren't the case it calls
  * stateHandler.validateToken(token) and checks for equality with the token passed in. If they are
  * unequal it calls back() and adds a new item immediately after, then returns. If everything
  * checks out then the method cycles through the list of ClientWidget's and adds those which are
  * related to the page, by calling addWidget().
  */
 public void onValueChange(ValueChangeEvent<String> event) {
   String token = event.getValue();
   if (back || !token.equals(History.getToken())) return;
   String validatedToken = stateHandler.validateToken(token);
   if (!stateHandler.compareTokens(token, validatedToken)) {
     // back(); /* Actually works in Chrome, so I can't use this trick
     History.newItem(validatedToken);
     return;
   }
   for (ClientWidget w : list) if (w.isTokenRelated(validatedToken)) w.addWidgetToRootPanel();
 }
 @Override
 public void execute() {
   if (businessGoal.getAssets().isEmpty()) {
     History.newItem(
         AssetsAndGoalsPilot.generateNavigationId(AssetsAndGoalsPilot.PageId.summary));
   } else {
     History.newItem(
         AssetsAndGoalsPilot.generateNavigationId(
             AssetsAndGoalsPilot.PageId.assetGoalAssociation));
   }
 }
Example #11
0
  public void onModuleLoad() {
    History.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            openView(event.getValue());
          }
        });

    openView(History.getToken());
  }
  /** @param value */
  public void selectFolder(FileNode value) {
    if (!value.getMime().equals("application/vnd.com.n3phele.Repository+json")) {
      String path =
          value.getPath() == null
              ? value.getName() + "/"
              : (value.getPath() + value.getName() + "/");
      if (path.startsWith("/")) GWT.log("FileNode " + value + " produces query with leading /");
      fetchFiles(value.getRepository(), path);

      History.newItem(historyMapper.getToken(new RepoContentPlace(value.getRepository(), path)));
    } else {
      fetchFiles(value.getRepository(), null);
      History.newItem(historyMapper.getToken(new RepoContentPlace(value.getRepository(), null)));
    }
  }
Example #13
0
  /** Register or unregister the handlers used by {@link PopupPanel}. */
  private void updateHandlers() {
    // Remove any existing handlers.
    if (nativePreviewHandlerRegistration != null) {
      nativePreviewHandlerRegistration.removeHandler();
      nativePreviewHandlerRegistration = null;
    }
    if (historyHandlerRegistration != null) {
      historyHandlerRegistration.removeHandler();
      historyHandlerRegistration = null;
    }

    // Create handlers if showing.
    if (showing) {
      nativePreviewHandlerRegistration =
          Event.addNativePreviewHandler(
              new NativePreviewHandler() {
                public void onPreviewNativeEvent(NativePreviewEvent event) {
                  previewNativeEvent(event);
                }
              });
      historyHandlerRegistration =
          History.addValueChangeHandler(
              new ValueChangeHandler<String>() {
                public void onValueChange(ValueChangeEvent<String> event) {
                  if (autoHideOnHistoryEvents) {
                    hide();
                  }
                }
              });
    }
  }
Example #14
0
 /**
  * Change location to the new place
  *
  * @param place new location to go to
  */
 public void go(Class<? extends Activity> place) {
   String placename = activityMap.getKeyFromClass(place);
   if (placename == null) {
     GWT.log("Place not found for activity: " + place.getName());
   }
   History.newItem(placename);
 }
Example #15
0
 @Override
 public void executeAction() {
   if (textToShow != null) {
     History.newItem(
         Constants.TEXT_VIEW + "?" + Constants.PATH_PARAMETER + "=" + textToShow.getPath());
   }
 }
  @Override
  public void go(Map<String, String> params) {

    // hide any leftover notifications
    this.view.hideMsg();

    // show or hide the campaign creation button
    this.view.setCanCreate(canCreate);

    // display any new notifications
    if (userInfo.hasInfoMessage()) this.view.showMsg(userInfo.getInfoMessage());
    if (userInfo.hasErrorMessage()) this.view.showError(userInfo.getErrorMessage(), null);
    userInfo.clearMessages();

    // get subview from url params
    if (params.isEmpty() || params.get("v").equals("list")) {
      fetchAndShowCampaignsFilteredByHistoryTokenParams(params);
    } else if (params.get("v").equals("detail") && params.containsKey("id")) {
      // anything after first id is ignored
      fetchAndShowCampaignDetail(params.get("id"));
    } else if (params.get("v").equals("create")) {
      showCampaignCreateForm();
    } else if (params.get("v").equals("edit") && params.containsKey("id")) {
      // anything after first id is ignored
      fetchCampaignAndShowEditForm(params.get("id"));
    } else {
      // unrecognized view - show campaign list by default
      History.newItem(HistoryTokens.campaignList());
    }
  }
  /**
   * watch the historyTokens after the querystring#historyToken or you could say
   * querystring#[historyEvent|applicationState]
   */
  private void initHistoryObservations() {

    History.addValueChangeHandler(this);

    // first load
    Track.track("home");
  }
Example #18
0
 /**
  * History support for folder navigation adds a new browser history entry
  *
  * @param key
  */
 public void updateHistory(String key) {
   //		Replace any whitespace of the initial string to "+"
   //		String result = key.replaceAll("\\s","+");
   //		Add a new browser history entry.
   //		History.newItem(result);
   History.newItem(key);
 }
 /** Open an asset if it is not already open. */
 public void openAsset(final String uuid) {
   History.newItem("asset=" + uuid);
   LoadingPopup.showMessage("Loading asset...");
   if (!showIfOpen(uuid)) {
     RepositoryServiceFactory.getService()
         .loadRuleAsset(
             uuid,
             new GenericCallback<RuleAsset>() {
               public void onSuccess(final RuleAsset a) {
                 SuggestionCompletionCache.getInstance()
                     .doAction(
                         a.metaData.packageName,
                         new Command() {
                           public void execute() {
                             RuleViewer rv = new RuleViewer(a);
                             addTab(a.metaData.name, true, rv, uuid);
                             rv.setCloseCommand(
                                 new Command() {
                                   public void execute() {
                                     close(uuid);
                                   }
                                 });
                             LoadingPopup.close();
                           }
                         });
               }
             });
   }
 }
  private void buildHistoryNewItem(String pageKey, String moduleKey, String itemId) {
    String destinationPage = "moduleKey=" + moduleKey + "&pageKey=" + pageKey;

    if (itemId != null) {
      destinationPage = destinationPage + "&itemId=" + itemId;
    }
    History.newItem(destinationPage);
  }
  public void onValueChange(ValueChangeEvent<String> event) {

    // get the querystring token
    String historyToken = History.getToken();

    // send to static method that will send the __utm.gif to google's server fro tracking
    Track.track(historyToken);
  }
Example #22
0
 /**
  * Private constructor for singleton pattern Register all views here which add each view to the
  * <code>allViews</code> hashMap
  */
 private ViewManager() {
   // Register views
   registerView(ViewEnum.AUTH, new AuthView());
   registerView(ViewEnum.HOME, new HomeView());
   registerView(ViewEnum.REGISTER, new RegisterView());
   registerView(ViewEnum.SIGNOUT, new SignOutView());
   registerView(ViewEnum.HISTORY, new PersonalHistoryView());
   History.addValueChangeHandler(this);
 }
Example #23
0
  /**
   * Adds a new browser history entry only if the requested page exists among the {@code pages} map
   * attribute.<br>
   * Does nothing if given {@code pageRequest} references a pop-up view or a <em>skip history</em>
   * page.
   *
   * @param request Page request.
   */
  private void newPlace(final PageRequest request) {

    final Page page = request.getPage();

    if (page != null && (page.skipHistory() || isPopupView(page))) {
      // "Pop-up views" and "Skip history pages" don't generate a new History item.
      return;
    }

    History.newItem(request.toString(), false);
  }
 private void redraw(boolean autoScroll) {
   if (autoScroll) {
     String historyToken = History.getToken();
     if (!Strings.isNullOrEmpty(historyToken)) {
       int top = this.affixMenu.getPinnedOffset();
       Window.scrollTo(Window.getScrollLeft(), top);
     } else {
       Window.scrollTo(Window.getScrollLeft(), 0);
     }
   }
 }
Example #25
0
 public void start() {
   evalHistoryToken(History.getToken());
   if (!historyToken.isProjectIdSet()) {
     User user = auth.getUser();
     Project project = user.getCurrentProject();
     if (project == null || user.isAdmin()) {
       gotoProjectSelector();
     } else {
       gotoProject(project.getId());
     }
   }
 }
Example #26
0
  /**
   * Page manager constructor.
   *
   * @param eventBus application event bus.
   */
  @Inject
  public PageManager(final EventBus eventBus) {
    this.eventBus = eventBus;
    pages = new HashMap<String, Pair<Page, Boolean>>();
    presenters = new HashMap<Page, Presenter.PagePresenter<?>>();

    // Register ourselves with the History API.
    History.addValueChangeHandler(this);

    // Listen for manual place change events.
    eventBus.addHandler(PageChangedEvent.getType(), this);
  }
Example #27
0
  public void updatePlace(TrendsPlace place) {
    if (this.place != null) return;

    this.place = place;
    final TrendsPlace finalPlace = this.place;
    if (place.getSelectedSessionIds().isEmpty()) {

      sessionsDataGrid
          .getSelectionModel()
          .addSelectionChangeHandler(new SessionSelectChangeHandler());

      selectTests = true;
      testDataGrid.getSelectionModel().addSelectionChangeHandler(new TestSelectChangeHandler());

      TaskDataTreeViewModel viewModel = (TaskDataTreeViewModel) taskDetailsTree.getTreeViewModel();
      viewModel
          .getSelectionModel()
          .addSelectionChangeHandler(new TaskPlotSelectionChangedHandler());

      metricPanel.addSelectionListener(new MetricsSelectionChangedHandler());

      chooseTab(place.getToken());
      return;
    }

    SessionDataService.Async.getInstance()
        .getBySessionIds(
            0,
            place.getSelectedSessionIds().size(),
            place.getSelectedSessionIds(),
            new AsyncCallback<PagedSessionDataDto>() {
              @Override
              public void onFailure(Throwable caught) {
                caught.printStackTrace();
              }

              @Override
              public void onSuccess(PagedSessionDataDto result) {
                for (SessionDataDto session : result.getSessionDataDtoList()) {
                  sessionsDataGrid.getSelectionModel().setSelected(session, true);
                }
                sessionsDataGrid
                    .getSelectionModel()
                    .addSelectionChangeHandler(new SessionSelectChangeHandler());
                sessionsDataGrid
                    .getSelectionModel()
                    .setSelected(result.getSessionDataDtoList().iterator().next(), true);
                chooseTab(finalPlace.getToken());
              }
            });
    History.newItem(NameTokens.EMPTY);
  }
Example #28
0
  /** This is the entry point method. */
  public void onModuleLoad() {
    //        GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
    //            public void onUncaughtException(Throwable e) {
    //                Window.alert("Error: " + e.getMessage());
    //                log.log(Level.SEVERE, e.getMessage(), e);
    //                e.printStackTrace();
    //            }
    //        });
    //        GXT.setDefaultTheme(Theme.BLUE, true);

    // Initialize servlets
    repoxService = (RepoxServiceAsync) GWT.create(RepoxService.class);
    Registry.register(REPOX_SERVICE, repoxService);
    Registry.register(COOKIE_MANAGER, new CookieManager());
    Registry.register(ES_MANAGEMENT_SERVICE, GWT.create(ESManagementService.class));
    Registry.register(HARVEST_OPERATIONS_SERVICE, GWT.create(HarvestOperationsService.class));
    Registry.register(RSS_SERVICE, GWT.create(RssService.class));
    Registry.register(DP_SERVICE, GWT.create(DPService.class));
    Registry.register(AGG_SERVICE, GWT.create(AGGService.class));
    Registry.register(DATA_SET_OPERATIONS_SERVICE, GWT.create(DataSetOperationsService.class));
    Registry.register(DATA_MANAGEMENT_SERVICE, GWT.create(DataManagementService.class));
    Registry.register(TASK_MANAGEMENT_SERVICE, GWT.create(TaskManagementService.class));
    Registry.register(TRANSFORMATIONS_SERVICE, GWT.create(TransformationsService.class));
    Registry.register(TAGS_SERVICE, GWT.create(TagsService.class));
    Registry.register(SEARCH_SERVICE, GWT.create(SearchService.class));
    Registry.register(FILTER_SERVICE, GWT.create(FilterService.class));
    userManagementService = (UserManagementServiceAsync) GWT.create(UserManagementService.class);
    Registry.register(USER_MANAGEMENT_SERVICE, userManagementService);
    Registry.register("MAIN_ROOT", this);

    // Add all controllers
    Dispatcher dispatcher = Dispatcher.get();
    dispatcher.addController(new AppController());
    dispatcher.addController(new BrowseController());
    dispatcher.addController(new FormController());
    dispatcher.addController(new DataSetController());
    dispatcher.addController(new HarvestingController());
    dispatcher.addController(new StatisticsController());
    dispatcher.addController(new AdministrationController());
    dispatcher.addController(new OaiTestController());
    dispatcher.addController(new AccountEditController());
    dispatcher.addController(new SchemaMapperController());
    dispatcher.addController(new ServiceManagerController());
    dispatcher.addController(new DataSetActionsController());
    dispatcher.addController(new RssController());
    // XMApper Controllers
    dispatcher.addController(new SaveMappingCtrl());

    checkFirstTimeRepoxUsed();

    History.addHistoryListener(this);
  }
Example #29
0
  private void initUI() {
    History.addValueChangeHandler(this);
    addDomHandler(this, ClickEvent.getType());
    GWTUtils.setUidToElement(UID_CAPTION_CLICK, elCaption);
    GWTUtils.setUidToElement(UID_LOGIN, elLogin);
    GWTUtils.setUidToElement(UID_LOGOUT, elLogout);

    JSONObject json = JSONHelper.getJsonFromElement(Actions.JSON_DATA_EL_ID);
    String loggedInUser = null;
    if (json != null) {
      loggedInUser = JSONHelper.getString(json, "user");
    }
    setCurrentUser(loggedInUser);
  }
Example #30
0
  private void processClickEvent(String uid, JSONObject json) {
    if (UID_FOLDER_CLICK.equals(uid)) {
      String folderId = JSONHelper.getString(json, "folderId");
      History.newItem(folderId);
    } else if (UID_CAPTION_CLICK.equals(uid)) {
      History.newItem("");
    } else if (UID_SMALL_IMAGE_CLICK.equals(uid)) {
      String folderId = JSONHelper.getString(json, "folderId");
      String imageId = JSONHelper.getString(json, "imageId");
      History.newItem(folderId + "/" + imageId);

      FullScreenHelper.startFullscreen(elBigPhotoW);

    } else if (UID_SMALL_LEFT.equals(uid)) {
      if (selectedFolder == null || GWTUtils.isEmpty(prevImageId)) {
        Window.alert("No more images");
      } else {
        loadSmallImages(selectedFolder.getId(), prevImageId, false);
        History.newItem(selectedFolder.getId() + "/" + prevImageId, false);
      }
    } else if (UID_SMALL_RIGHT.equals(uid)) {
      if (selectedFolder == null || GWTUtils.isEmpty(nextImageId)) {
        Window.alert("No more images");
      } else {
        loadSmallImages(selectedFolder.getId(), nextImageId, true);
        History.newItem(selectedFolder.getId() + "/" + nextImageId, false);
      }
    } else if (UID_LOGIN.equals(uid)) {
      login();
    } else if (UID_LOGOUT.equals(uid)) {
      logout();
    } else if (UID_ROTATE_LEFT.equals(uid)) {
      rotate(true);
    } else if (UID_ROTATE_RIGHT.equals(uid)) {
      rotate(false);
    }
  }