Validation API in an OutlineView and Properties Window

Tim's Validation API (which is in the "ide" cluster in your NetBeans IDE installation directory), in action in an OutlineView:

And in the Properties window:

To achieve the above, you need to create an InPlaceEditor for your Property. (In the example above, I use a JTextField.) Within the InPlaceEditor's constructor, I simply have this:

ValidationPanel panel = new ValidationPanel();
ValidationGroup group = panel.getValidationGroup();
group.add(
        textField, 
        Validators.REQUIRE_NON_EMPTY_STRING,
        Validators.NO_WHITESPACE,
        Validators.URL_MUST_BE_VALID);

...which is copied from here:

http://netbeans.dzone.com/news/how-quickly-add-validation

By the way, thanks Henry Kleynhans in Johannesburg for the above idea!

Comments:

Hi Geertjan,

I can not find the "Tims validation API" in the NB 6.9.1 platform in the ide cluster. Is it in a newer version or has it an other place.

Thanks

Oliver

Posted by Oliver Rettig on September 02, 2010 at 05:38 AM PDT #

install-dir/ide/modules/ext/ValidationAPI.jar

Posted by Geertjan on September 02, 2010 at 05:42 AM PDT #

Is the source code for the example available ?

Thanks,
Susanta

Posted by Susanta Tewari on July 18, 2011 at 10:22 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today