@RequestMapping(value = "/deleteAll")
 @ResponseBody
 public Object deleteAll() {
   logBefore(logger, "批量删除Textmsg");
   if (!PermissionHandler.buttonJurisdiction(menuUrl, "del")) {
     return null;
   }
   PageData pd = new PageData();
   Map<String, Object> map = new HashMap<String, Object>();
   try {
     pd = this.getPageData();
     List<PageData> pdList = new ArrayList<PageData>();
     String DATA_IDS = pd.getString("DATA_IDS");
     if (null != DATA_IDS && !"".equals(DATA_IDS)) {
       String ArrayDATA_IDS[] = DATA_IDS.split(",");
       weixinTextMsgService.deleteAll(ArrayDATA_IDS);
       pd.put("msg", "ok");
     } else {
       pd.put("msg", "no");
     }
     pdList.add(pd);
     map.put("list", pdList);
   } catch (Exception e) {
     logger.error(e.toString(), e);
   } finally {
     logAfter(logger);
   }
   return AppUtil.returnObject(pd, map);
 }
Exemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detecting);
    story1 = (ImageView) findViewById(R.id.story_1);
    head = (TextView) findViewById(R.id.story_head);
    storyBack = (ImageView) findViewById(R.id.story_back);
    storyBack.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent it = new Intent(Detecting.this, AppStart.class);
            startActivity(it);
            Log.v("detectActivity", "back");
            Detecting.this.finish();
          }
        });
    skip = (Button) findViewById(R.id.story_skip);
    skip.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            if (index != ImageInt.length) index = ImageInt.length;
          }
        });
    imgList = AppUtil.getImg1();
    story1.setImageResource(imgList.get(index));
    mp3 = MediaPlayer.create(this, MusicInt[index++]);
    mp3.start();
    mp3.setOnCompletionListener(new myMusicListener());
  }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == RESULT_CANCELED) {
     // se foi uma tentativa de pagamento
     if (requestCode == PagSeguroPayment.PAG_SEGURO_REQUEST_CODE) {
       // exibir confirmação de cancelamento
       final String msg = getString(R.string.transaction_cancelled);
       AppUtil.showConfirmDialog(this, msg, null);
     }
   } else if (resultCode == RESULT_OK) {
     // se foi uma tentativa de pagamento
     if (requestCode == PagSeguroPayment.PAG_SEGURO_REQUEST_CODE) {
       // exibir confirmação de sucesso
       final String msg = getString(R.string.transaction_succeded);
       AppUtil.showConfirmDialog(this, msg, null);
     }
   } else if (resultCode == PagSeguroPayment.PAG_SEGURO_REQUEST_CODE) {
     switch (data.getIntExtra(PagSeguroPayment.PAG_SEGURO_EXTRA, 0)) {
       case PagSeguroPayment.PAG_SEGURO_REQUEST_SUCCESS_CODE:
         {
           final String msg = getString(R.string.transaction_succeded);
           AppUtil.showConfirmDialog(this, msg, null);
           break;
         }
       case PagSeguroPayment.PAG_SEGURO_REQUEST_FAILURE_CODE:
         {
           final String msg = getString(R.string.transaction_error);
           AppUtil.showConfirmDialog(this, msg, null);
           break;
         }
       case PagSeguroPayment.PAG_SEGURO_REQUEST_CANCELLED_CODE:
         {
           final String msg = getString(R.string.transaction_cancelled);
           AppUtil.showConfirmDialog(this, msg, null);
           break;
         }
     }
   }
 }
Exemplo n.º 4
0
  /** Test method for {@link openones.oopms.dms.util.AppUtil#loadMenuBar()}. */
  @Test
  public void testLoadMenuBar() {
    List<SubMenu> subMenuList = AppUtil.loadMenuBar();

    assertEquals(2, subMenuList.size());

    assertEquals("Project Environment", subMenuList.get(0).getName());
    assertEquals("Manage Defect", subMenuList.get(1).getName());

    List<MenuItem> menuItemList = subMenuList.get(0).getMenuItemList();
    assertEquals(4, menuItemList.size());
    assertEquals("Manage Views", subMenuList.get(1).getMenuItemList().get(0).getName());
    assertEquals("goManageViews", subMenuList.get(1).getMenuItemList().get(0).getActionId());
  }
Exemplo n.º 5
0
  public void sendRecoverVerifyMail(
      RequestInfo reqInfo, String email, AccessToken at, AppUtil appUtils)
      throws IOException, TemplateException {
    Template tpl = wcfmcfg.getTemplate("account/recoverpwdmail.ftl");
    StringWriter sw = new StringWriter();

    Map<String, Object> dataModel = appUtils.createDataModel(reqInfo, reqInfo.isSsl());
    String returnTo = at.getReturnTo();
    String fireHost = returnTo.split(",")[0];
    dataModel.put("appHost", fireHost);
    dataModel.put("token", at);
    tpl.process(dataModel, sw);

    awsSesSerivce.sendEmail(true, "*****@*****.**", "M3958重置密码", sw.toString(), email);
  }
Exemplo n.º 6
0
        public void handleMessage(android.os.Message msg) {
          switch (msg.what) {
            case SHOWDIALOG:
              progress = AppUtil.showProgress(ActivitySelectCity.this, "正在加载数据,请稍候...");
              break;
            case DISMISSDIALOG:
              if (progress != null) {
                progress.dismiss();
              }
              adapter = new ListAdapter(ActivitySelectCity.this);
              personList.setAdapter(adapter);
              //				personList.setAdapter(adapter);

              sh.addTextChangedListener(
                  new TextWatcher() {
                    @Override
                    public void onTextChanged(CharSequence s, int start, int before, int count) {}

                    @Override
                    public void beforeTextChanged(
                        CharSequence s, int start, int count, int after) {}

                    @Override
                    public void afterTextChanged(Editable s) {
                      // 搜索符合用户输入的城市名
                      if (s.length() > 0) {
                        ArrayList<City> changecity = new ArrayList<City>();
                        for (int i = 0; i < city_lists.size(); i++) {
                          if (city_lists.get(i).name.indexOf(sh.getText().toString()) != -1) {
                            changecity.add(city_lists.get(i));
                          }
                        }
                        ShowCity_lists = changecity;
                      } else {
                        ShowCity_lists = allCity_lists;
                      }
                      adapter.notifyDataSetChanged();
                    }
                  });
              break;
            default:
              break;
          }
        };
 /** 判断关键词是否存在 */
 @RequestMapping(value = "/hasK")
 @ResponseBody
 public Object hasK() {
   Map<String, String> map = new HashMap<String, String>();
   String errInfo = "success";
   PageData pd = new PageData();
   try {
     pd = this.getPageData();
     pd.put("STATUS", "3");
     if (weixinTextMsgService.findByKw(pd) != null
         || weixinCommandService.findByKw(pd) != null
         || weixinImgMsgService.findByKw(pd) != null) {
       errInfo = "error";
     }
   } catch (Exception e) {
     logger.error(e.toString(), e);
   }
   map.put("result", errInfo); // 返回结果
   return AppUtil.returnObject(new PageData(), map);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.building01);

    Bundle bundle = this.getIntent().getExtras();
    soilid = bundle.getInt("soilid");

    try {

      JSONObject param = new JSONObject();
      param.put("verifycode", AppUtil.verifycode);
      param.put("actioncode", 17);
      this.actioncode = 17;

      requestURL(param.toString(), "building.php");

    } catch (JSONException e) {
      e.printStackTrace();
      AppUtil.button1Dialog(this, "解码JSON字符串失败!");
      release();
    }
  }
