/*
** $Id: SchemaActionFactory.java,v 1.4 2000/10/21 16:24:03 mrw Exp $
**
** Create Action instances for the schema view.
**
** Mike Wilson, September 2000, mrw@whisperingwind.co.uk
**
** (C) Copyright 2000, Mike Wilson, Reading, Berkshire, UK
**
** This program 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.
**
** This program 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 Library General
** Public License along with this library; if not, write to the
** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
** Boston, MA 02111-1307 USA.
*/
package uk.co.whisperingwind.vienna;
import java.awt.Event;
import javax.swing.Action;
import javax.swing.KeyStroke;
import uk.co.whisperingwind.framework.ActionFactory;
public class SchemaActionFactory extends ActionFactory
{
public SchemaActionFactory (String path)
{
super (path);
}
public DefaultAction createAction (String command)
{
DefaultAction action = null;
if (command.equals ("new"))
action = new NewAction ();
else if (command.equals ("close"))
action = new CloseAction ();
else if (command.equals ("table"))
action = new TableAction ();
else if (command.equals ("view"))
action = new ViewAction ();
else if (command.equals ("synonym"))
action = new SynonymAction ();
else if (command.equals ("sequence"))
action = new SequenceAction ();
return action;
}
private class NewAction extends ActionFactory.DefaultAction
{
public NewAction ()
{
super ("New");
putValue (Action.NAME, "New window");
putValue (Action.SMALL_ICON, getIcon ("New16.gif"));
putValue (DefaultAction.LARGE_ICON, getIcon ("New24.gif"));
putValue (DefaultAction.TOOL_TIP, "New window");
putValue (DefaultAction.MNEMONIC_KEY, new Integer ('N'));
putValue (DefaultAction.ACTION_COMMAND_KEY, "new");
putValue (DefaultAction.ACCELERATOR_KEY,
KeyStroke.getKeyStroke ('N', Event.CTRL_MASK, false));
}
}
private class CloseAction extends DefaultAction
{
public CloseAction ()
{
super ("Close");
putValue (Action.NAME, "Close window");
putValue (DefaultAction.TOOL_TIP, "Close window");
putValue (DefaultAction.MNEMONIC_KEY, new Integer ('W'));
putValue (DefaultAction.ACTION_COMMAND_KEY, "close");
putValue (DefaultAction.ACCELERATOR_KEY,
KeyStroke.getKeyStroke ('W', Event.CTRL_MASK, false));
}
}
private class TableAction extends ToggleAction
{
public TableAction ()
{
super ("Table");
putValue (Action.NAME, "Show tables");
putValue (DefaultAction.TOOL_TIP, "Show tables");
putValue (DefaultAction.ACTION_COMMAND_KEY, "viewtable");
}
}
private class ViewAction extends ToggleAction
{
public ViewAction ()
{
super ("View");
putValue (Action.NAME, "Show views");
putValue (DefaultAction.TOOL_TIP, "Show views");
putValue (DefaultAction.ACTION_COMMAND_KEY, "viewview");
}
}
private class SynonymAction extends ToggleAction
{
public SynonymAction ()
{
super ("Synonym");
putValue (Action.NAME, "Show synonyms");
putValue (DefaultAction.TOOL_TIP, "Show synonyms");
putValue (DefaultAction.ACTION_COMMAND_KEY, "viewsynonym");
}
}
private class SequenceAction extends ToggleAction
{
public SequenceAction ()
{
super ("Sequence");
putValue (Action.NAME, "Show sequences");
putValue (DefaultAction.TOOL_TIP, "Show sequences");
putValue (DefaultAction.ACTION_COMMAND_KEY, "viewsequence");
}
}
}
|