@Test public void testCreateDialogHiddenFalse() { when( parameter.getParameterAttribute( anyString(), eq( ParameterAttributeNames.Core.HIDDEN ), any() ) ).thenReturn( "false" ); dialog.updateFromParameter( parameter ); verify( dialog.hiddenCheckBox, times( 1 ) ).setSelected( eq( false ) ); }
@VisibleForTesting void updateFromParameter( final ParameterDefinitionEntry p ) { if ( p == null ) { dataFormatField.setText( null ); labelTextField.setText( null ); nameTextField.setText( null ); defaultValueTextField.setValue( null, String.class ); visibleItemsTextField.setValue( 0 ); parameterTypeModel.setSelectedItem( null ); availableDataSources.clearSelection(); displayValueComboBox.setSelectedItem( null ); valueTypeComboBox.setSelectedItem( String.class ); mandatoryCheckBox.setSelected( false ); hiddenCheckBox.setSelected( false ); postProcessingFormulaField.setFormula( null ); displayFormulaField.setFormula( null ); strictValuesCheckBox.setSelected( true ); timeZoneBox.setSelectedItem( null ); autofillSelectionCheckBox.setSelected( false ); reevaluateOnInvalidStrictParamCheckBox.setSelected( false ); setSelectedQuery( null ); return; } final boolean multiSelection; if ( p instanceof DefaultListParameter ) { final DefaultListParameter parameter = (DefaultListParameter) p; final String queryName = parameter.getQueryName(); final DataFactory factoryForQuery = findDataFactoryForQuery( queryName ); if ( factoryForQuery != null ) { final int idx = availableDataSourcesModel.indexOf( factoryForQuery ); availableDataSources.setSelectionPath( new TreePath( new Object[] { availableDataSourcesModel.getRoot(), availableDataSourcesModel.get( idx ), queryName } ) ); } else { setSelectedQuery( queryName ); } autofillSelectionCheckBox.setSelected( "true".equals( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.AUTOFILL_SELECTION, parameterContext ) ) ); reevaluateOnInvalidStrictParamCheckBox.setSelected( "true".equals( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.RE_EVALUATE_ON_FAILED_VALUES, parameterContext ) ) ); strictValuesCheckBox.setSelected( parameter.isStrictValueCheck() ); displayValueComboBox.setSelectedItem( parameter.getTextColumn() ); idComboBox.setSelectedItem( parameter.getKeyColumn() ); final int visibleItems = ParserUtil.parseInt( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.VISIBLE_ITEMS ), 0 ); visibleItemsTextField.setValue( visibleItems ); } else { autofillSelectionCheckBox.setSelected( false ); reevaluateOnInvalidStrictParamCheckBox.setSelected( false ); strictValuesCheckBox.setSelected( true ); } if ( p instanceof ListParameter ) { multiSelection = ( (ListParameter) p ).isAllowMultiSelection(); } else { multiSelection = false; } final Class theType = p.getValueType(); valueTypeComboBox.setSelectedItem( multiSelection ? theType.getComponentType() : theType ); nameTextField.setText( p.getName() ); final String labelText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.LABEL, parameterContext ); final String labelFormulaText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.LABEL_FORMULA, parameterContext ); labelTextField.setText( Objects.equals( labelText, labelFormulaText ) ? "" : labelText ); labelFormula.setFormula( labelFormulaText ); final String dataFormatText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DATA_FORMAT, parameterContext ); final String dataFormatFormulaText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DATA_FORMAT_FORMULA, parameterContext ); dataFormatField.setText( Objects.equals( dataFormatText, dataFormatFormulaText ) ? "" : dataFormatText ); dataFormatFormula.setFormula( dataFormatFormulaText ); mandatoryCheckBox.setSelected( p.isMandatory() ); postProcessingFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.POST_PROCESSOR_FORMULA, parameterContext ) ); displayFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DISPLAY_VALUE_FORMULA, parameterContext ) ); final String hiddenValue = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.HIDDEN, parameterContext ); if ( hiddenValue != null ) { hiddenCheckBox.setSelected( hiddenValue.equals( "true" ) ); } hiddenFormula.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.HIDDEN_FORMULA, parameterContext ) ); if ( p instanceof AbstractParameter ) { final AbstractParameter parameter = (AbstractParameter) p; defaultValueTextField.setValue( parameter.getDefaultValue(), parameter.getValueType() ); } else { defaultValueTextField.setValue( null, p.getValueType() ); } defaultValueFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DEFAULT_VALUE_FORMULA, parameterContext ) ); timeZoneModel.setSelectedKey( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.TIMEZONE, parameterContext ) ); final String type = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.TYPE, parameterContext ); if ( type != null ) { final int size = parameterTypeModel.getSize(); for ( int i = 0; i < size; i++ ) { final ParameterType typeEntry = (ParameterType) parameterTypeModel.getElementAt( i ); if ( typeEntry == null ) { continue; } if ( ( typeEntry.isMultiSelection() == multiSelection ) && ( type.equals( typeEntry.getInternalName() ) ) ) { parameterTypeModel.setSelectedItem( typeEntry ); break; } } } else { parameterTypeModel.setSelectedItem( null ); } }
ParameterDialog extends CommonDialog implements FormulaEditorDataModel { @VisibleForTesting void updateFromParameter( final ParameterDefinitionEntry p ) { if ( p == null ) { dataFormatField.setText( null ); labelTextField.setText( null ); nameTextField.setText( null ); defaultValueTextField.setValue( null, String.class ); visibleItemsTextField.setValue( 0 ); parameterTypeModel.setSelectedItem( null ); availableDataSources.clearSelection(); displayValueComboBox.setSelectedItem( null ); valueTypeComboBox.setSelectedItem( String.class ); mandatoryCheckBox.setSelected( false ); hiddenCheckBox.setSelected( false ); postProcessingFormulaField.setFormula( null ); displayFormulaField.setFormula( null ); strictValuesCheckBox.setSelected( true ); timeZoneBox.setSelectedItem( null ); autofillSelectionCheckBox.setSelected( false ); reevaluateOnInvalidStrictParamCheckBox.setSelected( false ); setSelectedQuery( null ); return; } final boolean multiSelection; if ( p instanceof DefaultListParameter ) { final DefaultListParameter parameter = (DefaultListParameter) p; final String queryName = parameter.getQueryName(); final DataFactory factoryForQuery = findDataFactoryForQuery( queryName ); if ( factoryForQuery != null ) { final int idx = availableDataSourcesModel.indexOf( factoryForQuery ); availableDataSources.setSelectionPath( new TreePath( new Object[] { availableDataSourcesModel.getRoot(), availableDataSourcesModel.get( idx ), queryName } ) ); } else { setSelectedQuery( queryName ); } autofillSelectionCheckBox.setSelected( "true".equals( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.AUTOFILL_SELECTION, parameterContext ) ) ); reevaluateOnInvalidStrictParamCheckBox.setSelected( "true".equals( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.RE_EVALUATE_ON_FAILED_VALUES, parameterContext ) ) ); strictValuesCheckBox.setSelected( parameter.isStrictValueCheck() ); displayValueComboBox.setSelectedItem( parameter.getTextColumn() ); idComboBox.setSelectedItem( parameter.getKeyColumn() ); final int visibleItems = ParserUtil.parseInt( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.VISIBLE_ITEMS ), 0 ); visibleItemsTextField.setValue( visibleItems ); } else { autofillSelectionCheckBox.setSelected( false ); reevaluateOnInvalidStrictParamCheckBox.setSelected( false ); strictValuesCheckBox.setSelected( true ); } if ( p instanceof ListParameter ) { multiSelection = ( (ListParameter) p ).isAllowMultiSelection(); } else { multiSelection = false; } final Class theType = p.getValueType(); valueTypeComboBox.setSelectedItem( multiSelection ? theType.getComponentType() : theType ); nameTextField.setText( p.getName() ); final String labelText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.LABEL, parameterContext ); final String labelFormulaText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.LABEL_FORMULA, parameterContext ); labelTextField.setText( Objects.equals( labelText, labelFormulaText ) ? "" : labelText ); labelFormula.setFormula( labelFormulaText ); final String dataFormatText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DATA_FORMAT, parameterContext ); final String dataFormatFormulaText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DATA_FORMAT_FORMULA, parameterContext ); dataFormatField.setText( Objects.equals( dataFormatText, dataFormatFormulaText ) ? "" : dataFormatText ); dataFormatFormula.setFormula( dataFormatFormulaText ); mandatoryCheckBox.setSelected( p.isMandatory() ); postProcessingFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.POST_PROCESSOR_FORMULA, parameterContext ) ); displayFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DISPLAY_VALUE_FORMULA, parameterContext ) ); final String hiddenValue = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.HIDDEN, parameterContext ); if ( hiddenValue != null ) { hiddenCheckBox.setSelected( hiddenValue.equals( "true" ) ); } hiddenFormula.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.HIDDEN_FORMULA, parameterContext ) ); if ( p instanceof AbstractParameter ) { final AbstractParameter parameter = (AbstractParameter) p; defaultValueTextField.setValue( parameter.getDefaultValue(), parameter.getValueType() ); } else { defaultValueTextField.setValue( null, p.getValueType() ); } defaultValueFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DEFAULT_VALUE_FORMULA, parameterContext ) ); timeZoneModel.setSelectedKey( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.TIMEZONE, parameterContext ) ); final String type = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.TYPE, parameterContext ); if ( type != null ) { final int size = parameterTypeModel.getSize(); for ( int i = 0; i < size; i++ ) { final ParameterType typeEntry = (ParameterType) parameterTypeModel.getElementAt( i ); if ( typeEntry == null ) { continue; } if ( ( typeEntry.isMultiSelection() == multiSelection ) && ( type.equals( typeEntry.getInternalName() ) ) ) { parameterTypeModel.setSelectedItem( typeEntry ); break; } } } else { parameterTypeModel.setSelectedItem( null ); } } }
ParameterDialog extends CommonDialog implements FormulaEditorDataModel { @VisibleForTesting void updateFromParameter( final ParameterDefinitionEntry p ) { if ( p == null ) { dataFormatField.setText( null ); labelTextField.setText( null ); nameTextField.setText( null ); defaultValueTextField.setValue( null, String.class ); visibleItemsTextField.setValue( 0 ); parameterTypeModel.setSelectedItem( null ); availableDataSources.clearSelection(); displayValueComboBox.setSelectedItem( null ); valueTypeComboBox.setSelectedItem( String.class ); mandatoryCheckBox.setSelected( false ); hiddenCheckBox.setSelected( false ); postProcessingFormulaField.setFormula( null ); displayFormulaField.setFormula( null ); strictValuesCheckBox.setSelected( true ); timeZoneBox.setSelectedItem( null ); autofillSelectionCheckBox.setSelected( false ); reevaluateOnInvalidStrictParamCheckBox.setSelected( false ); setSelectedQuery( null ); return; } final boolean multiSelection; if ( p instanceof DefaultListParameter ) { final DefaultListParameter parameter = (DefaultListParameter) p; final String queryName = parameter.getQueryName(); final DataFactory factoryForQuery = findDataFactoryForQuery( queryName ); if ( factoryForQuery != null ) { final int idx = availableDataSourcesModel.indexOf( factoryForQuery ); availableDataSources.setSelectionPath( new TreePath( new Object[] { availableDataSourcesModel.getRoot(), availableDataSourcesModel.get( idx ), queryName } ) ); } else { setSelectedQuery( queryName ); } autofillSelectionCheckBox.setSelected( "true".equals( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.AUTOFILL_SELECTION, parameterContext ) ) ); reevaluateOnInvalidStrictParamCheckBox.setSelected( "true".equals( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.RE_EVALUATE_ON_FAILED_VALUES, parameterContext ) ) ); strictValuesCheckBox.setSelected( parameter.isStrictValueCheck() ); displayValueComboBox.setSelectedItem( parameter.getTextColumn() ); idComboBox.setSelectedItem( parameter.getKeyColumn() ); final int visibleItems = ParserUtil.parseInt( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.VISIBLE_ITEMS ), 0 ); visibleItemsTextField.setValue( visibleItems ); } else { autofillSelectionCheckBox.setSelected( false ); reevaluateOnInvalidStrictParamCheckBox.setSelected( false ); strictValuesCheckBox.setSelected( true ); } if ( p instanceof ListParameter ) { multiSelection = ( (ListParameter) p ).isAllowMultiSelection(); } else { multiSelection = false; } final Class theType = p.getValueType(); valueTypeComboBox.setSelectedItem( multiSelection ? theType.getComponentType() : theType ); nameTextField.setText( p.getName() ); final String labelText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.LABEL, parameterContext ); final String labelFormulaText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.LABEL_FORMULA, parameterContext ); labelTextField.setText( Objects.equals( labelText, labelFormulaText ) ? "" : labelText ); labelFormula.setFormula( labelFormulaText ); final String dataFormatText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DATA_FORMAT, parameterContext ); final String dataFormatFormulaText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DATA_FORMAT_FORMULA, parameterContext ); dataFormatField.setText( Objects.equals( dataFormatText, dataFormatFormulaText ) ? "" : dataFormatText ); dataFormatFormula.setFormula( dataFormatFormulaText ); mandatoryCheckBox.setSelected( p.isMandatory() ); postProcessingFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.POST_PROCESSOR_FORMULA, parameterContext ) ); displayFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DISPLAY_VALUE_FORMULA, parameterContext ) ); final String hiddenValue = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.HIDDEN, parameterContext ); if ( hiddenValue != null ) { hiddenCheckBox.setSelected( hiddenValue.equals( "true" ) ); } hiddenFormula.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.HIDDEN_FORMULA, parameterContext ) ); if ( p instanceof AbstractParameter ) { final AbstractParameter parameter = (AbstractParameter) p; defaultValueTextField.setValue( parameter.getDefaultValue(), parameter.getValueType() ); } else { defaultValueTextField.setValue( null, p.getValueType() ); } defaultValueFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DEFAULT_VALUE_FORMULA, parameterContext ) ); timeZoneModel.setSelectedKey( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.TIMEZONE, parameterContext ) ); final String type = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.TYPE, parameterContext ); if ( type != null ) { final int size = parameterTypeModel.getSize(); for ( int i = 0; i < size; i++ ) { final ParameterType typeEntry = (ParameterType) parameterTypeModel.getElementAt( i ); if ( typeEntry == null ) { continue; } if ( ( typeEntry.isMultiSelection() == multiSelection ) && ( type.equals( typeEntry.getInternalName() ) ) ) { parameterTypeModel.setSelectedItem( typeEntry ); break; } } } else { parameterTypeModel.setSelectedItem( null ); } } ParameterDialog( final ReportDesignerContext context );  ParameterDialog( final Dialog aParent, final ReportDesignerContext context );  ParameterDialog( final Frame aParent, final ReportDesignerContext context ); }
ParameterDialog extends CommonDialog implements FormulaEditorDataModel { @VisibleForTesting void updateFromParameter( final ParameterDefinitionEntry p ) { if ( p == null ) { dataFormatField.setText( null ); labelTextField.setText( null ); nameTextField.setText( null ); defaultValueTextField.setValue( null, String.class ); visibleItemsTextField.setValue( 0 ); parameterTypeModel.setSelectedItem( null ); availableDataSources.clearSelection(); displayValueComboBox.setSelectedItem( null ); valueTypeComboBox.setSelectedItem( String.class ); mandatoryCheckBox.setSelected( false ); hiddenCheckBox.setSelected( false ); postProcessingFormulaField.setFormula( null ); displayFormulaField.setFormula( null ); strictValuesCheckBox.setSelected( true ); timeZoneBox.setSelectedItem( null ); autofillSelectionCheckBox.setSelected( false ); reevaluateOnInvalidStrictParamCheckBox.setSelected( false ); setSelectedQuery( null ); return; } final boolean multiSelection; if ( p instanceof DefaultListParameter ) { final DefaultListParameter parameter = (DefaultListParameter) p; final String queryName = parameter.getQueryName(); final DataFactory factoryForQuery = findDataFactoryForQuery( queryName ); if ( factoryForQuery != null ) { final int idx = availableDataSourcesModel.indexOf( factoryForQuery ); availableDataSources.setSelectionPath( new TreePath( new Object[] { availableDataSourcesModel.getRoot(), availableDataSourcesModel.get( idx ), queryName } ) ); } else { setSelectedQuery( queryName ); } autofillSelectionCheckBox.setSelected( "true".equals( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.AUTOFILL_SELECTION, parameterContext ) ) ); reevaluateOnInvalidStrictParamCheckBox.setSelected( "true".equals( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.RE_EVALUATE_ON_FAILED_VALUES, parameterContext ) ) ); strictValuesCheckBox.setSelected( parameter.isStrictValueCheck() ); displayValueComboBox.setSelectedItem( parameter.getTextColumn() ); idComboBox.setSelectedItem( parameter.getKeyColumn() ); final int visibleItems = ParserUtil.parseInt( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.VISIBLE_ITEMS ), 0 ); visibleItemsTextField.setValue( visibleItems ); } else { autofillSelectionCheckBox.setSelected( false ); reevaluateOnInvalidStrictParamCheckBox.setSelected( false ); strictValuesCheckBox.setSelected( true ); } if ( p instanceof ListParameter ) { multiSelection = ( (ListParameter) p ).isAllowMultiSelection(); } else { multiSelection = false; } final Class theType = p.getValueType(); valueTypeComboBox.setSelectedItem( multiSelection ? theType.getComponentType() : theType ); nameTextField.setText( p.getName() ); final String labelText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.LABEL, parameterContext ); final String labelFormulaText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.LABEL_FORMULA, parameterContext ); labelTextField.setText( Objects.equals( labelText, labelFormulaText ) ? "" : labelText ); labelFormula.setFormula( labelFormulaText ); final String dataFormatText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DATA_FORMAT, parameterContext ); final String dataFormatFormulaText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DATA_FORMAT_FORMULA, parameterContext ); dataFormatField.setText( Objects.equals( dataFormatText, dataFormatFormulaText ) ? "" : dataFormatText ); dataFormatFormula.setFormula( dataFormatFormulaText ); mandatoryCheckBox.setSelected( p.isMandatory() ); postProcessingFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.POST_PROCESSOR_FORMULA, parameterContext ) ); displayFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DISPLAY_VALUE_FORMULA, parameterContext ) ); final String hiddenValue = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.HIDDEN, parameterContext ); if ( hiddenValue != null ) { hiddenCheckBox.setSelected( hiddenValue.equals( "true" ) ); } hiddenFormula.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.HIDDEN_FORMULA, parameterContext ) ); if ( p instanceof AbstractParameter ) { final AbstractParameter parameter = (AbstractParameter) p; defaultValueTextField.setValue( parameter.getDefaultValue(), parameter.getValueType() ); } else { defaultValueTextField.setValue( null, p.getValueType() ); } defaultValueFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DEFAULT_VALUE_FORMULA, parameterContext ) ); timeZoneModel.setSelectedKey( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.TIMEZONE, parameterContext ) ); final String type = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.TYPE, parameterContext ); if ( type != null ) { final int size = parameterTypeModel.getSize(); for ( int i = 0; i < size; i++ ) { final ParameterType typeEntry = (ParameterType) parameterTypeModel.getElementAt( i ); if ( typeEntry == null ) { continue; } if ( ( typeEntry.isMultiSelection() == multiSelection ) && ( type.equals( typeEntry.getInternalName() ) ) ) { parameterTypeModel.setSelectedItem( typeEntry ); break; } } } else { parameterTypeModel.setSelectedItem( null ); } } ParameterDialog( final ReportDesignerContext context );  ParameterDialog( final Dialog aParent, final ReportDesignerContext context );  ParameterDialog( final Frame aParent, final ReportDesignerContext context ); ParameterEditResult performEditParameter( final ReportDesignerContext context,
                                                   final MasterReport masterReport,
                                                   final ParameterDefinitionEntry parameterDefinitionEntry ); String[] getDataFields(); String getParameter(); }