Exemplo n.º 9
0
  public void handleMethod(final String id, final String method, final Object... parameters) {
    final ClientCommand.COMMAND cmd = Enum.valueOf(ClientCommand.COMMAND.class, method);

    //		System.out.println("ClientMethodHandler#handleMethod: " + cmd.name());

    // These commands are safe to do in the background, any events that cause model updates need
    // to be on the EDT (See next section)
    switch (cmd) {
      case putAsset:
        AssetManager.putAsset((Asset) parameters[0]);
        MapTool.getFrame().getCurrentZoneRenderer().flushDrawableRenderer();
        MapTool.getFrame().refresh();
        return;

      case removeAsset:
        return;

      case startAssetTransfer:
        AssetHeader header = (AssetHeader) parameters[0];
        MapTool.getAssetTransferManager()
            .addConsumer(new AssetConsumer(AppUtil.getTmpDir(), header));
        return;

      case updateAssetTransfer:
        AssetChunk chunk = (AssetChunk) parameters[0];
        try {
          MapTool.getAssetTransferManager().update(chunk);
        } catch (IOException ioe) {
          // TODO: do something intelligent like clear the transfer
          // manager, and clear the "we're waiting for" flag so that it
          // gets requested again
          ioe.printStackTrace();
        }
        return;
    }

    // Model events need to update on the EDT
    EventQueue.invokeLater(
        new Runnable() {
          @SuppressWarnings("unchecked")
          public void run() {
            GUID zoneGUID;
            Zone zone;
            Set<GUID> selectedToks = null;

            switch (cmd) {
              case bootPlayer:
                String playerName = (String) parameters[0];
                if (MapTool.getPlayer().getName().equals(playerName)) {
                  ServerDisconnectHandler.disconnectExpected = true;
                  AppActions.disconnectFromServer();
                  MapTool.showInformation("You have been booted from the server.");
                }
                return;

              case enforceZone:
                zoneGUID = (GUID) parameters[0];
                ZoneRenderer renderer = MapTool.getFrame().getZoneRenderer(zoneGUID);

                if (renderer != null
                    && renderer != MapTool.getFrame().getCurrentZoneRenderer()
                    && (renderer.getZone().isVisible() || MapTool.getPlayer().isGM())) {
                  MapTool.getFrame().setCurrentZoneRenderer(renderer);
                }
                return;

              case clearAllDrawings:
                zoneGUID = (GUID) parameters[0];
                Zone.Layer layer = (Zone.Layer) parameters[1];
                zone = MapTool.getCampaign().getZone(zoneGUID);
                zone.getDrawnElements(layer).clear();

                MapTool.getFrame().refresh();
                return;

              case setZoneHasFoW:
                zoneGUID = (GUID) parameters[0];
                boolean hasFog = (Boolean) parameters[1];

                zone = MapTool.getCampaign().getZone(zoneGUID);
                zone.setHasFog(hasFog);

                // In case we're looking at the zone
                MapTool.getFrame().refresh();
                return;

              case exposeFoW:
                zoneGUID = (GUID) parameters[0];
                Area area = (Area) parameters[1];

                if (parameters.length > 2) {
                  if (parameters[2] != null) {
                    selectedToks = (Set<GUID>) parameters[2];
                  }
                }
                zone = MapTool.getCampaign().getZone(zoneGUID);
                zone.exposeArea(area, selectedToks);
                MapTool.getFrame().refresh();
                return;

              case setFoW:
                zoneGUID = (GUID) parameters[0];
                area = (Area) parameters[1];

                if (parameters.length > 2) {
                  if (parameters[2] != null) {
                    selectedToks = (Set<GUID>) parameters[2];
                  }
                }
                zone = MapTool.getCampaign().getZone(zoneGUID);
                zone.setFogArea(area, selectedToks);
                MapTool.getFrame().refresh();
                return;

              case hideFoW:
                zoneGUID = (GUID) parameters[0];
                area = (Area) parameters[1];

                if (parameters.length > 2) {
                  if (parameters[2] != null) {
                    selectedToks = (Set<GUID>) parameters[2];
                  }
                }
                zone = MapTool.getCampaign().getZone(zoneGUID);
                zone.hideArea(area, selectedToks);
                MapTool.getFrame().refresh();
                return;

              case setCampaign:
                Campaign campaign = (Campaign) parameters[0];
                MapTool.setCampaign(campaign);

                // Hide the "Connecting" overlay
                MapTool.getFrame().hideGlassPane();
                return;

              case putZone:
                zone = (Zone) parameters[0];
                MapTool.getCampaign().putZone(zone);

                // TODO: combine this with MapTool.addZone()
                renderer = ZoneRendererFactory.newRenderer(zone);
                MapTool.getFrame().addZoneRenderer(renderer);
                if (MapTool.getFrame().getCurrentZoneRenderer() == null && zone.isVisible()) {
                  MapTool.getFrame().setCurrentZoneRenderer(renderer);
                }
                MapTool.getEventDispatcher()
                    .fireEvent(MapTool.ZoneEvent.Added, MapTool.getCampaign(), null, zone);
                return;

              case removeZone:
                zoneGUID = (GUID) parameters[0];
                MapTool.getCampaign().removeZone(zoneGUID);
                MapTool.getFrame().removeZoneRenderer(MapTool.getFrame().getZoneRenderer(zoneGUID));
                return;

              case putToken:
                zoneGUID = (GUID) parameters[0];
                zone = MapTool.getCampaign().getZone(zoneGUID);
                Token token = (Token) parameters[1];
                zone.putToken(token);
                MapTool.getFrame().refresh();
                return;

              case putLabel:
                zoneGUID = (GUID) parameters[0];
                zone = MapTool.getCampaign().getZone(zoneGUID);
                Label label = (Label) parameters[1];
                zone.putLabel(label);
                MapTool.getFrame().refresh();
                return;

              case removeToken:
                zoneGUID = (GUID) parameters[0];
                zone = MapTool.getCampaign().getZone(zoneGUID);
                GUID tokenGUID = (GUID) parameters[1];
                zone.removeToken(tokenGUID);
                MapTool.getFrame().refresh();
                return;

              case removeLabel:
                zoneGUID = (GUID) parameters[0];
                zone = MapTool.getCampaign().getZone(zoneGUID);
                GUID labelGUID = (GUID) parameters[1];
                zone.removeLabel(labelGUID);
                MapTool.getFrame().refresh();
                return;

              case enforceZoneView:
                zoneGUID = (GUID) parameters[0];
                int x = (Integer) parameters[1];
                int y = (Integer) parameters[2];
                double scale = (Double) parameters[3];
                int gmWidth = (Integer) parameters[4];
                int gmHeight = (Integer) parameters[5];

                renderer = MapTool.getFrame().getZoneRenderer(zoneGUID);
                if (renderer == null) {
                  return;
                }
                if (AppPreferences.getFitGMView()) {
                  renderer.enforceView(x, y, scale, gmWidth, gmHeight);
                } else {
                  renderer.setScale(scale);
                  renderer.centerOn(new ZonePoint(x, y));
                }
                return;

              case draw:
                zoneGUID = (GUID) parameters[0];
                Pen pen = (Pen) parameters[1];
                Drawable drawable = (Drawable) parameters[2];

                zone = MapTool.getCampaign().getZone(zoneGUID);
                zone.addDrawable(new DrawnElement(drawable, pen));
                MapTool.getFrame().refresh();
                return;

              case undoDraw:
                zoneGUID = (GUID) parameters[0];
                GUID drawableId = (GUID) parameters[1];
                zone = MapTool.getCampaign().getZone(zoneGUID);
                if (zone == null) {
                  return;
                }
                zone.removeDrawable(drawableId);
                if (MapTool.getFrame().getCurrentZoneRenderer().getZone().getId().equals(zoneGUID)
                    && zoneGUID != null) {
                  MapTool.getFrame().refresh();
                }
                return;

              case setZoneVisibility:
                zoneGUID = (GUID) parameters[0];
                boolean visible = (Boolean) parameters[1];

                zone = MapTool.getCampaign().getZone(zoneGUID);
                zone.setVisible(visible);

                ZoneRenderer currentRenderer = MapTool.getFrame().getCurrentZoneRenderer();
                if (!visible
                    && !MapTool.getPlayer().isGM()
                    && currentRenderer != null
                    && currentRenderer.getZone().getId().equals(zoneGUID)) {
                  MapTool.getFrame().setCurrentZoneRenderer(null);
                }
                if (visible && currentRenderer == null) {
                  currentRenderer = MapTool.getFrame().getZoneRenderer(zoneGUID);
                  MapTool.getFrame().setCurrentZoneRenderer(currentRenderer);
                }
                MapTool.getFrame().getZoneMiniMapPanel().flush();
                MapTool.getFrame().refresh();
                return;

              case setZoneGridSize:
                zoneGUID = (GUID) parameters[0];
                int xOffset = ((Integer) parameters[1]).intValue();
                int yOffset = ((Integer) parameters[2]).intValue();
                int size = ((Integer) parameters[3]).intValue();
                int color = ((Integer) parameters[4]).intValue();

                zone = MapTool.getCampaign().getZone(zoneGUID);
                zone.getGrid().setSize(size);
                zone.getGrid().setOffset(xOffset, yOffset);
                zone.setGridColor(color);

                MapTool.getFrame().refresh();
                return;

              case playerConnected:
                MapTool.addPlayer((Player) parameters[0]);
                MapTool.getFrame().refresh();
                return;

              case playerDisconnected:
                MapTool.removePlayer((Player) parameters[0]);
                MapTool.getFrame().refresh();
                return;

              case message:
                TextMessage message = (TextMessage) parameters[0];
                MapTool.addServerMessage(message);
                return;

              case showPointer:
                MapTool.getFrame()
                    .getPointerOverlay()
                    .addPointer((String) parameters[0], (Pointer) parameters[1]);
                MapTool.getFrame().refresh();
                return;

              case hidePointer:
                MapTool.getFrame().getPointerOverlay().removePointer((String) parameters[0]);
                MapTool.getFrame().refresh();
                return;

              case startTokenMove:
                String playerId = (String) parameters[0];
                zoneGUID = (GUID) parameters[1];
                GUID keyToken = (GUID) parameters[2];
                Set<GUID> selectedSet = (Set<GUID>) parameters[3];

                renderer = MapTool.getFrame().getZoneRenderer(zoneGUID);
                renderer.addMoveSelectionSet(playerId, keyToken, selectedSet, true);
                return;

              case stopTokenMove:
                zoneGUID = (GUID) parameters[0];
                keyToken = (GUID) parameters[1];

                renderer = MapTool.getFrame().getZoneRenderer(zoneGUID);
                renderer.removeMoveSelectionSet(keyToken);
                return;

              case updateTokenMove:
                zoneGUID = (GUID) parameters[0];
                keyToken = (GUID) parameters[1];

                x = ((Integer) parameters[2]).intValue();
                y = ((Integer) parameters[3]).intValue();

                renderer = MapTool.getFrame().getZoneRenderer(zoneGUID);
                renderer.updateMoveSelectionSet(keyToken, new ZonePoint(x, y));
                return;

              case setTokenLocation:
                // Only the table should process this
                if (MapTool.getPlayer().getName().equalsIgnoreCase("Table")) {
                  //						System.out.println("Inside
                  // ClientMethodHandler.handleMethod().setTokenLocation");
                  zoneGUID = (GUID) parameters[0];
                  keyToken = (GUID) parameters[1];

                  // This X,Y is the where the center of the token needs to be placed in
                  // relation to the screen. So 0,0 would be top left which means only 1/4
                  // of token would be drawn. 1024,768 would be lower right (on my table).
                  x = ((Integer) parameters[2]).intValue();
                  y = ((Integer) parameters[3]).intValue();

                  // Get the zone
                  zone = MapTool.getCampaign().getZone(zoneGUID);
                  // Get the token
                  token = zone.getToken(keyToken);

                  Grid grid = zone.getGrid();
                  // Convert the X/Y to the screen point
                  renderer = MapTool.getFrame().getZoneRenderer(zone);
                  CellPoint newPoint = renderer.getCellAt(new ScreenPoint(x, y));
                  ZonePoint zp2 = grid.convert(newPoint);

                  token.setX(zp2.x);
                  token.setY(zp2.y);

                  MapTool.serverCommand().putToken(zoneGUID, token);
                }
                return;

              case toggleTokenMoveWaypoint:
                zoneGUID = (GUID) parameters[0];
                keyToken = (GUID) parameters[1];
                ZonePoint zp = (ZonePoint) parameters[2];

                renderer = MapTool.getFrame().getZoneRenderer(zoneGUID);
                renderer.toggleMoveSelectionSetWaypoint(keyToken, zp);
                return;

              case setServerPolicy:
                ServerPolicy policy = (ServerPolicy) parameters[0];
                MapTool.setServerPolicy(policy);
                return;

              case addTopology:
                zoneGUID = (GUID) parameters[0];
                area = (Area) parameters[1];

                zone = MapTool.getCampaign().getZone(zoneGUID);
                zone.addTopology(area);

                MapTool.getFrame().getZoneRenderer(zoneGUID).repaint();
                return;

              case removeTopology:
                zoneGUID = (GUID) parameters[0];
                area = (Area) parameters[1];

                zone = MapTool.getCampaign().getZone(zoneGUID);
                zone.removeTopology(area);

                MapTool.getFrame().getZoneRenderer(zoneGUID).repaint();
                return;

              case renameZone:
                zoneGUID = (GUID) parameters[0];
                String name = (String) parameters[1];

                zone = MapTool.getCampaign().getZone(zoneGUID);
                if (zone != null) {
                  zone.setName(name);
                }
                return;

              case updateCampaign:
                CampaignProperties properties = (CampaignProperties) parameters[0];

                MapTool.getCampaign().replaceCampaignProperties(properties);
                MapToolFrame frame = MapTool.getFrame();
                ZoneRenderer zr = frame.getCurrentZoneRenderer();
                if (zr != null) {
                  zr.getZoneView().flush();
                  zr.repaint();
                }
                AssetManager.updateRepositoryList();

                InitiativePanel ip = frame.getInitiativePanel();
                ip.setOwnerPermissions(properties.isInitiativeOwnerPermissions());
                ip.setMovementLock(properties.isInitiativeMovementLock());
                MapTool.getFrame().getLookupTablePanel().updateView();
                return;

              case movePointer:
                String player = (String) parameters[0];
                x = (Integer) parameters[1];
                y = (Integer) parameters[2];

                Pointer pointer = MapTool.getFrame().getPointerOverlay().getPointer(player);
                if (pointer == null) {
                  return;
                }
                pointer.setX(x);
                pointer.setY(y);

                MapTool.getFrame().refresh();
                return;

              case updateInitiative:
                InitiativeList list = (InitiativeList) parameters[0];
                Boolean ownerPermission = (Boolean) parameters[1];
                if (list != null) {
                  zone = list.getZone();
                  if (zone == null) return;
                  zone.setInitiativeList(list);
                }
                if (ownerPermission != null) {
                  MapTool.getFrame()
                      .getInitiativePanel()
                      .setOwnerPermissions(ownerPermission.booleanValue());
                }
                return;

              case updateTokenInitiative:
                zoneGUID = (GUID) parameters[0];
                tokenGUID = (GUID) parameters[1];
                zone = MapTool.getCampaign().getZone(zoneGUID);
                list = zone.getInitiativeList();
                TokenInitiative ti = list.getTokenInitiative((Integer) parameters[4]);
                if (!ti.getId().equals(tokenGUID)) {
                  // Index doesn't point to same token, try to find it
                  token = zone.getToken(tokenGUID);
                  List<Integer> tokenIndex = list.indexOf(token);

                  // If token in list more than one time, punt
                  if (tokenIndex.size() != 1) return;
                  ti = list.getTokenInitiative(tokenIndex.get(0));
                } // endif
                ti.update((Boolean) parameters[2], (String) parameters[3]);
                return;

              case setUseVision:
                zoneGUID = (GUID) parameters[0];
                VisionType visionType = (VisionType) parameters[1];
                zone = MapTool.getCampaign().getZone(zoneGUID);
                if (zone != null) {
                  zone.setVisionType(visionType);
                  if (MapTool.getFrame().getCurrentZoneRenderer() != null) {
                    MapTool.getFrame().getCurrentZoneRenderer().flushFog();
                    MapTool.getFrame().getCurrentZoneRenderer().getZoneView().flush();
                  }
                  MapTool.getFrame().refresh();
                }
                return;

              case setBoard:
                zoneGUID = (GUID) parameters[0];
                zone = MapTool.getCampaign().getZone(zoneGUID);

                Point boardXY = new Point((Integer) parameters[2], (Integer) parameters[3]);
                zone.setBoard(boardXY, (MD5Key) parameters[1]);
                return;

              case updateCampaignMacros:
                MapTool.getCampaign()
                    .setMacroButtonPropertiesArray(
                        new ArrayList<MacroButtonProperties>(
                            (ArrayList<MacroButtonProperties>) parameters[0]));
                MapTool.getFrame().getCampaignPanel().reset();
                return;
                // moved this down into the event queue section so that the threading works as
                // expected

              case setLiveTypingLabel:
                if ((Boolean) parameters[1]) {
                  // add a typer
                  MapTool.getFrame()
                      .getChatNotificationTimers()
                      .setChatTyper(parameters[0].toString());
                  return;
                } else {
                  // remove typer from list
                  MapTool.getFrame()
                      .getChatNotificationTimers()
                      .removeChatTyper(parameters[0].toString());
                  return;
                }

              case exposePCArea:
                if (parameters[0] != null && parameters[0] instanceof GUID) {
                  ZoneRenderer currentRenderer1 =
                      MapTool.getFrame().getZoneRenderer((GUID) parameters[0]);
                  FogUtil.exposePCArea(currentRenderer1);
                }
                return;

              case enforceNotification:
                Boolean enforce = (Boolean) parameters[0];
                MapTool.getFrame().getCommandPanel().disableNotifyButton(enforce);
                return;

              case updateExposedAreaMeta:
                zoneGUID = (GUID) parameters[0];
                tokenGUID = (GUID) parameters[1];
                ExposedAreaMetaData meta = (ExposedAreaMetaData) parameters[2];
                zone = MapTool.getCampaign().getZone(zoneGUID);
                zone.setExposedAreaMetaData(tokenGUID, meta);
                return;
            }
          }
        });
  }
