~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to scripting/php/debugger/src/org/netbeans/modules/php/dbgp/ui/LocalFilterPanel.java

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
Import upstream version 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * LocalFilterPanel.java
 
3
 *
 
4
 * Created on 25 Октябрь 2007 г., 17:45
 
5
 */
 
6
 
 
7
package org.netbeans.modules.php.dbgp.ui;
 
8
 
 
9
import java.util.Arrays;
 
10
import java.util.HashSet;
 
11
import java.util.LinkedList;
 
12
import java.util.List;
 
13
import java.util.Set;
 
14
 
 
15
import org.netbeans.modules.php.dbgp.models.VariablesModelFilter;
 
16
import org.netbeans.modules.php.dbgp.models.VariablesModelFilter.FilterType;
 
17
 
 
18
 
 
19
 
 
20
/**
 
21
 *
 
22
 * @author  den
 
23
 */
 
24
public class LocalFilterPanel extends javax.swing.JPanel {
 
25
    
 
26
    private static final long serialVersionUID = -523385854753396290L;
 
27
    
 
28
    /** Creates new form LocalFilterPanel */
 
29
    public LocalFilterPanel() {
 
30
        initComponents();
 
31
        init();
 
32
    }
 
33
 
 
34
    public FilterType[] getSelectedTypes() {
 
35
        List<FilterType> result = new LinkedList<FilterType>();
 
36
        if ( myScalars.isSelected() ) {
 
37
            result.add( FilterType.SCALARS);
 
38
        }
 
39
        if ( myArray.isSelected() ) {
 
40
            result.add( FilterType.ARRAY );
 
41
        }
 
42
        if ( myObject.isSelected() ) {
 
43
            result.add( FilterType.OBJECT );
 
44
        }
 
45
        if ( myResource.isSelected() ) {
 
46
            result.add( FilterType.RESOURCE );
 
47
        }
 
48
        if ( myNull.isSelected() ) {
 
49
            result.add( FilterType.NULL );
 
50
        }
 
51
        if ( myUninit.isSelected() ) {
 
52
            result.add( FilterType.UNINIT);
 
53
        }
 
54
        if ( mySuperglobal.isSelected() ) {
 
55
            result.add( FilterType.SUPERGLOBALS);
 
56
        }
 
57
        return result.toArray( new FilterType[ result.size()] );
 
58
    }
 
59
 
 
60
    private void init() {
 
61
        FilterType[] types = VariablesModelFilter.getFilters();
 
62
        if ( types == null ) {
 
63
            return;
 
64
        }
 
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 ));
 
73
    }
 
74
 
 
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.
 
79
     */
 
80
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
 
81
    private void initComponents() {
 
82
 
 
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();
 
91
 
 
92
        org.openide.awt.Mnemonics.setLocalizedText(mySelectLbl, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Select")); // NOI18N
 
93
 
 
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
 
96
 
 
97
        org.openide.awt.Mnemonics.setLocalizedText(myArray, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Array")); // NOI18N
 
98
 
 
99
        org.openide.awt.Mnemonics.setLocalizedText(myObject, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Object")); // NOI18N
 
100
 
 
101
        org.openide.awt.Mnemonics.setLocalizedText(myResource, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Resource")); // NOI18N
 
102
 
 
103
        org.openide.awt.Mnemonics.setLocalizedText(myNull, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Null")); // NOI18N
 
104
 
 
105
        org.openide.awt.Mnemonics.setLocalizedText(myUninit, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Uninit")); // NOI18N
 
106
 
 
107
        org.openide.awt.Mnemonics.setLocalizedText(mySuperglobal, org.openide.util.NbBundle.getMessage(LocalFilterPanel.class, "LBL_Superglobal")); // NOI18N
 
108
 
 
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()
 
114
                .addContainerGap()
 
115
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
 
116
                    .add(mySelectLbl)
 
117
                    .add(layout.createSequentialGroup()
 
118
                        .add(10, 10, 10)
 
119
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
 
120
                            .add(myArray)
 
121
                            .add(myScalars)
 
122
                            .add(myObject)
 
123
                            .add(myResource)
 
124
                            .add(myNull)
 
125
                            .add(myUninit)
 
126
                            .add(mySuperglobal))))
 
127
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
 
128
        );
 
129
        layout.setVerticalGroup(
 
130
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
 
131
            .add(layout.createSequentialGroup()
 
132
                .addContainerGap()
 
133
                .add(mySelectLbl)
 
134
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
 
135
                .add(myScalars)
 
136
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
 
137
                .add(myArray)
 
138
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
 
139
                .add(myObject)
 
140
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
 
141
                .add(myResource)
 
142
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
 
143
                .add(myNull)
 
144
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
 
145
                .add(myUninit)
 
146
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
 
147
                .add(mySuperglobal)
 
148
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
 
149
        );
 
150
 
 
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
 
159
 
 
160
 
 
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
 
171
 
 
172
}