コード例 #1
0
ファイル: DMRHandler.java プロジェクト: panossot/core-1
 private void logAtomicOperation(ModelNode operation) {
   if (operation.get(OP).asString().equals(COMPOSITE)) // nested composite ops?
   {
     Log.error("Failed to to log resources access", operation.toString());
   } else if (operation.hasDefined(CHILD_TYPE)) {
     // ModelNode address = operation.get(ADDRESS).clone();
     // address.add(operation.get(CHILD_TYPE).toString(), "*");
     resourceLog.log(
         Window.Location.getHash(),
         operation.get(ADDRESS).toString()
             + " : "
             + operation.get(OP).asString()
             + "(child-type="
             + operation.get(CHILD_TYPE)
             + ")");
   } else {
     resourceLog.log(
         Window.Location.getHash(),
         operation.get(ADDRESS).toString() + " : " + operation.get(OP).asString());
   }
 }
コード例 #2
0
ファイル: CloudCoder.java プロジェクト: jspacco/CloudCoder
  /** This is the entry point method. */
  public void onModuleLoad() {
    theInstance = this;

    GWT.log("loading, fragment name is " + Window.Location.getHash());

    session = new Session();
    pageStack = new PageStack();
    session.add(pageStack);
    subscriptionRegistrar = new DefaultSubscriptionRegistrar();

    // Subscribe to PAGE_CHANGE events in the PageStack
    pageStack.subscribe(PageStack.Event.PAGE_CHANGE, this, subscriptionRegistrar);

    // Subscribe to all Session events
    session.subscribeToAll(Session.Event.values(), this, subscriptionRegistrar);

    // Go to whatever initial page is appropriate.
    createInitialPage();
  }
コード例 #3
0
ファイル: Application.java プロジェクト: hasadna/obudget
  @Override
  public void onValueChange(ValueChangeEvent<String> event) {
    String hash = event.getValue();

    recordAnalyticsHit(Window.Location.getPath() + Window.Location.getHash());

    String[] parts = hash.split(",");

    if (parts.length == 12) {
      String code = parts[0];
      Integer year = Integer.decode(parts[1]);
      try {
        Integer timeLineDataType = Integer.decode(parts[2]);
        Integer timeLineChartSelect0 = Integer.decode(parts[3]);
        Integer timeLineChartSelect1 = Integer.decode(parts[4]);
        Integer timeLineChartSelect2 = Integer.decode(parts[5]);
        Integer timeLineChartSelect3 = Integer.decode(parts[6]);
        Integer timeLineChartSelect4 = Integer.decode(parts[7]);
        Integer timeLineChartSelect5 = Integer.decode(parts[8]);
        Integer pieChartDataType = Integer.decode(parts[9]);
        Integer pieChartNet = Integer.decode(parts[10]);
        Integer resultsGridNet = Integer.decode(parts[11]);
        selectBudgetCode(code, year);
        mTimeLineCharter.setState(
            timeLineDataType,
            timeLineChartSelect0,
            timeLineChartSelect1,
            timeLineChartSelect2,
            timeLineChartSelect3,
            timeLineChartSelect4,
            timeLineChartSelect5);
        mPieCharter.setState(pieChartDataType, pieChartNet);
        mResultsGrid.setState(resultsGridNet);
      } catch (Exception e) {
        Log.error("Application::onValueChange: Error while parsing url", e);
        newCodeAndYear("00", 2012);
      }
    } else {
      Log.error("Application::onValueChange: Error while parsing url");
      newCodeAndYear("00", 2012);
    }
  }
コード例 #4
0
ファイル: VUI.java プロジェクト: horun/vaadin
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
          String newFragment = event.getValue();

          // Send the location to the server if the fragment has changed
          // and flush active connectors in UI.
          if (!newFragment.equals(currentFragment) && connection != null) {
            /*
             * Ensure the fragment is properly encoded in all browsers
             * (#10769)
             *
             * createUrlBuilder does not properly pass an empty fragment to
             * UrlBuilder on Webkit browsers so do it manually (#11686)
             */
            String location =
                Window.Location.createUrlBuilder()
                    .setHash(URL.decodeQueryString(Window.Location.getHash()))
                    .buildString();

            currentFragment = newFragment;
            connection.flushActiveConnector();
            connection.updateVariable(id, UIConstants.LOCATION_VARIABLE, location, true);
          }
        }
コード例 #5
0
ファイル: CloudCoder.java プロジェクト: jspacco/CloudCoder
  private void createInitialPage() {
    // See if a URL fragment was specified, and if so, see if it
    // identifies a valid page.

    PageId linkPageId_ = null; // page id specified by the link, if any
    String linkPageParams_ = null; // page parameters specified by the link, if any

    String fragment = Window.Location.getHash();
    if (fragment != null && !fragment.equals("")) {
      GWT.log("URL fragment is " + fragment);
      String fragmentName = getFragmentName(fragment);
      GWT.log("Fragment name is " + fragmentName);

      linkPageId_ = PageId.forFragmentName(fragmentName);
      if (linkPageId_ != null) {
        linkPageParams_ = getFragmentParams(fragment);
        GWT.log("Link params: " + linkPageParams_);
      }
    }

    // Special case: don't attempt to redirect to the login page or init error page.
    // That would be silly.
    if (linkPageId_ == PageId.LOGIN || linkPageId_ == PageId.INIT_ERROR) {
      linkPageId_ = null;
      linkPageParams_ = null;
    }

    final PageId linkPageId = linkPageId_;
    final String linkPageParams = linkPageParams_;

    // Check to see if the user is already logged in.
    RPC.loginService.getUser(
        new AsyncCallback<User>() {
          @Override
          public void onFailure(Throwable caught) {
            // Special case: if this RPC call (which is the first one)
            // throws an InitErrorException, switch to the InitErrorPage
            // so that the cloudcoder admin can diagnose and resolve
            // the issue.
            if (caught instanceof InitErrorException) {
              changePage(new InitErrorPage());
            } else {
              session.add(
                  StatusMessage.error(
                      "Could not check for current login status: " + caught.getMessage()));
              changePage(new LoginPage());
            }
          }

          @Override
          public void onSuccess(User result) {
            if (result == null) {
              // Not logged in, so show LoginPage
              LoginPage loginPage = new LoginPage();
              if (linkPageId != null) {
                GWT.log("Login page will redirect to " + linkPageId + ":" + linkPageParams);
                // A page was linked in the original URL,
                // so have the LoginPage try to navigate to it
                // on a successful login.
                loginPage.setLinkPageId(linkPageId);
                loginPage.setLinkPageParams(linkPageParams);
              }
              changePage(loginPage);
            } else {
              // User is logged in!
              final User user = result;

              // Add user to session
              session.add(user);

              // If a page id was specified as part of the original URL,
              // try to navigate to it.
              if (linkPageId != null) {
                GWT.log("Already logged in, linking page " + linkPageId + ":" + linkPageParams);
                CloudCoderPage page = createPageForPageId(linkPageId, linkPageParams);
                changePage(page);
              } else {
                // Default behavior: navigate to the home page
                changePage(new CoursesAndProblemsPage3());
              }
            }
          }
        });
  }