1 30 package com.genimen.djeneric.tools.modeler.dialogs; 31 32 import java.awt.BorderLayout ; 33 import java.awt.Dimension ; 34 import java.awt.Frame ; 35 import java.awt.Toolkit ; 36 import java.awt.event.ActionEvent ; 37 38 import javax.swing.JButton ; 39 import javax.swing.JDialog ; 40 import javax.swing.JPanel ; 41 import javax.swing.JScrollPane ; 42 import javax.swing.JTextArea ; 43 44 import com.genimen.djeneric.language.Messages; 45 import com.genimen.djeneric.repository.DjPersistenceManager; 46 import com.genimen.djeneric.ui.Util; 47 import com.genimen.djeneric.util.DjLogger; 48 49 public class ModelVersionDialog extends JDialog 50 { 51 private static final long serialVersionUID = 1L; 52 JPanel panel1 = new JPanel (); 53 BorderLayout borderLayout1 = new BorderLayout (); 54 JPanel jPanel1 = new JPanel (); 55 JScrollPane jScrollPane1 = new JScrollPane (); 56 JTextArea _edtHistory = new JTextArea (); 57 BorderLayout borderLayout2 = new BorderLayout (); 58 JPanel jPanel2 = new JPanel (); 59 JButton _butOk = new JButton (); 60 JButton _butCancel = new JButton (); 61 DjPersistenceManager _mgr; 62 63 public ModelVersionDialog(Frame frame, DjPersistenceManager mgr) 64 { 65 super(frame, Messages.getString("ModelVersionDialog.ModelHistory"), true); 66 try 67 { 68 _mgr = mgr; 69 jbInit(); 70 71 setSize(600, 400); 72 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 73 Dimension frameSize = getSize(); 74 setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); 75 76 _edtHistory.setText(mgr.getModelHistory()); 77 setVisible(true); 78 } 79 catch (Exception ex) 80 { 81 DjLogger.log(ex); 82 } 83 } 84 85 void jbInit() throws Exception 86 { 87 panel1.setLayout(borderLayout1); 88 jPanel1.setLayout(borderLayout2); 89 _butOk.setText(Messages.getString("global.Ok")); 90 _butOk.addActionListener(new java.awt.event.ActionListener () 91 { 92 public void actionPerformed(ActionEvent e) 93 { 94 _butOk_actionPerformed(e); 95 } 96 }); 97 _butCancel.setText(Messages.getString("global.Cancel")); 98 _butCancel.addActionListener(new java.awt.event.ActionListener () 99 { 100 public void actionPerformed(ActionEvent e) 101 { 102 _butCancel_actionPerformed(e); 103 } 104 }); 105 _edtHistory.setFont(new java.awt.Font ("Monospaced", 0, 12)); 106 getContentPane().add(panel1); 107 panel1.add(jPanel1, BorderLayout.SOUTH); 108 jPanel1.add(jPanel2, BorderLayout.EAST); 109 jPanel2.add(_butCancel, null); 110 jPanel2.add(_butOk, null); 111 panel1.add(jScrollPane1, BorderLayout.CENTER); 112 jScrollPane1.getViewport().add(_edtHistory, null); 113 Util.sizeButtons(jPanel2); 114 } 115 116 void _butOk_actionPerformed(ActionEvent e) 117 { 118 _mgr.setModelHistory(_edtHistory.getText()); 119 setVisible(false); 120 } 121 122 void _butCancel_actionPerformed(ActionEvent e) 123 { 124 setVisible(false); 125 } 126 } | Popular Tags |