示例#1
0
  /*
   * (non-Javadoc)
   *
   * @see maptool.client.Tool#attachTo(maptool.client.ZoneRenderer)
   */
  @Override
  protected void attachTo(ZoneRenderer renderer) {
    oldShowGrid = AppState.isShowGrid();
    AppState.setShowGrid(true);

    Grid grid = renderer.getZone().getGrid();

    boolean showSecond =
        grid.getCapabilities().isSecondDimensionAdjustmentSupported() ? true : false;
    gridSecondDimension.setVisible(showSecond);
    gridSecondDimensionLabel.setVisible(showSecond);

    MapTool.getFrame().showControlPanel(controlPanel);
    renderer.repaint();

    super.attachTo(renderer);

    copyGridToControlPanel();
  }
示例#2
0
  /*
   * (non-Javadoc)
   *
   * @see maptool.client.Tool#detachFrom(maptool.client.ZoneRenderer)
   */
  @Override
  protected void detachFrom(ZoneRenderer renderer) {
    AppState.setShowGrid(oldShowGrid);
    MapTool.getFrame().hideControlPanel();
    renderer.repaint();

    // Commit the grid size change
    Zone zone = renderer.getZone();
    MapTool.serverCommand()
        .setZoneGridSize(
            zone.getId(),
            zone.getGrid().getOffsetX(),
            zone.getGrid().getOffsetY(),
            zone.getGrid().getSize(),
            zone.getGridColor());

    super.detachFrom(renderer);
  }