Exemplo n.º 10
0
public class TestAu extends LockssTestCase {

  public static final String NAME_VALUE = "AU Name";
  public static final String EDITION_VALUE = "Edition Value";
  public static final String EISBN_VALUE = "eISBN Value";
  public static final String ISBN_VALUE = "ISBN Value";
  public static final String PLUGIN_VALUE = "Plugin Value";
  public static final String PLUGIN_PREFIX_VALUE = "Plugin Prefix Value";
  public static final String PLUGIN_SUFFIX_VALUE = "Plugin Suffix Value";
  public static final String PROVIDER_VALUE = "Provider Value";
  public static final String PROXY_VALUE = "Proxy Value";
  public static final String RIGHTS_VALUE = "Rights Value";
  public static final String STATUS_VALUE = "Status Value";
  public static final String STATUS1_VALUE = "Status1 Value";
  public static final String STATUS2_VALUE = "Status2 Value";
  public static final String VOLUME_VALUE = "Volume Value";
  public static final String YEAR_VALUE = "Year Value";
  public static final List<String> IMPLICIT_VALUE =
      AppUtil.ul("implicit1", "implicit2", "implicit3");

  public static final String PARAM1_KEY = "p1";
  public static final String PARAM1_VALUE = "v1";
  public static final String PARAM2_KEY = "p2";
  public static final String PARAM2_VALUE = "v2";
  public static final String NONDEFPARAM1_KEY = "ndp1";
  public static final String NONDEFPARAM1_VALUE = "ndv1";
  public static final String NONDEFPARAM2_KEY = "ndp2";
  public static final String NONDEFPARAM2_VALUE = "ndv2";
  public static final String ATTR1_KEY = "attr1";
  public static final String ATTR1_VALUE = "attr1v";

