if ( bEnableUI && grouping.getGroupType( ) != null && grouping.getGroupType( ) == DataType.DATE_TIME_LITERAL && grouping.getGroupingUnit( ) != null ) { cmbUnit.setText( ns.getDisplayNameByName( grouping.getGroupingUnit( ) .getName( ) ) ); } else { cmbUnit.select( 0 ); } lblUnit.setEnabled( bEnableUI && DataType.DATE_TIME_LITERAL.getName( ) .equals( LiteralHelper.dataTypeSet.getNameByDisplayName( cmbType.getText( ) ) ) ); cmbUnit.setEnabled( lblUnit.getEnabled( ) );
    private void populateLists()    {        SeriesGrouping grouping = getGrouping();        boolean bEnableUI = btnEnabled.getSelection();        // Populate the data type combo        Object[] oArr = DataType.VALUES.toArray();        for (int iR = 0; iR < oArr.length; iR++)        {            cmbType.add(((DataType) oArr[iR]).getName());        }        if (bEnableUI && grouping.getGroupType() != null)        {            cmbType.setText(getGrouping().getGroupType().getName());        }        else        {            cmbType.select(0);        }        this.lblType.setEnabled(bEnableUI);        this.cmbType.setEnabled(bEnableUI);        this.lblInterval.setEnabled(bEnableUI);        this.iscInterval.setEnabled(bEnableUI);        // Populate grouping unit combo (applicable only if type is DateTime        // Populate the data type combo        Object[] oUnitArr = GroupingUnitType.VALUES.toArray();        for (int iR = 0; iR < oUnitArr.length; iR++)        {            cmbUnit.add(((GroupingUnitType) oUnitArr[iR]).getName());        }        if (bEnableUI && grouping.getGroupType() != null            && grouping.getGroupType() == DataType.DATE_TIME_LITERAL            && grouping.getGroupingUnit() != null)        {            cmbUnit.setText(grouping.getGroupingUnit().getName());        }        else        {            cmbUnit.select(0);        }        lblUnit.setEnabled(bEnableUI & cmbType.getText().equals(DataType.DATE_TIME_LITERAL.getName()));        cmbUnit.setEnabled(bEnableUI & cmbType.getText().equals(DataType.DATE_TIME_LITERAL.getName()));        // Populate grouping aggregate expression combo        cmbAggregate.setItems(PluginSettings.instance().getRegisteredAggregateFunctions());        if (bEnableUI && grouping.getAggregateExpression() != null)        {            cmbAggregate.setText(grouping.getAggregateExpression());        }        else        {            cmbAggregate.select(0);        }        lblAggregate.setEnabled(bEnableUI);        cmbAggregate.setEnabled(bEnableUI);    }