KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > debug > breakpoints > ActionsPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.web.debug.breakpoints;
21
22 import org.netbeans.api.debugger.jpda.JPDABreakpoint;
23 import org.openide.util.NbBundle;
24
25 /**
26  * @author Martin Grebac
27  */

28 public class ActionsPanel extends javax.swing.JPanel JavaDoc {
29
30     private JspLineBreakpoint breakpoint;
31
32     /** Creates new form LineBreakpointPanel */
33     public ActionsPanel (JspLineBreakpoint b) {
34         breakpoint = b;
35         initComponents ();
36
37         cbSuspend.addItem(NbBundle.getMessage(ActionsPanel.class, "LBL_CB_Actions_Panel_Suspend_None"));
38         cbSuspend.addItem(NbBundle.getMessage(ActionsPanel.class, "LBL_CB_Actions_Panel_Suspend_Current"));
39         cbSuspend.addItem(NbBundle.getMessage(ActionsPanel.class, "LBL_CB_Actions_Panel_Suspend_All"));
40         switch (b.getSuspend ()) {
41             case JspLineBreakpoint.SUSPEND_NONE:
42                 cbSuspend.setSelectedIndex (0);
43                 break;
44             case JspLineBreakpoint.SUSPEND_EVENT_THREAD:
45                 cbSuspend.setSelectedIndex (1);
46                 break;
47             case JspLineBreakpoint.SUSPEND_ALL:
48                 cbSuspend.setSelectedIndex (2);
49                 break;
50         }
51         if (b.getPrintText () != null)
52             tfPrintText.setText (b.getPrintText ());
53     }
54     
55     private void initComponents()
56     {
57         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
58
59         tfPrintText = new javax.swing.JTextField JavaDoc();
60         jLabel1 = new javax.swing.JLabel JavaDoc();
61         cbSuspend = new javax.swing.JComboBox JavaDoc();
62         jLabel2 = new javax.swing.JLabel JavaDoc();
63
64         setLayout(new java.awt.GridBagLayout JavaDoc());
65
66         setBorder(new javax.swing.border.TitledBorder JavaDoc("Actions"));
67         tfPrintText.setToolTipText(NbBundle.getMessage(ActionsPanel.class, "TTT_TF_Actions_Panel_Print_Text"));
68         tfPrintText.addActionListener(new java.awt.event.ActionListener JavaDoc() {
69             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
70                 //TODO
71
}
72         });
73
74         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
75         gridBagConstraints.gridx = 1;
76         gridBagConstraints.gridy = 1;
77         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
78         gridBagConstraints.insets = new java.awt.Insets JavaDoc(3, 3, 3, 3);
79         gridBagConstraints.weightx = 1.0;
80         add(tfPrintText, gridBagConstraints);
81         tfPrintText.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ActionsPanel.class, "ACSD_TF_Actions_Panel_Print_Text"));
82
83         jLabel1.setDisplayedMnemonic(NbBundle.getMessage(ActionsPanel.class, "MN_L_Actions_Panel_Suspend").charAt(0));
84         jLabel1.setLabelFor(cbSuspend);
85         jLabel1.setText(NbBundle.getMessage(ActionsPanel.class, "L_Actions_Panel_Suspend"));
86         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
87         gridBagConstraints.gridx = 0;
88         gridBagConstraints.gridy = 0;
89         gridBagConstraints.insets = new java.awt.Insets JavaDoc(3, 3, 3, 3);
90         add(jLabel1, gridBagConstraints);
91         jLabel1.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ActionsPanel.class, "ASCD_L_Actions_Panel_Suspend"));
92
93         cbSuspend.setToolTipText(NbBundle.getMessage(ActionsPanel.class, "TTT_CB_Actions_Panel_Suspend"));
94         cbSuspend.addActionListener(new java.awt.event.ActionListener JavaDoc() {
95             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
96                 //TODO
97
}
98         });
99
100         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
101         gridBagConstraints.insets = new java.awt.Insets JavaDoc(3, 3, 3, 3);
102         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
103         add(cbSuspend, gridBagConstraints);
104         cbSuspend.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ActionsPanel.class, "ASCD_CB_Actions_Panel_Suspend"));
105
106         jLabel2.setDisplayedMnemonic(NbBundle.getMessage(ActionsPanel.class, "MN_L_Actions_Panel_Print_Text").charAt(0));
107         jLabel2.setLabelFor(tfPrintText);
108         jLabel2.setText(NbBundle.getMessage(ActionsPanel.class, "L_Actions_Panel_Print_Text"));
109         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
110         gridBagConstraints.gridx = 0;
111         gridBagConstraints.gridy = 1;
112         gridBagConstraints.insets = new java.awt.Insets JavaDoc(3, 3, 3, 3);
113         add(jLabel2, gridBagConstraints);
114
115     }
116     
117     /**
118      * Called when "Ok" button is pressed.
119      *
120      * @return whether customizer can be closed
121      */

122     public void ok () {
123         String JavaDoc printText = tfPrintText.getText ();
124         if (printText.trim ().length () > 0) {
125             breakpoint.setPrintText (printText.trim ());
126         } else {
127             breakpoint.setPrintText (null);
128         }
129         
130         switch (cbSuspend.getSelectedIndex ()) {
131             case 0:
132                 breakpoint.setSuspend (JspLineBreakpoint.SUSPEND_NONE);
133                 break;
134             case 1:
135                 breakpoint.setSuspend (JspLineBreakpoint.SUSPEND_EVENT_THREAD);
136                 break;
137             case 2:
138                 breakpoint.setSuspend (JspLineBreakpoint.SUSPEND_ALL);
139                 break;
140         }
141     }
142     
143     // Variables declaration - do not modify
144
private javax.swing.JComboBox JavaDoc cbSuspend;
145     private javax.swing.JLabel JavaDoc jLabel1;
146     private javax.swing.JLabel JavaDoc jLabel2;
147     private javax.swing.JTextField JavaDoc tfPrintText;
148     // End of variables declaration
149

150 }
151
Popular Tags