1 56 package org.objectstyle.cayenne.modeler.dialog.datadomain; 57 58 import java.awt.BorderLayout ; 59 60 import javax.swing.ButtonGroup ; 61 62 import org.scopemvc.view.swing.SPanel; 63 import org.scopemvc.view.swing.SRadioButton; 64 import org.scopemvc.view.swing.STextField; 65 66 import com.jgoodies.forms.builder.DefaultFormBuilder; 67 import com.jgoodies.forms.layout.FormLayout; 68 69 72 public class JGroupsConfigPanel extends SPanel { 73 74 protected STextField multicastAddress; 75 protected STextField multicastPort; 76 protected STextField configURL; 77 78 public JGroupsConfigPanel() { 79 initView(); 80 } 81 82 protected void initView() { 83 setLayout(new BorderLayout ()); 84 85 SRadioButton useDefaultConfig = 86 new SRadioButton( 87 CacheSyncConfigController.JGROUPS_DEFAULT_CONTROL, 88 JGroupsConfigModel.USING_DEFAULT_CONFIG_SELECTOR); 89 90 SRadioButton useConfigFile = 91 new SRadioButton( 92 CacheSyncConfigController.JGROUPS_URL_CONTROL, 93 JGroupsConfigModel.USING_CONFIG_FILE_SELECTOR); 94 95 ButtonGroup group = new ButtonGroup (); 96 group.add(useConfigFile); 97 group.add(useDefaultConfig); 98 99 multicastAddress = new STextField(); 100 multicastAddress.setSelector(JGroupsConfigModel.MCAST_ADDRESS_SELECTOR); 101 102 multicastPort = new STextField(5); 103 multicastPort.setSelector(JGroupsConfigModel.MCAST_PORT_SELECTOR); 104 105 configURL = new STextField(); 106 configURL.setSelector(JGroupsConfigModel.JGROUPS_CONFIG_URL_SELECTOR); 107 108 FormLayout layout = new FormLayout("right:150, 3dlu, left:200", ""); 110 DefaultFormBuilder builder = new DefaultFormBuilder(layout); 111 builder.setDefaultDialogBorder(); 112 builder.appendSeparator("JavaGroups Settings"); 113 114 builder.append(useDefaultConfig); 115 builder.nextLine(); 116 117 builder.append("Multicast Address:", multicastAddress, 1); 120 builder.append("Multicast Port:", multicastPort); 121 122 builder.nextLine(); 123 builder.append(useConfigFile); 124 builder.nextLine(); 125 builder.append("JGroups Config File:", configURL, 1); 126 127 add(builder.getPanel(), BorderLayout.NORTH); 128 } 129 130 public void showDefaultConfig() { 131 multicastAddress.setEditable(true); 132 multicastPort.setEditable(true); 133 configURL.setEditable(false); 134 } 135 136 public void showCustomConfig() { 137 multicastAddress.setEditable(false); 138 multicastPort.setEditable(false); 139 configURL.setEditable(true); 140 } 141 } | Popular Tags |