Project

General

Profile

Bug #2702

Bug #2677: fix drawing and functional differences between P2J GUI and 4GL GUI

MESSAGE SET/UPDATE in GUI mode implicitly enables a special VIEW-AS ALERT-BOX mode

Added by Greg Shah over 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:

message_update_awesome_20150910.png (4.52 KB) Greg Shah, 09/10/2015 05:11 PM

message_update_num_20150910.png (4.73 KB) Greg Shah, 09/10/2015 05:11 PM

History

#1 Updated by Greg Shah over 8 years ago

When in GUI mode, a "normal" MESSAGE SET or MESSAGE UPDATE will implicitly use a special kind of alert-box instead of the normal message area inline approach (which we simulate with ThinClient.tinyInput()).

Here is an example (see testcases/uast/message-update6.p):

def var answer as logical.
def var num as int.

message "Is this awesome?" update answer format "Y/N".

message "How awesome (1 - 10)?" update num format "99".

The first message stmt:

and the second:

It is not a simple as just redirecting to the LT.messageBox() implementation for the following reasons:

1. There are no buttons, but the normal alert-box always has buttons so this is a deviation.
2. There is no icon. This might be the same as LogicalTerminal.ALERT_MESSAGE. However the sizing might be off since this method does everything in a 1-row alert-box.
3. The title is always "Message Update". Yes, even for SET.
4. The normal alert box can only be used to set/update a logical. This method can edit any data type.
5. The normal alert box can't honor the format, but this method does.
6. The normal alert box can't honor the auto-return option, but this method does.

One other note: when you try to use an explicit MESSAGE SET/UPDATE VIEW-AS ALERT-BOX, it will require you to use a logical var and it won't allow the format string or auto-return. But as long as you remove the VIEW-AS ALERT-BOX, it will automatically handle all of this in GUI mode.

#2 Updated by Greg Shah over 8 years ago

I'm analyzing the code in Window.tinyInput() with the intention to start making changes to implement GUI-specific code paths.

One thing I don't understand about that code is how the created frame gets attached to the current window. See the comment on line 1679.

Do either of you know how this is working?

#3 Updated by Hynek Cihlar over 8 years ago

Greg Shah wrote:

I'm analyzing the code in Window.tinyInput() with the intention to start making changes to implement GUI-specific code paths.

One thing I don't understand about that code is how the created frame gets attached to the current window. See the comment on line 1679.

Do either of you know how this is working?

This happens through Window.addFrame(), see Frame.initialize().

#4 Updated by Constantin Asofiei over 8 years ago

Greg, I think Frame.initialize() should use the FrameConfig.windowID: if is set, resolve the explicit window and attach it there. The code which should be modified is this:

      if (parent() == null)
      {
         // if the frame is not attached to a window, attach it now
         Window.resolveWindow().addFrame((Widget) this, location().y, location().x);
      }

This way, if Window.tinyInput() sets the frame's windowID, it will attach there directly.

#5 Updated by Greg Shah over 8 years ago

Yes, I like that approach better. The current approach is too "implicit" and depends upon the current window having been set previously. I'm surprised that all of the use cases we have run so far actually meet this criteria.

It seems to me that the 4GL may wait longer to associate a frame with a window.

#6 Updated by Greg Shah over 8 years ago

Hynek: I am trying to use ModalWindow directly as the containing window for a frame. Clearly this a bad idea:

Caused by: java.lang.ClassCastException: com.goldencode.p2j.ui.client.gui.ModalWindow cannot be cast to com.goldencode.p2j.ui.client.Window
        at com.goldencode.p2j.ui.chui.ThinClient.targetWindowWorker(ThinClient.java:17570)
        at com.goldencode.p2j.ui.chui.ThinClient.access$1200(ThinClient.java:2189)
        at com.goldencode.p2j.ui.chui.ThinClient$42.run(ThinClient.java:9561)
        at com.goldencode.p2j.ui.chui.ThinClient.eventBracket(ThinClient.java:13623)
        at com.goldencode.p2j.ui.chui.ThinClient.eventDrawingBracket(ThinClient.java:13564)
        at com.goldencode.p2j.ui.chui.ThinClient.eventDrawingBracket(ThinClient.java:13470)
        at com.goldencode.p2j.ui.chui.ThinClient.viewWorker(ThinClient.java:9455)
        at com.goldencode.p2j.ui.chui.ThinClient.enableWorker(ThinClient.java:4332)
        at com.goldencode.p2j.ui.chui.ThinClient.enable(ThinClient.java:4205)
        at com.goldencode.p2j.ui.chui.ThinClient.enable(ThinClient.java:4111)
        at com.goldencode.p2j.ui.client.Window.tinyInput(Window.java:1709)
        at com.goldencode.p2j.ui.client.Window.message(Window.java:2103)
        at com.goldencode.p2j.ui.chui.ThinClient.message(ThinClient.java:6587)

What would you suggest as an alternative?

#7 Updated by Hynek Cihlar over 8 years ago

Greg Shah wrote:

