1 23 24 package org.objectweb.fractal.gui.clipboard.control; 25 26 import org.objectweb.fractal.api.control.BindingController; 27 28 import org.objectweb.fractal.gui.selection.model.SelectionListener; 29 import org.objectweb.fractal.gui.selection.model.Selection; 30 import org.objectweb.fractal.gui.graph.model.GraphModel; 31 import org.objectweb.fractal.gui.model.Factory; 32 import org.objectweb.fractal.gui.clipboard.model.Clipboard; 33 import org.objectweb.fractal.swing.AbstractAction; 34 35 40 41 public abstract class ClipboardAction extends AbstractAction implements 42 SelectionListener, 43 BindingController 44 { 45 46 51 52 public final static String SELECTION_BINDING = "selection"; 53 54 59 60 public final static String GRAPH_BINDING = "graph"; 61 62 67 68 public final static String FACTORY_BINDING = "configuration-factory"; 69 70 74 75 public final static String CLIPBOARD_BINDING = "clipboard"; 76 77 80 81 Selection selection; 82 83 86 87 GraphModel graph; 88 89 92 93 Factory factory; 94 95 98 99 Clipboard clipboard; 100 101 104 105 public ClipboardAction () { 106 } 107 108 112 public String [] listFc () { 113 return new String [] { 114 SELECTION_BINDING, 115 GRAPH_BINDING, 116 FACTORY_BINDING, 117 CLIPBOARD_BINDING 118 }; 119 } 120 121 public Object lookupFc (final String clientItfName) { 122 if (SELECTION_BINDING.equals(clientItfName)) { 123 return selection; 124 } else if (GRAPH_BINDING.equals(clientItfName)) { 125 return graph; 126 } else if (FACTORY_BINDING.equals(clientItfName)) { 127 return factory; 128 } else if (CLIPBOARD_BINDING.equals(clientItfName)) { 129 return clipboard; 130 } 131 return null; 132 } 133 134 public void bindFc ( 135 final String clientItfName, 136 final Object serverItf) 137 { 138 if (SELECTION_BINDING.equals(clientItfName)) { 139 selection = (Selection)serverItf; 140 } else if (GRAPH_BINDING.equals(clientItfName)) { 141 graph = (GraphModel)serverItf; 142 } else if (FACTORY_BINDING.equals(clientItfName)) { 143 factory = (Factory)serverItf; 144 } else if (CLIPBOARD_BINDING.equals(clientItfName)) { 145 clipboard = (Clipboard)serverItf; 146 } 147 } 148 149 public void unbindFc (final String clientItfName) { 150 if (SELECTION_BINDING.equals(clientItfName)) { 151 selection = null; 152 } else if (GRAPH_BINDING.equals(clientItfName)) { 153 graph = null; 154 } else if (FACTORY_BINDING.equals(clientItfName)) { 155 factory = null; 156 } else if (CLIPBOARD_BINDING.equals(clientItfName)) { 157 clipboard = null; 158 } 159 } 160 } | Popular Tags |