Package net.alteiar.documents

Examples of net.alteiar.documents.BeanDocument


  }

  private class AuthorizationChangeListener extends AuthorizationAdapter {
    @Override
    public void authorizationChanged(PropertyChangeEvent evt) {
      BeanDocument bean = (BeanDocument) evt.getSource();
      if (bean.isAllowedToSee(CampaignClient.getInstance()
          .getCurrentPlayer())) {
        addElement(bean, new PanelDocumentDescription(bean));
      } else {
        removeElement(bean);
      }
View Full Code Here


      }
    }
  }

  public BeanDocument getSelectedBattle() {
    BeanDocument battle = null;
    int battleIdx = this.getSelectedIndex() - 1;
    if (battleIdx >= 0) {
      battle = findBattleFromName(this.getTitleAt(battleIdx));
    }
    return battle;
View Full Code Here

      }
    }
  }

  private BeanDocument findBattleFromName(String name) {
    BeanDocument finded = null;
    for (BeanDocument battle : CampaignClient.getInstance().getDocuments()) {
      if (isBattle(battle) && battle.getDocumentName().equals(name)) {
        finded = battle;
        break;
      }
View Full Code Here

      fail("exception should'nt occur");
    }

    assertNotNull("Map should'nt be null", map);

    BeanDocument doc = new BeanDocument(CampaignClient.getInstance()
        .getRootDirectory(), targetName, "document-type", map);

    doc = addBean(doc);
    map = doc.getBean();

    Scale newScale = new Scale(map.getScale().getPixels() + 5, map
        .getScale().getMeter());
    map.setScale(newScale);

    Integer newWidth = map.getWidth() + 5;
    map.setWidth(newWidth);

    Integer newHeight = map.getHeight() + 5;
    map.setHeight(newHeight);

    ImageBean imageBean = createBeanImage();

    CampaignClient.getInstance().addBean(imageBean);
    UniqueID newImage = imageBean.getId();

    map.setBackground(newImage);

    UniqueID newFilter = new UniqueID();
    map.setFilter(newFilter);

    HashSet<UniqueID> set = new HashSet<UniqueID>();
    set.add(new UniqueID());
    set.add(new UniqueID());
    map.setElements(set);

    waitForChange(map, "getScale", newScale);
    waitForChange(map, "getWidth", newWidth);
    waitForChange(map, "getHeight", newHeight);
    waitForChange(map, "getBackground", newImage);
    waitForChange(map, "getFilter", newFilter);
    waitForChange(map, "getElements", set);

    // Remove the battle
    CampaignClient.getInstance().removeBean(doc);

    long begin = System.currentTimeMillis();
    long current = System.currentTimeMillis();
    while (CampaignClient.getInstance().getBean(doc.getBeanId()) != null
        && (current - begin) < timeout) {
      sleep();
      current = System.currentTimeMillis();
    }
  }
View Full Code Here

    return getBeans(bean);
  }

  protected BeanDocument addBean(BeanDocument bean) {
    CampaignClient.getInstance().addBean(bean);
    BeanDocument b = getBeans(bean);
    assertNotNull("The bean should'nt be null", b);

    long begin = System.currentTimeMillis();
    long end = System.currentTimeMillis();
    BasicBean beanRec = b.getBean();
    while (beanRec == null && (end - begin) < getTimeout()) {
      beanRec = b.getBean();
      end = System.currentTimeMillis();
      sleep(50);
    }
    assertNotNull("The internal bean should'nt be null", beanRec);
View Full Code Here

    return getBeans(bean);
  }

  protected BeanDocument addBean(BeanDocument bean) {
    CampaignClient.getInstance().addBean(bean);
    BeanDocument b = getBeans(bean);
    assertNotNull("The bean should'nt be null", b);

    long begin = System.currentTimeMillis();
    long end = System.currentTimeMillis();
    BasicBean beanRec = b.getBean();
    while (beanRec == null && (end - begin) < getTimeout()) {
      beanRec = b.getBean();
      end = System.currentTimeMillis();
      sleep(50);
    }
    assertNotNull("The internal bean should'nt be null", beanRec);
    return b;
View Full Code Here

    Integer acTouch = 12;
    Integer initMod = 2;
    PathfinderCharacter character = new PathfinderCharacter("test-name",
        totalHp, currentHp, ac, acTouch, acFlat, initMod, img.getId());

    BeanDocument doc = new BeanDocument(CampaignClient.getInstance()
        .getRootDirectory(), character.getName(),
        DocumentTypeConstant.CHARACTER, character);

    doc = addBean(doc);

    character = doc.getBean();

    assertEquals("Total hp should be same", totalHp, character.getTotalHp());
    assertEquals("Current hp should be same", currentHp,
        character.getCurrentHp());
    assertEquals("ac should be same", ac, character.getAc());
View Full Code Here

TOP

Related Classes of net.alteiar.documents.BeanDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.