[SOLVED] Default value not used?

UrhixidurUrhixidur Member Posts: 40 Contributor II
edited November 2018 in Help
My operator has an Int parameter for which I set a default value (in the getParameterTypes() method):

     type = new ParameterTypeInt(PARAMETER_CHUNK_SIZE,
           I18N.getMessage(I18N.getGUIBundle(), "gui.label.rmx_LTFDataReader.parameter.chunk_size.description"), 1, Integer.MAX_VALUE, false);
     type.setDefaultValue(IndexCachedLTFExampleTable.DEFAULT_BATCH_SIZE);
     types.add(type);
...
But once the operator is instantiated in the GUI, the parameter's edit box remains empty and the GUI displays the problem "The mandatory parameter "exampleset chunk size" is undefined."  What am I doing wrong?
Tagged:

Answers

  • Nils_WoehlerNils_Woehler Member Posts: 463  Guru
    Hi,

    your right. If you use the constructor you have posted setting the default value with setDefaultValue() will not change the default value.
    This is indeed a bug that I've just fixed. To avoid the problem with your current version I would recommend you to use the ParameterType declartion this way:

    type = new ParameterTypeInt(PARAMETER_CHUNK_SIZE,
                I18N.getMessage(I18N.getGUIBundle(), "gui.label.rmx_LTFDataReader.parameter.chunk_size.description"), 1, Integer.MAX_VALUE, IndexCachedLTFExampleTable.DEFAULT_BATCH_SIZE);
          type.setOptional(false);
          types.add(type);
    Best,
    Nils
Sign In or Register to comment.