Ejemplo n.º 1
0
 protected void paste() {
   final Decorator c =
       (Decorator) GameModule.getGameModule().createPiece(clipBoard.getType(), null);
   if (c instanceof PlaceMarker) {
     ((PlaceMarker) c).updateGpId(GameModule.getGameModule().getGpIdSupport());
   }
   c.setInner((GamePiece) inUseModel.lastElement());
   inUseModel.addElement(c);
   c.mySetState(clipBoard.getState());
   refresh();
 }
Ejemplo n.º 2
0
  protected void addTrait(Decorator c) {
    final Class<? extends Decorator> cClass = c.getClass();
    Decorator d = null;
    try {
      d = cClass.getConstructor().newInstance();
    } catch (Throwable t) {
      ReflectionUtils.handleNewInstanceFailure(t, cClass);
    }

    if (d != null) {
      if (d instanceof PlaceMarker) {
        ((PlaceMarker) d).updateGpId(gpidSupport);
      }
      d.setInner((GamePiece) inUseModel.lastElement());
      inUseModel.addElement(d);
      setChanged(true);
    }

    refresh();
  }