Change parameters list upon read

chicofranchico
chicofranchico New Altair Community Member
edited November 5 in Community Q&A
Hi,

we currently have an operator that reads from a database the tables. We stipulated that there is a ParameterTypeCategory defined in the getParameterTypes method with a list of categories (take for reference the DatabaseHandler).

Is there a way to change this list of categories after I make a read from the database and populate it with my database table names?

I've tackled this problem but I've reached the point where I get to replace the parameters but that throws some Observer issues.

Can someone point me out a simple way to do what I'm trying?

Thanks

Answers

  • fischer
    fischer New Altair Community Member
    Hi,

    for the ParameterTypeCategory, there is no such way. In fact I wouldn't expect this to be the right way to go. The right thing would probably be to make a ParameterTypeTableName (I think we have something like this for the Read Database operator.) You would also have to register an editor for this type by calling

    PropertyPanel.registerPropertyValueCellEditor(Class<? extends ParameterType> typeClass, Class<? extends PropertyValueCellEditor> editor)

    unless using the one provided by the ParameterTypeCategory works out for you.

    Best,
    Simon
  • chicofranchico
    chicofranchico New Altair Community Member
    Hi!

    Thanks a lot for the reply.

    Where should I make the registration of my PropertyValueCellEditor implementation? If I do it on the initPlugin I get the following error:

    The method registerPropertyValueCellEditor(Class<? extends ParameterType>, Class<? extends PropertyValueCellEditor>) in the type PropertyPanel is not applicable for the arguments (Class<DatabaseDataReader>, Class<MyDatabaseTableValueCellEditor>) where MyDatabaseTableValueCellEditor is my implementation.

    Thanks again!
  • fischer
    fischer New Altair Community Member
    Hi,

    you should use initGui(MainFrame), but I don't think this will solve your problem. Isn't that a compile time error anyway?

    Cheers,
    Simon
  • chicofranchico
    chicofranchico New Altair Community Member
    Hi.

    Yeah, I don't know why the compile time error. If I put the declaration in the PropertyPanel static block (like the others) it works fine. Is there something I'm missing?

    Thanks again!