001package org.vishia.gral.example; 002 003import org.vishia.gral.base.GralMenu; 004import org.vishia.gral.base.GralMng; 005 006public class ExampleContextMenu extends ExampleSimpleButton 007{ 008 009 /**Version, history and license. 010 * <ul> 011 * <li>2011-06-00 Hartmut created 012 * </ul> 013 * 014 * <b>Copyright/Copyleft</b>:<br> 015 * For this source the LGPL Lesser General Public License, 016 * published by the Free Software Foundation is valid. 017 * It means: 018 * <ol> 019 * <li> You can use this source without any restriction for any desired purpose. 020 * <li> You can redistribute copies of this source to everybody. 021 * <li> Every user of this source, also the user of redistribute copies 022 * with or without payment, must accept this license for further using. 023 * <li> But the LPGL is not appropriate for a whole software product, 024 * if this source is only a part of them. It means, the user 025 * must publish this part of source, 026 * but doesn't need to publish the whole source of the own product. 027 * <li> You can study and modify (improve) this source 028 * for own using or for redistribution, but you have to license the 029 * modified sources likewise under this LGPL Lesser General Public License. 030 * You mustn't delete this Copyright/Copyleft inscription in this source file. 031 * </ol> 032 * If you intent to use this source without publishing its usage, you can get 033 * a second license subscribing a special contract with the author. 034 * 035 * @author Hartmut Schorrig = hartmut.schorrig@vishia.de 036 */ 037 public static final int version = 20120303; 038 039 ExampleContextMenu(GralMng gralMng) 040 { 041 super(gralMng); 042 } 043 044 045 /**The main routine. It creates the factory of this class 046 * and then calls {@link #main(String[], Factory)}. 047 * With that pattern a derived class may have a simple main routine too. 048 * @param args command line arguments. 049 */ 050 public static void main(String[] args) 051 { 052 main(args, new Factory()); 053 054 } 055 056 057 058 protected class InitGuiCodeContextMenu extends ExampleSimpleButton.InitGuiCodeSimpleButton{ 059 @Override public void executeOrder(){ 060 super.executeOrder(); 061 //GralMenu menuInput = gui.gralMng.createContextMenu("menu-test", gui.widgInput); 062 GralMenu menuInput = gui.widgInput.getContextMenu(); 063 } 064 065 } 066 067 068 069 /**This inner class creates this class with given parameter. 070 */ 071 static class Factory extends ExampleSimpleButton.Factory{ 072 ExampleSimpleButton create(GralMng gralMng){ 073 ExampleContextMenu obj = new ExampleContextMenu(gralMng); 074 obj.setInitGuiCode(obj.new InitGuiCodeContextMenu()); 075 return obj; 076 } 077 } 078 079 080 081 082}