  public static final String FOO_KEY = "aufookey";
  public static final String FOO_VALUE = "aufooval";

  public static final String PLUGIN1 = "org.lockss.plugin.FakePlugin";
  public static final String AUID1 =
      String.format(
          "%s&%s~%s&%s~%s",
          PLUGIN1.replace('.', '|'), PARAM1_KEY, PARAM1_VALUE, PARAM2_KEY, PARAM2_VALUE);
  public static final String AUIDPLUS1 =
      String.format(
          "%s@@@NONDEF@@@%s~%s&%s~%s",
          AUID1, NONDEFPARAM1_KEY, NONDEFPARAM1_VALUE, NONDEFPARAM2_KEY, NONDEFPARAM2_VALUE);

  public void testKeys() throws Exception {
    assertEquals("edition", Au.EDITION);
    assertEquals("eisbn", Au.EISBN);
    assertEquals("isbn", Au.ISBN);
    assertEquals("name", Au.NAME);
    assertEquals("plugin", Au.PLUGIN);
    assertEquals("pluginPrefix", Au.PLUGIN_PREFIX);
    assertEquals("pluginSuffix", Au.PLUGIN_SUFFIX);
    assertEquals("provider", Au.PROVIDER);
    assertEquals("proxy", Au.PROXY);
    assertEquals("rights", Au.RIGHTS);
    assertEquals("status", Au.STATUS);
    assertEquals("status1", Au.STATUS1);
    assertEquals("status2", Au.STATUS2);
    assertEquals("volume", Au.VOLUME);
    assertEquals("year", Au.YEAR);
  }

