org.xtce.apps.editor.ui.XTCEViewerHistory 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;
/**
*
* @author David Overeem
*
*/
public class XTCEViewerHistory extends javax.swing.JPanel {
/**
* Creates new form XTCEViewerHistory TODO
*
* @param historySet TODO
*
* @param text TODO
*
* @param idx TODO
*
*/
public XTCEViewerHistory( XTCEViewerHistorySet historySet, String text, int idx ) {
initComponents();
noteText.setText( text );
noteText.setCaretPosition( 0 );
historySet_ = historySet;
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() {
noteLabel = new javax.swing.JLabel();
noteText = new javax.swing.JTextField();
removeButton = new javax.swing.JButton();
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/xtce/toolkit/MessagesBundle"); // NOI18N
noteLabel.setText(bundle.getString("tab_ssdetail_recordlabel_text")); // NOI18N
noteText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
noteTextActionPerformed(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(noteLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(noteText, javax.swing.GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.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(noteLabel)
.addComponent(noteText, 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
historySet_.removeHistoryRecord( idx_ );
}//GEN-LAST:event_removeButtonActionPerformed
private void noteTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noteTextActionPerformed
if ( isVisible() == true ) {
historySet_.editHistoryRecord( noteText.getText(), idx_ );
}
}//GEN-LAST:event_noteTextActionPerformed
public void setEditable( boolean editEnabled ) {
removeButton.setEnabled( editEnabled );
noteText.setEditable( editEnabled );
}
//public void setHistoryText( String text ) {
// noteText.setText( text );
//}
// Private Data Members
private XTCEViewerHistorySet historySet_ = null;
private int idx_ = 0;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel noteLabel;
private javax.swing.JTextField noteText;
private javax.swing.JButton removeButton;
// End of variables declaration//GEN-END:variables
}