Mercurial > hg > graal-compiler
comparison visualizer/Filter/src/com/sun/hotspot/igv/filter/EditFilterDialog.java @ 4512:015fb895586b
Moved visualizer to new directory.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 07 Feb 2012 22:41:09 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4511:6cb549627941 | 4512:015fb895586b |
---|---|
1 /* | |
2 * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. Oracle designates this | |
8 * particular file as subject to the "Classpath" exception as provided | |
9 * by Oracle in the LICENSE file that accompanied this code. | |
10 * | |
11 * This code is distributed in the hope that it will be useful, but WITHOUT | |
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 * version 2 for more details (a copy is included in the LICENSE file that | |
15 * accompanied this code). | |
16 * | |
17 * You should have received a copy of the GNU General Public License version | |
18 * 2 along with this work; if not, write to the Free Software Foundation, | |
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
20 * | |
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
22 * or visit www.oracle.com if you need additional information or have any | |
23 * questions. | |
24 */ | |
25 package com.sun.hotspot.igv.filter; | |
26 | |
27 import org.openide.windows.WindowManager; | |
28 | |
29 /** | |
30 * | |
31 * @author Thomas Wuerthinger | |
32 */ | |
33 public class EditFilterDialog extends javax.swing.JDialog { | |
34 | |
35 private CustomFilter customFilter; | |
36 private boolean accepted; | |
37 | |
38 /** Creates new form EditFilterDialog */ | |
39 public EditFilterDialog(CustomFilter customFilter) { | |
40 super(WindowManager.getDefault().getMainWindow(), true); | |
41 this.customFilter = customFilter; | |
42 initComponents(); | |
43 | |
44 sourceTextArea.setText(customFilter.getCode()); | |
45 nameTextField.setText(customFilter.getName()); | |
46 } | |
47 | |
48 public boolean wasAccepted() { | |
49 return accepted; | |
50 } | |
51 | |
52 /** This method is called from within the constructor to | |
53 * initialize the form. | |
54 * WARNING: Do NOT modify this code. The content of this method is | |
55 * always regenerated by the Form Editor. | |
56 */ | |
57 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
58 private void initComponents() { | |
59 | |
60 jScrollPane1 = new javax.swing.JScrollPane(); | |
61 sourceTextArea = new javax.swing.JTextArea(); | |
62 nameTextField = new javax.swing.JTextField(); | |
63 nameLabel = new javax.swing.JLabel(); | |
64 sourceLabel = new javax.swing.JLabel(); | |
65 okButton = new javax.swing.JButton(); | |
66 cancelButton = new javax.swing.JButton(); | |
67 | |
68 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | |
69 setTitle(org.openide.util.NbBundle.getMessage(EditFilterDialog.class, "title")); // NOI18N | |
70 setResizable(false); | |
71 | |
72 sourceTextArea.setColumns(20); | |
73 sourceTextArea.setRows(5); | |
74 jScrollPane1.setViewportView(sourceTextArea); | |
75 | |
76 nameTextField.setText("null"); | |
77 | |
78 nameLabel.setText(org.openide.util.NbBundle.getMessage(EditFilterDialog.class, "jLabel1.text")); // NOI18N | |
79 | |
80 sourceLabel.setText(org.openide.util.NbBundle.getMessage(EditFilterDialog.class, "jLabel2.text")); // NOI18N | |
81 | |
82 okButton.setText(org.openide.util.NbBundle.getMessage(EditFilterDialog.class, "jButton1.text")); // NOI18N | |
83 okButton.addActionListener(new java.awt.event.ActionListener() { | |
84 public void actionPerformed(java.awt.event.ActionEvent evt) { | |
85 cancelButtonClicked(evt); | |
86 okButtonClicked(evt); | |
87 } | |
88 }); | |
89 | |
90 cancelButton.setText(org.openide.util.NbBundle.getMessage(EditFilterDialog.class, "jButton2.text")); // NOI18N | |
91 cancelButton.addActionListener(new java.awt.event.ActionListener() { | |
92 public void actionPerformed(java.awt.event.ActionEvent evt) { | |
93 cancelButtonClicked(evt); | |
94 } | |
95 }); | |
96 | |
97 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); | |
98 getContentPane().setLayout(layout); | |
99 layout.setHorizontalGroup( | |
100 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) | |
101 .add(layout.createSequentialGroup() | |
102 .addContainerGap() | |
103 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) | |
104 .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() | |
105 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) | |
106 .add(sourceLabel) | |
107 .add(nameLabel)) | |
108 .add(25, 25, 25) | |
109 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) | |
110 .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 695, Short.MAX_VALUE) | |
111 .add(nameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 695, Short.MAX_VALUE))) | |
112 .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() | |
113 .add(okButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) | |
114 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) | |
115 .add(cancelButton))) | |
116 .addContainerGap()) | |
117 ); | |
118 layout.setVerticalGroup( | |
119 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) | |
120 .add(layout.createSequentialGroup() | |
121 .addContainerGap() | |
122 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) | |
123 .add(nameLabel) | |
124 .add(nameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) | |
125 .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) | |
126 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) | |
127 .add(sourceLabel) | |
128 .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 337, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) | |
129 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 16, Short.MAX_VALUE) | |
130 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) | |
131 .add(cancelButton) | |
132 .add(okButton)) | |
133 .addContainerGap()) | |
134 ); | |
135 | |
136 pack(); | |
137 }// </editor-fold>//GEN-END:initComponents | |
138 | |
139 private void okButtonClicked(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonClicked | |
140 this.customFilter.setName(this.nameTextField.getText()); | |
141 this.customFilter.setCode(this.sourceTextArea.getText()); | |
142 accepted = true; | |
143 setVisible(false); | |
144 }//GEN-LAST:event_okButtonClicked | |
145 | |
146 private void cancelButtonClicked(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonClicked | |
147 setVisible(false); | |
148 }//GEN-LAST:event_cancelButtonClicked | |
149 | |
150 | |
151 // Variables declaration - do not modify//GEN-BEGIN:variables | |
152 private javax.swing.JButton cancelButton; | |
153 private javax.swing.JScrollPane jScrollPane1; | |
154 private javax.swing.JLabel nameLabel; | |
155 private javax.swing.JTextField nameTextField; | |
156 private javax.swing.JButton okButton; | |
157 private javax.swing.JLabel sourceLabel; | |
158 private javax.swing.JTextArea sourceTextArea; | |
159 // End of variables declaration//GEN-END:variables | |
160 | |
161 } |