Merge branch 'subtree'
[fanfix.git] / src / jexer / TCommand.java
index c0781eccf10e194fd8459a34a38b91f490c0009c..874a29dda7fcf2ceae1d92c622d034fb31fb78e9 100644 (file)
@@ -1,29 +1,27 @@
 /*
  * Jexer - Java Text User Interface
  *
- * License: LGPLv3 or later
+ * The MIT License (MIT)
  *
- * 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) 2019 Kevin Lamonte
  *
- *     Copyright (C) 2015  Kevin Lamonte
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
  *
- * 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.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
  *
- * 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
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
  *
  * @author Kevin Lamonte [kevin.lamonte@gmail.com]
  * @version 1
@@ -37,101 +35,159 @@ package jexer;
  */
 public class TCommand {
 
+    // ------------------------------------------------------------------------
+    // Constants --------------------------------------------------------------
+    // ------------------------------------------------------------------------
+
     /**
      * Immediately abort the application (e.g. remote side closed
      * connection).
      */
-    public static final int ABORT       = 1;
+    public static final int ABORT               = 1;
 
     /**
      * File open dialog.
      */
-    public static final int OPEN        = 2;
+    public static final int OPEN                = 2;
 
     /**
      * Exit application.
      */
-    public static final int EXIT        = 3;
+    public static final int EXIT                = 3;
 
     /**
      * Spawn OS shell window.
      */
-    public static final int SHELL       = 4;
+    public static final int SHELL               = 4;
 
     /**
      * Cut selected text and copy to the clipboard.
      */
-    public static final int CUT         = 5;
+    public static final int CUT                 = 5;
 
     /**
      * Copy selected text to clipboard.
      */
-    public static final int COPY        = 6;
+    public static final int COPY                = 6;
 
     /**
      * Paste from clipboard.
      */
-    public static final int PASTE       = 7;
+    public static final int PASTE               = 7;
 
     /**
      * Clear selected text without copying it to the clipboard.
      */
-    public static final int CLEAR       = 8;
+    public static final int CLEAR               = 8;
 
     /**
      * Tile windows.
      */
-    public static final int TILE        = 9;
+    public static final int TILE                = 9;
 
     /**
      * Cascade windows.
      */
-    public static final int CASCADE     = 10;
+    public static final int CASCADE             = 10;
 
     /**
      * Close all windows.
      */
-    public static final int CLOSE_ALL   = 11;
+    public static final int CLOSE_ALL           = 11;
 
     /**
      * Move (move/resize) window.
      */
-    public static final int WINDOW_MOVE = 12;
+    public static final int WINDOW_MOVE         = 12;
 
     /**
      * Zoom (maximize/restore) window.
      */
-    public static final int WINDOW_ZOOM = 13;
+    public static final int WINDOW_ZOOM         = 13;
 
     /**
      * Next window (like Alt-TAB).
      */
-    public static final int WINDOW_NEXT = 14;
+    public static final int WINDOW_NEXT         = 14;
 
     /**
      * Previous window (like Shift-Alt-TAB).
      */
-    public static final int WINDOW_PREVIOUS = 15;
+    public static final int WINDOW_PREVIOUS     = 15;
 
     /**
      * Close window.
      */
-    public static final int WINDOW_CLOSE = 16;
+    public static final int WINDOW_CLOSE        = 16;
+
+    /**
+     * Enter help system.
+     */
+    public static final int HELP                = 20;
+
+    /**
+     * Enter first menu.
+     */
+    public static final int MENU                = 21;
+
+    /**
+     * Save file.
+     */
+    public static final int SAVE                = 30;
+
+    /**
+     * Backend disconnected.
+     */
+    public static final int BACKEND_DISCONNECT  = 100;
+
+    public static final TCommand cmAbort        = new TCommand(ABORT);
+    public static final TCommand cmExit         = new TCommand(EXIT);
+    public static final TCommand cmQuit         = new TCommand(EXIT);
+    public static final TCommand cmOpen         = new TCommand(OPEN);
+    public static final TCommand cmShell        = new TCommand(SHELL);
+    public static final TCommand cmCut          = new TCommand(CUT);
+    public static final TCommand cmCopy         = new TCommand(COPY);
+    public static final TCommand cmPaste        = new TCommand(PASTE);
+    public static final TCommand cmClear        = new TCommand(CLEAR);
+    public static final TCommand cmTile         = new TCommand(TILE);
+    public static final TCommand cmCascade      = new TCommand(CASCADE);
+    public static final TCommand cmCloseAll     = new TCommand(CLOSE_ALL);
+    public static final TCommand cmWindowMove   = new TCommand(WINDOW_MOVE);
+    public static final TCommand cmWindowZoom   = new TCommand(WINDOW_ZOOM);
+    public static final TCommand cmWindowNext   = new TCommand(WINDOW_NEXT);
+    public static final TCommand cmWindowPrevious = new TCommand(WINDOW_PREVIOUS);
+    public static final TCommand cmWindowClose  = new TCommand(WINDOW_CLOSE);
+    public static final TCommand cmHelp         = new TCommand(HELP);
+    public static final TCommand cmSave         = new TCommand(SAVE);
+    public static final TCommand cmMenu         = new TCommand(MENU);
+    public static final TCommand cmBackendDisconnect    = new TCommand(BACKEND_DISCONNECT);
+
+    // ------------------------------------------------------------------------
+    // Variables --------------------------------------------------------------
+    // ------------------------------------------------------------------------
 
     /**
      * Type of command, one of EXIT, CASCADE, etc.
      */
     private int type;
 
+    // ------------------------------------------------------------------------
+    // Constructors -----------------------------------------------------------
+    // ------------------------------------------------------------------------
+
     /**
-     * Protected constructor.  Subclasses can be used to define new commands.
+     * Public constructor.
      *
      * @param type the Type of command, one of EXIT, CASCADE, etc.
      */
-    protected TCommand(final int type) {
+    public TCommand(final int type) {
         this.type = type;
     }
 
+    // ------------------------------------------------------------------------
+    // TCommand ---------------------------------------------------------------
+    // ------------------------------------------------------------------------
+
     /**
      * Make human-readable description of this TCommand.
      *
@@ -168,22 +224,4 @@ public class TCommand {
         return type;
     }
 
-    public static final TCommand cmAbort      = new TCommand(ABORT);
-    public static final TCommand cmExit       = new TCommand(EXIT);
-    public static final TCommand cmQuit       = new TCommand(EXIT);
-    public static final TCommand cmOpen       = new TCommand(OPEN);
-    public static final TCommand cmShell      = new TCommand(SHELL);
-    public static final TCommand cmCut        = new TCommand(CUT);
-    public static final TCommand cmCopy       = new TCommand(COPY);
-    public static final TCommand cmPaste      = new TCommand(PASTE);
-    public static final TCommand cmClear      = new TCommand(CLEAR);
-    public static final TCommand cmTile       = new TCommand(TILE);
-    public static final TCommand cmCascade    = new TCommand(CASCADE);
-    public static final TCommand cmCloseAll   = new TCommand(CLOSE_ALL);
-    public static final TCommand cmWindowMove = new TCommand(WINDOW_MOVE);
-    public static final TCommand cmWindowZoom = new TCommand(WINDOW_ZOOM);
-    public static final TCommand cmWindowNext = new TCommand(WINDOW_NEXT);
-    public static final TCommand cmWindowPrevious = new TCommand(WINDOW_PREVIOUS);
-    public static final TCommand cmWindowClose = new TCommand(WINDOW_CLOSE);
-
 }