All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xtce.apps.editor.dialogs.XTCEViewerDatabaseCompressorDialog Maven / Gradle / Ivy

Go to download

This project contains software to support the Object Management Group (OMG) Space Domain Task Force (SDTF) maintained XML Telemetry and Command Exchange (XTCE) specification.

There is a newer version: 1.1.6
Show newest version
/* Copyright 2017 David Overeem ([email protected])
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * 
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */

package org.xtce.apps.editor.dialogs;

import java.awt.event.WindowEvent;
import java.util.Properties;

/**
 *
 * @author dovereem
 */

public class XTCEViewerDatabaseCompressorDialog extends javax.swing.JDialog {

    /**
     * Creates new form XTCEViewerDatabaseCompressorDialog TODO
     * 
     * @param parent TODO
     * 
     * @param modal TODO
     * 
     */

    public XTCEViewerDatabaseCompressorDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        setLocationRelativeTo( getParent() );
    }

    public boolean proceed() {
        return proceed_;
    }

    public Properties getSelectedOptions() {

        Properties props = new Properties();

        props.put( "BASIC_DEFAULTS", option1Checkbox.isSelected() );
        props.put( "IDENTITY_CALIBRATORS", option2Checkbox.isSelected() );
        props.put( "UNNEEDED_LISTS", option3Checkbox.isSelected() );
        props.put( "RAW_VALID_RANGES", option4Checkbox.isSelected() );
        props.put( "ENUM_2_BOOL", option5Checkbox.isSelected() );
        props.put( "XTCE_PREFIX", namespaceXtceRadioButton.isSelected() );

        props.put( "ADVANCED_DEFAULTS", jCheckBox2.isSelected() );
        props.put( "DUPLICATE_TYPES", jCheckBox6.isSelected() );
        props.put( "START_BITS", jCheckBox1.isSelected() );

        return props;

    }

    /**
     * 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.
     */
    @SuppressWarnings("unchecked")
    // //GEN-BEGIN:initComponents
    private void initComponents() {

        namespaceButtonGroup = new javax.swing.ButtonGroup();
        optionsBasicLabel = new javax.swing.JLabel();
        optionsBasicDescLabel = new javax.swing.JLabel();
        optionsBasicPanel = new javax.swing.JPanel();
        option1Checkbox = new javax.swing.JCheckBox();
        option2Checkbox = new javax.swing.JCheckBox();
        option3Checkbox = new javax.swing.JCheckBox();
        option4Checkbox = new javax.swing.JCheckBox();
        option5Checkbox = new javax.swing.JCheckBox();
        optionsAdvancedLabel = new javax.swing.JLabel();
        optionsAdvancedDescLabel = new javax.swing.JLabel();
        optionsAdvancedPanel = new javax.swing.JPanel();
        jCheckBox2 = new javax.swing.JCheckBox();
        jCheckBox6 = new javax.swing.JCheckBox();
        jCheckBox1 = new javax.swing.JCheckBox();
        acceptButton = new javax.swing.JButton();
        dismissButton = new javax.swing.JButton();
        namespaceXtceRadioButton = new javax.swing.JRadioButton();
        namespaceDefaultRadioButton = new javax.swing.JRadioButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/xtce/toolkit/MessagesBundle"); // NOI18N
        setTitle(bundle.getString("file_compress_title")); // NOI18N
        setResizable(false);

        optionsBasicLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        optionsBasicLabel.setText(bundle.getString("file_compress_options_title1a")); // NOI18N
        optionsBasicLabel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        optionsBasicDescLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        optionsBasicDescLabel.setText(bundle.getString("file_compress_options_title1b")); // NOI18N

        option1Checkbox.setSelected(true);
        option1Checkbox.setText(bundle.getString("file_compress_options_1")); // NOI18N

        option2Checkbox.setSelected(true);
        option2Checkbox.setText(bundle.getString("file_compress_options_3")); // NOI18N

        option3Checkbox.setSelected(true);
        option3Checkbox.setText(bundle.getString("file_compress_options_4")); // NOI18N

        option4Checkbox.setSelected(true);
        option4Checkbox.setText(bundle.getString("file_compress_options_5")); // NOI18N

        option5Checkbox.setSelected(true);
        option5Checkbox.setText(bundle.getString("file_compress_options_7")); // NOI18N

        javax.swing.GroupLayout optionsBasicPanelLayout = new javax.swing.GroupLayout(optionsBasicPanel);
        optionsBasicPanel.setLayout(optionsBasicPanelLayout);
        optionsBasicPanelLayout.setHorizontalGroup(
            optionsBasicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionsBasicPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(optionsBasicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(option1Checkbox)
                    .addComponent(option2Checkbox)
                    .addComponent(option3Checkbox)
                    .addComponent(option4Checkbox)
                    .addComponent(option5Checkbox))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        optionsBasicPanelLayout.setVerticalGroup(
            optionsBasicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionsBasicPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(option1Checkbox)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(option2Checkbox)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(option3Checkbox)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(option4Checkbox)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(option5Checkbox)
                .addContainerGap(29, Short.MAX_VALUE))
        );

        optionsAdvancedLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        optionsAdvancedLabel.setText(bundle.getString("file_compress_options_title2a")); // NOI18N
        optionsAdvancedLabel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        optionsAdvancedDescLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        optionsAdvancedDescLabel.setText(bundle.getString("file_compress_options_title2b")); // NOI18N

        jCheckBox2.setText(bundle.getString("file_compress_options_2")); // NOI18N

        jCheckBox6.setText(bundle.getString("file_compress_options_6")); // NOI18N

        jCheckBox1.setText(bundle.getString("file_compress_options_8")); // NOI18N

        javax.swing.GroupLayout optionsAdvancedPanelLayout = new javax.swing.GroupLayout(optionsAdvancedPanel);
        optionsAdvancedPanel.setLayout(optionsAdvancedPanelLayout);
        optionsAdvancedPanelLayout.setHorizontalGroup(
            optionsAdvancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionsAdvancedPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(optionsAdvancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jCheckBox2)
                    .addComponent(jCheckBox6)
                    .addComponent(jCheckBox1))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        optionsAdvancedPanelLayout.setVerticalGroup(
            optionsAdvancedPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(optionsAdvancedPanelLayout.createSequentialGroup()
                .addComponent(jCheckBox2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox1)
                .addGap(0, 53, Short.MAX_VALUE))
        );

        acceptButton.setText(bundle.getString("general_accept_text")); // NOI18N
        acceptButton.setMaximumSize(new java.awt.Dimension(100, 30));
        acceptButton.setMinimumSize(new java.awt.Dimension(100, 30));
        acceptButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                acceptButtonActionPerformed(evt);
            }
        });

        dismissButton.setText(bundle.getString("general_dismiss_text")); // NOI18N
        dismissButton.setMaximumSize(new java.awt.Dimension(100, 30));
        dismissButton.setMinimumSize(new java.awt.Dimension(100, 30));
        dismissButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dismissButtonActionPerformed(evt);
            }
        });

        namespaceButtonGroup.add(namespaceXtceRadioButton);
        namespaceXtceRadioButton.setText(bundle.getString("file_compress_options_xtcens")); // NOI18N

        namespaceButtonGroup.add(namespaceDefaultRadioButton);
        namespaceDefaultRadioButton.setSelected(true);
        namespaceDefaultRadioButton.setText(bundle.getString("file_compress_options_defns")); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(optionsAdvancedDescLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(optionsAdvancedLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(optionsBasicPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(optionsBasicLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(optionsBasicDescLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(optionsAdvancedPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(namespaceXtceRadioButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(namespaceDefaultRadioButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 60, Short.MAX_VALUE)
                        .addComponent(dismissButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(acceptButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(optionsBasicLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(optionsBasicDescLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(optionsBasicPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(optionsAdvancedLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(optionsAdvancedDescLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(optionsAdvancedPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(acceptButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(dismissButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(namespaceXtceRadioButton)
                    .addComponent(namespaceDefaultRadioButton)))
        );

        pack();
    }// //GEN-END:initComponents

    private void acceptButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_acceptButtonActionPerformed
        proceed_ = true;
        dismissButtonActionPerformed( null );
    }//GEN-LAST:event_acceptButtonActionPerformed

    private void dismissButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dismissButtonActionPerformed
        dispatchEvent( new WindowEvent( this, WindowEvent.WINDOW_CLOSING ) );
    }//GEN-LAST:event_dismissButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(XTCEViewerDatabaseCompressorDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(XTCEViewerDatabaseCompressorDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(XTCEViewerDatabaseCompressorDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(XTCEViewerDatabaseCompressorDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                XTCEViewerDatabaseCompressorDialog dialog = new XTCEViewerDatabaseCompressorDialog(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Private Data Members

    private boolean proceed_ = false;

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton acceptButton;
    private javax.swing.JButton dismissButton;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBox2;
    private javax.swing.JCheckBox jCheckBox6;
    private javax.swing.ButtonGroup namespaceButtonGroup;
    private javax.swing.JRadioButton namespaceDefaultRadioButton;
    private javax.swing.JRadioButton namespaceXtceRadioButton;
    private javax.swing.JCheckBox option1Checkbox;
    private javax.swing.JCheckBox option2Checkbox;
    private javax.swing.JCheckBox option3Checkbox;
    private javax.swing.JCheckBox option4Checkbox;
    private javax.swing.JCheckBox option5Checkbox;
    private javax.swing.JLabel optionsAdvancedDescLabel;
    private javax.swing.JLabel optionsAdvancedLabel;
    private javax.swing.JPanel optionsAdvancedPanel;
    private javax.swing.JLabel optionsBasicDescLabel;
    private javax.swing.JLabel optionsBasicLabel;
    private javax.swing.JPanel optionsBasicPanel;
    // End of variables declaration//GEN-END:variables
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy