/** * 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); }
@Override protected void doPerformAction() { Map currentMap = editor.getCurrentMap(); currentMap.addLayer(); editor.setCurrentLayer(currentMap.getTotalLayers() - 1); }
public void moveMap(int x, int y) { // snap! inner.setLocation( (int) (x * (currentMap.getTileWidth() * zoom)), (int) (y * (currentMap.getTileHeight() * zoom))); }