Create a subclass warning with JPA, JSF in Netbeans - jsf

I am using Netebans 7.3 to develop a JSF application with JPA. When I create a new Entity, there is a warning at the #Entity line just above the class decleration "Create Subclass" and when I click on the it leads me to create a class with default name adding Impl suffix to the original class. Why it gives such warning and what can I do with the new subclass?

Netbeans documentation says 'Create Subclass' is a suggestion.
http://wiki.netbeans.org/Java_Hints
It also says that it was added in version 7.2 , I guess they have not perfected it yet and it is showing up as suggestion in a few more places than required.

Related

To migrate java web project from PrimeFaces 3.4 to PrimeFaces 5.2

I have not lot work experience with PrimeFaces. I have to migrate a java web PrimeFaces project from 3.4 to 5.2. Although I searched it all over the internet there was not proper solution for my situation. If you ever have any experience with this kind of problem or ever heard of that please let me know or send me link for that. Basically I want to the way of doing it. I already have idea about witch component should be changed. Is there anything to do except replacing the jar? I already tried to replace PrimeFaces 3.4 with PrimeFaces 5.2 jar. But it does not allow me to replace the jar. Do I have to to change the code too? Please i want the migration steps.
There is a PrimeFaces migration guide. you need to go step by step to get from 3.5 to 5.2.
Here is the full migration guide for your situation:
Copied from MigrationGuide
3.4 to 3.5
Component Changes
DateSelectEvent, ScheduleDateSelectEvent, ScheduleEntrySelectEvents classes are removed, use SelectEvent instead.
Column class in SortEvent and ColumnResizeEvent is replaced with UIColumn to support dynamic columns.
Scrollable and Resizable DataTable-TreeTable features are reimplemented. DataTable and TreeTable no longer render cell container div element with classes ui-dt-c and ui-tt-c.
Sheet component is removed as it duplicated functionality of DataTable. Galleria is reimplemented.
General Changes
IE7 support is phased out.
3.5 to 4.0 Component Changes
MenuModel is rewritten and not backward compatible with the old version.
(skip this when e.g. directly migrating from 3.x to 5.x, it is 'reverted' again in 5.0) DataTable sortBy and filterBy expressions require the plain property name meaning "name" instead of "#{person.name}".
Backward compatibility is maintained for expressions like
"#{var.property}" but not for complex expressions.
FileUpload is reimplemented and it is backward compatible except "showButtons" option is removed.
disabledSelection option of column, moved to DataTable, change is backward compatible and the option will be removed from column in a future release.
AutoComplete: removed process/global/onstart/oncomplete in favor of "p:ajax event="query" process/global/onstart/oncomplete"
General Changes
Preferred way of accessing widgets is via PF('widgetVarName').show(), old way (e.g. widgetVarName.show())
is still supported and will be removed in a future version.
4.0 to 5.0 Component Changes
Chart components are deprecated in favor of new generic chart component with new Chart API. Old chart components are still supported but will be removed in a future release.
ToolbarGroup deprecated, use left and right facets of toolbar instead. (Reverted back as of 5.0.1, both facets and toolbar groups will be supported instead)
Defining fields in sortBy-filterBy attributes is deprecated use a value expression instead.e.g. sortBy="#{user.name}" instead of sortBy="name"
DataTable frozen rows feature take an integer value instead of a collection from now on. This value defined how many rows from the start should be frozen.
LazyDataModel's filters parameter changed to Map instead of Map as a requirement of the new Advanced
Filtering Feature.
Dialog: appendToBody was removed in favor of appendTo="#(body)" to gain more flexibility
Watermark: forElement was removed in favor of for="#(yourSelector)".
Widgets must be referenced via "PF". e.g. PF('widgetVarName').show() instead of widgetVarName.show();
DataTable layout changed to table-layout:fixed.
PrimeFaces Push is reimplemented, PushContext is deprecated, use EventBus instead along with the new Push API.
ScrollPanel is reimplemented, usage is backward compatible however UI is slightly different.
5.0 to 5.1
Support for literal texts in filterBy-sortBy expressions were deprecated in 5.0 and it is removed in 5.1. These attributes only work with value expression as in the past.
Deprecated chart components are removed.
You can't directly migrate from 3.4 to 5.2.
There are some steps given to migrate in MigrationGuide. Perhaps you could first migrate from 3.4 to 4.0 there are some components changes on DataTable, DateSelectEvent, etc. Then you could proceed with 4.0 to 5.0 migration which involves more changes in LazyDataModel's and some of componets. Please go thought link given for MigrationGuide above.

