Open Property Binding via Double Click

When I double click on the IA components, the property binding window opens for a specific property. How do I achieve that for my own components?

  1. Construct your own customizer (or use on of our existing ones); give it a CustomizerDescriptor
  2. In your component's bean info constructor, supply that descriptor to the vararg trailing arguments:
public VisionAdvancedTableBeanInfo() {
        super(VisionAdvancedTable.class, 
            AdvancedTableCustomizer.VALUE_DESCRIPTOR,
            DynamicPropertyProviderCustomizer.VALUE_DESCRIPTOR
        );
  1. Also on the bean info, add a value for DOUBLE_CLICK_CUSTOMIZER_KEY that identifies the same descriptor by name:
getBeanDescriptor().setValue(DOUBLE_CLICK_CUSTOMIZER_KEY, TableCustomizer.VALUE_NAME);
3 Likes

I can get different customizers to open with the code snippets you shared, thank you for that.

What I'm ultimately trying to achieve is to open the Sources property Dataset Editor when the component is double clicked. Haven't been able to do that so far.

Ah; got it. The dropdown list component, for instance, does so like this in the bean info:

getBeanDescriptor().setValue(DOUBLE_CLICK_HANDLER, (DoubleClickHandler) (component, workspace) -> {
    try {
        if (BindUtilities.isBound(component, "data")) {
            workspace.getVisionDesigner().openBindingDialog(component, "data");

        } else {
            DataSetEditorDialog viewer = new DataSetEditorDialog(IgnitionDesigner.getFrame().getRootPane());
            Dataset oldDataset = ((PMIComboBox) component).getData();

            if (oldDataset == null) {
                oldDataset = new BasicDataset();
            }

            Dataset newDataset = viewer.editDataSet(oldDataset);

            if (newDataset != null) {
                ((PMIComboBox) component).setData(newDataset);
            }
        }
    } catch (NotBindableException e) {
        ErrorUtil.showError(e);
    }
});
2 Likes

That works. Thanks Paul!

1 Like