1 56 package org.objectstyle.cayenne.modeler.dialog.datamap; 57 58 import java.awt.BorderLayout ; 59 import java.awt.FlowLayout ; 60 61 import javax.swing.ButtonGroup ; 62 import javax.swing.JPanel ; 63 64 import org.scopemvc.view.swing.SButton; 65 import org.scopemvc.view.swing.SPanel; 66 import org.scopemvc.view.swing.SRadioButton; 67 import org.scopemvc.view.swing.SwingView; 68 69 import com.jgoodies.forms.builder.PanelBuilder; 70 import com.jgoodies.forms.layout.CellConstraints; 71 import com.jgoodies.forms.layout.FormLayout; 72 73 76 public class DefaultsPreferencesDialog extends SPanel { 77 78 public DefaultsPreferencesDialog(String allControl, String uninitializedControl) { 79 initView(allControl, uninitializedControl); 80 } 81 82 protected void initView(String allControl, String uninitializedControl) { 83 SRadioButton updateAll = new SRadioButton( 84 allControl, 85 DefaultsPreferencesModel.ALL_ENTITIES_SELECTOR); 86 87 SRadioButton updateEmpty = new SRadioButton( 88 uninitializedControl, 89 DefaultsPreferencesModel.UNINITIALIZED_ENTITIES_SELECTOR); 90 91 ButtonGroup buttonGroup = new ButtonGroup (); 92 buttonGroup.add(updateAll); 93 buttonGroup.add(updateEmpty); 94 95 SButton updateButton = new SButton( 96 DefaultsPreferencesController.UPDATE_CONTROL); 97 SButton cancelButton = new SButton(DefaultsPreferencesController.CANCEL_CONTROL); 98 99 JPanel buttonPanel = new JPanel (new FlowLayout (FlowLayout.RIGHT)); 101 buttonPanel.add(updateButton); 102 buttonPanel.add(cancelButton); 103 104 CellConstraints cc = new CellConstraints(); 105 FormLayout layout = new FormLayout("left:max(180dlu;pref)", "p, 3dlu, p, 3dlu"); 106 PanelBuilder builder = new PanelBuilder(layout); 107 builder.setDefaultDialogBorder(); 108 109 builder.add(updateAll, cc.xy(1, 1)); 110 builder.add(updateEmpty, cc.xy(1, 3)); 111 112 setLayout(new BorderLayout ()); 113 add(builder.getPanel(), BorderLayout.CENTER); 114 add(buttonPanel, BorderLayout.SOUTH); 115 116 setDisplayMode(SwingView.MODAL_DIALOG); 117 } 118 } | Popular Tags |