I try to create an aditionnal Editor for MyType using CompositeEditor.
Le vendredi 3 mars 2017 08:54:50 UTC+1, 129pierre a écrit :
-- It's just a HTMLPanel loading the correct RadioGroupEditor or ListBoxEditor based on the constructor.
on edit , the value is correct but on flush the value is never changed
Thanks for any idea
public class MyTypeCompositeEditor extends Composite implements CompositeEditor<MyType, MyType, Editor<MyType >> {
private EditorChain<MyType, Editor<MyType>> chain;
private MyType value;
@Path("")
ListBoxEditor<MyType> valueLB = new ListBoxEditor()
@Path("")
RadioGroupEditor<MyType> valueRB = new RadioGroupEditor()
@UiField
HTMLPanel panel;
boolean isRG;
@UiConstructor
public MyTypeCompositeEditor(boolean isRG) {
this.isRG = isRG;
initWidget(uiBinder.createAndBindUi(this));
}
@Override
public void flush() {
if (isRG)
this.value = chain.getValue(valueLB);
else
{
this.value = chain.getValue(valueRB);
}
}
@Override
public Editor<CmcValueType> createEditorForTraversal() {
// TODO Auto-generated method stub
if (isRG)
{
return valueRB;
}
return valueLB;
}
@Override
public String getPathElement(Editor<CmcValueType> subEditor) {
// TODO Auto-generated method stub
return "";
}
@Override
public void setValue(CmcValueType value) {
if (isRG)
{
this.value = value;
panel.clear();
// subEditor.setValue(value);
panel.add(valueRB);
chain.attach(value, valueRB);
}
else
{
chain.detach(valueLB);
this.value = value;
panel.clear();
// subEditor.setValue(value);
panel.add(valueLB);
chain.attach(value, valueLB);
chain.detach(valueRB);
}
}
Le vendredi 3 mars 2017 08:54:50 UTC+1, 129pierre a écrit :
Hi,I am trying to dynamicly change the editor of a field.In some circonstances, I want a particular field (value) to be edited by a RadioButton Group and in others by a ListBox.I started this way :@Path("value")@UiField(provided=true)RadioGroupEditor<MyType> valueRB = new RadioGroupEditor(...@Path("value")@UiField(provided=true)ListBoxEditor<MyType> valueLB = new ListBoxEditor( ...and make the not relevant Editor invisible.But it doest not work as the value come alway from the ListBox component.Thanks for any idea how to make that works.Pierre
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment