Example #1
0
  private void appendEntities(Room room, NodeList creatures, DeferredStorage.StorageType type)
      throws FactoryException {
    for (int c = 0; c < creatures.getLength(); ++c) {
      Node creatureLink = creatures.item(c);

      String strX = FactoryUtils.getValue(creatureLink, Attributes.ATTR_X);
      String strY = FactoryUtils.getValue(creatureLink, Attributes.ATTR_Y);
      String id = FactoryUtils.getValue(creatureLink, Attributes.ATTR_ID);
      int x = Integer.parseInt(strX);
      int y = Integer.parseInt(strY);

      storage.add(room, id, type, x, y);
    }
  }
Example #2
0
  @Override
  public Room create(Node node) throws FactoryException {

    Room room = null;

    String id = FactoryUtils.getValue(node, Attributes.ATTR_ID);
    String name = FactoryUtils.getValue(node, Attributes.ATTR_NAME);
    String message = FactoryUtils.getValue(node, Attributes.ATTR_MESSAGE);
    FactoryUtils.validateId(id, adventure);

    appendChildren(room, node);

    return room;
  }
Example #3
0
  @Override
  protected void decorateView(
      View containerView,
      View view,
      IAdaptable semanticAdapter,
      String semanticHint,
      int index,
      boolean persisted) {

    super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);

    // Create the region compartment
    IAdaptable eObjectAdapter = null;
    EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
    if (eObject != null) {
      eObjectAdapter = new EObjectAdapter(eObject);
    }
    FactoryUtils.createLabel(view, SemanticHints.REGION_NAME);

    getViewService()
        .createNode(
            eObjectAdapter,
            view,
            SemanticHints.REGION_COMPARTMENT,
            ViewUtil.APPEND,
            true,
            getPreferencesHint());
  }