Hynek: I am trying to use ModalWindow directly as the containing window for a frame. Clearly this a bad idea:

[...]

What would you suggest as an alternative?

Greg, placing a frame to a modal window is essentially the goal of #2560. Unfortunately I don't think there is any quick alternative if you want to achieve the same functionality of the modal window as in 4GL.

Maybe it would make sense to delegate this task to me.

#8 Updated by Greg Shah over 8 years ago

Thanks, Hynek. I was worried you would say that.

I have a range of other changes related to this. Perhaps I should merge them into 2560a? I can leave behind some markers in Window (mostly tinyInput()) where the modal window changes are needed.

#9 Updated by Hynek Cihlar over 8 years ago

Greg Shah wrote:

Thanks, Hynek. I was worried you would say that.

I have a range of other changes related to this. Perhaps I should merge them into 2560a? I can leave behind some markers in Window (mostly tinyInput()) where the modal window changes are needed.

Please merge it into 2560a.

#10 Updated by Hynek Cihlar over 8 years ago

Greg, just let me know, if you want me to rebase 2560a.

#11 Updated by Greg Shah over 8 years ago

Hynek Cihlar wrote:

Greg, just let me know, if you want me to rebase 2560a.

No, actually my changes are based on trunk 10940 (I built them in 1811r). I will clean them up, test to make sure that the ChUI code usage of tinyInput() hasn't been broken and then I'll apply the changes to 2560a.

#12 Updated by Greg Shah over 8 years ago

I've checked in my changes as revision 10949 in branch 2560a. The window integration portions are marked in Window using HC_TODO. Thanks for helping with this.

Please note that I could not test the ChUI support using 2560a because it seems broken:

Caused by: java.lang.ClassCastException: com.goldencode.p2j.ui.client.chui.driver.swing.SwingChuiDriver cannot be cast to com.goldencode.p2j.ui.client.gui.driver.GuiDriver
        at com.goldencode.p2j.ui.client.WindowManager.disableOSEvents(WindowManager.java:575)
        at com.goldencode.p2j.ui.chui.ThinClient.getChanges(ThinClient.java:11812)
        at com.goldencode.p2j.net.Protocol.attachChanges(Protocol.java:274)
        at com.goldencode.p2j.net.Queue.enqueueOutbound(Queue.java:810)
        at com.goldencode.p2j.net.Queue.transactImpl(Queue.java:1109)
        at com.goldencode.p2j.net.Queue.transact(Queue.java:585)
        at com.goldencode.p2j.net.BaseSession.transact(BaseSession.java:223)
        at com.goldencode.p2j.net.HighLevelObject.transact(HighLevelObject.java:163)
        at com.goldencode.p2j.net.HighLevelObject.getKey(HighLevelObject.java:116)
        at com.goldencode.p2j.net.RemoteObject$RemoteAccess.obtainRoutingKey(RemoteObject.java:1504)
        ... 11 more

#13 Updated by Greg Shah over 8 years ago

To test GUI support for tinyInput(), please pull the latest @testcases/uast/message-update6.p. I've made several changes that demonstrate some specific behavior.

#14 Updated by Hynek Cihlar over 8 years ago

Greg Shah wrote:

I've checked in my changes as revision 10949 in branch 2560a. The window integration portions are marked in Window using HC_TODO. Thanks for helping with this.

Please note that I could not test the ChUI support using 2560a because it seems broken:

[...]

Yes, this is a known issue.

#15 Updated by Hynek Cihlar over 8 years ago

Greg Shah wrote:

I've checked in my changes as revision 10949 in branch 2560a. The window integration portions are marked in Window using HC_TODO. Thanks for helping with this.

Please note that I could not test the ChUI support using 2560a because it seems broken:

[...]

This is fixed in 2560a, revision 10950.

#16 Updated by Greg Shah over 8 years ago

I tested rev 10950 and message-update6.p works properly in ChUI. I see 2 small deviations (related to the ChUI cursor and the display of the ? in the numeric editing field), but I think they exist in the trunk too.

#17 Updated by Hynek Cihlar over 8 years ago

After 2560a revision 10949, Window.message() in GUI no longer outputs messages to the window message area.

I think the problematic code is

      // the actual message content is only output to the message lines for ChUI
      if (tc.isChui())
      {
         row = message(text, cs, var != null);
      }

in Window.message().

Greg, what was the intention there?

#18 Updated by Greg Shah over 8 years ago

Sorry, that was a regression. This is what the code should have been:

      // the actual message content is only output to the message lines for ChUI
      // if we are in MESSAGE SET/UPDATE mode; if not in MESSAGE SET/UPDATE mode
      // then it should output for GUI or ChUI
      if (var == null || tc.isChui())
      {
         row = message(text, cs, var != null);
      }

Checked into task branch 2560a revision 10954.

#19 Updated by Greg Shah over 8 years ago

I tested this on 2560a rev 10959. The testcase abends before displaying. Here is the bottom of the log:

...

