Skip to content

Subforms, triggers and ntforms #25

@fpuga

Description

@fpuga

I open this ticket only to share some thoughts about the following case.

A form ('water system') has an embedded table ('family water consumption') that reflects a segregated data related to the main form. The main form has a field ('total water consumption') that aggregates the data and should be automatically updated when the data in the subforms change.

Right now we have a trigger in the main table that calculates the field, each time an update happens in the mainform, and a trigger in the sub table, that forces the trigger in the main table to be executed.

The problem with this approach is that even if the change is done in the database gvSIG is not being notified about it until a reload of the data (open/end edition, or a manual or code FLyrVect.reload)

There are several solutions:

  • A listener in the subform window, to reload parent layer when it's closed. Bad solution because it is not needed always.
  • A manual reload in the parent layer + refreshGUI in nt, when save button is pressed in the sub form. This sounds good but it should not be in the general code, as a layer reload is a heavy operation and this is a corner case.
  • I don't know if exists some mechanism that allows the database notify gvSIG that the layer should be reloaded.

The second solutions implies changes in AbstractSubForm, as does not exist a saveRecord method that can be overwritten, and the SaveAction class is private and can not be injected from outside.

For sure, it can be said, that maybe triggers are not suitable for this case, but java code and views also has some corner case that make things tricky.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions