Search in sources :

Example 11 with RateInformation

use of CCDD.CcddClassesDataTable.RateInformation in project CCDD by nasa.

the class CcddTelemetrySchedulerDialog method addDataStreams.

/**
 ********************************************************************************************
 * Add a scheduler handler for each rate
 ********************************************************************************************
 */
private void addDataStreams() {
    // Step through each rate
    for (RateInformation rateInfo : rateHandler.getRateInformation()) {
        // Create a new scheduler handler for each rate column
        schHandlers.add(new CcddSchedulerHandler(ccddMain, rateInfo.getRateName(), this));
        // Add each table as a tab in the editor window tabbed pane
        tabbedPane.addTab(rateInfo.getStreamName(), null, schHandlers.get(schHandlers.size() - 1).getSchedulerPanel(), null);
    }
}
Also used : RateInformation(CCDD.CcddClassesDataTable.RateInformation)

Example 12 with RateInformation

use of CCDD.CcddClassesDataTable.RateInformation in project CCDD by nasa.

the class CcddRateParameterHandler method getRateInformationIndexByStreamName.

/**
 ********************************************************************************************
 * Get the index of the rate information with the specified stream name
 *
 * @param streamName
 *            stream name
 *
 * @return Index of the rate information with the specified stream name; -1 if no rate
 *         information has this stream name
 ********************************************************************************************
 */
protected int getRateInformationIndexByStreamName(String streamName) {
    int streamIndex = -1;
    int index = 0;
    // Step through the rate information
    for (RateInformation info : rateInformation) {
        // Check if the stream name matches the name for this rate information
        if (streamName.equals(info.getStreamName())) {
            // Save the index and stop searching
            streamIndex = index;
            break;
        }
        index++;
    }
    return streamIndex;
}
Also used : RateInformation(CCDD.CcddClassesDataTable.RateInformation)

Example 13 with RateInformation

use of CCDD.CcddClassesDataTable.RateInformation in project CCDD by nasa.

the class CcddRateParameterHandler method setRateInformation.

/**
 ********************************************************************************************
 * Set the rate information list based on the unique rate columns
 *
 * @return true if the number of rate columns changed
 ********************************************************************************************
 */
protected boolean setRateInformation() {
    // Store the current number of rate columns
    int oldNumRateColumns = rateInformation.size();
    // Step through any existing rate column information
    for (RateInformation rateInfo : rateInformation) {
        // Set the number of table types referencing this rate to zero. This is used to
        // determine if a rate is still in use
        rateInfo.setNumSharedTableTypes(0);
    }
    // Step through each table type
    for (TypeDefinition typeDefn : tableTypeHandler.getTypeDefinitions()) {
        // Check if the type represents a structure
        if (typeDefn.isStructure()) {
            // Step through each column in the type definition
            for (int index = 0; index < typeDefn.getColumnCountDatabase(); index++) {
                // Check if the column is a sample rate
                if (typeDefn.getInputTypes()[index] == InputDataType.RATE) {
                    // Get the column's visible name
                    String colName = typeDefn.getColumnNamesUser()[index];
                    // Get the rate information for this rate column name
                    RateInformation rateInfo = getRateInformationByRateName(colName);
                    // Check if the column name hasn't been added
                    if (rateInfo == null) {
                        // Add the rate column name to the list
                        rateInformation.add(new RateInformation(colName));
                    } else // The rate column already exists
                    {
                        // Increment the share counter for the existing rate information
                        rateInfo.setNumSharedTableTypes(rateInfo.getNumSharedTableTypes() + 1);
                    }
                }
            }
        }
    }
    // Create a list to store any rate column information that no longer exists
    List<RateInformation> removedRates = new ArrayList<RateInformation>();
    // Step through each rate column's information
    for (RateInformation rateInfo : rateInformation) {
        // Check if the rate is not referenced by a table type
        if (rateInfo.getNumSharedTableTypes() == 0) {
            // Add the non-referenced rate to the list of those to remove
            removedRates.add(rateInfo);
        }
    }
    // Remove any rate information that's no longer valid
    rateInformation.removeAll(removedRates);
    return rateInformation.size() != oldNumRateColumns;
}
Also used : ArrayList(java.util.ArrayList) RateInformation(CCDD.CcddClassesDataTable.RateInformation) TypeDefinition(CCDD.CcddTableTypeHandler.TypeDefinition)

Example 14 with RateInformation

use of CCDD.CcddClassesDataTable.RateInformation in project CCDD by nasa.

the class CcddRateParameterHandler method getRateInformationByStreamName.

/**
 ********************************************************************************************
 * Get the rate information with the specified data stream name
 *
 * @param streamName
 *            name of stream
 *
 * @return Rate information with the data stream name; null if the data stream doesn't exist
 ********************************************************************************************
 */
protected RateInformation getRateInformationByStreamName(String streamName) {
    RateInformation rateInfo = null;
    // Get the index into the rate information for the specified data stream name
    int index = getRateInformationIndexByStreamName(streamName);
    // Check if the stream name exists
    if (index != -1) {
        // Get the reference to the rate information at the index
        rateInfo = rateInformation.get(index);
    }
    return rateInfo;
}
Also used : RateInformation(CCDD.CcddClassesDataTable.RateInformation)

Example 15 with RateInformation

use of CCDD.CcddClassesDataTable.RateInformation in project CCDD by nasa.

the class CcddRateParameterHandler method getRateInformationByRateName.

/**
 ********************************************************************************************
 * Get the rate information with the specified rate column
 *
 * @param rateColumnName
 *            rate column name
 *
 * @return Rate information with the specified rate column; null if the rate column doesn't
 *         exist
 ********************************************************************************************
 */
protected RateInformation getRateInformationByRateName(String rateColumnName) {
    RateInformation rateInfo = null;
    // Get the index into the rate information for the specified rate column name
    int index = getRateInformationIndexByRateName(rateColumnName);
    // Check if the rate column name exists
    if (index != -1) {
        // Get the reference to the rate information at the index
        rateInfo = rateInformation.get(index);
    }
    return rateInfo;
}
Also used : RateInformation(CCDD.CcddClassesDataTable.RateInformation)

Aggregations

RateInformation (CCDD.CcddClassesDataTable.RateInformation)22 ArrayList (java.util.ArrayList)7 JPanel (javax.swing.JPanel)5 GridBagConstraints (java.awt.GridBagConstraints)4 GridBagLayout (java.awt.GridBagLayout)4 ActionEvent (java.awt.event.ActionEvent)4 DnDTabbedPane (CCDD.CcddClassesComponent.DnDTabbedPane)3 Insets (java.awt.Insets)3 ActionListener (java.awt.event.ActionListener)3 JLabel (javax.swing.JLabel)3 ChangeEvent (javax.swing.event.ChangeEvent)3 ChangeListener (javax.swing.event.ChangeListener)3 BackgroundCommand (CCDD.CcddBackgroundCommand.BackgroundCommand)2 PaddedComboBox (CCDD.CcddClassesComponent.PaddedComboBox)2 TypeDefinition (CCDD.CcddTableTypeHandler.TypeDefinition)2 JScrollPane (javax.swing.JScrollPane)2 TableColumn (javax.swing.table.TableColumn)2 ArrayListMultiple (CCDD.CcddClassesComponent.ArrayListMultiple)1 CustomSplitPane (CCDD.CcddClassesComponent.CustomSplitPane)1 ToolTipTreeNode (CCDD.CcddClassesComponent.ToolTipTreeNode)1