ParameterDialog extends CommonDialog implements FormulaEditorDataModel { @VisibleForTesting void updateFromParameter( final ParameterDefinitionEntry p ) { if ( p == null ) { dataFormatField.setText( null ); labelTextField.setText( null ); nameTextField.setText( null ); defaultValueTextField.setValue( null, String.class ); visibleItemsTextField.setValue( 0 ); parameterTypeModel.setSelectedItem( null ); availableDataSources.clearSelection(); displayValueComboBox.setSelectedItem( null ); valueTypeComboBox.setSelectedItem( String.class ); mandatoryCheckBox.setSelected( false ); hiddenCheckBox.setSelected( false ); postProcessingFormulaField.setFormula( null ); displayFormulaField.setFormula( null ); strictValuesCheckBox.setSelected( true ); timeZoneBox.setSelectedItem( null ); autofillSelectionCheckBox.setSelected( false ); reevaluateOnInvalidStrictParamCheckBox.setSelected( false ); setSelectedQuery( null ); return; } final boolean multiSelection; if ( p instanceof DefaultListParameter ) { final DefaultListParameter parameter = (DefaultListParameter) p; final String queryName = parameter.getQueryName(); final DataFactory factoryForQuery = findDataFactoryForQuery( queryName ); if ( factoryForQuery != null ) { final int idx = availableDataSourcesModel.indexOf( factoryForQuery ); availableDataSources.setSelectionPath( new TreePath( new Object[] { availableDataSourcesModel.getRoot(), availableDataSourcesModel.get( idx ), queryName } ) ); } else { setSelectedQuery( queryName ); } autofillSelectionCheckBox.setSelected( "true".equals( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.AUTOFILL_SELECTION, parameterContext ) ) ); reevaluateOnInvalidStrictParamCheckBox.setSelected( "true".equals( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.RE_EVALUATE_ON_FAILED_VALUES, parameterContext ) ) ); strictValuesCheckBox.setSelected( parameter.isStrictValueCheck() ); displayValueComboBox.setSelectedItem( parameter.getTextColumn() ); idComboBox.setSelectedItem( parameter.getKeyColumn() ); final int visibleItems = ParserUtil.parseInt( parameter.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.VISIBLE_ITEMS ), 0 ); visibleItemsTextField.setValue( visibleItems ); } else { autofillSelectionCheckBox.setSelected( false ); reevaluateOnInvalidStrictParamCheckBox.setSelected( false ); strictValuesCheckBox.setSelected( true ); } if ( p instanceof ListParameter ) { multiSelection = ( (ListParameter) p ).isAllowMultiSelection(); } else { multiSelection = false; } final Class theType = p.getValueType(); valueTypeComboBox.setSelectedItem( multiSelection ? theType.getComponentType() : theType ); nameTextField.setText( p.getName() ); final String labelText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.LABEL, parameterContext ); final String labelFormulaText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.LABEL_FORMULA, parameterContext ); labelTextField.setText( Objects.equals( labelText, labelFormulaText ) ? "" : labelText ); labelFormula.setFormula( labelFormulaText ); final String dataFormatText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DATA_FORMAT, parameterContext ); final String dataFormatFormulaText = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DATA_FORMAT_FORMULA, parameterContext ); dataFormatField.setText( Objects.equals( dataFormatText, dataFormatFormulaText ) ? "" : dataFormatText ); dataFormatFormula.setFormula( dataFormatFormulaText ); mandatoryCheckBox.setSelected( p.isMandatory() ); postProcessingFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.POST_PROCESSOR_FORMULA, parameterContext ) ); displayFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DISPLAY_VALUE_FORMULA, parameterContext ) ); final String hiddenValue = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.HIDDEN, parameterContext ); if ( hiddenValue != null ) { hiddenCheckBox.setSelected( hiddenValue.equals( "true" ) ); } hiddenFormula.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.HIDDEN_FORMULA, parameterContext ) ); if ( p instanceof AbstractParameter ) { final AbstractParameter parameter = (AbstractParameter) p; defaultValueTextField.setValue( parameter.getDefaultValue(), parameter.getValueType() ); } else { defaultValueTextField.setValue( null, p.getValueType() ); } defaultValueFormulaField.setFormula( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.DEFAULT_VALUE_FORMULA, parameterContext ) ); timeZoneModel.setSelectedKey( p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.TIMEZONE, parameterContext ) ); final String type = p.getParameterAttribute( ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.TYPE, parameterContext ); if ( type != null ) { final int size = parameterTypeModel.getSize(); for ( int i = 0; i < size; i++ ) { final ParameterType typeEntry = (ParameterType) parameterTypeModel.getElementAt( i ); if ( typeEntry == null ) { continue; } if ( ( typeEntry.isMultiSelection() == multiSelection ) && ( type.equals( typeEntry.getInternalName() ) ) ) { parameterTypeModel.setSelectedItem( typeEntry ); break; } } } else { parameterTypeModel.setSelectedItem( null ); } } ParameterDialog( final ReportDesignerContext context );  ParameterDialog( final Dialog aParent, final ReportDesignerContext context );  ParameterDialog( final Frame aParent, final ReportDesignerContext context ); ParameterEditResult performEditParameter( final ReportDesignerContext context,
                                                   final MasterReport masterReport,
                                                   final ParameterDefinitionEntry parameterDefinitionEntry ); String[] getDataFields(); String getParameter();  }