enableEvents false 1
com.goldencode.p2j.ui.client.gui.driver.swing.SwingEmulatedWindow.enableEvents(SwingEmulatedWindow.java:496)
com.goldencode.p2j.ui.client.gui.driver.AbstractGuiDriver.enableEvents(AbstractGuiDriver.java:1844)
com.goldencode.p2j.ui.client.WindowManager.disableOSEvents(WindowManager.java:597)
com.goldencode.p2j.ui.client.gui.driver.GuiOutputManager.disableOSEvents(GuiOutputManager.java:239)
com.goldencode.p2j.ui.chui.ThinClient.getChanges(ThinClient.java:11810)
com.goldencode.p2j.net.Protocol.attachChanges(Protocol.java:274)

enableEvents false -29
com.goldencode.p2j.ui.client.gui.driver.swing.SwingEmulatedWindow.enableEvents(SwingEmulatedWindow.java:496)
com.goldencode.p2j.ui.client.gui.driver.AbstractGuiDriver.enableEvents(AbstractGuiDriver.java:1844)
com.goldencode.p2j.ui.client.WindowManager.disableOSEvents(WindowManager.java:597)
com.goldencode.p2j.ui.client.gui.driver.GuiOutputManager.disableOSEvents(GuiOutputManager.java:239)
com.goldencode.p2j.ui.chui.ThinClient.getChanges(ThinClient.java:11810)
com.goldencode.p2j.net.Protocol.attachChanges(Protocol.java:274)

enableEvents true -29
com.goldencode.p2j.ui.client.gui.driver.swing.SwingEmulatedWindow.enableEvents(SwingEmulatedWindow.java:496)
com.goldencode.p2j.ui.client.gui.driver.AbstractGuiDriver.enableEvents(AbstractGuiDriver.java:1844)
com.goldencode.p2j.ui.client.WindowManager.enableOSEvents(WindowManager.java:583)
com.goldencode.p2j.ui.client.gui.driver.GuiOutputManager.enableOSEvents(GuiOutputManager.java:227)
com.goldencode.p2j.ui.chui.ThinClient.applyChanges(ThinClient.java:11917)
com.goldencode.p2j.net.Protocol.applyChanges(Protocol.java:309)

java.lang.IllegalStateException: Widget  2 is not attached to a TopLevelWindow instance.
    at com.goldencode.p2j.ui.client.widget.AbstractWidget.topLevelWindow(AbstractWidget.java:288)
    at com.goldencode.p2j.ui.client.gui.FrameGuiImpl.destroy(FrameGuiImpl.java:417)
    at com.goldencode.p2j.ui.client.widget.AbstractContainer.destroy(AbstractContainer.java:702)
    at com.goldencode.p2j.ui.client.widget.AbstractContainer.destroy(AbstractContainer.java:702)
    at com.goldencode.p2j.ui.client.widget.AbstractContainer.destroy(AbstractContainer.java:702)
    at com.goldencode.p2j.ui.client.widget.TitledWindow.destroy(TitledWindow.java:393)
    at com.goldencode.p2j.ui.client.gui.ModalWindow.destroy(ModalWindow.java:515)
    at com.goldencode.p2j.ui.client.WindowManager.clearWindowList(WindowManager.java:233)
    at com.goldencode.p2j.ui.chui.ThinClient.terminate(ThinClient.java:2853)
    at com.goldencode.p2j.main.ClientCore.start(ClientCore.java:280)
    at com.goldencode.p2j.main.ClientCore.start(ClientCore.java:100)
    at com.goldencode.p2j.main.ClientDriver.start(ClientDriver.java:201)
    at com.goldencode.p2j.main.CommonDriver.process(CommonDriver.java:398)
    at com.goldencode.p2j.main.ClientDriver.process(ClientDriver.java:95)
    at com.goldencode.p2j.main.ClientDriver.main(ClientDriver.java:267)

Is MESSAGE SET/UPDATE support supposed to be functional at this point?

#20 Updated by Hynek Cihlar over 8 years ago

Greg Shah wrote:

Is MESSAGE SET/UPDATE support supposed to be functional at this point?

Yes, MESSAGE SET/UPDATE is supposed to work and it did work. I must have broken something with my changes from yesterday. I will check it. Btw., the exception dump is not the exception of the primary cause I think.

#21 Updated by Hynek Cihlar over 8 years ago

Support for GUI tiny input has been delivered together with task branch 2560a and checked in to trunk as revision 10948.

#22 Updated by Greg Shah over 8 years ago

This partially works in the trunk rev 10948. The window title for the dialog doesn't display properly. Please note that this issue is fixed in 1811s rev 10994.

There are 2 other issues remaining. Those problems are going to be worked in #2763 and #2764.

#23 Updated by Greg Shah over 8 years ago

  • Status changed from New to Closed
  • Assignee set to Hynek Cihlar

#24 Updated by Greg Shah over 8 years ago

  • % Done changed from 0 to 100

#25 Updated by Greg Shah over 7 years ago

  • Target version changed from Milestone 12 to GUI Support for a Complex ADM2 App

Also available in: Atom PDF