org.xtce.apps.editor.dialogs.XTCEViewerArgumentXmlDialog 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.dialogs;
import java.awt.Frame;
import org.xtce.toolkit.XTCEDatabaseException;
import java.awt.event.WindowEvent;
import org.xtce.toolkit.XTCEArgument;
import org.xtce.toolkit.XTCEFunctions;
/** Dialog window to display the raw XML contents of an Argument, where
* both the type element and the Argument element are shown for the user.
*
* @author David Overeem
*/
public class XTCEViewerArgumentXmlDialog extends javax.swing.JDialog {
/** Constructor to create a new XML output dialog for a Parameter in an
* XTCE document.
*
* @param parent Frame object containing a reference to the parent window.
*
* @param modal Boolean indicating if this dialog should block access to
* the parent window while it is open.
*
* @param argument XTCEArgument object from the XTCE data model.
*
* @throws XTCEDatabaseException Thrown in the event that the XML cannot
* be extracted from the XTCEParameter object provided.
*
*/
public XTCEViewerArgumentXmlDialog( Frame parent,
boolean modal,
XTCEArgument argument )
throws XTCEDatabaseException {
super(parent, modal);
initComponents();
if ( argument == null ) {
return;
}
parameterDefinitionText.setText( argument.toXml() );
parameterTypeDefinitionText.setText( argument.typeToXml() );
setTitle( XTCEFunctions.getText(
"dialog_argument_xml_title" ) + // NOI18N
": " + // NOI18N
argument.getName() );
pack();
setLocationRelativeTo( parent );
}
/**
* 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() {
parameterTypeLabel = new javax.swing.JLabel();
parameterTypeScrollPane = new javax.swing.JScrollPane();
parameterTypeDefinitionText = new javax.swing.JTextArea();
parameterLabel = new javax.swing.JLabel();
parameterDefinitionScrollPane = new javax.swing.JScrollPane();
parameterDefinitionText = new javax.swing.JTextArea();
buttonPanel = new javax.swing.JPanel();
acceptButton = new javax.swing.JButton();
dismissButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setMinimumSize(new java.awt.Dimension(500, 400));
setModalExclusionType(java.awt.Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);
setName("XML Elements"); // NOI18N
parameterTypeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/xtce/toolkit/MessagesBundle"); // NOI18N
parameterTypeLabel.setText(bundle.getString("dialog_argtype_xml_def")); // NOI18N
parameterTypeDefinitionText.setRows(10);
parameterTypeScrollPane.setViewportView(parameterTypeDefinitionText);
parameterLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
parameterLabel.setText(bundle.getString("dialog_arg_xml_def")); // NOI18N
parameterDefinitionText.setRows(3);
parameterDefinitionScrollPane.setViewportView(parameterDefinitionText);
buttonPanel.setMaximumSize(new java.awt.Dimension(32767, 47));
buttonPanel.setMinimumSize(new java.awt.Dimension(0, 47));
acceptButton.setText(bundle.getString("general_accept_text")); // NOI18N
acceptButton.setMaximumSize(new java.awt.Dimension(100, 25));
acceptButton.setMinimumSize(new java.awt.Dimension(100, 25));
acceptButton.setPreferredSize(new java.awt.Dimension(100, 25));
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, 25));
dismissButton.setMinimumSize(new java.awt.Dimension(100, 25));
dismissButton.setPreferredSize(new java.awt.Dimension(100, 25));
dismissButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dismissButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout buttonPanelLayout = new javax.swing.GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
buttonPanelLayout.setHorizontalGroup(
buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(buttonPanelLayout.createSequentialGroup()
.addContainerGap(132, Short.MAX_VALUE)
.addComponent(acceptButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(dismissButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(144, Short.MAX_VALUE))
);
buttonPanelLayout.setVerticalGroup(
buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(buttonPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(buttonPanelLayout.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))
.addContainerGap())
);
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(buttonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(parameterTypeLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(parameterLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(parameterDefinitionScrollPane, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(parameterTypeScrollPane))
.addContainerGap())))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(parameterTypeLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(parameterTypeScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(parameterLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(parameterDefinitionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
pack();
}// //GEN-END:initComponents
private void dismissButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dismissButtonActionPerformed
this.dispatchEvent( new WindowEvent(this, WindowEvent.WINDOW_CLOSING) );
}//GEN-LAST:event_dismissButtonActionPerformed
private void acceptButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_acceptButtonActionPerformed
this.dispatchEvent( new WindowEvent(this, WindowEvent.WINDOW_CLOSING) );
}//GEN-LAST:event_acceptButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton acceptButton;
private javax.swing.JPanel buttonPanel;
private javax.swing.JButton dismissButton;
private javax.swing.JScrollPane parameterDefinitionScrollPane;
private javax.swing.JTextArea parameterDefinitionText;
private javax.swing.JLabel parameterLabel;
private javax.swing.JTextArea parameterTypeDefinitionText;
private javax.swing.JLabel parameterTypeLabel;
private javax.swing.JScrollPane parameterTypeScrollPane;
// End of variables declaration//GEN-END:variables
}