Repeater.getLoadedTemplates()

I have a template with a repeater that repeats a custom button template.
The parent template’s custom property is bound to a tag.
The repeater’s templateParams, inside the parent template, is bound to a SQL query.
Once the SQL executes and repeats my custom button template, I need to toggle the first button.

What I have tried is to execute a script when the repeater’s templateParams changes.

However at this point, getLoadedTemplates() returns an empty array.

Is there a different approach to this?

[code]
PROPERTY_CHANGE::(VisionTemplate)[ToggleStrip].[AssetId] 0 => 3
PROPERTY_CHANGE::(TemplateRepeater)[repeater].[templateParams] Dataset [0R ⅹ 3C] => Dataset [4R ⅹ 3C]

getLoadedTemplates executed here
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[componentRunning] False => True
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[instanceName] => repeater_child_0
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[Text] => Job
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[WindowName] => jde/CollectWorkOrderAndOperation
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[AssetId] 0 => 3
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[componentRunning] False => True
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[instanceName] => repeater_child_1
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[index] 0 => 1
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[Text] => Material
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[WindowName] => communication/MaterialHandlerRequest
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[AssetId] 0 => 3
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[componentRunning] False => True
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[instanceName] => repeater_child_2
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[index] 0 => 2
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[Text] => Tests
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[WindowName] => workcenters/TorqueTesterFixture
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[AssetId] 0 => 3
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[componentRunning] False => True
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[instanceName] => repeater_child_3
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[index] 0 => 3
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[Text] => Calibration
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[WindowName] => workcenters/TorqueTesterFixtureCalibration
PROPERTY_CHANGE::(VisionTemplate)[ToggleStripButton].[AssetId] 0 => 3[/code]

Meh, so instead I am watching the “instanceName” property of the child template.
When I see a change, I call a function on the parent template which increments an internal property.
When that internal property == repeater’s templateParams, then I execute a ‘onTemplateReady’ function where I can use getLoadedTemplates().

Seems to work ok.

do you have sample code sir?

This might be a good place to use system.util.invokeLater?

I can’t remember if template loading is synchronous (probably) so invokeLater should put your actions after the template loading in the EDT.

1 Like

Question, how would you do this from a Client Message Handler?

My example:

  • window with a repeater, repeatBehavior=Count
  • Window.internalFrame.internalFrameActivated call system.util.sendMessage
  • Inside the message handler, find the repeater and call getLoadedTemplates()

I tried different threading models for the message handler and I also tried invokeLater within the message handler. None worked.