Exemplo n.º 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();*/
    }
  }
 @Override
 public void execute() {
   if (businessGoal.getAssets().isEmpty()) {
     History.newItem(
         AssetsAndGoalsPilot.generateNavigationId(AssetsAndGoalsPilot.PageId.summary));
   } else {
     History.newItem(
         AssetsAndGoalsPilot.generateNavigationId(
             AssetsAndGoalsPilot.PageId.assetGoalAssociation));
   }
 }
Exemplo n.º 4
0
  /** @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)));
    }
  }
Exemplo n.º 5
0
 @Override
 public void executeAction() {
   if (textToShow != null) {
     History.newItem(
         Constants.TEXT_VIEW + "?" + Constants.PATH_PARAMETER + "=" + textToShow.getPath());
   }
 }
 /** 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();
                           }
                         });
               }
             });
   }
 }
Exemplo n.º 7
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);
 }
Exemplo n.º 8
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);
 }
Exemplo n.º 9
0
  @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());
    }
  }
Exemplo n.º 10
0
  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);
  }
Exemplo n.º 11
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");
    }
  }
Exemplo n.º 12
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();
 }
Exemplo n.º 14
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);
  }
Exemplo n.º 15
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);
  }
Exemplo n.º 16
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);
    }
  }
Exemplo n.º 17
0
  protected void applyImages(String folderId, String selectedImageId, JSONObject json) {

    JSONObject jsonObj = JSONHelper.getObject(json, "data");

    totalImagesCount = JSONHelper.getInteger(jsonObj, "totalImagesCount");
    prevImageId = JSONHelper.getString(jsonObj, "prevImageId");
    nextImageId = JSONHelper.getString(jsonObj, "nextImageId");
    startIndex = JSONHelper.getPrimitiveInt(jsonObj, "startIndex");

    // parse images
    List<ClientImage> images =
        JSONHelper.getArray(
            jsonObj,
            "images",
            new ValueParser<ClientImage>() {
              @Override
              public ClientImage parse(JSONValue jsonValue) {
                JSONObject json = jsonValue.isObject();
                String id = JSONHelper.getString(json, "id");
                return new ClientImage(id);
              }
            });
    if (GWTUtils.isEmpty(images)) {
      Window.alert("Failed to load images list");
      return;
    }
    loadedImages.clear();
    loadedImages.addAll(images);

    // parse folder
    JSONObject folderJson = JSONHelper.getObject(jsonObj, "folder");
    if (folderJson == null) {
      Window.alert("Failed to get images list!");
      return;
    }
    String folderCaption = JSONHelper.getString(folderJson, "caption");
    long folderSize = JSONHelper.getPrimitiveLong(json, "folderSize");
    int imagesCount = JSONHelper.getPrimitiveInt(json, "imagesCount");
    selectedFolder = new ClientFolder(folderId, folderCaption, null, folderSize, imagesCount);

    if (GWTUtils.isEmpty(selectedImageId)) {
      selectedImageId = loadedImages.get(0).getId();
      History.newItem(folderId + "/" + selectedImageId, false);
    }

    // paint folder, big photo, small images
    showImages(selectedFolder, selectedImageId, images, true);
  }
Exemplo n.º 18
0
 public void showScreen(Panel panel, String title, String iconCls, String screenName) {
   String panelID = panel.getId();
   if (appTabPanel.hasItem(panelID)) {
     appTabPanel.scrollToTab(panel, true);
     appTabPanel.activate(panelID);
   } else {
     if (!panel.isRendered()) {
       panel.setTitle(title);
       if (iconCls == null) {
         iconCls = "plugins-nav-icon";
       }
       panel.setIconCls(iconCls);
     }
     appTabPanel.add(panel);
     appTabPanel.activate(panel.getId());
   }
   History.newItem(screenName);
 }
Exemplo n.º 19
0
  /** Open an asset if it is not already open. */
  public void openAsset(final String uuid) {
    if (uuid.contains("<")) {
      return;
    }
    History.newItem("asset=" + uuid); // NON-NLS

    if (!explorerViewCenterPanel.showIfOpen(uuid)) {

      final boolean[] loading = {true};

      Timer t =
          new Timer() {
            public void run() {
              if (loading[0]) {
                LoadingPopup.showMessage(constants.LoadingAsset());
              }
            }
          };
      t.schedule(200);

      loadRuleAsset(uuid, loading);
    }
  }
Exemplo n.º 20
0
  /**
   * Selects correct job before removal.
   *
   * @param jobToStop identifier of the job which was removed
   */
  private void selectPrevious(String jobToRemove) {
    List<MyJobsModel> currentJobs = myJobsStore.getAll();

    boolean found = false;
    int jobNr = 0;

    while ((jobNr < currentJobs.size()) && (!found)) {
      if (currentJobs.get(jobNr).getJobid().equals(jobToRemove)) {
        found = true;
      }

      jobNr++;
    }

    jobNr -= 2;

    if (jobNr >= 0) {
      myJobsGrid.getSelectionModel().select(currentJobs.get(jobNr), false);
    } else if (myJobsStore.getAll().size() > 1) {
      myJobsGrid.getSelectionModel().select(currentJobs.get(1), false);
    } else {
      History.newItem("");
    }
  }
Exemplo n.º 21
0
 protected void gotoLocation(String token) {
   History.newItem(token);
 }
