001 /* 002 * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. 003 * Copyright (C) 2000-2011 The Gridarta Developers. 004 * 005 * This program is free software; you can redistribute it and/or modify 006 * it under the terms of the GNU General Public License as published by 007 * the Free Software Foundation; either version 2 of the License, or 008 * (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU General Public License for more details. 014 * 015 * You should have received a copy of the GNU General Public License along 016 * with this program; if not, write to the Free Software Foundation, Inc., 017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 018 */ 019 020 package net.sf.gridarta.gui.misc; 021 022 import java.awt.Frame; 023 import net.sf.gridarta.gui.dialog.help.Help; 024 import net.sf.gridarta.utils.ActionUtils; 025 import net.sf.japi.swing.action.ActionBuilder; 026 import net.sf.japi.swing.action.ActionBuilderFactory; 027 import net.sf.japi.swing.action.ActionMethod; 028 import net.sf.japi.swing.tod.TipOfTheDayManager; 029 import org.jetbrains.annotations.NotNull; 030 031 /** 032 * Actions that are related to displaying help information. 033 * @author Andreas Kirschbaum 034 */ 035 public class HelpActions { 036 037 /** 038 * The main view {@link Frame}. 039 */ 040 @NotNull 041 private final Frame mainViewFrame; 042 043 /** 044 * Creates a new instance. 045 * @param mainViewFrame the main view frame 046 */ 047 public HelpActions(@NotNull final Frame mainViewFrame) { 048 this.mainViewFrame = mainViewFrame; 049 final ActionBuilder actionBuilder = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); 050 ActionUtils.newActions(actionBuilder, "Help", this, "showHelp", "tipOfTheDay"); 051 } 052 053 /** 054 * Action for creating a new project. 055 */ 056 @ActionMethod 057 public void showHelp() { 058 new Help(mainViewFrame, "start.html").setVisible(true); 059 } 060 061 /** 062 * Action for creating a new project. 063 */ 064 @ActionMethod 065 public void tipOfTheDay() { 066 TipOfTheDayManager.show(mainViewFrame); 067 } 068 069 }