1 56 package org.objectstyle.cayenne.modeler.dialog.pref; 57 58 import java.awt.BorderLayout ; 59 60 import javax.swing.JLabel ; 61 import javax.swing.JPanel ; 62 import javax.swing.JTextField ; 63 64 import com.jgoodies.forms.builder.PanelBuilder; 65 import com.jgoodies.forms.layout.CellConstraints; 66 import com.jgoodies.forms.layout.FormLayout; 67 68 71 public class GeneralPreferencesView extends JPanel { 72 73 protected JTextField saveInterval; 74 protected JLabel saveIntervalLabel; 75 protected EncodingSelectorView encodingSelector; 76 protected JLabel encodingSelectorLabel; 77 78 public GeneralPreferencesView() { 79 this.saveInterval = new JTextField (); 80 this.encodingSelector = new EncodingSelectorView(); 81 this.saveIntervalLabel = new JLabel ("Preferences Save Interval (sec):"); 82 this.encodingSelectorLabel = new JLabel ("File Encoding:"); 83 84 FormLayout layout = new FormLayout( 85 "right:pref, 3dlu, 30dlu, 3dlu, fill:70dlu", 86 "p, 3dlu, p, 12dlu, p, 3dlu, fill:40dlu:grow"); 87 88 CellConstraints cc = new CellConstraints(); 89 PanelBuilder builder = new PanelBuilder(layout); 90 builder.setDefaultDialogBorder(); 91 builder.addSeparator("General Preferences", cc.xywh(1, 1, 5, 1)); 92 builder.add(saveIntervalLabel, cc.xy(1, 3)); 93 builder.add(saveInterval, cc.xy(3, 3)); 94 builder.add(encodingSelectorLabel, cc.xy(1, 5)); 95 builder.add(encodingSelector, cc.xywh(3, 5, 3, 3)); 96 97 this.setLayout(new BorderLayout ()); 98 this.add(builder.getPanel(), BorderLayout.CENTER); 99 } 100 101 public void setEnabled(boolean b) { 102 super.setEnabled(b); 103 saveInterval.setEnabled(b); 104 saveIntervalLabel.setEnabled(b); 105 encodingSelector.setEnabled(b); 106 encodingSelectorLabel.setEnabled(b); 107 } 108 109 public JTextField getSaveInterval() { 110 return saveInterval; 111 } 112 113 public EncodingSelectorView getEncodingSelector() { 114 return encodingSelector; 115 } 116 } | Popular Tags |