1 3 package org.objectweb.fractal.swing; 4 5 import org.objectweb.fractal.api.control.LifeCycleController; 6 import org.objectweb.fractal.api.control.BindingController; 7 8 import java.awt.event.WindowAdapter ; 9 import java.awt.event.WindowEvent ; 10 11 import javax.swing.JMenuBar ; 12 13 public class JFrameImpl 14 extends javax.swing.JFrame 15 implements JFrameItf, JFrameAttributes, BindingController, LifeCycleController 16 { 17 18 public final static String CONTENT_PANE_BINDING = "content-pane"; 20 public final static String MENU_BAR_BINDING = "menu-bar"; 21 private java.awt.Container contentPane; 22 23 public JFrameImpl () { 24 super(); 25 addWindowListener( 27 new WindowAdapter () { 28 public void windowClosing (WindowEvent e) { 29 System.exit(0); 30 } 31 }); 32 } 33 public JFrameImpl (java.awt.GraphicsConfiguration arg0) { 34 super(arg0); 35 } 36 public JFrameImpl (String arg0) { 37 super(arg0); 38 } 39 public JFrameImpl (String arg0, java.awt.GraphicsConfiguration arg1) { 40 super(arg0,arg1); 41 } 42 43 public String [] listFc () { 44 return new String [] { 46 CONTENT_PANE_BINDING, 47 MENU_BAR_BINDING 48 }; 49 } 50 51 public Object lookupFc (String clientItfName) { 52 if (clientItfName.equals(CONTENT_PANE_BINDING)) { 54 return contentPane; 55 } else if (clientItfName.equals(MENU_BAR_BINDING)) { 56 return getJMenuBar(); 57 } 58 return null; 59 } 60 61 public void bindFc (String clientItfName, Object serverItf) { 62 if (clientItfName.equals(CONTENT_PANE_BINDING)) { 64 contentPane = (java.awt.Container )serverItf; 65 super.setContentPane(contentPane); 66 } else if (clientItfName.equals(MENU_BAR_BINDING)) { 67 super.setJMenuBar((JMenuBar )serverItf); 68 } 69 } 70 71 public void unbindFc (String clientItfName) { 72 if (clientItfName.equals(CONTENT_PANE_BINDING)) { 74 contentPane = null; 75 super.setContentPane(new java.awt.Container ()); 76 } else if (clientItfName.equals(MENU_BAR_BINDING)) { 77 super.setJMenuBar(null); 78 } 79 } 80 81 83 public void setWidth (int width) { 84 setSize(width, getHeight()); 85 } 86 87 public void setHeight (int height) { 88 setSize(getWidth(), height); 89 } 90 91 public String getFcState () { 92 return null; 93 } 94 95 public void startFc () { 96 show(); 97 } 98 99 public void stopFc () { 100 } 101 102 } 103 | Popular Tags |