/** * Jexer - Java Text User Interface * * Version: $Id$ * * Author: Kevin Lamonte, kevin.lamonte@gmail.com * * License: LGPLv3 or later * * Copyright: This module is licensed under the GNU Lesser General * Public License Version 3. Please see the file "COPYING" in this * directory for more information about the GNU Lesser General Public * License Version 3. * * Copyright (C) 2015 Kevin Lamonte * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 3 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 Lesser General Public * License along with this program; if not, see * http://www.gnu.org/licenses/, or write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ package jexer; /** * This class encapsulates several kinds of user commands. A user command * can be generated by a menu action or keyboard accelerator. */ public class TCommand { public enum Type { /** * Immediately abort the application (e.g. remote side closed * connection) */ ABORT, /** * File open dialog */ OPEN, /** * Exit application */ EXIT, /** * Spawn OS shell window */ SHELL, /** * Cut selected text and copy to the clipboard */ CUT, /** * Copy selected text to clipboard */ COPY, /** * Paste from clipboard */ PASTE, /** * Clear selected text without copying it to the clipboard */ CLEAR, /** * Tile windows */ TILE, /** * Cascade windows */ CASCADE, /** * Close all windows */ CLOSE_ALL, /** * Move (move/resize) window */ WINDOW_MOVE, /** * Zoom (maximize/restore) window */ WINDOW_ZOOM, /** * Next window (like Alt-TAB) */ WINDOW_NEXT, /** * Previous window (like Shift-Alt-TAB) */ WINDOW_PREVIOUS, /** * Close window */ WINDOW_CLOSE, } /** * Type of command, one of EXIT, CASCADE, etc. */ public Type type; /** * Public contructor * * @param type the Type of command, one of EXIT, CASCADE, etc. */ public TCommand(Type type) { this.type = type; } /** * Make human-readable description of this event */ @Override public String toString() { return String.format("%s", type); } static public final TCommand cmAbort = new TCommand(TCommand.Type.ABORT); static public final TCommand cmExit = new TCommand(TCommand.Type.EXIT); static public final TCommand cmQuit = new TCommand(TCommand.Type.EXIT); static public final TCommand cmOpen = new TCommand(TCommand.Type.OPEN); static public final TCommand cmShell = new TCommand(TCommand.Type.SHELL); static public final TCommand cmCut = new TCommand(TCommand.Type.CUT); static public final TCommand cmCopy = new TCommand(TCommand.Type.COPY); static public final TCommand cmPaste = new TCommand(TCommand.Type.PASTE); static public final TCommand cmClear = new TCommand(TCommand.Type.CLEAR); static public final TCommand cmTile = new TCommand(TCommand.Type.TILE); static public final TCommand cmCascade = new TCommand(TCommand.Type.CASCADE); static public final TCommand cmCloseAll = new TCommand(TCommand.Type.CLOSE_ALL); static public final TCommand cmWindowMove = new TCommand(TCommand.Type.WINDOW_MOVE); static public final TCommand cmWindowZoom = new TCommand(TCommand.Type.WINDOW_ZOOM); static public final TCommand cmWindowNext = new TCommand(TCommand.Type.WINDOW_NEXT); static public final TCommand cmWindowPrevious = new TCommand(TCommand.Type.WINDOW_PREVIOUS); static public final TCommand cmWindowClose = new TCommand(TCommand.Type.WINDOW_CLOSE); }