Hi Rafael,
Thank you for the issue explanation. I thought I had seen an issue similar
to what you described in our JIRA but I couldn't find it.
Can I ask you to open a JIRA with these instructions? I'll have a look when
possible.
Best regards,
George Gastaldi
Em Qui, 7 de mar de 2019 18:26, Rafael Pestano <rmpestano(a)gmail.com>
escreveu:
Hi guys,
I'm trying to set a default value of a previous disabled input and it is
not working, let me show some code:
hidden = componentFactory.createInput("Hidden", Boolean.class)
.setEnabled(false);
length = componentFactory.createInput("Length", Integer.class)
.setEnabled(false);
required = componentFactory.createInput("Required", Boolean.class)
.setEnabled(false);
type = componentFactory.createSelectOne("Type", ComponentTypeEnum.class)
.setValueChoices(Arrays.stream(ComponentTypeEnum.values()).collect(Collectors.toList()))
.setEnabled(false);
those fields are enabled on a valueChangeLIstener:
fieldConfigList.addValueChangeListener((ValueChangeEvent event) -> {
fieldConfig = (FieldConfig) event.getNewValue();
if (fieldConfig != null) {
hidden.setEnabled(true)
.setDescription(String.format("When true the field '%s' will be
ignored on AdminFaces scaffold.", fieldConfig.getName()))
.setValue(fieldConfig.getHidden());
hidden.addValueChangeListener((ValueChangeEvent evt) -> {
fieldConfig.setHidden((Boolean) evt.getNewValue());
});
required.setEnabled(true)
.setDescription(String.format("When true the field '%s' will be
required on AdminFaces scaffold generated pages.", fieldConfig.getName()))
.setValue(fieldConfig.getRequired());
required.addValueChangeListener((ValueChangeEvent evt) -> {
fieldConfig.setRequired((Boolean) evt.getNewValue());
});
length.setEnabled(true)
.setDescription(String.format("Set field '%s' length to be used
on AdminFaces scaffold generated pages.", fieldConfig.getName()))
.setValue(fieldConfig.getLength());
length.addValueChangeListener((ValueChangeEvent evt) -> {
fieldConfig.setLength((Integer) evt.getNewValue());
});
type.setEnabled(true)
.setDescription(String.format("Set field '%s' component type to
be used on AdminFaces scaffold generated pages.", fieldConfig.getName()))
.setValue(fieldConfig.getType());
type.addValueChangeListener((ValueChangeEvent evt) -> {
fieldConfig.setType((ComponentTypeEnum) evt.getNewValue());
});
} else {
hidden.setEnabled(false)
.setNote("");
length.setEnabled(false)
.setNote("");
required.setEnabled(false)
.setNote("");
type.setEnabled(false)
.setNote("");
}
});
Whenever I change "fieldConfigList" I want to change "type",
"length",
"required" and "hidden" defaultValues. It only works for
"type" field which
is a selectOne or if I go back and forth on the wizard as shown on the
video below:
https://youtu.be/hKbGGJZCOjE
Also it is working for the "description" attribute because it is changing
accordingly with selected fieldConfig as you can see on the video.
Code is available here:
https://github.com/adminfaces/admin-addon/blob/55da7431d0f64170855cbc1f68...
Any hints? (I also tried to use "setValue"instead of defaultValue but also
did not worked)
Thanks in advance!
--
Att,
Rafael M. Pestano
Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
http://rpestano.wordpress.com/
@realpestano
_______________________________________________
forge-users mailing list
forge-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-users