/* This file is part of CivQuest.
*
* CivQuest is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* CivQuest is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CivQuest; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: PrintFieldInfoAction.java 628 2005-07-14 16:44:57Z wpausch $
*/
package civquest.swing.quadmap.genericActions;
import civquest.core.GameDataAccessor;
import civquest.io.Messages;
import civquest.map.Field;
import civquest.map.FieldReader;
import civquest.swing.quadmap.QuadMap;
import java.awt.Point;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import swifu.main.AbstractFunctionAction;
import swifu.main.FunctionActionEvent;
/** Prints some information about the field at the given position.
*
*/
public class PrintFieldInfoAction extends AbstractFunctionAction {
private QuadMap quadMap;
public PrintFieldInfoAction(QuadMap quadMap) {
this.quadMap = quadMap;
}
public void actionPerformed(FunctionActionEvent e) {
Point position = e.getPosition();
if (position != null) {
Field field = quadMap.getFieldAtPosition(position);
if (field != null) {
GameDataAccessor gameData = quadMap.getGameData();
FieldReader fieldReader = gameData.getFieldReader();
Messages messages = Messages.getMessages();
messages.info("MoveUnitsToWF", "FieldProp", "Information about field at coord "
+ field.getPosition() + ": " + field);
}
} else {
Messages messages = Messages.getMessages();
messages.info("MoveUnitsToWF", "FieldProp", "No field at " + position);
}
}
}