Force RadioButtonGroup to re-read its values from LookupCall [message #1172331] |
Tue, 05 November 2013 21:34 |
Andriy Fomenko Messages: 24 Registered: May 2013 |
Junior Member |
|
|
I have a Form, where I placed a TableField, StringField and a RadioButtonGroup.
User selects one of the rows in the TableField and I'm pushing an ID of selected row into a StringField to test I'm getting it right => so far so good.
For RadioButtonGroup, I'm using a LookupCall, based on LookupService, where I inject ID from the table using a "variable" in the Form => per debugger, value is properly injected and LookupCall is executed once upon form load.
QUESTION: how to force RadioButtonGroup to re-read its values from the LookupCall ?
[Updated on: Tue, 05 November 2013 21:34] Report message to a moderator
|
|
|
|
|
|
Re: Force RadioButtonGroup to re-read its values from LookupCall [message #1183030 is a reply to message #1173612] |
Tue, 12 November 2013 15:38 |
Jeremie Bresson Messages: 1252 Registered: October 2011 |
Senior Member |
|
|
Thank you for your example.
Now I see what you want to do. I am afraid it is not possible to recall the LookupCall to recreate the RadioButtons.
In the example, I do not see how many different values can be returned by the DeviceLookupCall. If there is not so many, maybe you can define your SelectDeviceGroup with some RadioButtons defined as inner-classes (instead of using your lookup call):
@Order(20.0)
public class SelectDeviceGroup extends AbstractRadioButtonGroup<Long> {
@Override
protected double getConfiguredGridWeightY() {
return 1.0;
}
@Override
protected int getConfiguredGridY() {
return 3;
}
@Override
protected String getConfiguredLabel() {
return TEXTS.get("SelectDevice");
}
@Override
protected Class<? extends IValueField> getConfiguredMasterField() {
return EventIDField.class;
}
@Override
protected boolean getConfiguredMasterRequired() {
return true;
}
@Order(10.0)
public class StaticButton extends AbstractRadioButton {
@Override
protected String getConfiguredLabel() {
return TEXTS.get("Static");
}
@Override
protected Object getConfiguredRadioValue() {
return 1L;
}
}
@Order(20.0)
public class DynamicButton extends AbstractRadioButton {
@Override
protected String getConfiguredLabel() {
return TEXTS.get("Dynamic");
}
@Override
protected Object getConfiguredRadioValue() {
return 2L;
}
}
}
This way you can control what should be changed for a specific button in your execRowAction:
@Override
protected void execRowAction(ITableRow row) throws ProcessingException {
Long value = (Long) row.getCell(getEventIDColumn()).getValue();
getEventIDField().setValue(value);
getPreviewField().setValue(getEventIDField().getValue().toString()); // check I'm not crazy??
getDynamicButton().setLabel("Dynamic " + value);
}
I hope this helps...
NB: The only other solution I see for your problem is to change your RadioGroup for a SmartField.
[Updated on: Tue, 12 November 2013 15:39] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.01921 seconds