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

org.xtce.apps.editor.ui.XTCEViewerCompressFileChooser 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.ui;

import java.io.File;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import org.xtce.toolkit.XTCEFunctions;

/** This dialog creates the File Chooser for selecting an XTCE document for
 * the purpose of applying schema aware compression algorithms, in support of
 * the menu item on the XTCEViewer application.
 *
 * @author dovereem
 *
 */

public class XTCEViewerCompressFileChooser extends JFileChooser {

    /** This dialog creates the File Chooser for selecting an XTCE document for
     * the purpose of applying schema aware compression algorithms, in support
     * of the menu item on the XTCEViewer application.
     *
     * @param prefs XTCEViewerPreferences object containing the current user
     * preferences.
     *
     */

    XTCEViewerCompressFileChooser( XTCEViewerPreferences prefs ) {

        super( "." );

        xincludeCheckBox.setSelected( prefs.getUseXIncludeOption() );

        JPanel accessory = new JPanel();
        accessory.setLayout( new BoxLayout( accessory, BoxLayout.PAGE_AXIS ) );
        accessory.add( xincludeCheckBox );
        setAccessory( accessory );

        FileFilter fileFilter =
            new FileNameExtensionFilter( XTCEFunctions.getText( "file_chooser_xtcexml_text" ), // NOI18N
                                         "xml" ); // NOI18N
        addChoosableFileFilter( fileFilter );
        setFileFilter( fileFilter ); // Initial filter setting

        if ( prefs.getCurrentWorkingDirectory().isEmpty() == false ) {
            setCurrentDirectory( new File( prefs.getCurrentWorkingDirectory() ) );
        }

        setDialogTitle( XTCEFunctions.getText( "file_chooser_compress_title" ) ); // NOI18N

    }

    /** Retrieve the selection state of the option to use XInclude when opening
     * the requested file.
     *
     * @return Boolean indicating of XInclude should be used.
     *
     */

    public boolean isXIncludeSelected() {
        return xincludeCheckBox.isSelected();
    }

    // Private Data Members

    private final JCheckBox xincludeCheckBox =
        new JCheckBox( XTCEFunctions.getText( "file_chooser_xinclude_text" ) ); // NOI18N

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy