1 package org.columba.core.selection; 17 18 import java.util.Hashtable ; 19 20 import org.columba.api.command.ICommandReference; 21 import org.columba.api.selection.ISelectionHandler; 22 import org.columba.api.selection.ISelectionListener; 23 import org.columba.api.selection.ISelectionManager; 24 25 43 public class SelectionManager implements ISelectionManager { 44 48 private Hashtable selectionHandler; 49 50 53 public SelectionManager() { 54 selectionHandler = new Hashtable (); 56 } 57 58 63 public void addSelectionHandler(ISelectionHandler handler) { 64 selectionHandler.put(handler.getId(), handler); 65 } 66 67 70 public void registerSelectionListener(String id, ISelectionListener l) { 71 SelectionHandler h = ((SelectionHandler) selectionHandler.get(id)); 72 73 h.addSelectionListener(l); 74 } 75 76 79 public void removeSelectionListener(String id, ISelectionListener l) { 80 SelectionHandler h = ((SelectionHandler) selectionHandler.get(id)); 81 82 h.removeSelectionListener(l); 83 } 84 85 86 89 public void setSelection(String id, ICommandReference selection) { 90 ((ISelectionHandler) selectionHandler.get(id)).setSelection(selection); 91 } 92 93 96 public ICommandReference getSelection(String id) { 97 return ((ISelectionHandler) selectionHandler.get(id)).getSelection(); 98 } 99 100 103 public ISelectionHandler getHandler(String id) { 104 return (ISelectionHandler) selectionHandler.get(id); 105 } 106 } | Popular Tags |