001package org.vishia.gral.ifc; 002 003import java.util.List; 004 005import org.vishia.util.KeyCode; 006 007/**This class contains Strings and keys for functions of an application 008 * in a common way to build menus, buttons etc. 009 * @author Hartmut Schorrig 010 * 011 */ 012public class GralButtonKeyMenu 013{ 014 /**Version, history and copyright/copyleft. 015 * <ul> 016 * <li>2013-03-30 created. Situation before: discrete variables in {@link org.vishia.commander.FcmdIdents} 017 * </ul> 018 * 019 * <b>Copyright/Copyleft</b>:<br> 020 * For this source the LGPL Lesser General Public License, 021 * published by the Free Software Foundation is valid. 022 * It means: 023 * <ol> 024 * <li> You can use this source without any restriction for any desired purpose. 025 * <li> You can redistribute copies of this source to everybody. 026 * <li> Every user of this source, also the user of redistribute copies 027 * with or without payment, must accept this license for further using. 028 * <li> But the LPGL is not appropriate for a whole software product, 029 * if this source is only a part of them. It means, the user 030 * must publish this part of source, 031 * but doesn't need to publish the whole source of the own product. 032 * <li> You can study and modify (improve) this source 033 * for own using or for redistribution, but you have to license the 034 * modified sources likewise under this LGPL Lesser General Public License. 035 * You mustn't delete this Copyright/Copyleft inscription in this source file. 036 * </ol> 037 * If you intent to use this source without publishing its usage, you can get 038 * a second license subscribing a special contract with the author. 039 * 040 * @author Hartmut Schorrig = hartmut.schorrig@vishia.de 041 */ 042 public static final int version = 20130330; 043 044 045 /**Menu bar string. 046 * Use for example = "&Help/&Settings [cP]". 047 */ 048 public String menu; 049 050 /**Context menu string. */ 051 public String menuContext = "Settings [cP]"; 052 053 /**Identification for the button to present. 054 * 3 chars: gF1 055 */ 056 public String buttonId; 057 058 /**Text for the button*/ 059 public String buttontext; 060 061 /**One of two possible {@link KeyCode} for this functionality. */ 062 public int key1, key2; 063 064 /**The action which is associated to all the functions. */ 065 public GralUserAction action; 066 067 068 069 /**Constructs and adds the instance to a given list. 070 * @param action 071 * @param menu 072 * @param menuContext 073 * @param buttonId 074 * @param buttontext 075 * @param key1 076 * @param key2 077 * @param addToList add to this list if not null. 078 */ 079 public GralButtonKeyMenu(GralUserAction action, String menu, String menuContext 080 , String buttonId, String buttontext, int key1, int key2 081 , List<GralButtonKeyMenu> addToList 082 ){ 083 this.action = action; 084 this.menu = menu; 085 this.menuContext = menuContext; 086 this.buttonId = buttonId; 087 this.buttontext = buttontext; 088 this.key1 = key1; 089 this.key2 = key2; 090 if(addToList !=null) { 091 addToList.add(this); 092 } 093 } 094 095 096 public GralButtonKeyMenu(GralUserAction action, String menu, String menuContext 097 , String buttonId, String buttontext, int key1, int key2 098 ){ 099 this(action, menu, menuContext, buttonId, buttontext, key1, key2, null); 100 } 101 102 103}