KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > jsf > navigation > options > NavigationOptionPanel


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /*
20  * NavigationOptionPanel.java
21  *
22  * Created on April 14, 2006, 11:52 AM
23  */

24
25 package org.netbeans.modules.web.jsf.navigation.options;
26
27 import org.openide.options.SystemOption;
28
29 /**
30  *
31  * @author Administrator
32  */

33 public class NavigationOptionPanel extends javax.swing.JPanel JavaDoc {
34
35     private boolean useNewGraphView;
36
37     private boolean optionChanged = false;
38
39     /** Creates new form ExamplePanel */
40     public NavigationOptionPanel() {
41         initComponents();
42     }
43
44     /** This method is called from within the constructor to
45      * initialize the form.
46      * WARNING: Do NOT modify this code. The content of this method is
47      * always regenerated by the Form Editor.
48      */

49     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
50
private void initComponents() {
51         graphView = new javax.swing.JCheckBox JavaDoc();
52
53         graphView.setSelected(true);
54         graphView.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/jsf/navigation/options/Bundle").getString("USE_NEW_GRAPH_VIEW"));
55         graphView.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
56         graphView.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
57         graphView.addItemListener(new java.awt.event.ItemListener JavaDoc() {
58             public void itemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {
59                 graphViewItemStateChanged(evt);
60             }
61         });
62
63         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
64         this.setLayout(layout);
65         layout.setHorizontalGroup(
66             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
67             .add(layout.createSequentialGroup()
68                 .add(32, 32, 32)
69                 .add(graphView)
70                 .addContainerGap(200, Short.MAX_VALUE))
71         );
72         layout.setVerticalGroup(
73             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
74             .add(layout.createSequentialGroup()
75                 .add(33, 33, 33)
76                 .add(graphView)
77                 .addContainerGap(251, Short.MAX_VALUE))
78         );
79     }// </editor-fold>//GEN-END:initComponents
80

81     private void graphViewItemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {//GEN-FIRST:event_graphViewItemStateChanged
82
useNewGraphView = graphView.isSelected();
83         optionChanged = true;
84     }//GEN-LAST:event_graphViewItemStateChanged
85

86     public void update() {
87         NavigationSettings navigationSettings = (NavigationSettings) SystemOption.findObject(NavigationSettings.class, true);
88         useNewGraphView = navigationSettings.getUseNewGraphView();
89         graphView.setSelected(useNewGraphView);
90         optionChanged = false;
91     }
92
93     public void applyChanges() {
94         NavigationSettings navigationSettings = (NavigationSettings) SystemOption.findObject(NavigationSettings.class, true);
95         navigationSettings.setUseNewGraphView(useNewGraphView);
96         optionChanged = false;
97     }
98
99     public void cancel() {
100         optionChanged = false;
101     }
102
103     public boolean isChanged() {
104         return optionChanged;
105     }
106
107     // Variables declaration - do not modify//GEN-BEGIN:variables
108
public javax.swing.JCheckBox JavaDoc graphView;
109     // End of variables declaration//GEN-END:variables
110

111 }
112
Popular Tags