Ejemplo n.º 1
0
 @SuppressWarnings("unchecked")
 void doHierarchial(Consumer<? super AWTGrid> consumer) {
   consumer.accept(this);
   if (hasStateChildrenImpl()) {
     for (Grid g : getChildren()) {
       ((AWTGrid) g).doHierarchial(consumer);
     }
   }
 }
Ejemplo n.º 2
0
  private void evalutateChangeImpl(AWTGrid sender, PlayContext context) {
    if (isGreatParentImpl()) {
      return;
    }
    GridCoord coord = sender.getCoord();
    if (coord == null) {
      return;
    }
    GridCollection peers = getPeers();
    AWTGrid grid = (AWTGrid) peers.getGrid(coord);
    final boolean locked = (grid.getStates() & States.LOCKED) != 0;
    peers.forEach(
        new Consumer<Grid>() {

          @Override
          public void accept(Grid t) {
            if (t instanceof AWTGrid) {
              AWTGrid g = ((AWTGrid) t);
              g.doHierarchial(
                  new Consumer<AWTGrid>() {

                    @Override
                    public void accept(AWTGrid t) {
                      t.setStatePlayableAndFilteredImpl(locked);
                    }
                  });
            }
          }
        });
    if (!locked) {
      grid.doHierarchial(
          new Consumer<AWTGrid>() {

            @Override
            public void accept(AWTGrid t) {
              t.setStatePlayableAndFilteredImpl(true);
            }
          });
    }
  }