Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to PrimeFaces 8 #6634

Closed
mheppler opened this issue Feb 10, 2020 · 7 comments · Fixed by #6804
Closed

Upgrade to PrimeFaces 8 #6634

mheppler opened this issue Feb 10, 2020 · 7 comments · Fixed by #6804
Assignees
Labels
Component: Code Infrastructure formerly "Feature: Code Infrastructure"
Milestone

Comments

@mheppler
Copy link
Contributor

mheppler commented Feb 10, 2020

When it's available, we should upgrade. Have not seen any updates from PrimeFaces.

Blocked/related(?) issues:

More details on the changes from 7.0 in the Migration Guide.

7.0 to 8.0

Breaking Changes

  • PrimeFaces is now only compatible with Java8+
  • Removed long time deprecated image attribute on buttons
  • Facelet function p:component has been removed in favor of: p:resolveFirstComponentWithId('myId', view).clientId
  • Facelet function p:widgetVar have been removed in favor of: p:resolveWidgetVar('myTable', view)
  • StreamedContent API
    • DefaultStreamedContent: Constructors and setters have been deprecated in favor of DefaultStreamedContent.Builder
    • ByteArrayContent has been removed in favor of DefaultStreamedContent.Builder#stream(() -> new ByteArrayInputStream(...))
    • LazyDefaultStreamedContent has been removed, instead use DefaultStreamedContent with a Supplier which will always "lazy-creates" the InputStream: DefaultStreamedContent.Builder#stream(() -> new FileInputStream(...))
  • DataTable
    • Methods PrimeFaces#clearTableStates() and PrimeFaces#clearDataListStates() have been deprecated in favor of PrimeFaces#multiViewState()
    • DataTable: getFilters / setFilters has been removed in favor of getFilterBy / setFilterBy
    • LazyDataModel#load signatures has been changed; sortBy is now a Map instead of List, filterBy Map value is now a FilterMeta object instead the filter value. Please note that there is a change between 8.0RC1 and 8.0RC2.
  • Menu
    • DynamicMenuModel has been removed, use BaseMenuModel instead.
  • FileUpload API
    • Models have been moved from org.primefaces.model to org.primefaces.model.file
    • UploadedFile#getContents has been renamed to getContent
    • UploadedFile#getInputstream has been renamed to getInputStream
    • FileUpload#fileUploadListener has been renamed into listener
    • In case of using multiple feature in a simple mode, use UploadedFiles model to get all files in a single request.
  • DataExporter API
    • org.primefaces.component.export.Exporter interface allows you to implement your own exporter using exporter attribute
    • Removal of repeat attribute: used as a workaround in case of tables contained in an iterator component (e.g ui:repeat, p:tabView etc.). No longer necessary, instead, define every ids component you wish to export (without specifying component index)
    • Apache POI minimum version 4.1.1 to use Excel export
  • TextEditor for security reasons (TextEditor: SONATYPE-2018-0365 Issue primefaces/primefaces#5163) now requires the OWASP Sanitizer library by default but you can choose to opt-out of using the library by setting the attribute secure="false".
  • InputMask for security reasons (Add validateMask attribute to InputMask primefaces/primefaces#5105) validates the mask used on the server side. If you would like to disable that set validateMask="false". Especially if you use a custom mask with $.mask.definitions for example: InputMask: lack of user input validation primefaces/primefaces#3234 (comment)
  • p:watermarkhas been reimplemented with a simple HTML placeholder attribute. Therefore PrimeFaces.cleanWatermarks() and PrimeFaces.showWatermarks() has been removed.
  • InputNumber: upgraded using Autonumeric
    • emptyValue: sign is now always
    • symbolPosition: prefix is now p, suffix is now s
    • decimalPlaces: now defaults to 2
  • TimeLine: updated to the newest vis timeline version.
    • TimelineEvent uses java.time.LocalDateTime instead of java.util.Date
    • TimelineEvent has now 3 more properties to fine tunning editable: editableTime, editableGroup and editableRemove.
    • TimelineGroup has now styleClass property similar to the one in TimelineEvent.
    • Properties deprecated in favor of others: axisOnTop, groupsChangeable, groupsWidth, groupMinHeight, snapEvents, timeChangeable.
    • Properties deprecated with NO replacement: dragAreaWith (use css classes instead), unselectable, groupsOnRight, animate, animateZoom, showButtonNew, showNavigation, browserTimeZone.
    • New properties: maxHeight, orientationAxis, orientationItem, editableAdd, editableTime, editableGroup, editableRemove, editableOverrideItems, eventHorizontalMargin, eventVerticalMargin, groupStyle, snap, clickToUse, clientTimeZone.
    • New extender property to specify a javascript function to extend configuration of vis.js timeline component similar to extender property in <p:chart /> component.
  • Schedule upgraded to FullCalendar 4.x
    • ScheduleEvent uses java.time.LocalDateTime instead of java.util.Date
    • Removed deprecated attributes
    • Localization comes with FullCalendar: does not require/use PF-localization
    • New view names (dayGridMonth, dayGridWeek, dayGridDay, timeGridWeek, timeGridDay, listYear, listMonth, listWeek, listDay): old ones are translated by Schedule component
    • ScheduleEntryMoveEvent: new properties yearDelta and monthDelta
    • ScheduleEntryResizeEvent: new properties yearDelta and monthDelta: splitted properties between start and end (up to PF 7.0 only end)
    • Property slotLabelFormat was removed (only available in commercial version of FullCalendar - see https://fullcalendar.io/docs/slotLabelFormat)
    • ScheduleEvent: new properties groupId and overlapAllowed
  • Calendar and DatePicker: Without a value-binding it converts OOTB to java java.time.LocalDate. (up to PrimeFaces 7.0: java.util.Date) This may be relevant when you use Calendar or DatePicker as a filter for eg DataTable. You can add something like <f:convertDateTime type="date" /> to your Calendar or DatePicker to get a java.util.Date.

Others

  • Fluent builders
    • Menu: instanciate menu items using builders (e.g DefaultMenuItem#builder())
    • Timeline: instanciate timeline events using builders (e.g TimelineEvent#builder())
    • Schedule: instanciate schedule events using builders (e.g DefaultScheduleEvent#builder())
    • DefaultStreamedContent: instanciate DefaultStreamedContent using builders (e.g DefaultStreamedContent#builder())
    • All constructors with arguments are deprecated
  • Calendar and DatePicker offer built-in support for java.time.LocalDate, java.time.LocalDateTime and java.time.LocalTime (no converter needed anymore)
  • Many events (eg SelectEvent, UnselectEvent, RowEditEvent, etc.) now use generics
  • Cropper: change libraries from JCrop to Cropper.js
  • PanelGrid: new layout="flex" based on PrimeFlex/FlexGrid
  • Menu
    • MenuModel#addElement() has been deprecated, add element using MenuModel#getElements()#add() instead.
@djbrooke
Copy link
Contributor

  • We expect this will be available on Monday
  • We can decide whether or not to test this with a pre-release candidate (and get started earlier) or the official release.
  • The release notes indicate that there are not major/concerning changes

@mheppler
Copy link
Contributor Author

mheppler commented Feb 27, 2020

After our discussion in sprint planning, I went and dug up the PrimeFaces 8 breaking changes outline that I saw on GitHub and add it to my original comment on the issue. Nothing too major. I searched the project for some of the changes, org.primefaces.model, fileUploadListener and p:watermark are some of the changes I discovered the most instances of in my brief investigation.

@scolapasta
Copy link
Contributor

OK, after switching PrimeFaces from 7.0 to 8.0 in the pom.xml, the code would not compile successfully.

I was able to get it to compile by making 3 changes in our code:

• References to org.primefaces.model.UploadedFile became org.primefaces.model.file.UploadedFile and called on that class to getInputstream became getInputStream (note the captial "S")
• Removed references to import org.primefaces.json.*; (all of which where unused imports)
• LazyFileMetadataDataModel load method changed the filters parameter from type Map<String, Object> to Map<String, FilterMeta>

(the 2nd one is not mentioned above in the migration guide, but like I noted, they were all unused imports anyway)

Now, we can test to see if there are any functional changes that occur from PF 8.

@scolapasta
Copy link
Contributor

Some quick testing - crated a user, dataverse, datset - all worked as expected.

However, attempting to add a file did not. It went through the upload, but then did not add it to the list.

@mheppler
Copy link
Contributor Author

@scolapasta I didn't get as far as a successful deploy when I quickly tried to start a PrimeFaces 8 branch after it was released. Did you catch all the "models have been moved from org.primefaces.model to org.primefaces.model.file"? That was not outlined in your code changes.

There are a lot (11 by searching the project in NetBeans) of those references to change. There are also 8 references to fileUploadListener that need to change and 12 getContents (although I am not sure all of those relate to file upload).

@scolapasta
Copy link
Contributor

OK, issue with file was that there was an xhtml change need as well - replacing fileUploadListener attribute with listener (thanks @mheppler and @landreev). With that changed, files can be uploaded.

@sekmiller sekmiller self-assigned this Mar 30, 2020
@mheppler
Copy link
Contributor Author

mheppler commented Mar 31, 2020

Found UI issues, confirmed in all browsers or otherwise noted:

Dialog ui-block layering issue

  • Preview guestbook, terms tab of dataset pg (see screenshot)
  • thumbnail selection on edit dataset thumnail pg
  • thumbnail remove on edit dataset thumnail pg

Example screenshot...

Screen Shot 2020-03-31 at 10 46 48 AM

@djbrooke djbrooke added this to the Dataverse 5 milestone Apr 2, 2020
sekmiller added a commit that referenced this issue Apr 9, 2020
sekmiller added a commit that referenced this issue Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Code Infrastructure formerly "Feature: Code Infrastructure"
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants