Java: Simple Validation API Validation Strategy Change - java

This is in reference to the question posted at org.netbeans.validation.api.ui.ValidationGroup.add() - How to specify ValidationStrategy?
I am trying to do something similar. Please guide me on what needs to be changed and where. I went through the given links but couldn't find the relevant info.
P.S.: Asking in a separate question because I can't comment on the original one due to lack of reputation points.
Regards
Uday

I found out what was required.
Check out the code from their repository (https://svn.kenai.com/svn/simplevalidation~src) and open ValidationAPI as a project in Netbeans (or whatever IDE you're using).
To change the default validation strategy you'll need to make the changes in ValidationGroup and SwingValidationGroup classes under org.netbeans.validation.api.ui and org.netbeans.validation.api.ui.swing respectively.
In these classes find ValidationStrategy.DEFAULT and replace it with the strategy you want (INPUT_VERIFIER, ON_FOCUS_LOSS, ON_CHANGE_OR_ACTION).
Build the project to generate a new jar and incorporate that jar in your own project.
That's it.

Related

Why is javafx.mail.jar Java library not found in my IDE?

Does anybody knows a link or site that I could find this Java library?
The problem is there is a Java program that my employer needs me to fix a bug but the problem is that the person that was the author of the program is not anymore working with him so he needs me to fix it but the IDE is looking for a library that is javafx.mail.jar and so far as I was searching the web there were no answers of this kind of file type.
Can someone knows about this type? Thank you in advance
FYI: I'm new in Java so please be nice :)
I'm pretty sure1 you should be looking for the JAR file for javax.mail, not javafx.mail.
You can get the JAR file from Maven Central, from Oracle or from GitHub, depending on what version you need.
1 - The Oracle javafx product has nothing to do with email. Either you have misread something, or the code you are trying to fix is currently referring to something that doesn't exist ... and you need to fix that. The javafx package tree is reserved for the use of the javafx product line itself. 3rd party libraries should not define packages in that tree.

Java UML editable component/lib

I have a task where we need to generate UML(or similar) from XML and will be able to edit text, property type and drag dependency row. But I can't find any Java lib or component wich will allow me to do such.
For example PlantText is a good lib but it does not allow to make edit.
If someone known such lib/compoment please share.
Thanks
EDIT:
Sorry, maybe I wasn't wrote clear. Actually, I need library which I can implement into my project, and after I will be able to generate UML from my project, then edit it and save into XML.
draw.io is very good site where you can create (not only) UML's and save them to XML file so in future you can edit it. The drawback is it is not automatic and must be drawn from scratch.

NetBeans save edited .jar

I am currently using a library for "Notify My Android". The library is using an outdated URL so i tried to change it. I attached the source file and now I can edit the code. Before attaching the source file it just said "compiled code". But when i save it it does not seem to save the changes. It is still using the old URL. Also the change I made is underlined in blue. I hope somebody knows how to make the .jar to accept my changes.
Thanks in advance
it's highly discouraged to modify jars you depend on simply because if you ever want to upgrade versions you'd need to modify the new jar you are looking for.
In those situations you have these options:
if it is an open source project, contribute to the project and correct the URL
try and set the property from your code (this may not be possible in certain situations)
try and extend the class you're trying to use and set the URL on the property you need (like the previous one, it may not be possible to do this)
this should be your last resource: create your own project (from the original jar), make the changes you require, package it up and add it to you app.

Can I include code from one file to the next, similar to Includes in html

Ok, Please be gentle and kind. I am taking an Android Programming class in college and its our teachers first semester so he is learning as we are... Nothing against him, he's a good teacher, just doesn't know the answer.
I don't know how to put this in Android/java language so here goes...
Is there a way to use something similar to Includes, in web design, in Android. I am looking to add similar java code from one activity to the next, can i make a file that if i change this one file it will change in all the files its included it.
I know it can be done with the XML files but i couldn't find anything to show that it can be done in the actually coding... but then again i don't know the correct terminology. Please any help would be great. And thank you for taking the time to read and answer me. I apologize if this was somewhere else, I just couldn't find it.. Thanks again
Put anything you wish to "include" in Java classes, then import them. http://leepoint.net/notes-java/language/10basics/import.html
Android Programming class! I would've loved that in University...
Regardless, if you're using Eclipse for your IDE, it should pickup any changes from your java imports automatically. If you choose to refactor other java classes within your project, a rename for example (with "Update All References"), will update all references to that class across your project.
You could also use Maven (dependency management) to pull the latest third-party (or other) .jars at build time, if that's applicable to what your needs are.
:)

Simple JDT example of code generation

I'm trying to write an Eclipse plugin. It will have dependencies on the RCP for basic stuff and JDT for Java code generation. It consists of a Wizard / WizardPage which asks for a package and a few class names. When the user hits "Finish", I want the wizard to create classes corresponding to the entered values into the current Java project.
I have the basic UI working. What I cannot figure out is how to generate the corresponding class code. Eclipse documentation is a bit hard to follow. From what I can glean I need to first obtain an IJavaProject from the workspace, from that an IPackageFragment and from that I can call createCompilationUnit() to make a class.
What I can't do is find any working examples. I assume that somehow I can walk from the workspace root to where I need to be and create the unit.
Can anyone offer some pointers to simple working code?
You need to extend NewElementWizardPage and provide the functionality. See this documentation for more details
I assume that somehow I can walk from the workspace root to where I need to be and create the unit.
Yes. Take a look at IProject, IFolder, and IFile in the org.eclipse.core.resources package.
Can anyone offer some pointers to simple working code?
Eclipse itself creates a new Java class with a limited skeleton when you ask it to, using the New Java Class Wizard. That source code would be helpful to you for what you want to do. I couldn't find it with a cursory search of Eclipse and the Eclipse help. I'm guessing it's somewhere in an org.eclipse.pde package.
You might also look at Creation Wizards, which is the extension point org.eclipse.ui.newWizards.

Categories

Resources