ListDataModel<Car> or just ListDataModel?

I am trying to clone example here http://primefaces.org/showcase/ui/datatableRowSelectionRadioCheckbox.jsf
But Netbeans tell me that "type ListDataModel does not take parameters" at
public class CarDataModel extends ListDataModel<Car> implements SelectableDataModel<Car>
line at CarDataModel.java
If I remove Car parameter, like
public class CarDataModel extends ListDataModel implements SelectableDataModel<Car>
it compiles without any error and jsf page open with empty datatable.
what am I doing wrong?
Thanks for helping.
PM 4.0.4, Jboss 7.1.1
The error you've got implies that you're trying to indicate a type parameter on a class that's not generic, that is, the class that doesn't expect it.
Examination of past Java EE releases showed that within Java EE 5 the ListDataModel is non-generic, while in Java EE 6+ ListDataModel<E> indeed is.
As generics has become a Java artifact since Java SE 5 ages, Sun probably decided to leave a non-generic version of list model for Java EE 5.
As for the solution, look for old JSF libraries in your classpath and upgrade them to JSF 2+ (as of December 2013, the JSF version is 2.2). Alternatively, as application servers come bundled with JSF, and that you've got the most recent one, you can just as safely remove the webapp's JSF library altogether.

jfxtras CalendarTextField cannot be loaded in Scene Builder

I am using Netbeans and Scenebuilder to create a JavaFX project. I realized that Scenebuilder does not have a date picker component so I downloaded the jfxtras and added the library to my classpath. I used the following code to add the CalendarTextField Object to my FXML file:
<?import jfxtras.labs.scene.control.*?>
<CalendarTextField fx:id="setupdate" prefWidth="200.0" showTime="true" GridPane.columnIndex="3" GridPane.rowIndex="8" />
It appeared to have worked ok, however, when I opened my FXML file in Scenebuilder I am getting the following error:
fxml:99: error:
javafx.fxml.LoadException: Element does not define a default property.
I am not sure what this means.
Java 8 DatePicker
Use Java 8 + SceneBuilder 2, it has a DatePicker.
Both are early access (especially SceneBuilder 2). Don't expect much in the way of SceneBuilder 2 stability for a little while, it's implementation is currently pretty rough and not as polished as SceneBuilder 1.1.
jfxtras and fxml
With regards to the use of jfxtras controls in SceneBuilder 1.1, my guess is that it is just not supported.
In order to build the jfxtras controls for Java 7, it was necessary for the jfxtras developers to make use of private APIs as feature complete public APIs for building custom controls are not available in Java 8. Usage of private APIs may cause compatibility issues with different SceneBuilder versions as it ties the control binaries to only work with certain JavaFX versions (as backward compatibility of private JavaFX apis is not guaranteed in new Java versions).
Also, the jfxtras developers may not have implemented the builder classes required to make their controls work with FXML. This would seem to be the case, as lack of an appropriate builder is what generates the error: javafx.fxml.LoadException: Element does not define a default property.
Implementing your own builder
You can read more about builders and fxml in an Introduction to FXML. You could implement a builder for the jfxtras CalendarTextField if you wish (I will not write one in this answer though). If you did implement an appropriate builder, there is a reasonable chance that you would then be able to use the control in FXML used by SceneBuilder 1.1.