  public void testStatus() throws Exception {
    assertEquals("crawling", Au.STATUS_CRAWLING);
    assertEquals("deepCrawl", Au.STATUS_DEEP_CRAWL);
    assertEquals("doNotProcess", Au.STATUS_DO_NOT_PROCESS);
    assertEquals("doesNotExist", Au.STATUS_DOES_NOT_EXIST);
    assertEquals("down", Au.STATUS_DOWN);
    assertEquals("exists", Au.STATUS_EXISTS);
    assertEquals("expected", Au.STATUS_EXPECTED);
    assertEquals("finished", Au.STATUS_FINISHED);
    assertEquals("frozen", Au.STATUS_FROZEN);
    assertEquals("ingNotReady", Au.STATUS_ING_NOT_READY);
    assertEquals("manifest", Au.STATUS_MANIFEST);
    assertEquals("notReady", Au.STATUS_NOT_READY);
    assertEquals("ready", Au.STATUS_READY);
    assertEquals("readySource", Au.STATUS_READY_SOURCE);
    assertEquals("released", Au.STATUS_RELEASED);
    assertEquals("releasing", Au.STATUS_RELEASING);
    assertEquals("superseded", Au.STATUS_SUPERSEDED);
    assertEquals("testing", Au.STATUS_TESTING);
    assertEquals("wanted", Au.STATUS_WANTED);
    assertEquals("zapped", Au.STATUS_ZAPPED);
  }

  public void testEmpty() throws Exception {
    Au au = new Au();
    assertNull(au.getTitle());
    assertNull(au.getName());
    assertNull(au.getAuid());
    assertNull(au.getAuidPlus());
    assertNull(au.getComputedPlugin());
    assertNull(au.getEdition());
    assertNull(au.getEisbn());
    assertNull(au.getIsbn());
    assertNull(au.getPlugin());
    assertNull(au.getPluginPrefix());
    assertNull(au.getPluginSuffix());
    assertNull(au.getProvider());
    assertNull(au.getProxy());
    assertNull(au.getRights());
    assertNull(au.getStatus());
    assertNull(au.getStatus1());
    assertNull(au.getStatus2());
    assertNull(au.getVolume());
    assertNull(au.getYear());
    assertEmpty(au.getParams());
    assertEmpty(au.getNondefParams());
    assertEmpty(au.getAttrs());
    assertNull(au.getImplicit());
    assertNull(au.getArbitraryValue(FOO_KEY));
  }

  public void testAu() throws Exception {
    Publisher publisher = new Publisher();
    Title title = new Title(publisher);
    Au au = new Au(title);
    assertSame(title, au.getTitle());
    assertSame(publisher, au.getTitle().getPublisher());
    au.put(Au.NAME, NAME_VALUE);
    assertEquals(NAME_VALUE, au.getName());
    au.put(Au.EDITION, EDITION_VALUE);
    assertEquals(EDITION_VALUE, au.getEdition());
    au.put(Au.EISBN, EISBN_VALUE);
    assertEquals(EISBN_VALUE, au.getEisbn());
    au.put(Au.ISBN, ISBN_VALUE);
    assertEquals(ISBN_VALUE, au.getIsbn());
    au.put(Au.PROVIDER, PROVIDER_VALUE);
    assertEquals(PROVIDER_VALUE, au.getProvider());
    au.put(Au.PROXY, PROXY_VALUE);
    assertEquals(PROXY_VALUE, au.getProxy());
    au.put(Au.RIGHTS, RIGHTS_VALUE);
    assertEquals(RIGHTS_VALUE, au.getRights());
    au.put(Au.STATUS, STATUS_VALUE);
    assertEquals(STATUS_VALUE, au.getStatus());
    au.put(Au.STATUS1, STATUS1_VALUE);
    assertEquals(STATUS1_VALUE, au.getStatus1());
    au.put(Au.STATUS2, STATUS2_VALUE);
    assertEquals(STATUS2_VALUE, au.getStatus2());
    au.put(Au.VOLUME, VOLUME_VALUE);
    assertEquals(VOLUME_VALUE, au.getVolume());
    au.put(Au.YEAR, YEAR_VALUE);
    assertEquals(YEAR_VALUE, au.getYear());
    au.put(String.format("param[%s]", PARAM1_KEY), PARAM1_VALUE);
    assertEquals(PARAM1_VALUE, au.getParams().get(PARAM1_KEY));
    assertNull(au.getParams().get("X" + PARAM1_KEY));
    au.put(String.format("nondefparam[%s]", NONDEFPARAM1_KEY), NONDEFPARAM1_VALUE);
    assertEquals(NONDEFPARAM1_VALUE, au.getNondefParams().get(NONDEFPARAM1_KEY));
    assertNull(au.getNondefParams().get("X" + NONDEFPARAM1_KEY));
    au.put(String.format("attr[%s]", ATTR1_KEY), ATTR1_VALUE);
    assertEquals(ATTR1_VALUE, au.getAttrs().get(ATTR1_KEY));
    assertNull(au.getAttrs().get("X" + ATTR1_KEY));
    au.setImplicit(IMPLICIT_VALUE);
    assertIsomorphic(Arrays.asList("implicit1", "implicit2", "implicit3"), au.getImplicit());
    au.put(FOO_KEY, FOO_VALUE);
    assertEquals(FOO_VALUE, au.getArbitraryValue(FOO_KEY));
    assertNull(au.getArbitraryValue("X" + FOO_KEY));
  }

