Announcement Announcement Module
Collapse
No announcement yet.
Master/Detail not refreshing anymore when setFormObject called... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Master/Detail not refreshing anymore when setFormObject called...

    Hi

    I do not know if it is related to some recent changes explained in http://forum.springframework.org/showthread.php?p=46263

    What I see is that using setFormObject on a model does not seem to trigger a refresh on the Master/Detail forms.

    I am using the latest code checked out this morning.

    if I add the following code to my form extending AbstractTableMasterForm:
    Code:
            this.addFormObjectChangeListener(new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("/ ObjectChanged objectSet ==> " + evt.getNewValue());
                    }
                }
            });
    It is NOT called when the object is changed in the overall model. The impact is that my table stays "empty" whilst the object does contain values for that attribute.

    This is a new phenomenon, I believe it used to work with the source code from end of dec. I cannot say whether the addFormObjectChangeListener used to work but my master tables were definitely filled in...

    The form is built:
    final MyForm legForm = new MyForm(getMainModel(), "objectSet", MyObject.class);
    where objectSet returns a set of the objects to display in the master table.

    and MyForm constructor is:
    Code:
    public class MyForm extends AbstractTableMasterForm {
        public static final String GENERAL_FORM_PAGE = "myPage";
    
        private static final Logger LOG = Logger.getLogger(MyForm.class);
    
        public MyForm(final HierarchicalFormModel formModel, final String property, Class clazz) {
            super(formModel, property, GENERAL_FORM_PAGE, clazz);
            this.addFormObjectChangeListener(new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("/ ObjectChanged objectSet ==> " + evt.getNewValue());
                    }
                }
            });
        }
    Any suggestion?

    Many thanks!

    Benoit

  • #2
    Ok, I can reproduce the problem. I'll dig into it.

    Larry.

    Comment


    • #3
      Hi Benoit,

      It's fixed - sorry for that. I hadn't updated this code when I "integrated" the root event list and the underlying buffered list model.

      Thanks for catching it (and sorry you had to)

      Larry.

      Comment


      • #4
        all working fine now!
        Thanks for the quick patch!

        Benoit

        Comment


        • #5
          Hi to all!

          Where i can find this fix?
          Probably i've the same problem :

          private Component buildMainPanel() {
          Customer customer;
          if (this.getSelectedCustomer()!=null) customer = this.getSelectedCustomer();
          else {
          Object [] customers = getCustomerDataStore().getAllCustomers();
          customer=(Customer)customers[0];
          }
          customerInvoice CustomerInvoice = new CustomerInvoice();
          customerInvoice.setId(Customer.getId());
          customerInvoice.setCodeCustomer.getCode());
          customerInvoice.setDescrizione(Customer.getDescriz ione());
          customerInvoice.setInvoice(documentoDataStore.getA llInvoices(customer));
          formModel = FormModelHelper.createFormModel(customerInvoice);
          form = new CustomerInvoiceForm(formModel,"invoices");
          return createStrippedScrollPane(form.getControl());
          }

          /**
          * Builds and answers the main panel.
          */
          private Component refreshMainPanel() {
          Customer customer;
          customer = this.getSelectedCustomer();
          customerInvoice customerInvoice = new CustomerInvoice();
          customerInvoice.setId(Customer.getId());
          customerInvoice.setCode(Customer.getCode());
          customerInvoice.setDescrizione(Customer.getDescriz ione());
          customerInvoice.setInvoice(documentoDataStore.getA llInvoices(customer));
          form.getControl().setEnabled(false);
          formModel = FormModelHelper.createFormModel(customerInvoice);
          form.setFormObject(formModel);
          form.getControl().setEnabled(true);
          return createStrippedScrollPane(form.getControl());
          }

          Nested in a JSplitPane :

          protected JComponent createControl() {
          JPanel view = new JPanel(new BorderLayout());
          createCustomerManagerTree();
          JScrollPane sp = new JScrollPane(customersTree);
          sp.setMinimumSize(new Dimension(150, 150));

          rightMainPanel=buildMainPanel();
          JSplitPane splitPane =
          new JSplitPane(
          JSplitPane.HORIZONTAL_SPLIT,
          sp,
          rightMainPanel);
          view.add(splitPane, BorderLayout.CENTER);
          return view;
          }


          refreshed in :

          private void updateCommands() {
          int treeSelectionCount = customersTree.getSelectionCount();
          if (isRootOrNothingSelected()) {
          deleteExecutor.setEnabled(false);
          propertiesExecutor.setEnabled(false);
          }
          else if (treeSelectionCount == 1) {
          deleteExecutor.setEnabled(true);
          propertiesExecutor.setEnabled(true);
          }
          else if (treeSelectionCount > 1) {
          deleteExecutor.setEnabled(true);
          propertiesExecutor.setEnabled(false);
          }
          rightMainPanel=refreshMainPanel();
          }


          Thanks in advance!!
          Regards!!

          Vincenzo!!

          Comment

          Working...
          X