Announcement Announcement Module
Collapse
No announcement yet.
Comminting JFormattedTextField dont work Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Comminting JFormattedTextField dont work

    When commit or revert a form with JFormattedTextField dont work
    in SwinFormModel:

    Code:
       
    public JFormattedTextField createBoundFormattedTextField(
                String formProperty, AbstractFormatterFactory formatterFactory) {
            ValueModel valueModel = new PropertyAdapter(formModel
                    .getPropertyAccessStrategy(), formProperty);
            if (formModel.getBufferChangesDefault()) {
                valueModel = new BufferedValueModel(valueModel);
            }
            JFormattedTextField textField = createNewFormattedTextField(formatterFactory);
            TypeConverter typeConverter = new TypeConverter(valueModel, textField);
            ValueModel validatingModel = formModel.add(formProperty, typeConverter);
    in DefaultFormModel:
    Code:
        public ValueModel add(String formPropertyPath, ValueModel formValueModel) {
            if (formValueModel instanceof BufferedValueModel) {
                ((BufferedValueModel)formValueModel)
                        .setCommitTrigger(commitTrigger);
            }
    pass a TypeConverter not a BufferedValueModel

    It works
    Code:
        public ValueModel add(String formPropertyPath, ValueModel formValueModel) {
            ValueModel bufferedValueModel;
            if(formValueModel instanceof TypeConverter){
                bufferedValueModel=((TypeConverter)formValueModel).
                                                        getWrappedInstance;
            }else{
                bufferedValueModel=formValueModel;
            }
            if (bufferedValueModel instanceof BufferedValueModel) {
                ((BufferedValueModel)bufferedValueModel)
                        .setCommitTrigger(commitTrigger);
            }
    Good work

  • #2
    Thanks besbello; this is fixed now.

    Comment

    Working...
    X