  public void testPlugin() throws Exception {
    Au au1 = new Au();
    au1.put(Au.PLUGIN, PLUGIN_VALUE);
    assertEquals(PLUGIN_VALUE, au1.getPlugin());
    assertNull(au1.getPluginPrefix());
    assertNull(au1.getPluginSuffix());
    assertEquals(PLUGIN_VALUE, au1.getComputedPlugin());

    Au au2 = new Au();
    au2.put(Au.PLUGIN_PREFIX, PLUGIN_PREFIX_VALUE);
    au2.put(Au.PLUGIN_SUFFIX, PLUGIN_SUFFIX_VALUE);
    assertNull(au2.getPlugin());
    assertEquals(PLUGIN_PREFIX_VALUE, au2.getPluginPrefix());
    assertEquals(PLUGIN_SUFFIX_VALUE, au2.getPluginSuffix());
    assertEquals(PLUGIN_PREFIX_VALUE + PLUGIN_SUFFIX_VALUE, au2.getComputedPlugin());

    // Other combinations are illegal but have the following behavior:

    Au au3 = new Au();
    au3.put(Au.PLUGIN, PLUGIN_VALUE);
    au3.put(Au.PLUGIN_PREFIX, PLUGIN_PREFIX_VALUE);
    assertEquals(PLUGIN_VALUE, au3.getPlugin());
    assertEquals(PLUGIN_PREFIX_VALUE, au3.getPluginPrefix());
    assertNull(au3.getPluginSuffix());
    assertEquals(PLUGIN_VALUE, au3.getComputedPlugin());

    Au au4 = new Au();
    au4.put(Au.PLUGIN, PLUGIN_VALUE);
    au4.put(Au.PLUGIN_SUFFIX, PLUGIN_SUFFIX_VALUE);
    assertEquals(PLUGIN_VALUE, au4.getPlugin());
    assertNull(au4.getPluginPrefix());
    assertEquals(PLUGIN_SUFFIX_VALUE, au4.getPluginSuffix());
    assertEquals(PLUGIN_VALUE, au4.getComputedPlugin());

    Au au5 = new Au();
    au5.put(Au.PLUGIN_PREFIX, PLUGIN_PREFIX_VALUE);
    assertNull(au5.getPlugin());
    assertEquals(PLUGIN_PREFIX_VALUE, au5.getPluginPrefix());
    assertNull(au5.getPluginSuffix());
    assertNull(au5.getComputedPlugin());

    Au au6 = new Au();
    au6.put(Au.PLUGIN_SUFFIX, PLUGIN_SUFFIX_VALUE);
    assertNull(au6.getPlugin());
    assertNull(au6.getPluginPrefix());
    assertEquals(PLUGIN_SUFFIX_VALUE, au6.getPluginSuffix());
    assertNull(au6.getComputedPlugin());
  }

  public void testAuid() throws Exception {
    Au au1 = new Au();
    au1.put(Au.PLUGIN, PLUGIN1);
    au1.put(String.format("param[%s]", PARAM1_KEY), PARAM1_VALUE);
    au1.put(String.format("param[%s]", PARAM2_KEY), PARAM2_VALUE);
    assertEquals(AUID1, au1.getAuid());
    assertEquals(AUID1, au1.getAuidPlus());

    Au au2 = new Au();
    au2.put(Au.PLUGIN, PLUGIN1);
    au2.put(String.format("param[%s]", PARAM1_KEY), PARAM1_VALUE);
    au2.put(String.format("param[%s]", PARAM2_KEY), PARAM2_VALUE);
    au2.put(String.format("nondefparam[%s]", NONDEFPARAM1_KEY), NONDEFPARAM1_VALUE);
    au2.put(String.format("nondefparam[%s]", NONDEFPARAM2_KEY), NONDEFPARAM2_VALUE);
    assertEquals(AUID1, au2.getAuid());
    assertEquals(AUIDPLUS1, au2.getAuidPlus());
  }

  public void testNesting() throws Exception {
    Au au1 = new Au();
    au1.put(Au.EISBN, EISBN_VALUE);
    au1.put(String.format("param[%s]", PARAM1_KEY), PARAM1_VALUE);
    au1.put(FOO_KEY, FOO_VALUE);
    au1.setImplicit(IMPLICIT_VALUE);
    Au au2 = new Au(au1);
    au2.put(Au.ISBN, ISBN_VALUE);
    au2.put(String.format("nondefparam[%s]", NONDEFPARAM1_KEY), NONDEFPARAM1_VALUE);
    Au au3 = new Au(au2);
    au3.put(Au.PLUGIN, PLUGIN_VALUE);
    au3.put(String.format("attr[%s]", ATTR1_KEY), ATTR1_VALUE);
    assertEquals(EISBN_VALUE, au3.getEisbn());
    assertEquals(ISBN_VALUE, au3.getIsbn());
    assertEquals(PLUGIN_VALUE, au3.getPlugin());
    assertEquals(PLUGIN_VALUE, au3.getComputedPlugin());
    assertEquals(PARAM1_VALUE, au3.getParams().get(PARAM1_KEY));
    assertEquals(NONDEFPARAM1_VALUE, au3.getNondefParams().get(NONDEFPARAM1_KEY));
    assertEquals(ATTR1_VALUE, au3.getAttrs().get(ATTR1_KEY));
    assertIsomorphic(Arrays.asList("implicit1", "implicit2", "implicit3"), au3.getImplicit());
    assertEquals(FOO_VALUE, au3.getArbitraryValue(FOO_KEY));
    assertNull(au3.getArbitraryValue("X" + FOO_KEY));
  }