MonoTouch 5 Error: "Failed to find selector setXxxxxx" after migrating to Xcode 4.2 and MonoDevelop 2.8

I have an iPad project that has been under development in Xcode 3.2.6 / MonoTouch 4.2.x / MonoDevelop 2.6 and when I installed the Monotouch 5, MonoDevelop 2.8.1 and Xcode 4.2 the project compiled and run OK. But when I started to change the XIB files in Xcode 4.2 (adding outlets) I started to have some glitches:
1) App crashes and MonoDevelop in debug mode says the the views were not loaded because the view outlet was not set. I figured out that in Xcode 4.2 there is no need to create an outlet named "view" in the .h file and just need to connect the File Owner view to the view control in the designer. Correct?
2) The main problem and is not solved yet is that I get exceptions "Failed to find selector setXxxxx" where "xxxxx" is a name of an outlet for a UI control. It started to happen in ViewControllers that inherited from a base view controller, but as soon as I started to change other normal viewControllers I get the same type of errors. Any hints of what is wrong?
3) I have a controller that loads dynamically some views and that works fine. but when I set a property on one of this sub views outlets (like the Text of a UILabel) the value is set (on the debugger) but no change in the UI. The actions for example work fine. What could be wrong.
4) Any special settings in the XIB's that are needed in order to correctly under Xcode 4.2 to integrate well with MonoDevelop 2.8?
Help is much appreciated, I thought in going back to the previous set of tools and monotouch but I guess once the project was upgraded there is no way to go back without losing all the development done now.
Thanks, Pedro
EDIT: Beside the new clean attributed [Outlet] code generated by MonoTouch 5 (replacing lot of code previously generated), the significant difference is that before the partial class generated was public and now is private, this may be the source of my problem. Is there a way to generate public partial classes or protected?
EDIT 2: If I manually add the public keyword to the partial class and members generated by MonoTouch in designer.cs the selectors are generated behind the scenes and all works. This indicates that with the change from public to private partial class the bindings generation changed in MonoTouch 5, is it by design or bug? I would find it very strange that now its not possible to create a viewcontroller with outlets, subclasss it and the child viewcontroller cannot access the parent class outlets.
1) There is indeed a view outlet on the base UIViewController class, which is an Objective-C property. When using Interface Builder 3 with MonoTouch, IB often didn't allow connecting to the base view outlet so many users created their own in their custom subclasses. MonoDevelop 2.6 and older created these custom outlets as ivars (Objective-C fields), and apparently the UIKit runtime would connect the object to both versions of the outlet - both the custom ivar and the base property. MonoDevelop 2.8 generates the custom outlets as properties, which means that the redundant view outlet shadows the base view outlet, so the base view outlet is never set, and UIKit gets unhappy. You can fix this by removing the redundant custom view outlet - MD 2.8.2 will do this automatically.
2) Seems to be a bug with the way MonoTouch exports custom outlets that prevents connecting to custom outlets defined in base classes. A possible workaround is mentioned on the bug report.
3) The UI rendering won't update while your app is paused in the debugger, it'll update on the next mainloop iteration.
4) Nope.
5) The class accessibility should be controlled by the user class part, not the designer class part, so you can freely change it.

Generate code for core data attributes in xcode 4

In xcode 3 there was a helpful feature in the data model builder where you could highlight some attributes/relationships in an entity, right-click, and choose to copy method and property declarations to the clipboard. (You could choose if you wanted objective-c 2.0 property declarations also). Then you could paste them into your NSManagedObject subclass.
I see how you can still generate the entire class file; but this isn't helpful if you are adding attributes to an existing entity. Have they removed this feature from xcode 4? I used it all the time!
See the Core Data Model Editor Help: Creating Objective-C Accessor Methods for a Managed Object
You may find MoGenerator useful.
Watch out for the fact that the special paste menu item only appears in the Edit menu not the contextual menu in the source editor.

Resources