1 package org.columba.core.gui.frame; 19 20 import javax.swing.JComponent ; 21 import javax.swing.JPopupMenu ; 22 23 import org.columba.api.gui.frame.IDockable; 24 import org.columba.core.gui.docking.DockableView; 25 26 public class FrameMediatorDockable implements IDockable { 27 28 private String id; 29 30 private String name; 31 32 private DockableView comp; 33 34 private JPopupMenu popup; 35 36 public FrameMediatorDockable(String id, String name, JComponent comp, 37 JPopupMenu popup) { 38 if (id == null) 39 throw new IllegalArgumentException ("id == null"); 40 if (name == null) 41 throw new IllegalArgumentException ("name == null"); 42 if (comp == null) 43 throw new IllegalArgumentException ("comp == null"); 44 45 this.id = id; 46 this.name = name; 47 this.comp = new DockableView(id, name); 48 this.comp.setContentPane(comp); 49 50 if (popup != null) { 51 this.popup = popup; 52 this.comp.setPopupMenu(this.popup); 53 } 54 } 55 56 public String getId() { 57 return id; 58 } 59 60 public String resolveName() { 61 return name; 62 } 63 64 public JComponent getView() { 65 return (JComponent ) comp.getComponent(); 66 } 67 68 public JPopupMenu getPopupMenu() { 69 return popup; 70 } 71 72 public void setPopupMenu(JPopupMenu popup) { 73 if (popup == null) 74 throw new IllegalArgumentException ("popup == null"); 75 76 this.popup = popup; 77 78 this.comp.setPopupMenu(this.popup); 79 } 80 81 public void setTitle(String title) { 82 comp.setTitle(title); 83 } 84 85 } 86 | Popular Tags |