Example #1
0
  public static Bitmap getTileBitmap(TileType type) {

    if (grassRes == null) {
      grassRes = new int[11];
      grassRes[0] = R.drawable.grass0;
      grassRes[1] = R.drawable.grass1;
      grassRes[2] = R.drawable.grass2;
      grassRes[3] = R.drawable.grass3;
      grassRes[4] = R.drawable.grass4;
      grassRes[5] = R.drawable.grass5;
      grassRes[6] = R.drawable.grass6;
      grassRes[7] = R.drawable.grass7;
      grassRes[8] = R.drawable.grass8;
      grassRes[9] = R.drawable.grass9;
      grassRes[10] = R.drawable.grass10;
    }
    if (grass == null) grass = new Bitmap[11];

    int random;

    switch (type) {
      case GRASS:
        random = (int) (Math.random() * 11);
        if (grass[random] == null || (grass[random] != null && grass[random].isRecycled()))
          grass[random] =
              BitmapFactory.decodeResource(
                  ContextProvider.getInstance().getContext().getResources(), grassRes[random]);
        return grass[random];
      case SAND:
        if (sand == null || (sand != null && sand.isRecycled()))
          sand =
              BitmapFactory.decodeResource(
                  ContextProvider.getInstance().getContext().getResources(), R.drawable.tile_sand);
        return sand;
      default:
        random = (int) (Math.random() * 11);
        if (grass[random] == null || (grass[random] != null && grass[random].isRecycled()))
          grass[random] =
              BitmapFactory.decodeResource(
                  ContextProvider.getInstance().getContext().getResources(), grassRes[random]);
        return grass[random];
    }
  }
  public void testStartupRequestWithParameter() throws Exception {
    RWTFactory.getEntryPointManager().registerByPath("/rap", DefaultEntryPoint.class, null);
    Fixture.fakeNewGetRequest();
    Fixture.fakeRequestParam("param", "value");
    RWTFactory.getServiceManager().getHandler().service();

    Fixture.fakeNewRequest();
    Fixture.fakeRequestParam("param", null);
    Fixture.fakeRequestParam(RequestParams.RWT_INITIALIZE, "true");
    RWTFactory.getServiceManager().getHandler().service();

    assertEquals("value", ContextProvider.getRequest().getParameter("param"));
  }
 /**
  * @param request
  * @param response
  */
 public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws IOException, ServletException {
   System.out.print("\n\t In do get method dfgfbg");
   PrintWriter out = response.getWriter();
   ServiceDAO<TestTaker> testTakerdao =
       (ServiceDAO<TestTaker>)
           ContextProvider.getApplicationContext().getBean(Constants.TESTTAKER_DAO);
   TestTaker testTaker = new TestTaker();
   testTaker.setEmailId(request.getParameter("emailId"));
   List<TestTaker> testTakerList = testTakerdao.select(testTaker);
   System.out.println("\t\t\t\t\t  the value in ajax validation is " + testTakerList.size());
   if (testTakerList.size() > 0) {
     out.write("failure");
   }
 }
Example #4
0
 /**
  * Implements check function with same arguments of Authorisation security implementation
  *
  * @see Verify#check(UserContext, Query, Operation)
  */
 public Authorization.QueryCheck check(User userContext, Query query, Operation operation) {
   return provider.check(userContext, query, operation);
 }
Example #5
0
 protected boolean mayDo(
     MMObjectNode user, MMObjectNode contextNode, Operation operation, boolean checkOwnRights) {
   return provider.mayDoOnContext(user, contextNode, operation, checkOwnRights);
 }
 @Override
 public C getContext() {
   return _context == null ? null : _context.getContext();
 }
 /** The destroy method is used to release the pointer to the subscriber service */
 public void destroy() {
   unbindSubscriber(ContextProvider.getInstance().getSubscriber());
 }
  /**
   * initializing the servlet by defining the resolution directory, the alias for the servlet, and
   * the resolution directory alias. Also, the servlet uses the singleton ContextProvider to get the
   * subscriber found by the service to be registered with the servlet.
   */
  public void init() {

    this.setServletAlias(SERVLET_ALIAS);

    bindSubscriber(ContextProvider.getInstance().getSubscriber());
  }