1 /* $RCSfile$ 2 * $Author$ 3 * $Date$ 4 * $Revision$ 5 * 6 * Copyright (C) 2011 The Jmol Development Team 7 * 8 * Contact: jmol-developers@lists.sf.net 9 * 10 * This library is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU Lesser General Public 12 * License as published by the Free Software Foundation; either 13 * version 2.1 of the License, or (at your option) any later version. 14 * 15 * This library is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Lesser General Public License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public 21 * License along with this library; if not, write to the Free Software 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 * 02110-1301, USA. 24 */ 25 26 package org.jmol.c; 27 28 import javajs.util.SB; 29 30 public enum CBK { 31 32 ANIMFRAME, 33 APPLETREADY, 34 ATOMMOVED, 35 AUDIO, 36 CLICK, 37 DRAGDROP, 38 ECHO, 39 ERROR, 40 EVAL, 41 HOVER, 42 IMAGE, 43 LOADSTRUCT, 44 MEASURE, 45 MESSAGE, 46 MINIMIZATION, 47 MODELKIT, 48 SERVICE, 49 PICK, 50 RESIZE, 51 SCRIPT, 52 SYNC, STRUCTUREMODIFIED; 53 getCallback(String name)54 public static CBK getCallback(String name) { 55 56 name = name.toUpperCase(); 57 name = name.substring(0, Math.max(name.indexOf("CALLBACK"), 0)); 58 for (CBK item : values()) 59 if (item.name().equalsIgnoreCase(name)) 60 return item; 61 return null; 62 } 63 64 private static String nameList; 65 getNameList()66 public static synchronized String getNameList() { 67 if (nameList == null) { 68 SB names = new SB(); 69 for (CBK item : values()) 70 names.append(item.name().toLowerCase()).append("Callback;"); 71 nameList = names.toString(); 72 } 73 return nameList; 74 } 75 } 76