Looking for help with TagBrowseTree component

I am trying to use the TagBrowseTree component from within Java. I can get the component to display but it contains the wrong data, which is the default items from Java’s TreeModel (colors, sports, food, etc.).

When I drop a TagBrowseTree component onto a new designer window, these same items are BRIEFLY displayed, but then very quickly replaced with the actual tag values. What needs to be done to use proper TreeModel for TagBrowseTree?

I tried searching the forums, looking at the SDK documention, and even looking at the SDK examples on GitHub. I found nothing to help.

It sounds like you want the standard tree view control and not the TagBrowseTree
They are different controls in the Designer control tree.

I appreciate the reply, however I don’t see how using a simple Tree component will get me all of the tags to be populated in it. Could you please provide an example?

Sorry, from your post it sounded like you wanted to use a treeview for something other than tags,
I will defer to developers.

I work for Sepasoft and we are creating some modules. In Java code, I need to be able to replicate the Tag Selector Tree component. That is what I am trying to do.

Through some trial and error, this worked for me, although I don’t know if this is the best way because it requires passing in the ClientContext every time.

import com.inductiveautomation.factorypmi.application.binding.VisionClientContext;
import com.inductiveautomation.factorypmi.application.components.TagBrowseTree;

public class MyTagBrowseTree extends TagBrowseTree{
    public MyTagBrowseTree() {
    public MyTagBrowseTree(VisionClientContext context) {

You don’t need to initialize with the context. It will be delivered to you when startupComponent() is called, and saved for you. Which is then retrievable with getAppContext(). Per that documentation, you should be overriding onStartup().

Hi Phil,

Thank you for replying. I am not understanding your comment though. The startupComponent() method signature requires a VisionClientContext parameter. Are you able to execute this method without passing in the context?

So, instead of what Steve was suggesting with setContext(context), how I got it working was to pass in the context like this:

TagBrowseTree tree = new TagBrowseTree();

The context was available through an existing module, so I just reused it.

Don’t call startupComponent() yourself. The container will call it for you when it starts up. startupComponent() will then call onStartup(). Override onStartup() to perform your actual tree configuration – don’t do it in the constructor.