|
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.cvsclient.customizer; import org.openide.util.*; import org.openide.*; import org.netbeans.modules.vcscore.util.*; import org.netbeans.modules.cvsclient.NbJavaCvsFileSystem; import javax.swing.event.*; import javax.swing.*; import javax.accessibility.*; import java.awt.event.*; import java.io.*; import java.util.*; import javax.swing.JFileChooser; import org.netbeans.modules.cvsclient.editors.*; import org.netbeans.modules.javacvs.editors.*; /** The first panel in the wizard. * * * @author mkleint */ public class Cust1WorkPanel extends javax.swing.JPanel { private static final java.util.ResourceBundle bundle1 = NbBundle.getBundle(UiModePropertyEditor.class); private static final java.util.ResourceBundle bundle2 = NbBundle.getBundle(RefreshModePropertyEditor.class); /** array of hosts */ private static final String[] modes = {bundle1.getString("UiModePropertyEditor.defaults"), // NOI18N bundle1.getString("UiModePropertyEditor.detailed")}; // NOI18N // bundle1.getString("UiModePropertyEditor.commandLine")}; // NOI18N private static final String[] types = {bundle1.getString("DisplayTypePropertyEditor.simple"), // NOI18N bundle1.getString("DisplayTypePropertyEditor.formatted"), // NOI18N bundle1.getString("DisplayTypePropertyEditor.limited_formatted")}; // NOI18N private static final String[] autos = {bundle2.getString("RefreshModePropertyEditor.noRefresh"), // NOI18N bundle2.getString("RefreshModePropertyEditor.dirOnOpen"), // NOI18N bundle2.getString("RefreshModePropertyEditor.recursOnMount"), // NOI18N bundle2.getString("RefreshModePropertyEditor.recursOnRestart"), // NOI18N bundle2.getString("RefreshModePropertyEditor.recursOnMountAndRestart")}; // NOI18N private ArrayList listeners = new ArrayList(); private NbJavaCvsFileSystem fs; public Cust1WorkPanel() { initComponents(); initAccessibility(); btnWorking.setMnemonic(NbBundle.getBundle(Cust1WorkPanel.class).getString("JavaCvsCustomizer.btnWorking.mnemonic").charAt(0)); // NOI18N lbWorking.setDisplayedMnemonic(NbBundle.getBundle(Cust1WorkPanel.class).getString("JavaCvsCustomizer.lbWorking.mnemonic").charAt(0)); // NOI18N lbWorking.setLabelFor(txWorking); cbUiMode.setModel(new DefaultComboBoxModel(modes)); cbOutputDisplay.setModel(new DefaultComboBoxModel(types)); cbAutoRefresh.setModel(new DefaultComboBoxModel(autos)); lblUiMode.setDisplayedMnemonic(NbBundle.getBundle(Cust1WorkPanel.class).getString("Cust3OtherPropertiesPanel.lblUiMode.mnemonic").charAt(0)); // NOI18N lblUiMode.setLabelFor(cbUiMode); lblOutputDisplay.setDisplayedMnemonic(NbBundle.getBundle(Cust1WorkPanel.class).getString("Cust3OtherPropertiesPanel.lblOutputDisplay.mnemonic").charAt(0)); // NOI18N lblOutputDisplay.setLabelFor(cbOutputDisplay); lblAutoRefresh.setDisplayedMnemonic(NbBundle.getBundle(Cust1WorkPanel.class).getString("Cust3OtherPropertiesPanel.lblAutoRefresh.mnemonic").charAt(0)); // NOI18N lblAutoRefresh.setLabelFor(cbAutoRefresh); cbProcessAll.setMnemonic(NbBundle.getBundle(Cust1WorkPanel.class).getString("Cust1WorkDirPanel.cbProcessAll.mnemonic").charAt(0)); // NOI18N cbOffLine.setMnemonic(NbBundle.getBundle(Cust1WorkPanel.class).getString("Cust3OtherPropertiesPanel.cbOffLine.mnemonic").charAt(0)); // NOI18N cbBackUpFiles.setMnemonic(NbBundle.getBundle(Cust1WorkPanel.class).getString("Cust1WorkDirPanel.cbBackupFiles.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 FormEditor. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; lbWorking = new javax.swing.JLabel(); txWorking = new javax.swing.JTextField(); btnWorking = new javax.swing.JButton(); lblAutoRefresh = new javax.swing.JLabel(); cbAutoRefresh = new javax.swing.JComboBox(); lblUiMode = new javax.swing.JLabel(); cbUiMode = new javax.swing.JComboBox(); lblOutputDisplay = new javax.swing.JLabel(); cbOutputDisplay = new javax.swing.JComboBox(); cbProcessAll = new javax.swing.JCheckBox(); cbOffLine = new javax.swing.JCheckBox(); cbBackUpFiles = new javax.swing.JCheckBox(); setLayout(new java.awt.GridBagLayout()); setPreferredSize(new java.awt.Dimension(450, 325)); setMinimumSize(new java.awt.Dimension(450, 325)); lbWorking.setLabelFor(txWorking); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(12, 12, 12, 0); add(lbWorking, gridBagConstraints); txWorking.setColumns(20); txWorking.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { txWorkingKeyReleased(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(12, 12, 12, 0); add(txWorking, gridBagConstraints); btnWorking.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnWorkingActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(12, 5, 12, 11); add(btnWorking, gridBagConstraints); lblAutoRefresh.setLabelFor(cbAutoRefresh); 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, 0); add(lblAutoRefresh, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 12, 5, 0); add(cbAutoRefresh, gridBagConstraints); lblUiMode.setLabelFor(cbUiMode); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 12, 5, 0); add(lblUiMode, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 12, 5, 0); add(cbUiMode, gridBagConstraints); lblOutputDisplay.setLabelFor(cbOutputDisplay); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 12, 11, 0); add(lblOutputDisplay, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 12, 11, 0); add(cbOutputDisplay, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 11); add(cbProcessAll, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 11); add(cbOffLine, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 12, 11, 11); add(cbBackUpFiles, gridBagConstraints); }//GEN-END:initComponents private void txWorkingKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txWorkingKeyReleased // Add your handling code here: fireChangeState(); }//GEN-LAST:event_txWorkingKeyReleased private void btnWorkingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnWorkingActionPerformed // Add your handling code here: JFileChooser fd = new JFileChooser(); fd.setFileHidingEnabled(false); fd.setFileFilter( new javax.swing.filechooser.FileFilter() { public boolean accept(File file) { if (file.exists() && file.isDirectory()) return true; else return false; } public String getDescription() { return NbBundle.getBundle("org/netbeans/modules/vcscore/wizard/mountcvs/Bundle").getString("TXT_Directory"); // NOI18N } }); fd.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); File dir = null;//org.netbeans.modules.vcscore.wizard.mountcvs.util.Utilities.findDirectory(this.txWorking.getText()); if (dir != null) fd.setCurrentDirectory(dir); if (fd.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { this.txWorking.setText(fd.getSelectedFile().getAbsolutePath()); } fireChangeState(); }//GEN-LAST:event_btnWorkingActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnWorking; private javax.swing.JComboBox cbAutoRefresh; private javax.swing.JCheckBox cbBackUpFiles; private javax.swing.JCheckBox cbOffLine; private javax.swing.JComboBox cbOutputDisplay; private javax.swing.JCheckBox cbProcessAll; private javax.swing.JComboBox cbUiMode; private javax.swing.JLabel lbWorking; private javax.swing.JLabel lblAutoRefresh; private javax.swing.JLabel lblOutputDisplay; private javax.swing.JLabel lblUiMode; private javax.swing.JTextField txWorking; // End of variables declaration//GEN-END:variables static final long serialVersionUID = -7632627368102894471L; private static final java.util.ResourceBundle bundle = NbBundle.getBundle(Cust1WorkPanel.class); // NOI18N private void initAccessibility() { AccessibleContext context = this.getAccessibleContext(); context.setAccessibleDescription(bundle.getString("ACSD_Cust1WorkPanel")); context = btnWorking.getAccessibleContext(); context.setAccessibleDescription(bundle.getString("ACSD_Cust1WorkPanel.btnWorking")); context = cbProcessAll.getAccessibleContext(); context.setAccessibleDescription(bundle.getString("ACSD_Cust1WorkPanel.cbProcessAll")); context = cbOffLine.getAccessibleContext(); context.setAccessibleDescription(bundle.getString("ACSD_Cust1WorkPanel.cbOffLine")); context = cbBackUpFiles.getAccessibleContext(); context.setAccessibleDescription(bundle.getString("ACSD_Cust1WorkPanel.cbBackUpFiles")); context = cbAutoRefresh.getAccessibleContext(); context.setAccessibleDescription(bundle.getString("ACSD_Cust1WorkPanel.cbAutoRefresh")); context = cbOutputDisplay.getAccessibleContext(); context.setAccessibleDescription(bundle.getString("ACSD_Cust1WorkPanel.cbOutputDisplay")); context = cbUiMode.getAccessibleContext(); context.setAccessibleDescription(bundle.getString("ACSD_Cust1WorkPanel.cbUiMode")); context = txWorking.getAccessibleContext(); context.setAccessibleDescription(bundle.getString("ACSD_Cust1WorkPanel.txWorking")); } /** name of the panel. * @return the name of the current panel. */ public String getName() { return org.openide.util.NbBundle.getBundle(Cust1WorkPanel.class).getString("Cust1WorkPanel.workDialogLabel"); // NOI18N } /** Get the component displayed in this panel. * @return the component */ /** Add a listener to changes of the panel's validity. * @param l the listener to add * @see #isValid */ private synchronized void addChangeListener(ChangeListener l) { if (listeners == null) { listeners = new ArrayList(); } listeners.add(l); } /** Remove a listener to changes of the panel's validity. * @param l the listener to remove */ private synchronized void removeChangeListener(ChangeListener l) { if (listeners != null) { listeners.remove(l); } } private void fireChangeState() { ArrayList list; synchronized (this) { if (this.listeners == null) return; list = (ArrayList) this.listeners.clone(); } ChangeEvent event = new ChangeEvent(this); for (int i=0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 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.