Project

General

Profile

Bug #3335

buggy no-validate in browse widget

Added by Ovidiu Maxiniuc over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version:

Related issues

Related to User Interface - Feature #3275: improve browse support Closed

History

#1 Updated by Ovidiu Maxiniuc over 6 years ago

I was testing #3330 with a large customer GUI application and I got an message that was not expected according to docs. It says:

    "NO-VALIDATE is an invalid attribute for a static BROWSE brTable" 

I checked the source and it looks like this:

    DEFINE BROWSE br_table
        WITH NO-ASSIGN NO-ROW-MARKERS SEPARATORS NO-VALIDATE SIZE 66 BY 6.65
             FONT 9 EXPANDABLE.

And this is valid code. The error is incorrectly raised by BrowseWidget.java, in setNoValidate(boolean), line 1051. This is evidently a double copy/paste error, the handling of error handling was copied from setNoValidate(logical), but what is the error message and what is the proper condition here? Also, the message should contain the legacy widget name (br_table), not the javaname (brTable).

Since this is in trunk for some time, I think it will not be fixed in 3330a.

#2 Updated by Stanislav Lomany over 6 years ago

  • Status changed from New to WIP
  • Assignee set to Stanislav Lomany

Greg, setNoValidate should behave differently depending if it is a frame construction stage (NO-VALIDATE option) or assignment of NO-VALIDATE attribute. I suggest to convert NO-VALIDATE option to function named setNoValidateOption() instead. Is it OK?

#3 Updated by Greg Shah over 6 years ago

Stanislav Lomany wrote:

Greg, setNoValidate should behave differently depending if it is a frame construction stage (NO-VALIDATE option) or assignment of NO-VALIDATE attribute. I suggest to convert NO-VALIDATE option to function named setNoValidateOption() instead. Is it OK?

Yes, it is OK. Please note that 3330a is frozen right now. The change should go into a different branch.

#4 Updated by Greg Shah over 6 years ago

#6 Updated by Stanislav Lomany over 6 years ago

Also, the message should contain the legacy widget name (br_table), not the javaname (brTable).

Error message uses GenericWidget.widgetName() which is "widget name for the error message" and used by all widgets. It's strange that this error was noted only now. The correct name is, as far as I tested

protected String widgetName()
{
   character name = name();
   return dynamic && name.isUnknown() ? "widget" : name.toStringMessage();
}

Any objections?

#7 Updated by Greg Shah over 6 years ago

The current implementation of GenericWidget.widgetName() is using GenericFrame.getName(GenericWidget widget) to obtain the name. That code uses the converted name, not the legacy (or original) name. That does seem wrong.

On the other hand, there are some use cases (frame, field-group and "Unknown") which is different from the use of GenericWidget.name() and may be needed. I'm not sure about these cases.

Also, BrowseWidget.finishSetup() sets config.name using GenericWidget.widgetName(), so that is not clear either.

Constantin: What do you think?

#8 Updated by Constantin Asofiei over 6 years ago

Greg Shah wrote:

Constantin: What do you think?

I have this code in 3260b which I think it should fix the issue:

### Eclipse Workspace Patch 1.0
#P p2j
Index: src/com/goldencode/p2j/ui/GenericFrame.java
===================================================================
--- src/com/goldencode/p2j/ui/GenericFrame.java    (revision 1249)
+++ src/com/goldencode/p2j/ui/GenericFrame.java    (working copy)
@@ -812,6 +812,7 @@
 **                           and it breaks down frames after the improvements for down frame
 **                           configs.
 ** 344 EVL 20170530          Adding DROP-TARGET frame option support.
+** 345 CA  20170914          Fixed getOriginalName() for frame widgets.
 */
 /*
 ** This program is free software: you can redistribute it and/or modify
@@ -7742,7 +7743,18 @@
     */
    public String getOriginalName(GenericWidget<?> widget)
    {
-      return n2n.get(getName(widget));
+      String cvtName = getName(widget);
+      if (n2n.containsKey(cvtName))
+      {
+         return n2n.get(cvtName);
+      }
+      
+      if (widget instanceof FrameWidget)
+      {
+         return ((FrameWidget) widget).getFrame().frameName;
+      }
+      
+      return null;
    }

    /**

Stanislav: can you test the patch above?

#9 Updated by Constantin Asofiei over 6 years ago

Actually, sorry, that was only for FRAME:NAME.

Stanislav/Ovidiu: is the converted code for the frame definition (the addWidget call) using br_table or brTable as second parameter?

#10 Updated by Stanislav Lomany over 6 years ago

Constantin,

addWidget("brTable", "br_table", brTable);

#11 Updated by Constantin Asofiei over 6 years ago

Looks like the BROWSE:NAME attribute is reported properly. Stanislav, I think the issues are:
  1. as you mentioned in #3335-6, we need to use name() API to retrieve the legacy name, in widgetName()
  2. there are many calls for frame.getName(this) in error messages, throughout the server-side widget classes - please fix these too. Also, replace all getOriginalName(this) calls in error messages with widgetName(), too.

#12 Updated by Stanislav Lomany over 6 years ago

Constantin, frame.getName(this) cannot be replaced with widgetName() for usages inside FrameWidget, because the first function returns GenericFrame.frameName which keeps the legacy name for the frame. Leave it as is?

#13 Updated by Constantin Asofiei over 6 years ago

Stanislav Lomany wrote:

Constantin, frame.getName(this) cannot be replaced with widgetName() for usages inside FrameWidget, because the first function returns GenericFrame.frameName which keeps the legacy name for the frame. Leave it as is?

Not even if you use the patch in note 8?

#14 Updated by Stanislav Lomany over 6 years ago

Sorry, patch fixes the problem.

#15 Updated by Stanislav Lomany over 6 years ago

  • Status changed from WIP to Review

Fixed as part of #3275

#16 Updated by Greg Shah over 6 years ago

  • Status changed from Review to Closed
  • % Done changed from 0 to 100

These changes are included in trunk rev 11185.

Also available in: Atom PDF