1 19 24 25 package org.netbeans.modules.web.jsf.navigation.options; 26 27 import org.openide.options.SystemOption; 28 29 33 public class NavigationOptionPanel extends javax.swing.JPanel { 34 35 private boolean useNewGraphView; 36 37 private boolean optionChanged = false; 38 39 40 public NavigationOptionPanel() { 41 initComponents(); 42 } 43 44 49 private void initComponents() { 51 graphView = new javax.swing.JCheckBox (); 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 (0, 0, 0, 0)); 57 graphView.addItemListener(new java.awt.event.ItemListener () { 58 public void itemStateChanged(java.awt.event.ItemEvent 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 } 81 private void graphViewItemStateChanged(java.awt.event.ItemEvent evt) { useNewGraphView = graphView.isSelected(); 83 optionChanged = true; 84 } 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 public javax.swing.JCheckBox graphView; 109 111 } 112 | Popular Tags |