|
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.xml.core.wizard;
import java.awt.*;
import java.awt.event.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Set;
import java.util.Vector;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.FocusManager;
import javax.swing.text.JTextComponent;
import org.openide.nodes.Children;
import org.openide.nodes.FilterNode;
import org.openide.nodes.Node;
import org.openide.nodes.NodeOperation;
import org.xml.sax.*;
/**
* Gathers data for DTD driven XML document instantionation.
*
* @author Petr Kuzel
* @version it does not work well, no PIDs no roots, ...
*/
public class DTDPanel extends AbstractPanel {
/** Serial Version UID */
private static final long serialVersionUID = 5310047495162425192L;
/** Creates new form DTDPanel */
public DTDPanel() {
initComponents();
initAccessibility();
// attach focus listener to editor directly
Component editor = pidComboBox.getEditor().getEditorComponent();
editor.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
if (existsPID()) updatePossibilities();
}
});
}
/** 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;
descTextArea = new javax.swing.JTextArea();
pidLabel = new javax.swing.JLabel();
pidComboBox = new javax.swing.JComboBox();
catalogButton = new javax.swing.JButton();
sidLabel = new javax.swing.JLabel();
sidComboBox = new javax.swing.JComboBox();
rootLabel = new javax.swing.JLabel();
rootComboBox = new javax.swing.JComboBox();
fillPanel = new javax.swing.JPanel();
setLayout(new java.awt.GridBagLayout());
setName(Util.THIS.getString("PROP_dtd_panel_name"));
descTextArea.setEditable(false);
descTextArea.setLineWrap(true);
descTextArea.setText(Util.THIS.getString("MSG_dtd_panel_desc"));
descTextArea.setWrapStyleWord(true);
descTextArea.setDisabledTextColor(descTextArea.getForeground());
descTextArea.setEnabled(false);
descTextArea.setOpaque(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
add(descTextArea, gridBagConstraints);
pidLabel.setLabelFor(pidComboBox);
pidLabel.setText(Util.THIS.getString("PROP_dtd_pid_name"));
pidLabel.setToolTipText(Util.THIS.getString("PROP_dtd_pidLable_desc"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 12);
add(pidLabel, gridBagConstraints);
pidComboBox.setEditable(true);
pidComboBox.setToolTipText(Util.THIS.getString("PROP_dtd_pidComboBox_desc"));
pidComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
pidComboBoxActionPerformed(evt);
}
});
pidComboBox.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
pidComboBoxFocusLost(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
add(pidComboBox, gridBagConstraints);
catalogButton.setText(Util.THIS.getString("PROP_dtd_catalog_name"));
catalogButton.setToolTipText(Util.THIS.getString("PROP_dtd_catalog_desc"));
catalogButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
catalogButtonActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
add(catalogButton, gridBagConstraints);
sidLabel.setLabelFor(sidComboBox);
sidLabel.setText(Util.THIS.getString("PROP_dtd_sid_name"));
sidLabel.setToolTipText(Util.THIS.getString("PROP_dtd_sidLabel_desc"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 12);
add(sidLabel, gridBagConstraints);
sidComboBox.setEditable(true);
sidComboBox.setToolTipText(Util.THIS.getString("PROP_dtd_sidComboBox_desc"));
sidComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sidComboBoxActionPerformed(evt);
}
});
sidComboBox.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
sidComboBoxFocusLost(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
add(sidComboBox, gridBagConstraints);
rootLabel.setLabelFor(rootComboBox);
rootLabel.setText(Util.THIS.getString("PROP_dtd_root_name"));
rootLabel.setToolTipText(Util.THIS.getString("PROP_dtd_rootLabel_desc"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 12);
add(rootLabel, gridBagConstraints);
rootComboBox.setEditable(true);
rootComboBox.setToolTipText(Util.THIS.getString("PROP_dtd_rootComboBox_desc"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
add(rootComboBox, gridBagConstraints);
fillPanel.setLayout(null);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
add(fillPanel, gridBagConstraints);
}//GEN-END:initComponents
private void catalogButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_catalogButtonActionPerformed
Node catalog = getCatalogNode();
if (catalog == null) return;
NodeOperation.getDefault().explore(catalog);
}//GEN-LAST:event_catalogButtonActionPerformed
private void initAccessibility() {
Util util = Util.THIS;
rootLabel.setDisplayedMnemonic(util.getChar("PROP_dtd_rootLabel_mne"));
pidLabel.setDisplayedMnemonic(util.getChar("PROP_dtd_pidLabel_mne"));
sidLabel.setDisplayedMnemonic(util.getChar("PROP_dtd_sidLabel_mne"));
catalogButton.setMnemonic(util.getChar("PROP_dtd_catalog_mne"));
getAccessibleContext().setAccessibleDescription(descTextArea.getText());
}
private void sidComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sidComboBoxActionPerformed
// ignore listing
if (sidComboBox.isPopupVisible()) return;
if (existsPID() == false) updatePossibilities();
}//GEN-LAST:event_sidComboBoxActionPerformed
private void pidComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pidComboBoxActionPerformed
// ignore listing
if (pidComboBox.isPopupVisible()) return;
if (existsPID()) updatePossibilities();
}//GEN-LAST:event_pidComboBoxActionPerformed
private void pidComboBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_pidComboBoxFocusLost
if (existsPID()) updatePossibilities();
}//GEN-LAST:event_pidComboBoxFocusLost
private void sidComboBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_sidComboBoxFocusLost
if (existsPID() == false) updatePossibilities();
}//GEN-LAST:event_sidComboBoxFocusLost
/**
* Try to access catalog management node or
|
... 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.