Announcement Announcement Module
Collapse
No announcement yet.
readonly form and commit... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • readonly form and commit...

    Hello

    Given certain condition, I would like to display a form as a readonly form, where the user cannot modify anything. To that effect, I have created a constructor like this:

    Code:
        public MyGeneralForm(final FormModel formModel) {
            super(formModel, GENERAL_FORM_PAGE);
            getFormModel().setEnabled(false);
        }
    Where I call setEnabled(false) on the formModel.

    The form behaves as expected until one realises that the "OK" button is still enabled (which I don't really mind) but when you press it... you get an exception "Form is disabled; submit not allowed."

    Question... Shouldn't the OK button be automatically disabled if the formModel is disabled? What do you think? and if not, how could I do it?

    THANKS!

    Regards from London,

    Benoit

    Stacktrace:
    Code:
    [WARN,60627,ApplicationDialog$1,AWT-EventQueue-0] Exception occurred executing dialog finish command.
    java.lang.IllegalStateException: Form is disabled; submit not allowed.
            at org.springframework.binding.form.support.AbstractFormModel.commit(AbstractFormModel.java:377)
            at net.objectlab.safemargin.gui.view.CurrencyManagerView$CurrencyPropertiesExecutor$1.onFinish(CurrencyManagerView.java:436)
            at org.springframework.richclient.dialog.ApplicationDialog$1.doExecuteCommand(ApplicationDialog.java:332)
            at org.springframework.richclient.command.ActionCommand.execute(ActionCommand.java:188)
            at org.springframework.richclient.command.ActionCommand$1.actionPerformed(ActionCommand.java:123)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
            at java.awt.Component.processMouseEvent(Component.java:5488)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
            at java.awt.Component.processEvent(Component.java:5253)
            at java.awt.Container.processEvent(Container.java:1966)
            at java.awt.Component.dispatchEventImpl(Component.java:3955)
            at java.awt.Container.dispatchEventImpl(Container.java:2024)
            at java.awt.Component.dispatchEvent(Component.java:3803)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
            at java.awt.Container.dispatchEventImpl(Container.java:2010)
            at java.awt.Window.dispatchEventImpl(Window.java:1766)
            at java.awt.Component.dispatchEvent(Component.java:3803)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
            at java.awt.Dialog$1.run(Dialog.java:515)
            at java.awt.Dialog.show(Dialog.java:536)

  • #2
    Hi Beniot,

    Are you using the latest code from CVS? There was a significant checkin a while back (less than a week) that made significant changes in the way the form buttons are guarded.

    If you're not on the latest release, and you can upgrade, I'd suggest you do.

    Thanks.
    Larry.

    Comment


    • #3
      Ok with CVS version

      Hi Larry,

      Thanks for your reply. I had a version from Sept 2nd.
      I have updated to the latest CVS version from this morning (Sept 8th) and the problem seems solved!

      The form is disabled and both buttons OK/Cancel are enabled; however, pressing OK does not generate the exception anymore.

      Thanks!
      Regards from London,

      Benoit.

      Comment

      Working...
      X