2
* LocalFilterPanel.java
4
* Created on 25 Октябрь 2007 г., 17:45
7
package org.netbeans.modules.php.dbgp.ui;
9
import java.util.Arrays;
10
import java.util.HashSet;
11
import java.util.LinkedList;
12
import java.util.List;
15
import org.netbeans.modules.php.dbgp.models.VariablesModelFilter;
16
import org.netbeans.modules.php.dbgp.models.VariablesModelFilter.FilterType;
24
public class LocalFilterPanel extends javax.swing.JPanel {
26
private static final long serialVersionUID = -523385854753396290L;
28
/** Creates new form LocalFilterPanel */
29
public LocalFilterPanel() {
34
public FilterType[] getSelectedTypes() {
35
List<FilterType> result = new LinkedList<FilterType>();
36
if ( myScalars.isSelected() ) {
37
result.add( FilterType.SCALARS);
39
if ( myArray.isSelected() ) {
40
result.add( FilterType.ARRAY );
42
if ( myObject.isSelected() ) {
43
result.add( FilterType.OBJECT );
45
if ( myResource.isSelected() ) {
46
result.add( FilterType.RESOURCE );
48
if ( myNull.isSelected() ) {
49
result.add( FilterType.NULL );
51
if ( myUninit.isSelected() ) {
52
result.add( FilterType.UNINIT);
54
if ( mySuperglobal.isSelected() ) {
55
result.add( FilterType.SUPERGLOBALS);
57
return result.toArray( new FilterType[ result.size()] );
61
FilterType[] types = VariablesModelFilter.getFilters();
62
if ( types == null ) {
65
Set<FilterType> set = new HashSet<FilterType>( Arrays.asList( types ) );
66
myScalars.setSelected( set.contains( FilterType.SCALARS));
67
myArray.setSelected( set.contains( FilterType.ARRAY));
68
myObject.setSelected( set.contains( FilterType.OBJECT));
69
myResource.setSelected( set.contains(FilterType.RESOURCE));
70
myNull.setSelected( set.contains( FilterType.NULL));
71
myUninit.setSelected( set.contains(FilterType.UNINIT));
72
mySuperglobal.setSelected( set.contains(FilterType.SUPERGLOBALS ));
75
/** This method is called from within the constructor to
76
* initialize the form.
77
* WARNING: Do NOT modify this code. The content of this method is
78
* always regenerated by the Form Editor.
80
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
81
private void initComponents() {
83
mySelectLbl = new javax.swing.JLabel();
84
myScalars = new javax.swing.JCheckBox();
85
myArray = new javax.swing.JCheckBox();
86
myObject = new javax.swing.JCheckBox();
87
myResource = new javax.swing.JCheckBox();
88
myNull = new javax.swing.JCheckBox();
89
myUninit = new javax.swing.JCheckBox();
90
mySuperglobal = new javax.swing.JCheckBox();
92
org.openide.awt.Mnemonics.setLocalizedText(mySelectLbl, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Select")); // NOI18N
94
org.openide.awt.Mnemonics.setLocalizedText(myScalars, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Scalars")); // NOI18N
95
myScalars.setActionCommand(org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Scalars")); // NOI18N
97
org.openide.awt.Mnemonics.setLocalizedText(myArray, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Array")); // NOI18N
99
org.openide.awt.Mnemonics.setLocalizedText(myObject, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Object")); // NOI18N
101
org.openide.awt.Mnemonics.setLocalizedText(myResource, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Resource")); // NOI18N
103
org.openide.awt.Mnemonics.setLocalizedText(myNull, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Null")); // NOI18N
105
org.openide.awt.Mnemonics.setLocalizedText(myUninit, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Uninit")); // NOI18N
107
org.openide.awt.Mnemonics.setLocalizedText(mySuperglobal, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Superglobal")); // NOI18N
109
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
110
this.setLayout(layout);
111
layout.setHorizontalGroup(
112
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
113
.add(layout.createSequentialGroup()
115
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
117
.add(layout.createSequentialGroup()
119
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
126
.add(mySuperglobal))))
127
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
129
layout.setVerticalGroup(
130
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
131
.add(layout.createSequentialGroup()
134
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
136
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
138
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
140
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
142
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
144
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
146
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
148
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
151
myScalars.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "A11_Scalars")); // NOI18N
152
myArray.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "A11_Array")); // NOI18N
153
myObject.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "A11_Object")); // NOI18N
154
myResource.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "A11_Resource")); // NOI18N
155
myNull.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "A11_Null")); // NOI18N
156
myUninit.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "A11_Uninit")); // NOI18N
157
mySuperglobal.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "A11_Superglobal")); // NOI18N
158
}// </editor-fold>//GEN-END:initComponents
161
// Variables declaration - do not modify//GEN-BEGIN:variables
162
private javax.swing.JCheckBox myArray;
163
private javax.swing.JCheckBox myNull;
164
private javax.swing.JCheckBox myObject;
165
private javax.swing.JCheckBox myResource;
166
private javax.swing.JCheckBox myScalars;
167
private javax.swing.JLabel mySelectLbl;
168
private javax.swing.JCheckBox mySuperglobal;
169
private javax.swing.JCheckBox myUninit;
170
// End of variables declaration//GEN-END:variables