I searched this category (#module-development tag component
) and found several references to help me do this but I don’t know about the UDT. Is there a way to create “something” in my component (I’m thinking it’ll be a property?) that has the same structure as my UDT? I’m assuming that deep down a user created UDT in Designer is a Java class (or interface?) and the actual tag instance of the UDT is an instance of that class. If so, I should be able to create (or get) a reference to that tag instance in my component when the drop listener is fired. Am I on the right track? Any suggestions on how to do this?
Thank you!
Regards,
Ted.
I changed up a little bit trying to drop a String tag onto my component instead of a UDT…baby steps.
Okay, wading through the SDK JavaDoc with hints from other posts in this category and this is where I’m at. I have a property in my client component class private String statusMessage = "";
and I want to drop my String tag onto my component and bind it to my statusMessage
property in my bean info class.
Question: Do I need a tag listener?
Answer: No, the code below works (just packaged, imported, dragged & dropped and tested, success
Original Question: How do I do this with a UDT tag? I suppose I’ll keep wading through the API…I’ll probably need a tag listener for this (lol).
Answer: (pointers anyone?)
//============================================================================================================================================================
/** A sample valve component from the sandbox.
* @author Ted Fowler
*/
public class ValveSampleType1BeanInfo extends CommonBeanInfo {
public ValveSampleType1BeanInfo() {
// Our superclass constructor takes the class of the component we describe and the customizers that are applicable.
super(ValveSampleType1.class, DynamicPropertyProviderCustomizer.VALUE_DESCRIPTOR, StyleCustomizer.VALUE_DESCRIPTOR);
// Set things up for handling tag drop. The tag will be a UDT for the valve (a companion for the PLC valve UDT).
tagDropHandler = createTagDropHandler();
} // Constructor
// ========================================================================================================================================================
// Stuff for this class.
// ========================================================================================================================================================
protected TagDropHandler tagDropHandler;
// ========================================================================================================================================================
// Overrides
// ========================================================================================================================================================
@Override
protected void configureTagDropHandler(DefaultTagDropHandler tagDropHandler) {
tagDropHandler.addBinding(TagProp.Value, "statusMessage");
} // protected void configureTagDropHandler
// ========================================================================================================================================================