This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 21744 - JamPropertyButton.getValue() returns "trimmed" value
Summary: JamPropertyButton.getValue() returns "trimmed" value
Status: CLOSED FIXED
Alias: None
Product: qa
Classification: Unclassified
Component: Jellytools (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@qa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-20 12:38 UTC by Marian Mirilovic
Modified: 2002-07-19 15:21 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marian Mirilovic 2002-03-20 12:38:13 UTC
Class JamPropertyButton contains method getValue() that return value of property
from PropertySheet.

This value is counted as :
   String description = jComponent.getAccessibleContext().getAccessibleName();
   return description.substring(description.lastIndexOf(':') + 2);

It means, that from accessible description gets only string after last occurence
of ':', this is incorrect trimm !!!

What about property type Icon ?!
Value is : 			"Classpath: /data/myPicture.gif"
but getValue returns only 	"/data/myPicture.gif"

or URL ?!
Value is : 			"URL: http://www.netbeans.org/myPicture.gif"
but getValue returns only 	"/www.netebeans.org/myPicture.gif"

And maybe new pottentional problem arise if property value isn't valid, how can
we test it ??
(if value is invalid , red-rectangle icon displayed, 
accessible description is :
"<property_name>: Invalid value Classpath: /data/myPicture.gif" )

Why P2 ? :
I am testing property sheet and property editors and I need get real value of
the property, not trimmed !!!



SUGGESTION:

- add new method 

    public String getRealValue() {
        verify();
        if (flagValueButton) {
            return jComponent.getAccessibleContext().getAccessibleName();
        } else if (flagNameButton) {
            getPropertyValueButton().getValue();
        }
        throw new JamRuntimeException("getValue() for dotDotDotButton");
    }
Comment 1 Jiri Skrivanek 2002-03-21 09:25:24 UTC
OK. I would suggest to use SheetButton.toString() to get real value:

        if (flagValueButton) {
String toStringValue = jComponent.toString();
return toStringValue.substring(toStringValue.indexOf("[ \"")+3,
toStringValue.indexOf("\" ]"));
        } else if (flagNameButton) {
            getPropertyValueButton().getValue();
        }

It should work. Any objections?
Comment 2 Marian Mirilovic 2002-03-21 11:44:46 UTC
Ok, I agree, this is better solution as my one.
Comment 3 Jiri Skrivanek 2002-03-22 14:17:15 UTC
Fixed both in trunk and release33. jelly-nb.jar also updated.
Comment 4 Marian Mirilovic 2002-03-25 11:15:25 UTC
New problems with property type Color arise,

please add method getRealValue in JamPropertyButton.

Thanks in advance.
Comment 5 ssffleming 2002-03-25 16:23:21 UTC
I would suggest you fix getValue() to trim smarter
rather than implementing getRealValue()
This should be easy to do.
Comment 6 Jiri Skrivanek 2002-03-26 10:26:26 UTC
I revert to use again getAccessibleContext() but it uses better
parsing (I hope).
Comment 7 Marian Mirilovic 2002-03-28 14:30:18 UTC
verified, it works fine now,

thanks Jirka.