コード例 #1
0
  /**
   * Wraps {@link #doPerformAction} in order to capture the layer vector before and after the action
   * is performed.
   */
  @Override
  public final void actionPerformed(ActionEvent e) {
    // Capture the layers before the operation is executed.
    Map map = editor.getCurrentMap();
    Vector<MapLayer> layersBefore = new Vector<MapLayer>(map.getLayerVector());

    doPerformAction();

    // Capture the layers after the operation is executed and create the
    // layer state edit instance.
    Vector<MapLayer> layersAfter = new Vector<MapLayer>(map.getLayerVector());
    MapLayerStateEdit mapLayerStateEdit =
        new MapLayerStateEdit(map, layersBefore, layersAfter, e.getActionCommand());
    editor.getUndoSupport().postEdit(mapLayerStateEdit);
  }
コード例 #2
0
ファイル: AddLayerAction.java プロジェクト: abtplouton/YAams
 @Override
 protected void doPerformAction() {
   Map currentMap = editor.getCurrentMap();
   currentMap.addLayer();
   editor.setCurrentLayer(currentMap.getTotalLayers() - 1);
 }
コード例 #3
0
ファイル: ResizePanel.java プロジェクト: abtplouton/YAams
 public void moveMap(int x, int y) {
   // snap!
   inner.setLocation(
       (int) (x * (currentMap.getTileWidth() * zoom)),
       (int) (y * (currentMap.getTileHeight() * zoom)));
 }