Exemplo n.º 22
0
  @Override
  public void onModuleLoad() {
    // Initialize the singleton before calling the constructors of the
    // various widgets that might call GSS.get().
    singleton = this;
    parseUserCredentials();

    topPanel = new TopPanel(GSS.images);
    topPanel.setWidth("100%");

    messagePanel.setWidth("100%");
    messagePanel.setVisible(false);

    search = new Search(images);
    searchStatus.add(search, DockPanel.WEST);
    searchStatus.add(userDetailsPanel, DockPanel.EAST);
    searchStatus.setCellHorizontalAlignment(userDetailsPanel, HasHorizontalAlignment.ALIGN_RIGHT);
    searchStatus.setCellVerticalAlignment(search, HasVerticalAlignment.ALIGN_MIDDLE);
    searchStatus.setCellVerticalAlignment(userDetailsPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    searchStatus.setWidth("100%");

    fileList = new FileList(images);

    searchResults = new SearchResults(images);

    // Inner contains the various lists.
    inner.sinkEvents(Event.ONCONTEXTMENU);
    inner.setAnimationEnabled(true);
    inner.getTabBar().addStyleName("gss-MainTabBar");
    inner.getDeckPanel().addStyleName("gss-MainTabPanelBottom");
    inner.add(
        fileList, createHeaderHTML(AbstractImagePrototype.create(images.folders()), "Files"), true);

    inner.add(
        groups, createHeaderHTML(AbstractImagePrototype.create(images.groups()), "Groups"), true);
    inner.add(
        searchResults,
        createHeaderHTML(AbstractImagePrototype.create(images.search()), "Search Results"),
        true);
    // inner.add(new CellTreeView(images),
    // createHeaderHTML(AbstractImagePrototype.create(images.search()), "Cell tree sample"), true);
    inner.setWidth("100%");
    inner.selectTab(0);

    inner.addSelectionHandler(
        new SelectionHandler<Integer>() {

          @Override
          public void onSelection(SelectionEvent<Integer> event) {
            int tabIndex = event.getSelectedItem();
            //				TreeItem treeItem = GSS.get().getFolders().getCurrent();
            switch (tabIndex) {
              case 0:
                //						Files tab selected
                // fileList.clearSelectedRows();
                fileList.updateCurrentlyShowingStats();
                break;
              case 1:
                //						Groups tab selected
                groups.updateCurrentlyShowingStats();
                updateHistory("Groups");
                break;
              case 2:
                //						Search tab selected
                searchResults.clearSelectedRows();
                searchResults.updateCurrentlyShowingStats();
                updateHistory("Search");
                break;
            }
          }
        });
    //		If the application starts with no history token, redirect to a new "Files" state
    String initToken = History.getToken();
    if (initToken.length() == 0) History.newItem("Files");
    //		   Add history listener to handle any history events
    History.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            String tokenInput = event.getValue();
            String historyToken = handleSpecialFolderNames(tokenInput);
            try {
              if (historyToken.equals("Search")) inner.selectTab(2);
              else if (historyToken.equals("Groups")) inner.selectTab(1);
              else if (historyToken.equals("Files") || historyToken.length() == 0)
                inner.selectTab(0);
              else {
                /*TODO: CELLTREE
                PopupTree popupTree = GSS.get().getFolders().getPopupTree();
                TreeItem treeObj = GSS.get().getFolders().getPopupTree().getTreeItem(historyToken);
                SelectionEvent.fire(popupTree, treeObj);
                */
              }
            } catch (IndexOutOfBoundsException e) {
              inner.selectTab(0);
            }
          }
        });

    // Add the left and right panels to the split panel.
    splitPanel.setLeftWidget(treeView);
    splitPanel.setRightWidget(inner);
    splitPanel.setSplitPosition("25%");
    splitPanel.setSize("100%", "100%");
    splitPanel.addStyleName("gss-splitPanel");

    // Create a dock panel that will contain the menu bar at the top,
    // the shortcuts to the left, the status bar at the bottom and the
    // right panel taking the rest.
    VerticalPanel outer = new VerticalPanel();
    outer.add(topPanel);
    outer.add(searchStatus);
    outer.add(messagePanel);
    outer.add(splitPanel);
    outer.add(statusPanel);
    outer.setWidth("100%");
    outer.setCellHorizontalAlignment(messagePanel, HasHorizontalAlignment.ALIGN_CENTER);

    outer.setSpacing(4);

    // Hook the window resize event, so that we can adjust the UI.
    Window.addResizeHandler(this);
    // Clear out the window's built-in margin, because we want to take
    // advantage of the entire client area.
    Window.setMargin("0px");
    // Finally, add the outer panel to the RootPanel, so that it will be
    // displayed.
    RootPanel.get().add(outer);
    // Call the window resized handler to get the initial sizes setup. Doing
    // this in a deferred command causes it to occur after all widgets'
    // sizes have been computed by the browser.
    DeferredCommand.addCommand(
        new Command() {

          @Override
          public void execute() {
            onWindowResized(Window.getClientHeight());
          }
        });
  }
Exemplo n.º 23
0
 void setBrowserHistoryToken(String historyToken, boolean issueEvent) {
   History.newItem(historyToken, issueEvent);
 }
Exemplo n.º 24
0
 public void onActivation() {
   History.newItem(n);
 }
Exemplo n.º 25
0
 protected void doEntityUpdated() {
   History.newItem(getListAction());
 }
Exemplo n.º 26
0
 protected void doEditEntityCancelled() {
   History.newItem(getListAction());
 }
Exemplo n.º 27
0
 protected void doEditEntity(Long id) {
   History.newItem(getEditAction(), false);
   Presenter presenter = createEditPresenter(id);
   presenter.go(getContainer());
 }
Exemplo n.º 28
0
 protected void doAddNewEntity() {
   History.newItem(getAddAction());
 }
Exemplo n.º 29
0
 public void changePage(String pageId) {
   History.newItem(pageId);
 }
Exemplo n.º 30
0
 @UiHandler(value = "logout")
 public void logoutClick(ClickEvent event) {
   History.newItem("logout");
 }