org.xtce.apps.editor.ui.XTCEViewerSpaceSystemAttributes Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xtcetools Show documentation
Show all versions of xtcetools Show documentation
This project contains software to support the Object Management Group (OMG) Space Domain Task Force (SDTF) maintained XML Telemetry and Command Exchange (XTCE) specification.
/* 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;
import org.omg.space.xtce.HeaderType;
import org.xtce.toolkit.XTCESpaceSystem;
/**
*
* @author David Overeem
*
*/
public class XTCEViewerSpaceSystemAttributes extends javax.swing.JPanel {
/**
* Creates new form XTCEViewerSpaceSystemAttributes
*/
public XTCEViewerSpaceSystemAttributes() {
initComponents();
}
/**
* 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() {
attributesLabel = new javax.swing.JLabel();
operationalStatusLabel = new javax.swing.JLabel();
versionLabel = new javax.swing.JLabel();
dateLabel = new javax.swing.JLabel();
classificationLabel = new javax.swing.JLabel();
classificationInstructionsLabel = new javax.swing.JLabel();
validationStatusLabel = new javax.swing.JLabel();
shortDescriptionLabel = new javax.swing.JLabel();
operationalStatusText = new javax.swing.JTextField();
versionText = new javax.swing.JTextField();
dateText = new javax.swing.JTextField();
classificationText = new javax.swing.JTextField();
classificationInstructionsText = new javax.swing.JTextField();
validationStatusComboBox = new javax.swing.JComboBox();
shortDescriptionScrollPane = new javax.swing.JScrollPane();
shortDescriptionText = new javax.swing.JTextArea();
attributesLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/xtce/toolkit/MessagesBundle"); // NOI18N
attributesLabel.setText(bundle.getString("tab_ssdetail_attr_text")); // NOI18N
operationalStatusLabel.setText(bundle.getString("tab_ssdetail_opstatus_text")); // NOI18N
versionLabel.setText(bundle.getString("tab_ssdetail_version_text")); // NOI18N
dateLabel.setText(bundle.getString("tab_ssdetail_date_text")); // NOI18N
classificationLabel.setText(bundle.getString("tab_ssdetail_classification_text")); // NOI18N
classificationInstructionsLabel.setText(bundle.getString("tab_ssdetail_classinstruction_text")); // NOI18N
validationStatusLabel.setText(bundle.getString("tab_ssdetail_validationstatus_text")); // NOI18N
shortDescriptionLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
shortDescriptionLabel.setText(bundle.getString("tab_ssdetail_shortdesc_text")); // NOI18N
operationalStatusText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
operationalStatusTextActionPerformed(evt);
}
});
versionText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
versionTextActionPerformed(evt);
}
});
dateText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dateTextActionPerformed(evt);
}
});
classificationText.setText("NotClassified");
classificationText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
classificationTextActionPerformed(evt);
}
});
classificationInstructionsText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
classificationInstructionsTextActionPerformed(evt);
}
});
validationStatusComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Unknown", "Working", "Draft", "Test", "Validated", "Released", "Withdrawn" }));
validationStatusComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
validationStatusComboBoxActionPerformed(evt);
}
});
shortDescriptionText.setColumns(20);
shortDescriptionText.setLineWrap(true);
shortDescriptionText.setRows(2);
shortDescriptionText.setWrapStyleWord(true);
shortDescriptionText.addAncestorListener(new javax.swing.event.AncestorListener() {
public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
shortDescriptionTextAncestorAdded(evt);
}
public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
}
public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
}
});
shortDescriptionScrollPane.setViewportView(shortDescriptionText);
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()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(attributesLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(shortDescriptionScrollPane)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(operationalStatusLabel)
.addComponent(versionLabel)
.addComponent(dateLabel)
.addComponent(classificationLabel)
.addComponent(classificationInstructionsLabel)
.addComponent(validationStatusLabel))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(operationalStatusText)
.addComponent(versionText)
.addComponent(dateText)
.addComponent(classificationText)
.addComponent(classificationInstructionsText)
.addComponent(validationStatusComboBox, 0, 264, Short.MAX_VALUE)))
.addComponent(shortDescriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(attributesLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(operationalStatusLabel)
.addComponent(operationalStatusText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(versionLabel)
.addComponent(versionText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(dateLabel)
.addComponent(dateText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(classificationText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(classificationLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(classificationInstructionsLabel)
.addComponent(classificationInstructionsText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(validationStatusComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(validationStatusLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(shortDescriptionLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(shortDescriptionScrollPane)
.addContainerGap())
);
}// //GEN-END:initComponents
private void operationalStatusTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_operationalStatusTextActionPerformed
String text = operationalStatusText.getText();
if ( ( text == null ) || ( text.isEmpty() == true ) ) {
spaceSystem_.getReference().setOperationalStatus( null );
} else {
spaceSystem_.getReference().setOperationalStatus( text );
}
}//GEN-LAST:event_operationalStatusTextActionPerformed
private void versionTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_versionTextActionPerformed
String text = versionText.getText();
HeaderType header = spaceSystem_.getReference().getHeader();
if ( ( text == null ) || ( text.isEmpty() == true ) ) {
if ( header == null ) {
return;
} else if ( header.getVersion() != null ) {
header.setVersion( null );
}
return;
}
if ( header == null ) {
header = new HeaderType();
spaceSystem_.getReference().setHeader( header );
}
header.setVersion( text );
}//GEN-LAST:event_versionTextActionPerformed
private void dateTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dateTextActionPerformed
String text = dateText.getText();
HeaderType header = spaceSystem_.getReference().getHeader();
if ( ( text == null ) || ( text.isEmpty() == true ) ) {
if ( header == null ) {
return;
} else if ( header.getDate() != null ) {
header.setDate( null );
}
return;
}
if ( header == null ) {
header = new HeaderType();
spaceSystem_.getReference().setHeader( header );
}
header.setDate( text );
}//GEN-LAST:event_dateTextActionPerformed
private void classificationTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_classificationTextActionPerformed
String text = classificationText.getText();
HeaderType header = spaceSystem_.getReference().getHeader();
if ( ( text == null ) || ( text.isEmpty() == true ) ) {
if ( header == null ) {
return;
} else if ( header.getClassification() != null ) {
header.setClassification( null );
}
return;
}
if ( header == null ) {
header = new HeaderType();
spaceSystem_.getReference().setHeader( header );
}
header.setClassification( text );
}//GEN-LAST:event_classificationTextActionPerformed
private void classificationInstructionsTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_classificationInstructionsTextActionPerformed
String text = classificationInstructionsText.getText();
HeaderType header = spaceSystem_.getReference().getHeader();
if ( ( text == null ) || ( text.isEmpty() == true ) ) {
if ( header == null ) {
return;
} else if ( header.getClassificationInstructions() != null ) {
header.setClassificationInstructions( null );
}
return;
}
if ( header == null ) {
header = new HeaderType();
spaceSystem_.getReference().setHeader( header );
}
header.setClassificationInstructions( text );
}//GEN-LAST:event_classificationInstructionsTextActionPerformed
private void validationStatusComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_validationStatusComboBoxActionPerformed
String text = (String)validationStatusComboBox.getSelectedItem();
HeaderType header = spaceSystem_.getReference().getHeader();
if ( header == null ) {
header = new HeaderType();
spaceSystem_.getReference().setHeader( header );
}
header.setValidationStatus( text );
}//GEN-LAST:event_validationStatusComboBoxActionPerformed
private void shortDescriptionTextAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_shortDescriptionTextAncestorAdded
String text = shortDescriptionText.getText();
if ( ( text == null ) || ( text.isEmpty() == true ) ) {
spaceSystem_.getReference().setShortDescription( null );
} else {
spaceSystem_.getReference().setShortDescription( text );
}
}//GEN-LAST:event_shortDescriptionTextAncestorAdded
public void setSpaceSystem( XTCESpaceSystem spaceSystem ) {
spaceSystem_ = spaceSystem;
shortDescriptionText.setText( spaceSystem_.getShortDescription() );
shortDescriptionText.setCaretPosition( 0 );
operationalStatusText.setText( spaceSystem_.getReference().
getOperationalStatus() );
operationalStatusText.setCaretPosition( 0 );
if ( spaceSystem_.getReference().getHeader() != null ) {
versionText.setText( spaceSystem_.getReference().
getHeader().
getVersion() );
dateText.setText( spaceSystem_.getReference().
getHeader().
getDate() );
classificationText.setText( spaceSystem_.getReference().
getHeader().
getClassification() );
classificationInstructionsText.setText( spaceSystem_.getReference().
getHeader().
getClassificationInstructions() );
classificationInstructionsText.setCaretPosition( 0 );
validationStatusComboBox.setSelectedItem( spaceSystem_.getReference().
getHeader().
getValidationStatus() );
}
}
public void setEditable( boolean editEnabled ) {
shortDescriptionText.setEditable( editEnabled );
operationalStatusText.setEditable( editEnabled );
versionText.setEditable( editEnabled );
dateText.setEditable( editEnabled );
classificationText.setEditable( editEnabled );
classificationInstructionsText.setEditable( editEnabled );
validationStatusComboBox.setEnabled( editEnabled );
}
// Private Data Members
private XTCESpaceSystem spaceSystem_ = null;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel attributesLabel;
private javax.swing.JLabel classificationInstructionsLabel;
private javax.swing.JTextField classificationInstructionsText;
private javax.swing.JLabel classificationLabel;
private javax.swing.JTextField classificationText;
private javax.swing.JLabel dateLabel;
private javax.swing.JTextField dateText;
private javax.swing.JLabel operationalStatusLabel;
private javax.swing.JTextField operationalStatusText;
private javax.swing.JLabel shortDescriptionLabel;
private javax.swing.JScrollPane shortDescriptionScrollPane;
private javax.swing.JTextArea shortDescriptionText;
private javax.swing.JComboBox validationStatusComboBox;
private javax.swing.JLabel validationStatusLabel;
private javax.swing.JLabel versionLabel;
private javax.swing.JTextField versionText;
// End of variables declaration//GEN-END:variables
}