Search in sources :

Example 1 with BaseDataTypeInfo

use of CCDD.CcddConstants.BaseDataTypeInfo in project CCDD by nasa.

the class CcddDataTypeHandler method isInteger.

/**
 ********************************************************************************************
 * Determine if the specified data type is a signed or unsigned integer
 *
 * @param dataTypeName
 *            data type name
 *
 * @return true if the specified data type is a signed or unsigned integer
 ********************************************************************************************
 */
protected boolean isInteger(String dataTypeName) {
    boolean isInteger = false;
    // get the base data type for the specified data type
    BaseDataTypeInfo baseDataType = getBaseDataType(dataTypeName);
    // Set the flag to true if the base data type is an integer (signed or unsigned)
    isInteger = baseDataType == BaseDataTypeInfo.UNSIGNED_INT || baseDataType == BaseDataTypeInfo.SIGNED_INT;
    return isInteger;
}
Also used : BaseDataTypeInfo(CCDD.CcddConstants.BaseDataTypeInfo)

Example 2 with BaseDataTypeInfo

use of CCDD.CcddConstants.BaseDataTypeInfo in project CCDD by nasa.

the class CcddDataTypeHandler method getBaseDataType.

/**
 ********************************************************************************************
 * Get the base data type for the specified data type
 *
 * @param dataTypeName
 *            data type name
 *
 * @return Base data type for the specified data type; returns null if the data type doesn't
 *         exist
 ********************************************************************************************
 */
protected BaseDataTypeInfo getBaseDataType(String dataTypeName) {
    BaseDataTypeInfo baseDataType = null;
    // Get the data type information based on the type name
    String[] dataType = getDataTypeInfo(dataTypeName);
    // Check if the data type exists
    if (dataType != null) {
        // Get the associated base data type
        baseDataType = BaseDataTypeInfo.getBaseType(dataType[DataTypesColumn.BASE_TYPE.ordinal()]);
    }
    return baseDataType;
}
Also used : BaseDataTypeInfo(CCDD.CcddConstants.BaseDataTypeInfo)

Example 3 with BaseDataTypeInfo

use of CCDD.CcddConstants.BaseDataTypeInfo in project CCDD by nasa.

the class CcddDataTypeEditorDialog method createBasePrimitiveTypeCellEditor.

/**
 ********************************************************************************************
 * Create the cell editor for base data types
 ********************************************************************************************
 */
private void createBasePrimitiveTypeCellEditor() {
    // Create a combo box for displaying the base data types
    final PaddedComboBox baseComboBox = new PaddedComboBox(dataTypeTable.getFont());
    // Step through each base data type
    for (BaseDataTypeInfo type : BaseDataTypeInfo.values()) {
        // Add the data type to the list
        baseComboBox.addItem(type.getName().toLowerCase());
    }
    // Add a listener to the combo box for focus changes
    baseComboBox.addFocusListener(new FocusAdapter() {

        /**
         ************************************************************************************
         * Handle a focus gained event so that the combo box automatically expands when
         * selected
         ************************************************************************************
         */
        @Override
        public void focusGained(FocusEvent fe) {
            baseComboBox.showPopup();
        }
    });
    // Create the data type cell editor for enumerations
    baseTypeCellEditor = new DefaultCellEditor(baseComboBox);
}
Also used : FocusAdapter(java.awt.event.FocusAdapter) PaddedComboBox(CCDD.CcddClassesComponent.PaddedComboBox) BaseDataTypeInfo(CCDD.CcddConstants.BaseDataTypeInfo) FocusEvent(java.awt.event.FocusEvent) DefaultCellEditor(javax.swing.DefaultCellEditor)

Example 4 with BaseDataTypeInfo

use of CCDD.CcddConstants.BaseDataTypeInfo in project CCDD by nasa.

the class CcddScriptDataAccessHandler method getBaseDataType.

/**
 ********************************************************************************************
 * Get the base type for the specified data type
 *
 * @param dataType
 *            primitive data type
 *
 * @return Base type for the specified data type; returns null if the data type doesn't exist
 *         or isn't a primitive type
 ********************************************************************************************
 */
public String getBaseDataType(String dataType) {
    String baseType = null;
    // Get the base data type information based on the data type
    BaseDataTypeInfo baseTypeInfo = dataTypeHandler.getBaseDataType(dataType);
    // Check if the data type exists
    if (baseTypeInfo != null) {
        // Get the base type for the data type
        baseType = baseTypeInfo.getName();
    }
    return baseType;
}
Also used : BaseDataTypeInfo(CCDD.CcddConstants.BaseDataTypeInfo)

Aggregations

BaseDataTypeInfo (CCDD.CcddConstants.BaseDataTypeInfo)4 PaddedComboBox (CCDD.CcddClassesComponent.PaddedComboBox)1 FocusAdapter (java.awt.event.FocusAdapter)1 FocusEvent (java.awt.event.FocusEvent)1 DefaultCellEditor (javax.swing.DefaultCellEditor)1