|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.editor.options; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.event.ItemEvent; import java.util.HashMap; import java.util.Map; import org.netbeans.editor.SettingsNames; import org.netbeans.editor.ext.java.JavaSettingsNames; import org.openide.util.NbBundle; /** * * @author Martin Roskanin */ public class CodeFoldingEditorPanel extends javax.swing.JPanel { CodeFoldingEditor foldingEditor; /** Creates new form CodeFoldingEditorPanel */ public CodeFoldingEditorPanel(CodeFoldingEditor foldingEditor) { this.foldingEditor = foldingEditor; initComponents(); initAccessibility(); } private void initAccessibility(){ enableFoldingCB.setMnemonic(getBundleString("CFEP_UseCF_Mnemonic").charAt(0)); //NOI18N methodCB.setMnemonic(getBundleString("CFEP_Method_Mnemonic").charAt(0)); //NOI18N innerCB.setMnemonic(getBundleString("CFEP_InnerClass_Mnemonic").charAt(0)); //NOI18N importCB.setMnemonic(getBundleString("CFEP_Import_Mnemonic").charAt(0)); //NOI18N javadocCB.setMnemonic(getBundleString("CFEP_Javadoc_Mnemonic").charAt(0)); //NOI18N initialCommentCB.setMnemonic(getBundleString("CFEP_InitialComment_Mnemonic").charAt(0)); //NOI18N } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; enableFoldingCB = new javax.swing.JCheckBox(); jLabel1 = new javax.swing.JLabel(); methodCB = new javax.swing.JCheckBox(); innerCB = new javax.swing.JCheckBox(); importCB = new javax.swing.JCheckBox(); javadocCB = new javax.swing.JCheckBox(); initialCommentCB = new javax.swing.JCheckBox(); setLayout(new java.awt.GridBagLayout()); enableFoldingCB.setText(getBundleString( "CFEP_UseCF" )); enableFoldingCB.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { checkBoxChange(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(12, 12, 12, 0); add(enableFoldingCB, gridBagConstraints); jLabel1.setText(getBundleString( "CFEP_CollapsedByDefault" )); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 12, 5, 11); add(jLabel1, gridBagConstraints); methodCB.setText(getBundleString( "CFEP_Method" )); methodCB.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { methodCBItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 24, 0, 0); add(methodCB, gridBagConstraints); innerCB.setText(getBundleString( "CFEP_InnerClass" )); innerCB.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { innerCBItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 24, 0, 0); add(innerCB, gridBagConstraints); importCB.setText(getBundleString( "CFEP_Import" )); importCB.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { importCBItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 24, 0, 0); add(importCB, gridBagConstraints); javadocCB.setText(getBundleString( "CFEP_Javadoc" )); javadocCB.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { javadocCBItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.insets = new java.awt.Insets(0, 24, 0, 0); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; add(javadocCB, gridBagConstraints); initialCommentCB.setText(getBundleString( "CFEP_InitialComment" )); initialCommentCB.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { initialCommentCBItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; gridBagConstraints.insets = new java.awt.Insets(0, 24, 0, 0); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; add(initialCommentCB, gridBagConstraints); }//GEN-END:initComponents private void initialCommentCBItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_initialCommentCBItemStateChanged notifyEditor(); }//GEN-LAST:event_initialCommentCBItemStateChanged private void javadocCBItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_javadocCBItemStateChanged notifyEditor(); }//GEN-LAST:event_javadocCBItemStateChanged private void importCBItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_importCBItemStateChanged notifyEditor(); }//GEN-LAST:event_importCBItemStateChanged private void innerCBItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_innerCBItemStateChanged notifyEditor(); }//GEN-LAST:event_innerCBItemStateChanged private void methodCBItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_methodCBItemStateChanged notifyEditor(); }//GEN-LAST:event_methodCBItemStateChanged private void checkBoxChange(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_checkBoxChange setCBoxesEnabled(evt.getStateChange() == ItemEvent.SELECTED); notifyEditor(); }//GEN-LAST:event_checkBoxChange private void notifyEditor() { if( foldingEditor != null ) foldingEditor.customEditorChange(); } private void setCBoxesEnabled(boolean selected){ methodCB.setEnabled(selected); innerCB.setEnabled(selected); importCB.setEnabled(selected); javadocCB.setEnabled(selected); initialCommentCB.setEnabled(selected); } /** * Fill in editor with initial values */ public void setValue( Map m ) { Boolean val = (Boolean)m.get(SettingsNames.CODE_FOLDING_ENABLE); if (val.booleanValue() == false){ setCBoxesEnabled(false); } enableFoldingCB.setSelected(val.booleanValue()); val = (Boolean)m.get(JavaSettingsNames.CODE_FOLDING_COLLAPSE_METHOD); methodCB.setSelected(val.booleanValue()); val = (Boolean)m.get(JavaSettingsNames.CODE_FOLDING_COLLAPSE_INNERCLASS); innerCB.setSelected(val.booleanValue()); val = (Boolean)m.get(JavaSettingsNames.CODE_FOLDING_COLLAPSE_IMPORT); importCB.setSelected(val.booleanValue()); val = (Boolean)m.get(JavaSettingsNames.CODE_FOLDING_COLLAPSE_JAVADOC); javadocCB.setSelected(val.booleanValue()); val = (Boolean)m.get(JavaSettingsNames.CODE_FOLDING_COLLAPSE_INITIAL_COMMENT); initialCommentCB.setSelected(val.booleanValue()); } /** * Take the result of users modifications */ public Map getValue() { Map ret = new HashMap(); ret.put(SettingsNames.CODE_FOLDING_ENABLE, new Boolean(enableFoldingCB.isSelected())); ret.put(JavaSettingsNames.CODE_FOLDING_COLLAPSE_METHOD, new Boolean(methodCB.isSelected())); ret.put(JavaSettingsNames.CODE_FOLDING_COLLAPSE_INNERCLASS, new Boolean(innerCB.isSelected())); ret.put(JavaSettingsNames.CODE_FOLDING_COLLAPSE_IMPORT, new Boolean(importCB.isSelected())); ret.put(JavaSettingsNames.CODE_FOLDING_COLLAPSE_JAVADOC, new Boolean(javadocCB.isSelected())); ret.put(JavaSettingsNames.CODE_FOLDING_COLLAPSE_INITIAL_COMMENT, new Boolean(initialCommentCB.isSelected())); return ret; } private String getBundleString(String s) { return NbBundle.getMessage(CodeFoldingEditorPanel.class, s); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox enableFoldingCB; private javax.swing.JCheckBox importCB; private javax.swing.JCheckBox initialCommentCB; private javax.swing.JCheckBox innerCB; private javax.swing.JLabel jLabel1; private javax.swing.JCheckBox javadocCB; private javax.swing.JCheckBox methodCB; // End of variables declaration//GEN-END:variables } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.