Java - How to know if a DesignerProperty method is internal or not?

Some @DesignerProperty methods in components are not visible in the builder.
For example, FirebaseDB component has a DesignerProperty DeveloperBucket, but it is not visible in the builder.
http://ai2.appinventor.mit.edu/reference/components/experimental.html
How can I know if a method is internal or not?

Hello,

The SimpleProperty annotation specifies whether the property will be visible in the blocks editor. Specifically the userVisible part of the annotation.

For the DeveloperBucket you can see that it is set to false on the DeveloperBucket setter.

How can I know if a method is internal or not?

I hope the above answers this question! But if it doesn't if you provide a bit more information about what you're looking for, I'm sure someone here can help you out.

Best wishes,
--Beka

Thanks for the reply.
But I am asking about DesignerProperty.
How to know if a DesignerProperty is userVisible or not?

A Designer Property is always visible unless you hide it from Mock.

@vknow360 read this

When I have a DesignerProperty method - java.lang.reflect.Method
How to know if the DesignerProperty Method is userVisible or not?

Hmm I'm having trouble understanding what you're asking.

If you're wondering how to tell if a property will be available in the blocks editor, that is controlled by the userVisible part of the SimpleProperty annotation.

If you're wondering how to tell if a property will be available in the designer, existance of the DesignerProperty annotation. Properties with this annotation will be available in the designer, and properties without it will not be available in the designer.


I did some looking at the FirebaseDB component, and I think it/the docs may be broken, which is what is causing the confusion.

It looks like the firebase db has a custom mock (which is what controls what fields show up in the designer pallet). This forcefully sets the developer bucket to invisible.

I think the reason it may need a DesignerProperty annotation is so that it can be passed the user's email? If it wasn't annotated, there may be no way to send that information via the browser. But I'm really not sure...

I've filed an issue to address this problem. If you have more info feel free to reply or provide it there :smiley:

Best wishes,
--Beka

3 Likes

Thank You. @BeksOmega

  1. Are the Mock .java file names always in this format?
    "Mock" + Name
    MockFirebaseDB

  2. Are all the Mock .java files located in this package?
    com.google.appinventor.client.editor.simple.components

Answer to your both questions is Yes

1 Like

How can check it from my code?
The method is protected

What you want to check?

Whether a property should be visible or not.
MockFirebaseDB has a method isPropertyVisible()
But it is a protected method.

I am curious to know, why you want to know whether a property should be visible or not.

Dynamic Components extension is returning these unwanted DesignerProperties.

Maybe this can help you:

Please give me the code of the method in text format.

The above code is taken from the source code of Dynamic Components extension.

As previously mentioned, this is controlled in the web editor and not by the annotations in the code, which means that code running in the Android device won't know about the fact that these special properties aren't visible. I've proposed in the issue that is tracking this that we make this a formal declaration on the property so that it can be managed across all of the different environments.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.