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

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

/**
 *
 * @author David Overeem
 *
 */

public class XTCEViewerAlias extends javax.swing.JPanel {

    /**
     * Creates new form XTCEViewerAlias TODO
     * 
     * @param aliasSet TOTO
     * 
     * @param ns TODO
     * 
     * @param idx TODO
     * 
     * @param text TODO
     * 
     */
    public XTCEViewerAlias( XTCEViewerAliasSet aliasSet, String ns, String text, int idx ) {
        initComponents();
        namespaceText.setText( ns );
        namespaceText.setCaretPosition( 0 );
        aliasText.setText( text );
        aliasText.setCaretPosition( 0 );
        aliasSet_ = aliasSet;
        idx_      = idx;
    }

    /**
     * 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() {

        namespaceLabel = new javax.swing.JLabel();
        namespaceText = new javax.swing.JTextField();
        aliasLabel = new javax.swing.JLabel();
        aliasText = new javax.swing.JTextField();
        removeButton = new javax.swing.JButton();

        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/xtce/toolkit/MessagesBundle"); // NOI18N
        namespaceLabel.setText(bundle.getString("tab_ssdetail_nslabel_text")); // NOI18N

        namespaceText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                namespaceTextActionPerformed(evt);
            }
        });

        aliasLabel.setText(bundle.getString("tab_ssdetail_aliaslabel_text")); // NOI18N

        aliasText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aliasTextActionPerformed(evt);
            }
        });

        removeButton.setText(bundle.getString("tab_ssdetail_remove_text")); // NOI18N
        removeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(namespaceLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(namespaceText, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(aliasLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(aliasText, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(removeButton)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(namespaceLabel)
                    .addComponent(namespaceText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(aliasLabel)
                    .addComponent(aliasText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(removeButton))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// //GEN-END:initComponents

    private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed
        aliasSet_.removeAlias( idx_ );
    }//GEN-LAST:event_removeButtonActionPerformed

    private void aliasTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aliasTextActionPerformed
        if ( isVisible() == true ) {
            aliasSet_.editAlias( namespaceText.getText(), aliasText.getText(), idx_ );
        }
    }//GEN-LAST:event_aliasTextActionPerformed

    private void namespaceTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_namespaceTextActionPerformed
        if ( isVisible() == true ) {
            aliasSet_.editAlias( namespaceText.getText(), aliasText.getText(), idx_ );
        }
    }//GEN-LAST:event_namespaceTextActionPerformed

    public void setEditable( boolean editEnabled ) {
        removeButton.setEnabled( editEnabled );
        aliasText.setEditable( editEnabled );
        namespaceText.setEditable( editEnabled );
    }

    // Private Data Members

    private XTCEViewerAliasSet aliasSet_ = null;
    private int                idx_      = 0;

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel aliasLabel;
    private javax.swing.JTextField aliasText;
    private javax.swing.JLabel namespaceLabel;
    private javax.swing.JTextField namespaceText;
    private javax.swing.JButton removeButton;
    // End of variables declaration//GEN-END:variables
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy