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