1 56 57 package org.objectstyle.cayenne.dataview.dvmodeler; 58 59 import java.awt.Container ; 60 import java.awt.Frame ; 61 import java.awt.event.ActionEvent ; 62 import java.awt.event.ActionListener ; 63 64 import javax.swing.JButton ; 65 import javax.swing.JDialog ; 66 67 import com.jgoodies.forms.builder.ButtonBarBuilder; 68 import com.jgoodies.forms.builder.PanelBuilder; 69 import com.jgoodies.forms.layout.CellConstraints; 70 import com.jgoodies.forms.layout.FormLayout; 71 72 73 78 79 class ErrorsDialog extends JDialog { 80 public ErrorsDialog(Frame frame, java.util.List errors, String titleText){ 81 super(frame, "DVModeler :: " + titleText, false); 82 83 ButtonBarBuilder buttonPanelBuilder = new ButtonBarBuilder(); 84 buttonPanelBuilder.addGlue(); 85 86 JButton okButton = new JButton ("Ok"); 88 okButton.addActionListener(new ActionListener () { 89 public void actionPerformed(ActionEvent e) { 90 setVisible(false); 91 } 92 }); 93 94 buttonPanelBuilder.addGridded(okButton); 95 getRootPane().setDefaultButton(okButton); 96 97 98 Container contentPane = getContentPane(); 100 FormLayout layout = new FormLayout( 101 "fill:pref:grow", 102 "fill:p:grow, 5dlu, p"); 103 104 PanelBuilder mainPanelBuilder = new PanelBuilder(layout); 105 CellConstraints cc = new CellConstraints(); 106 mainPanelBuilder.setDefaultDialogBorder(); 107 108 ErrorsPanel errorsPanel = new ErrorsPanel(errors, "SaveErrors" + ":"); 109 110 mainPanelBuilder.add(errorsPanel, cc.xy(1, 1)); 111 mainPanelBuilder.add(buttonPanelBuilder.getPanel(), cc.xy(1, 3)); 112 contentPane.add(mainPanelBuilder.getPanel()); 113 pack(); 114 115 this.setLocationRelativeTo(null); 116 117 118 } 119 } 120 | Popular Tags |