  public void testTraitFunctors() throws Exception {
    // Make a publisher
    Map<String, String> publisherMap = new LinkedHashMap<String, String>();
    Publisher publisher = new Publisher(publisherMap);

    // Make a title with that publisher
    Map<String, String> titleMap = new LinkedHashMap<String, String>();
    Title title = new Title(publisher, titleMap);

    // Make an AU with that title
    Au au = new Au(title);

    // Test AU traits
    au.put(Au.EDITION, EDITION_VALUE);
    assertEquals(EDITION_VALUE, Au.traitFunctor("au:edition").apply(au));
    assertSame(Au.traitFunctor("au:edition"), Au.traitFunctor("edition"));
    au.put(Au.EISBN, EISBN_VALUE);
    assertEquals(EISBN_VALUE, Au.traitFunctor("au:eisbn").apply(au));
    assertSame(Au.traitFunctor("au:eisbn"), Au.traitFunctor("eisbn"));
    au.put(Au.ISBN, ISBN_VALUE);
    assertEquals(ISBN_VALUE, Au.traitFunctor("au:isbn").apply(au));
    assertSame(Au.traitFunctor("au:isbn"), Au.traitFunctor("isbn"));
    au.put(Au.NAME, NAME_VALUE);
    assertEquals(NAME_VALUE, Au.traitFunctor("au:name").apply(au));
    assertSame(Au.traitFunctor("au:name"), Au.traitFunctor("name"));
    au.put(Au.PROVIDER, PROVIDER_VALUE);
    assertEquals(PROVIDER_VALUE, Au.traitFunctor("au:provider").apply(au));
    assertSame(Au.traitFunctor("au:provider"), Au.traitFunctor("provider"));
    au.put(Au.PROXY, PROXY_VALUE);
    assertEquals(PROXY_VALUE, Au.traitFunctor("au:proxy").apply(au));
    assertSame(Au.traitFunctor("au:proxy"), Au.traitFunctor("proxy"));
    au.put(Au.RIGHTS, RIGHTS_VALUE);
    assertEquals(RIGHTS_VALUE, Au.traitFunctor("au:rights").apply(au));
    assertSame(Au.traitFunctor("au:rights"), Au.traitFunctor("rights"));
    au.put(Au.STATUS, STATUS_VALUE);
    assertEquals(STATUS_VALUE, Au.traitFunctor("au:status").apply(au));
    assertSame(Au.traitFunctor("au:status"), Au.traitFunctor("status"));
    au.put(Au.STATUS1, STATUS1_VALUE);
    assertEquals(STATUS1_VALUE, Au.traitFunctor("au:status1").apply(au));
    assertSame(Au.traitFunctor("au:status1"), Au.traitFunctor("status1"));
    au.put(Au.STATUS2, STATUS2_VALUE);
    assertEquals(STATUS2_VALUE, Au.traitFunctor("au:status2").apply(au));
    assertSame(Au.traitFunctor("au:status2"), Au.traitFunctor("status2"));
    au.put(Au.VOLUME, VOLUME_VALUE);
    assertEquals(VOLUME_VALUE, Au.traitFunctor("au:volume").apply(au));
    assertSame(Au.traitFunctor("au:volume"), Au.traitFunctor("volume"));
    au.put(Au.YEAR, YEAR_VALUE);
    assertEquals(YEAR_VALUE, Au.traitFunctor("au:year").apply(au));
    assertSame(Au.traitFunctor("au:year"), Au.traitFunctor("year"));
    au.put(String.format("param[%s]", PARAM1_KEY), PARAM1_VALUE);
    assertEquals(
        PARAM1_VALUE, Au.traitFunctor(String.format("au:param[%s]", PARAM1_KEY)).apply(au));
    assertEquals(PARAM1_VALUE, Au.traitFunctor(String.format("param[%s]", PARAM1_KEY)).apply(au));
    au.put(String.format("nondefparam[%s]", NONDEFPARAM1_KEY), NONDEFPARAM1_VALUE);
    assertEquals(
        NONDEFPARAM1_VALUE,
        Au.traitFunctor(String.format("au:nondefparam[%s]", NONDEFPARAM1_KEY)).apply(au));
    assertEquals(
        NONDEFPARAM1_VALUE,
        Au.traitFunctor(String.format("nondefparam[%s]", NONDEFPARAM1_KEY)).apply(au));
    au.put(String.format("attr[%s]", ATTR1_KEY), ATTR1_VALUE);
    assertEquals(ATTR1_VALUE, Au.traitFunctor(String.format("au:attr[%s]", ATTR1_KEY)).apply(au));
    assertEquals(ATTR1_VALUE, Au.traitFunctor(String.format("attr[%s]", ATTR1_KEY)).apply(au));
    au.put(FOO_KEY, FOO_VALUE);
    assertEquals(FOO_VALUE, Au.traitFunctor(String.format("au:%s", FOO_KEY)).apply(au));
    assertNull(Au.traitFunctor(FOO_KEY));

    au.put(Au.PLUGIN, PLUGIN1);
    assertEquals(PLUGIN1, Au.traitFunctor("au:plugin").apply(au));
    assertSame(Au.traitFunctor("au:plugin"), Au.traitFunctor("plugin"));
    au.put(String.format("param[%s]", PARAM2_KEY), PARAM2_VALUE);
    au.put(String.format("nondefparam[%s]", NONDEFPARAM2_KEY), NONDEFPARAM2_VALUE);
    assertEquals(AUID1, Au.traitFunctor("au:auid").apply(au));
    assertSame(Au.traitFunctor("au:auid"), Au.traitFunctor("auid"));
    assertEquals(AUIDPLUS1, Au.traitFunctor("au:auidplus").apply(au));
    assertSame(Au.traitFunctor("au:auidplus"), Au.traitFunctor("auidplus"));

    au.put(Au.PLUGIN_PREFIX, PLUGIN_PREFIX_VALUE);
    assertEquals(PLUGIN_PREFIX_VALUE, Au.traitFunctor("au:pluginPrefix").apply(au));
    assertSame(Au.traitFunctor("au:pluginPrefix"), Au.traitFunctor("pluginPrefix"));
    au.put(Au.PLUGIN_SUFFIX, PLUGIN_SUFFIX_VALUE);
    assertEquals(PLUGIN_SUFFIX_VALUE, Au.traitFunctor("au:pluginSuffix").apply(au));
    assertSame(Au.traitFunctor("au:pluginSuffix"), Au.traitFunctor("pluginSuffix"));

    // Test title traits
    titleMap.put(Title.NAME, TestTitle.NAME_VALUE);
    assertEquals(TestTitle.NAME_VALUE, Au.traitFunctor("title:name").apply(au));
    assertSame(Au.traitFunctor("title:name"), Au.traitFunctor("title"));
    titleMap.put(Title.DOI, TestTitle.DOI_VALUE);
    assertEquals(TestTitle.DOI_VALUE, Au.traitFunctor("title:doi").apply(au));
    assertSame(Au.traitFunctor("title:doi"), Au.traitFunctor("doi"));
    titleMap.put(Title.EISSN, TestTitle.EISSN_VALUE);
    assertEquals(TestTitle.EISSN_VALUE, Au.traitFunctor("title:eissn").apply(au));
    assertSame(Au.traitFunctor("title:eissn"), Au.traitFunctor("eissn"));
    titleMap.put(Title.ISSN, TestTitle.ISSN_VALUE);
    assertEquals(TestTitle.ISSN_VALUE, Au.traitFunctor("title:issn").apply(au));
    assertSame(Au.traitFunctor("title:issn"), Au.traitFunctor("issn"));
    titleMap.put(Title.ISSNL, TestTitle.ISSNL_VALUE);
    assertEquals(TestTitle.ISSNL_VALUE, Au.traitFunctor("title:issnl").apply(au));
    assertSame(Au.traitFunctor("title:issnl"), Au.traitFunctor("issnl"));
    titleMap.put(Title.TYPE, TestTitle.TYPE_VALUE);
    assertEquals(TestTitle.TYPE_VALUE, Au.traitFunctor("title:type").apply(au));
    assertSame(Au.traitFunctor("title:type"), Au.traitFunctor("type"));
    titleMap.put(TestTitle.FOO_KEY, TestTitle.FOO_VALUE);
    assertEquals(
        TestTitle.FOO_VALUE,
        Au.traitFunctor(String.format("title:%s", TestTitle.FOO_KEY)).apply(au));
    assertNull(Au.traitFunctor(String.format("title:X%s", TestTitle.FOO_KEY)).apply(au));

    // Test publisher traits
    publisherMap.put(Publisher.NAME, TestPublisher.NAME_VALUE);
    assertEquals(TestPublisher.NAME_VALUE, Au.traitFunctor("publisher:name").apply(au));
    assertSame(Au.traitFunctor("publisher:name"), Au.traitFunctor("publisher"));
    publisherMap.put(TestPublisher.FOO_KEY, TestPublisher.FOO_VALUE);
    assertEquals(
        TestPublisher.FOO_VALUE,
        Au.traitFunctor(String.format("publisher:%s", TestPublisher.FOO_KEY)).apply(au));
    assertNull(Au.traitFunctor(String.format("publisher:X%s", TestPublisher.FOO_KEY)).apply(au));
  }
}
  public HolyWarScene(Context context, String[] spirits) {
    super(context);

    // ±³¾° ³õʼ»¯
    Spirit bgSpirit =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), R.drawable.castle_bg), 0, 0, 0, 0, null);
    addSpirit(bgSpirit);

    this.spiritsName = spirits;
    this.spiritsImage = AppUtil.getBuidingImgId(this.spiritsName);
    // 1#µØ¿é
    Spirit spirit1 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[0]),
            225,
            26,
            0,
            0,
            "onTouchEvent1");
    addSpirit(spirit1);

    // 2#µØ¿é
    Spirit spirit2 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[1]),
            300,
            30,
            0,
            0,
            "onTouchEvent2");
    addSpirit(spirit2);

    // 3#µØ¿é
    Spirit spirit3 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[2]),
            379,
            103,
            0,
            0,
            "onTouchEvent3");
    addSpirit(spirit3);

    // 4#µØ¿é
    Spirit spirit4 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[3]),
            149,
            45,
            0,
            0,
            "onTouchEvent4");
    addSpirit(spirit4);

    // 5#µØ¿é
    Spirit spirit5 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[4]),
            91,
            80,
            0,
            0,
            "onTouchEvent5");
    addSpirit(spirit5);

    // 6#µØ¿é
    Spirit spirit6 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[5]),
            40,
            120,
            0,
            0,
            "onTouchEvent6");
    addSpirit(spirit6);

    // 7#µØ¿é
    Spirit spirit7 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[6]),
            212,
            85,
            0,
            0,
            "onTouchEvent7");
    addSpirit(spirit7);

    // 8#µØ¿é
    Spirit spirit8 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[7]),
            163,
            128,
            0,
            0,
            "onTouchEvent8");
    addSpirit(spirit8);

    // 9#µØ¿é
    Spirit spirit9 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[8]),
            100,
            150,
            0,
            0,
            "onTouchEvent9");
    addSpirit(spirit9);

    // 10#µØ¿é
    Spirit spirit10 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[9]),
            300,
            130,
            0,
            0,
            "onTouchEvent10");
    addSpirit(spirit10);

    // 11#µØ¿é
    Spirit spirit11 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[10]),
            246,
            175,
            0,
            0,
            "onTouchEvent11");
    addSpirit(spirit11);

    // 12#µØ¿é
    Spirit spirit12 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[11]),
            180,
            220,
            0,
            0,
            "onTouchEvent12");
    addSpirit(spirit12);

    // 13#µØ¿é
    Spirit spirit13 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[12]),
            364,
            171,
            0,
            0,
            "onTouchEvent13");
    addSpirit(spirit13);

    // 14#µØ¿é
    Spirit spirit14 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[13]),
            304,
            220,
            0,
            0,
            "onTouchEvent14");
    addSpirit(spirit14);

    // 15#µØ¿é
    Spirit spirit15 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[14]),
            240,
            265,
            0,
            0,
            "onTouchEvent15");
    addSpirit(spirit15);

    // 16#µØ¿é
    Spirit spirit16 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[15]),
            400,
            230,
            0,
            0,
            "onTouchEvent16");
    addSpirit(spirit16);

    // 17#µØ¿é
    Spirit spirit17 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[16]),
            45,
            10,
            0,
            0,
            "onTouchEvent17");
    addSpirit(spirit17);

    // 18#µØ¿é
    Spirit spirit18 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[17]),
            49,
            178,
            0,
            0,
            "onTouchEvent18");
    addSpirit(spirit18);

    // 19#µØ¿é
    Spirit spirit19 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[18]),
            100,
            215,
            0,
            0,
            "onTouchEvent19");
    addSpirit(spirit19);

    // 20#µØ¿é
    Spirit spirit20 =
        new Spirit(
            BitmapFactory.decodeResource(getResources(), spiritsImage[19]),
            196,
            278,
            0,
            0,
            "onTouchEvent20");
    addSpirit(spirit20);
  }