1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 3.0.11
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package org.scilab.modules.xcos;
10 
11 import java.util.Map;
12 import java.util.TreeMap;
13 
14 public class JavaController extends Controller {
port_from_property(ObjectProperties p)15   public static int port_from_property(ObjectProperties p) {
16     return JavaControllerJNI.port_from_property(p.ordinal());
17   }
18 
property_from_port(int p)19   public static ObjectProperties property_from_port(int p) {
20     return ObjectProperties.class.getEnumConstants()[JavaControllerJNI.property_from_port(p)];
21   }
22 
23 
24   // will contain all registered JavaViews to prevent garbage-collection
25   private static Map<String, View> references = new TreeMap<String, View>();
26 
add_reference(String name, View v)27   private static long add_reference(String name, View v) {
28     references.put(name, v);
29     return View.getCPtr(v);
30   }
31 
remove_reference(View v)32   private static View remove_reference(View v) {
33     references.values().remove(v);
34     return v;
35   }
36 
lookup_view(String name)37   public static View lookup_view(String name) {
38     return references.get(name);
39   }
40 
register_view(String name, View view)41   public static void register_view(String name, View view) {
42     JavaControllerJNI.register_view(name, add_reference(name, view), view);
43   }
44 
unregister_view(View view)45   public static void unregister_view(View view) {
46     JavaControllerJNI.unregister_view(View.getCPtr(view), view);
47     remove_reference(view);
48   }
49 
50 }
51