|
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-2002 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.xml.core.wizard; /** * * @author Petr Kuzel */ public class DocumentPanel extends AbstractPanel { /** Serial Version UID */ private static final long serialVersionUID = 3793605846188902177L; /** Creates new form DocumentPanel */ public DocumentPanel() { initComponents(); initAccessibility(); // switch off extensibity point - not implemented otherRadioButton.setVisible(false); otherComboBox.setVisible(false); } /** 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; buttonGroup = new javax.swing.ButtonGroup(); descTextArea = new javax.swing.JTextArea(); wellformedRadioButton = new javax.swing.JRadioButton(); dtdConstrainedRadioButton = new javax.swing.JRadioButton(); schemaConstrainedRadioButton = new javax.swing.JRadioButton(); otherRadioButton = new javax.swing.JRadioButton(); otherComboBox = new javax.swing.JComboBox(); fillPanel = new javax.swing.JPanel(); setLayout(new java.awt.GridBagLayout()); setName(Util.THIS.getString("PROP_doc_panel_name")); descTextArea.setEditable(false); descTextArea.setLineWrap(true); descTextArea.setText(Util.THIS.getString("MSG_document_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); wellformedRadioButton.setText(Util.THIS.getString("PROP_wellformed_name")); wellformedRadioButton.setToolTipText(Util.THIS.getString("PROP_doc_wellformedRadioButton_desc")); buttonGroup.add(wellformedRadioButton); wellformedRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { wellformedRadioButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 0); add(wellformedRadioButton, gridBagConstraints); dtdConstrainedRadioButton.setText(Util.THIS.getString("PROP_dtd_doc_name")); dtdConstrainedRadioButton.setToolTipText(Util.THIS.getString("PROP_doc_dtdConstrainedRadioButton_desc")); buttonGroup.add(dtdConstrainedRadioButton); dtdConstrainedRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { dtdConstrainedRadioButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 0); add(dtdConstrainedRadioButton, gridBagConstraints); schemaConstrainedRadioButton.setText(Util.THIS.getString("PROP_schema_doc_name")); schemaConstrainedRadioButton.setToolTipText(Util.THIS.getString("PROP_doc_schemaConstrainedRadioButton_desc")); buttonGroup.add(schemaConstrainedRadioButton); schemaConstrainedRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { schemaConstrainedRadioButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 0); add(schemaConstrainedRadioButton, gridBagConstraints); otherRadioButton.setText(Util.THIS.getString("PROP_other_doc_name")); buttonGroup.add(otherRadioButton); otherRadioButton.setEnabled(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 12); add(otherRadioButton, gridBagConstraints); otherComboBox.setEnabled(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; add(otherComboBox, 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 initAccessibility() { Util util = Util.THIS; wellformedRadioButton.setMnemonic(util.getChar("PROP_doc_wellformedRadioButton_mne")); schemaConstrainedRadioButton.setMnemonic(util.getChar("PROP_doc_schemaConstrainedRadioButton_mne")); dtdConstrainedRadioButton.setMnemonic(util.getChar("PROP_doc_dtdConstrainedRadioButton_mne")); getAccessibleContext().setAccessibleDescription(descTextArea.getText()); } private void schemaConstrainedRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_schemaConstrainedRadioButtonActionPerformed updateModel(); }//GEN-LAST:event_schemaConstrainedRadioButtonActionPerformed private void dtdConstrainedRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dtdConstrainedRadioButtonActionPerformed updateModel(); }//GEN-LAST:event_dtdConstrainedRadioButtonActionPerformed private void wellformedRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_wellformedRadioButtonActionPerformed updateModel(); }//GEN-LAST:event_wellformedRadioButtonActionPerformed /** User just entered the panel, init view by model values */ protected void initView() { int type = model.getType(); switch (type) { case DocumentModel.NONE: wellformedRadioButton.setSelected(true); break; case DocumentModel.DTD: dtdConstrainedRadioButton.setSelected(true); break; case DocumentModel.SCHEMA: schemaConstrainedRadioButton.setSelected(true); break; case DocumentModel.OTHER: otherRadioButton.setSelected(true); break; default: throw new IllegalStateException(); } } /** User just leaved the panel, update model */ protected void updateModel() { if (wellformedRadioButton.isSelected()) { model.setType(model.NONE); } else if (dtdConstrainedRadioButton.isSelected()) { model.setType(model.DTD); } else if (schemaConstrainedRadioButton.isSelected()) { model.setType(model.SCHEMA); } else { model.setType(model.OTHER); } } /** User just reentered the panel. */ protected void updateView() { // no dynamic update needed } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup buttonGroup; private javax.swing.JRadioButton otherRadioButton; private javax.swing.JRadioButton wellformedRadioButton; private javax.swing.JRadioButton schemaConstrainedRadioButton; private javax.swing.JComboBox otherComboBox; private javax.swing.JTextArea descTextArea; private javax.swing.JRadioButton dtdConstrainedRadioButton; private javax.swing.JPanel fillPanel; // 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.