├── .gitignore
├── src
└── main
│ ├── resources
│ ├── ValidationMessages.properties
│ ├── messages_tr.properties
│ ├── chapter7
│ │ ├── PFSamplePDF.pdf
│ │ ├── primefaces.jpg
│ │ └── sample_iTunes.mov
│ ├── ehcache.xml
│ └── messages_en.properties
│ ├── webapp
│ ├── resources
│ │ ├── css
│ │ │ ├── chapter6
│ │ │ │ └── panelMenu.css
│ │ │ ├── chapter1
│ │ │ │ ├── resourceLast.css
│ │ │ │ └── resourceMiddle.css
│ │ │ ├── chapter8
│ │ │ │ ├── integrationDragDrop.css
│ │ │ │ ├── droppable.css
│ │ │ │ ├── ajaxDragDrop.css
│ │ │ │ └── draggable.css
│ │ │ ├── chapter2
│ │ │ │ ├── customStyles.css
│ │ │ │ └── customInputStyles.css
│ │ │ └── layout.css
│ │ ├── images
│ │ │ ├── logo.png
│ │ │ ├── colors.gif
│ │ │ ├── ajax-loader.gif
│ │ │ ├── dragdrop
│ │ │ │ ├── dvi.png
│ │ │ │ ├── mid.png
│ │ │ │ ├── mp3.png
│ │ │ │ ├── ppt.png
│ │ │ │ ├── swf.png
│ │ │ │ ├── wav.png
│ │ │ │ ├── xls.png
│ │ │ │ ├── xml.png
│ │ │ │ ├── perl.png
│ │ │ │ ├── pizza1.png
│ │ │ │ ├── pizza2.png
│ │ │ │ ├── pizza3.png
│ │ │ │ ├── pizza4.png
│ │ │ │ └── pizza5.png
│ │ │ ├── export
│ │ │ │ ├── csv.png
│ │ │ │ ├── excel.png
│ │ │ │ ├── pdf.png
│ │ │ │ └── xml.png
│ │ │ ├── inplace
│ │ │ │ ├── true.png
│ │ │ │ └── false.png
│ │ │ ├── themes
│ │ │ │ ├── cruze.png
│ │ │ │ ├── delta.png
│ │ │ │ ├── flick.png
│ │ │ │ ├── home.png
│ │ │ │ ├── sam.png
│ │ │ │ ├── start.png
│ │ │ │ ├── sunny.png
│ │ │ │ ├── vader.png
│ │ │ │ ├── aristo.png
│ │ │ │ ├── blitzer.png
│ │ │ │ ├── bluesky.png
│ │ │ │ ├── dot-luv.png
│ │ │ │ ├── glass-x.png
│ │ │ │ ├── le-frog.png
│ │ │ │ ├── redmond.png
│ │ │ │ ├── rocket.png
│ │ │ │ ├── afterdark.png
│ │ │ │ ├── afternoon.png
│ │ │ │ ├── afterwork.png
│ │ │ │ ├── black-tie.png
│ │ │ │ ├── bootstrap.png
│ │ │ │ ├── casablanca.png
│ │ │ │ ├── cupertino.png
│ │ │ │ ├── dark-hive.png
│ │ │ │ ├── eggplant.png
│ │ │ │ ├── hot-sneaks.png
│ │ │ │ ├── humanity.png
│ │ │ │ ├── midnight.png
│ │ │ │ ├── mint-choc.png
│ │ │ │ ├── overcast.png
│ │ │ │ ├── smoothness.png
│ │ │ │ ├── trontastic.png
│ │ │ │ ├── excite-bike.png
│ │ │ │ ├── south-street.png
│ │ │ │ ├── swanky-purse.png
│ │ │ │ ├── ui-darkness.png
│ │ │ │ ├── ui-lightness.png
│ │ │ │ └── pepper-grinder.png
│ │ │ ├── map
│ │ │ │ └── bosphorus.jpg
│ │ │ ├── autocomplete
│ │ │ │ ├── CC.png
│ │ │ │ ├── Golf.png
│ │ │ │ ├── Polo.png
│ │ │ │ ├── Jetta.png
│ │ │ │ ├── Passat.png
│ │ │ │ ├── Scirocco.png
│ │ │ │ └── Touareg.png
│ │ │ ├── crop
│ │ │ │ └── primefaces.jpg
│ │ │ └── download
│ │ │ │ └── fileDownload.png
│ │ ├── media
│ │ │ ├── PFSamplePDF.pdf
│ │ │ └── sample_iTunes.mov
│ │ └── js
│ │ │ ├── chapter10
│ │ │ ├── validators.js
│ │ │ └── lang_en.js
│ │ │ ├── chapter1
│ │ │ └── calendarLocalization.js
│ │ │ └── chapter8
│ │ │ └── dragDrop.js
│ ├── WEB-INF
│ │ ├── jboss-web.xml
│ │ ├── beans.xml
│ │ ├── cookbook.taglib.xml
│ │ └── faces-config.xml
│ ├── index.html
│ └── views
│ │ ├── home.xhtml
│ │ ├── chapter1
│ │ ├── yourFirstPage.xhtml
│ │ ├── internationalization.xhtml
│ │ ├── componentInDifferentNamingContainer.xhtml
│ │ ├── basicPPR.xhtml
│ │ ├── rightToLeft.xhtml
│ │ ├── localizationWithResources.xhtml
│ │ ├── resourceOrdering.xhtml
│ │ ├── partialSubmit.xhtml
│ │ ├── partialProcessing.xhtml
│ │ └── fragment.xhtml
│ │ ├── chapter6
│ │ ├── programmaticMenu.xhtml
│ │ ├── menuButton.xhtml
│ │ ├── tieredMenu.xhtml
│ │ ├── contextMenuIntegration.xhtml
│ │ ├── megaMenu.xhtml
│ │ ├── contextMenu.xhtml
│ │ ├── tieredMenuStructure.xhtml
│ │ ├── breadcrumb.xhtml
│ │ └── checkboxMenu.xhtml
│ │ ├── chapter2
│ │ ├── statelessThemeSwitcher.xhtml
│ │ ├── formElements.xhtml
│ │ ├── customThemeStyles.xhtml
│ │ ├── statefulThemeSwitcher.xhtml
│ │ ├── fontAwesome.xhtml
│ │ └── customInputStyles.xhtml
│ │ ├── chapter7
│ │ ├── fileUploadSizeLimit.xhtml
│ │ ├── dynaImage.xhtml
│ │ ├── fileUploadFiltering.xhtml
│ │ ├── fileUploadMultiple.xhtml
│ │ ├── multipleFileUploadInOneForm.xhtml
│ │ ├── fileUploadDND.xhtml
│ │ ├── captureImage.xhtml
│ │ ├── fileUpload.xhtml
│ │ ├── fileUploadCallback.xhtml
│ │ ├── media.xhtml
│ │ └── fileDownload.xhtml
│ │ ├── chapter9
│ │ ├── combinedChart.xhtml
│ │ ├── pollingChart.xhtml
│ │ ├── chartInteraction.xhtml
│ │ ├── map.xhtml
│ │ ├── chart.xhtml
│ │ ├── mapInfoView.xhtml
│ │ ├── mapDrawings.xhtml
│ │ └── mapMarkers.xhtml
│ │ ├── chapter11
│ │ ├── errors
│ │ │ ├── viewExpired.xhtml
│ │ │ ├── illegalState.xhtml
│ │ │ └── throwable.xhtml
│ │ ├── bookRating.xhtml
│ │ ├── caching.xhtml
│ │ ├── sticking.xhtml
│ │ ├── focusManagement.xhtml
│ │ ├── dataTableColoring.xhtml
│ │ ├── ajaxCallbacks.xhtml
│ │ ├── dialogFramework.xhtml
│ │ ├── polling.xhtml
│ │ └── targetableMessages.xhtml
│ │ ├── chapter8
│ │ ├── droppable.xhtml
│ │ ├── advancedDraggable.xhtml
│ │ ├── draggable.xhtml
│ │ └── snapping.xhtml
│ │ ├── chapter5
│ │ ├── dataScroller.xhtml
│ │ └── dataTableLazyDataModel.xhtml
│ │ ├── chapter10
│ │ ├── instantCsv.xhtml
│ │ ├── extendJsfCsv.xhtml
│ │ └── extendBvCsv.xhtml
│ │ ├── chapter3
│ │ ├── rating.xhtml
│ │ └── editor.xhtml
│ │ └── chapter4
│ │ ├── scrollPanel.xhtml
│ │ ├── toolbar.xhtml
│ │ ├── gridCSSNested.xhtml
│ │ ├── nestedLayout.xhtml
│ │ └── gridCSS.xhtml
│ └── java
│ └── org
│ └── primefaces
│ └── cookbook
│ ├── validator
│ ├── UnicodeValidator.java
│ ├── CvcConstraintValidator.java
│ ├── ValidCVC.java
│ ├── CvcClientConstraint.java
│ └── RequiredCheckboxValidator.java
│ ├── controller
│ ├── chapter6
│ │ ├── MenuButtonBean.java
│ │ ├── PanelMenuBean.java
│ │ ├── SlideMenuBean.java
│ │ ├── TieredMenuBean.java
│ │ ├── PositionedMenuBean.java
│ │ ├── MegaMenuBean.java
│ │ └── BaseMenuBean.java
│ ├── chapter3
│ │ ├── EditorBean.java
│ │ ├── PasswordBean.java
│ │ ├── InplaceBean.java
│ │ ├── RatingBean.java
│ │ ├── SpinnerBean.java
│ │ ├── CalendarBean.java
│ │ ├── InputMaskBean.java
│ │ ├── SelectCheckboxBean.java
│ │ ├── InputTextAreaBean.java
│ │ ├── SelectOneMenuBean.java
│ │ └── SliderBean.java
│ ├── chapter7
│ │ ├── GalleriaBean.java
│ │ ├── ImageSwitchBean.java
│ │ ├── DynaImageBean.java
│ │ ├── MediaBean.java
│ │ ├── ContentFlowBean.java
│ │ ├── PhotoCamBean.java
│ │ └── FileBean.java
│ ├── chapter4
│ │ ├── ScrollPanelBean.java
│ │ ├── PanelBean.java
│ │ ├── TabViewBean.java
│ │ ├── AccordionPanelBean.java
│ │ ├── LayoutBean.java
│ │ └── DashboardBean.java
│ ├── chapter5
│ │ ├── DataScrollerBean.java
│ │ ├── DataListBean.java
│ │ ├── OrderListBean.java
│ │ ├── DataExportBean.java
│ │ └── LazyDataTableBean.java
│ ├── chapter1
│ │ ├── BasicPPRBean.java
│ │ ├── LocalizationBean.java
│ │ └── FragmentBean.java
│ ├── chapter11
│ │ ├── BookRatingBean.java
│ │ ├── ExceptionHandlerBean.java
│ │ ├── PollingBean.java
│ │ ├── DefaultCommandBean.java
│ │ ├── DataTableColoringBean.java
│ │ ├── RequestContextBean.java
│ │ ├── JavaScriptExecBean.java
│ │ ├── AjaxCallbackParamBean.java
│ │ ├── TargetableMessagesBean.java
│ │ └── DialogFrameworkBean.java
│ ├── chapter10
│ │ ├── InstantCsvBean.java
│ │ ├── ExtendCsvBean.java
│ │ └── BasicCsvBean.java
│ └── chapter2
│ │ └── TreeBean.java
│ ├── model
│ ├── BookTreeNode.java
│ ├── chapter2
│ │ └── Theme.java
│ ├── chapter3
│ │ └── Car.java
│ ├── chapter11
│ │ └── CountryGdp.java
│ ├── chapter5
│ │ ├── CarDataModel.java
│ │ ├── Stat.java
│ │ ├── TreeTableElement.java
│ │ ├── Boxer.java
│ │ └── DetailedCar.java
│ └── chapter8
│ │ └── Document.java
│ ├── utils
│ └── FacesUtil.java
│ └── converter
│ ├── ThemeConverter.java
│ ├── CarConverter.java
│ └── DetailedCarConverter.java
└── .travis.yml
/.gitignore:
--------------------------------------------------------------------------------
1 | .*
2 | target
3 | *.?ar
4 | *.iml
5 | *.ipr
6 | *.iws
7 | *.NavData
8 | *.navData
--------------------------------------------------------------------------------
/src/main/resources/ValidationMessages.properties:
--------------------------------------------------------------------------------
1 | invalid.cvc.message=Card Validation Code is invalid
--------------------------------------------------------------------------------
/src/main/webapp/resources/css/chapter6/panelMenu.css:
--------------------------------------------------------------------------------
1 | .ui-panelmenu h3 {
2 | font-size: 1em;
3 | }
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 |
3 | jdk:
4 | - oraclejdk7
5 |
6 | notifications:
7 | email: true
--------------------------------------------------------------------------------
/src/main/resources/messages_tr.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/resources/messages_tr.properties
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/logo.png
--------------------------------------------------------------------------------
/src/main/resources/chapter7/PFSamplePDF.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/resources/chapter7/PFSamplePDF.pdf
--------------------------------------------------------------------------------
/src/main/resources/chapter7/primefaces.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/resources/chapter7/primefaces.jpg
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/colors.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/colors.gif
--------------------------------------------------------------------------------
/src/main/resources/chapter7/sample_iTunes.mov:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/resources/chapter7/sample_iTunes.mov
--------------------------------------------------------------------------------
/src/main/webapp/resources/css/chapter1/resourceLast.css:
--------------------------------------------------------------------------------
1 | #myDiv {
2 | border: 10px solid;
3 | font-size: 50px;
4 | text-align: center;
5 | }
--------------------------------------------------------------------------------
/src/main/webapp/resources/css/chapter1/resourceMiddle.css:
--------------------------------------------------------------------------------
1 | #myDiv {
2 | border: 1px solid;
3 | font-size: 5px;
4 | text-align: center;
5 | }
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/ajax-loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/ajax-loader.gif
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/dvi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/dvi.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/mid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/mid.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/mp3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/mp3.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/ppt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/ppt.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/swf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/swf.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/wav.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/wav.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/xls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/xls.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/xml.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/xml.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/export/csv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/export/csv.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/export/excel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/export/excel.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/export/pdf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/export/pdf.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/export/xml.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/export/xml.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/inplace/true.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/inplace/true.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/cruze.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/cruze.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/delta.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/delta.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/flick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/flick.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/home.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/sam.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/sam.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/start.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/sunny.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/sunny.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/vader.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/vader.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/media/PFSamplePDF.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/media/PFSamplePDF.pdf
--------------------------------------------------------------------------------
/src/main/webapp/resources/media/sample_iTunes.mov:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/media/sample_iTunes.mov
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/perl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/perl.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/inplace/false.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/inplace/false.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/map/bosphorus.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/map/bosphorus.jpg
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/aristo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/aristo.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/blitzer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/blitzer.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/bluesky.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/bluesky.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/dot-luv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/dot-luv.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/glass-x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/glass-x.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/le-frog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/le-frog.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/redmond.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/redmond.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/rocket.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/rocket.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/autocomplete/CC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/autocomplete/CC.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/autocomplete/Golf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/autocomplete/Golf.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/autocomplete/Polo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/autocomplete/Polo.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/crop/primefaces.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/crop/primefaces.jpg
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/pizza1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/pizza1.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/pizza2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/pizza2.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/pizza3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/pizza3.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/pizza4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/pizza4.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/dragdrop/pizza5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/dragdrop/pizza5.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/afterdark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/afterdark.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/afternoon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/afternoon.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/afterwork.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/afterwork.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/black-tie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/black-tie.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/bootstrap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/bootstrap.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/casablanca.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/casablanca.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/cupertino.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/cupertino.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/dark-hive.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/dark-hive.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/eggplant.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/eggplant.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/hot-sneaks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/hot-sneaks.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/humanity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/humanity.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/midnight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/midnight.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/mint-choc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/mint-choc.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/overcast.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/overcast.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/smoothness.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/smoothness.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/trontastic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/trontastic.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/js/chapter10/validators.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/js/chapter10/validators.js
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/autocomplete/Jetta.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/autocomplete/Jetta.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/autocomplete/Passat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/autocomplete/Passat.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/excite-bike.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/excite-bike.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/south-street.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/south-street.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/swanky-purse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/swanky-purse.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/ui-darkness.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/ui-darkness.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/ui-lightness.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/ui-lightness.png
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/jboss-web.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | pf-cookbook
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/autocomplete/Scirocco.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/autocomplete/Scirocco.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/autocomplete/Touareg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/autocomplete/Touareg.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/download/fileDownload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/download/fileDownload.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/images/themes/pepper-grinder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/images/themes/pepper-grinder.png
--------------------------------------------------------------------------------
/src/main/webapp/resources/js/chapter1/calendarLocalization.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/webapp/resources/js/chapter1/calendarLocalization.js
--------------------------------------------------------------------------------
/src/main/webapp/resources/js/chapter8/dragDrop.js:
--------------------------------------------------------------------------------
1 | function handleDrop(event, ui) {
2 | $(event.target).addClass("ui-state-highlight").
3 | find("p").html("Dropped!");
4 | }
--------------------------------------------------------------------------------
/src/main/webapp/resources/css/chapter8/integrationDragDrop.css:
--------------------------------------------------------------------------------
1 | .ui-panel .ui-panel-titlebar {
2 | cursor: move;
3 | }
4 |
5 | .ui-panel .ui-panel-content {
6 | padding-bottom: 0;
7 | }
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/validator/UnicodeValidator.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ova2/primefaces-cookbook/HEAD/src/main/java/org/primefaces/cookbook/validator/UnicodeValidator.java
--------------------------------------------------------------------------------
/src/main/webapp/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/main/webapp/views/home.xhtml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/src/main/webapp/resources/css/chapter2/customStyles.css:
--------------------------------------------------------------------------------
1 | .customStyles .ui-selectonemenu {
2 | width: 157px !important;
3 | }
4 |
5 | .customStyles .ui-selectonemenu .ui-selectonemenu-label {
6 | width: 130px !important;
7 | }
8 |
9 | .customStyles .ui-tree {
10 | border: none;
11 | background: none;
12 | }
--------------------------------------------------------------------------------
/src/main/webapp/resources/css/chapter8/droppable.css:
--------------------------------------------------------------------------------
1 | .dragDiv {
2 | width: 150px;
3 | height: 60px;
4 | padding: 5px;
5 | margin: 0;
6 | }
7 |
8 | .dropTarget {
9 | height: 120px;
10 | width: 200px;
11 | margin: 0;
12 | }
13 |
14 | .dropTarget > p {
15 | margin: 0;
16 | padding: 5px;
17 | }
--------------------------------------------------------------------------------
/src/main/webapp/resources/css/chapter8/ajaxDragDrop.css:
--------------------------------------------------------------------------------
1 | .col1, .col2, .col3 {
2 | vertical-align: top;
3 | }
4 |
5 | .col2 {
6 | padding-left: 50px;
7 | }
8 |
9 | .text {
10 | font-weight: bold;
11 | padding: 2px 0 2px 0;
12 | }
13 |
14 | .ui-datalist-content ul {
15 | list-style-type: none;
16 | }
17 |
18 | #selectPizza img,
19 | #orderedPizza ul li {
20 | cursor: move;
21 | }
--------------------------------------------------------------------------------
/src/main/webapp/resources/css/chapter8/draggable.css:
--------------------------------------------------------------------------------
1 | .ui-panel {
2 | margin-bottom: 15px;
3 | width: 300px;
4 | }
5 |
6 | .dragContainer {
7 | width: 400px;
8 | height: 200px;
9 | text-align: center;
10 | margin-top: 10px;
11 | }
12 |
13 | .dragSnap {
14 | width: 150px;
15 | height: 60px;
16 | margin-top: 15px;
17 | margin-right: 5px;
18 | padding: 5px;
19 | }
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter6/MenuButtonBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter6;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 |
6 | /**
7 | * MenuButtonBean
8 | *
9 | * @author Oleg Varaksin / last modified by $Author: $
10 | * @version $Revision: 1.0 $
11 | */
12 | @Named
13 | @ViewScoped
14 | public class MenuButtonBean extends BaseMenuBean {
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter6/PanelMenuBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter6;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 |
6 | /**
7 | * PanelMenuBean
8 | *
9 | * @author Oleg Varaksin / last modified by $Author: $
10 | * @version $Revision: 1.0 $
11 | */
12 | @Named
13 | @ViewScoped
14 | public class PanelMenuBean extends BaseMenuBean {
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter6/SlideMenuBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter6;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 |
6 | /**
7 | * SlideMenuBean
8 | *
9 | * @author Oleg Varaksin / last modified by $Author: $
10 | * @version $Revision: 1.0 $
11 | */
12 | @Named
13 | @ViewScoped
14 | public class SlideMenuBean extends BaseMenuBean {
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter6/TieredMenuBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter6;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 |
6 | /**
7 | * TieredMenuBean
8 | *
9 | * @author Oleg Varaksin / last modified by $Author: $
10 | * @version $Revision: 1.0 $
11 | */
12 | @Named
13 | @ViewScoped
14 | public class TieredMenuBean extends BaseMenuBean {
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter6/PositionedMenuBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter6;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 |
6 | /**
7 | * PositionedMenuBean
8 | *
9 | * @author Oleg Varaksin / last modified by $Author: $
10 | * @version $Revision: 1.0 $
11 | */
12 | @Named
13 | @ViewScoped
14 | public class PositionedMenuBean extends BaseMenuBean {
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter1/yourFirstPage.xhtml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter6/MegaMenuBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter6;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 | import java.io.Serializable;
6 |
7 | /**
8 | * MegaMenuBean
9 | *
10 | * @author Oleg Varaksin / last modified by $Author: $
11 | * @version $Revision: 1.0 $
12 | */
13 | @Named
14 | @ViewScoped
15 | public class MegaMenuBean implements Serializable {
16 |
17 | public String getItems() {
18 | return "Bought items: ...";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter3/EditorBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter3;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 | import java.io.Serializable;
6 |
7 | /**
8 | * User: mertcaliskan
9 | * Date: 6/30/12
10 | */
11 | @Named
12 | @ViewScoped
13 | public class EditorBean implements Serializable {
14 |
15 | private String text;
16 |
17 | public String getText() {
18 | return text;
19 | }
20 |
21 | public void setText(String text) {
22 | this.text = text;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter1/internationalization.xhtml:
--------------------------------------------------------------------------------
1 |
5 |
6 | Internationalization of the Faces Messages
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter3/PasswordBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter3;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 | import java.io.Serializable;
6 |
7 | /**
8 | * User: mertcaliskan
9 | * Date: 7/19/12
10 | */
11 | @Named
12 | @ViewScoped
13 | public class PasswordBean implements Serializable {
14 |
15 | private String password;
16 |
17 | public String getPassword() {
18 | return password;
19 | }
20 |
21 | public void setPassword(String password) {
22 | this.password = password;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter7/GalleriaBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter7;
2 |
3 | import org.primefaces.cookbook.converter.CarConverter;
4 | import org.primefaces.cookbook.model.chapter3.Car;
5 |
6 | import javax.faces.view.ViewScoped;
7 | import javax.inject.Named;
8 | import java.io.Serializable;
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | /**
13 | * User: mertcaliskan
14 | * Date: 9/11/12
15 | */
16 | @Named
17 | @ViewScoped
18 | public class GalleriaBean implements Serializable {
19 |
20 | public List getCars() {
21 | return new ArrayList(CarConverter.cars.values());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter4/ScrollPanelBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter4;
2 |
3 | import org.primefaces.cookbook.converter.CarConverter;
4 | import org.primefaces.cookbook.model.chapter3.Car;
5 |
6 | import javax.faces.view.ViewScoped;
7 | import javax.inject.Named;
8 | import java.io.Serializable;
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | /**
13 | * User: mertcaliskan
14 | * Date: 7/30/12
15 | */
16 | @Named
17 | @ViewScoped
18 | public class ScrollPanelBean implements Serializable {
19 |
20 | public List getCars() {
21 | return new ArrayList(CarConverter.cars.values());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter7/ImageSwitchBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter7;
2 |
3 | import org.primefaces.cookbook.converter.CarConverter;
4 | import org.primefaces.cookbook.model.chapter3.Car;
5 |
6 | import javax.faces.view.ViewScoped;
7 | import javax.inject.Named;
8 | import java.io.Serializable;
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | /**
13 | * User: mertcaliskan
14 | * Date: 9/11/12
15 | */
16 | @Named
17 | @ViewScoped
18 | public class ImageSwitchBean implements Serializable {
19 |
20 | public List getCars() {
21 | return new ArrayList(CarConverter.cars.values());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter5/DataScrollerBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter5;
2 |
3 | import org.primefaces.cookbook.converter.CarConverter;
4 | import org.primefaces.cookbook.model.chapter3.Car;
5 |
6 | import javax.faces.view.ViewScoped;
7 | import javax.inject.Named;
8 | import java.io.Serializable;
9 | import java.util.ArrayList;
10 | import java.util.Collection;
11 |
12 | /**
13 | * User: mertcaliskan
14 | * Date: 8/21/12
15 | */
16 | @Named
17 | @ViewScoped
18 | public class DataScrollerBean implements Serializable {
19 |
20 | public Collection getCars() {
21 | return new ArrayList(CarConverter.cars.values());
22 | }
23 | }
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter1/componentInDifferentNamingContainer.xhtml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/model/BookTreeNode.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.model;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * BookTreeNode
7 | *
8 | * @author Oleg Varaksin / last modified by $Author: $
9 | * @version $Revision: 1.0 $
10 | */
11 | public class BookTreeNode implements Serializable {
12 |
13 | private static final long serialVersionUID = 20120517L;
14 |
15 | private String name;
16 |
17 | private String view;
18 |
19 | public BookTreeNode(String name, String view) {
20 | this.name = name;
21 | this.view = view;
22 | }
23 |
24 | public String getName() {
25 | return name;
26 | }
27 |
28 | public String getView() {
29 | return view;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter1/basicPPR.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Basic Partial Page Rendering
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/model/chapter2/Theme.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.model.chapter2;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Model class for a theme.
7 | *
8 | * @author Oleg Varaksin / last modified by $Author: $
9 | * @version $Revision: 1.0 $
10 | */
11 | public class Theme implements Serializable {
12 |
13 | private static final long serialVersionUID = 20141005L;
14 |
15 | private String displayName;
16 | private String name;
17 |
18 | public Theme(String displayName, String name) {
19 | this.displayName = displayName;
20 | this.name = name;
21 | }
22 |
23 | public final String getDisplayName() {
24 | return displayName;
25 | }
26 |
27 | public String getName() {
28 | return name;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/validator/CvcConstraintValidator.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.validator;
2 |
3 | import javax.validation.ConstraintValidator;
4 | import javax.validation.ConstraintValidatorContext;
5 |
6 | public class CvcConstraintValidator
7 | implements ConstraintValidator {
8 |
9 | @Override
10 | public void initialize(ValidCVC validCVC) {
11 | }
12 |
13 | @Override
14 | public boolean isValid(Integer cvc,
15 | ConstraintValidatorContext context) {
16 | if (cvc == null || cvc < 0) {
17 | return false;
18 | }
19 |
20 | int length = (int) (Math.log10(cvc) + 1);
21 | return (length >= 3 && length <= 4);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter1/rightToLeft.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Right to left language support
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter6/programmaticMenu.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 | Programmatic menu
10 |
11 |
12 |
13 |
14 |
15 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter2/statelessThemeSwitcher.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 | Stateless Theme Switcher
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter7/fileUploadSizeLimit.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Limiting File Size for File Upload
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter1/BasicPPRBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter1;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 | import java.io.Serializable;
6 |
7 | /**
8 | * @author mertcaliskan Date: 6/18/12 / last modified by $Author: $
9 | * @version $Revision: 1.0 $
10 | */
11 | @Named
12 | @ViewScoped
13 | public class BasicPPRBean implements Serializable {
14 |
15 | private String value;
16 |
17 | public String updateValue() {
18 | value = String.valueOf(System.currentTimeMillis());
19 | return null;
20 | }
21 |
22 | public String getValue() {
23 | return value;
24 | }
25 |
26 | public void setValue(String value) {
27 | this.value = value;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter9/combinedChart.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Interacting with charts via AJAX
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter7/DynaImageBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter7;
2 |
3 | import org.primefaces.model.DefaultStreamedContent;
4 | import org.primefaces.model.StreamedContent;
5 |
6 | import javax.enterprise.context.SessionScoped;
7 | import javax.inject.Named;
8 | import java.io.IOException;
9 | import java.io.InputStream;
10 | import java.io.Serializable;
11 |
12 | /**
13 | * User: mertcaliskan
14 | * Date: 10/18/12
15 | */
16 | @Named
17 | @SessionScoped
18 | public class DynaImageBean implements Serializable {
19 |
20 | public StreamedContent getGraphicText() throws IOException {
21 | InputStream stream = this.getClass().getResourceAsStream("/chapter7/primefaces.jpg");
22 | return new DefaultStreamedContent(stream);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter1/LocalizationBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter1;
2 |
3 | import org.primefaces.cookbook.utils.MessageUtil;
4 |
5 | import javax.faces.view.ViewScoped;
6 | import javax.inject.Named;
7 | import java.io.Serializable;
8 |
9 | /**
10 | * User: mertcaliskan
11 | * Date: 6/21/12
12 | */
13 | @Named
14 | @ViewScoped
15 | public class LocalizationBean implements Serializable {
16 |
17 | private boolean selectedValue = true;
18 |
19 | public boolean isSelectedValue() {
20 | return selectedValue;
21 | }
22 |
23 | public void setSelectedValue(boolean selectedValue) {
24 | this.selectedValue = selectedValue;
25 | }
26 |
27 | public String addMessage() {
28 | MessageUtil.addInfoMessage("broadcast.message");
29 |
30 | return null;
31 | }
32 | }
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter7/dynaImage.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 | Creating dynamic image streaming programmatically
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter7/MediaBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter7;
2 |
3 | import org.primefaces.model.DefaultStreamedContent;
4 | import org.primefaces.model.StreamedContent;
5 |
6 | import javax.enterprise.context.SessionScoped;
7 | import javax.inject.Named;
8 | import java.io.IOException;
9 | import java.io.InputStream;
10 | import java.io.Serializable;
11 |
12 | /**
13 | * Created by mertcaliskan
14 | * on 26/01/15.
15 | */
16 | @Named
17 | @SessionScoped
18 | public class MediaBean implements Serializable {
19 |
20 | public StreamedContent getMedia() throws IOException {
21 | InputStream stream = this.getClass().getResourceAsStream("/chapter7/sample_iTunes.mov");
22 | return new DefaultStreamedContent(stream, "video/quicktime");
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/webapp/resources/js/chapter10/lang_en.js:
--------------------------------------------------------------------------------
1 | PrimeFaces.locales['en'] = {
2 | messages : PrimeFaces.locales['en_US'].messages
3 | };
4 |
5 | $.extend(PrimeFaces.locales['en'].messages, {
6 | 'javax.faces.component.UIInput.REQUIRED':
7 | '{0}: Value is required.',
8 | 'javax.faces.validator.LengthValidator.MINIMUM':
9 | '{1}: Length is less than allowable minimum of \'{0}\'',
10 | 'javax.faces.validator.LengthValidator.MAXIMUM':
11 | '{1}: Length is greater than allowable maximum of \'{0}\'',
12 | 'javax.faces.validator.RegexValidator.NOT_MATCHED':
13 | 'Value does not match regex pattern {0}',
14 |
15 | 'invalid.unicode':
16 | '{0} may only contain letters, spaces, hyphens and apostrophes',
17 | 'invalid.cvc':
18 | 'Card Validation Code is invalid'
19 | });
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter7/fileUploadFiltering.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Filtering File Types for File Upload
8 |
9 |
10 |
11 |
12 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter7/fileUploadMultiple.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Multiple File Upload
8 |
9 |
10 |
11 |
12 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter9/pollingChart.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Updating live data in charts with polling
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/model/chapter3/Car.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.model.chapter3;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * User: mertcaliskan
7 | * Date: 7/9/12
8 | */
9 | public class Car implements Serializable {
10 |
11 | public String name;
12 | public int year;
13 |
14 | public Car(String name, int year) {
15 | this.name = name;
16 | this.year = year;
17 | }
18 |
19 | public String getName() {
20 | return name;
21 | }
22 |
23 | public int getYear() {
24 | return year;
25 | }
26 |
27 | public void setName(String name) {
28 | this.name = name;
29 | }
30 |
31 | public void setYear(int year) {
32 | this.year = year;
33 | }
34 |
35 | @Override
36 | public String toString() {
37 | return getName();
38 | }
39 | }
--------------------------------------------------------------------------------
/src/main/webapp/resources/css/chapter2/customInputStyles.css:
--------------------------------------------------------------------------------
1 | .customInputStyles .ui-inputfield {
2 | background: #ffffff;
3 | -moz-box-shadow: none;
4 | -webkit-box-shadow: none;
5 | box-shadow: none;
6 | color: #000000;
7 | }
8 |
9 | .customInputStyles .ui-inputfield.ui-state-focus {
10 | -moz-box-shadow: none;
11 | -webkit-box-shadow: none;
12 | box-shadow: none;
13 | }
14 |
15 | .customInputStyles .ui-inputfield.ui-state-default {
16 | background: none;
17 | border: 1px inset;
18 | }
19 |
20 | .customInputStyles .ui-inputfield.ui-state-disabled,
21 | .customInputStyles .ui-state-disabled .ui-inputfield {
22 | background-color: #8F8F8F;
23 | border: solid 1px gray;
24 | }
25 |
26 | .customInputStyles .ui-inputfield.ui-state-error,
27 | .customInputStyles .ui-state-error .ui-inputfield {
28 | background-color: #F43939;
29 | }
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter7/multipleFileUploadInOneForm.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Basic File Upload
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter11/BookRatingBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter11;
2 |
3 | import org.primefaces.context.RequestContext;
4 | import org.primefaces.event.RateEvent;
5 |
6 | import javax.enterprise.context.RequestScoped;
7 | import javax.inject.Named;
8 |
9 | @Named
10 | @RequestScoped
11 | public class BookRatingBean {
12 |
13 | private String bookName;
14 |
15 | public void onrate(RateEvent rateEvent) {
16 | RequestContext.getCurrentInstance().closeDialog(rateEvent.getRating());
17 | }
18 |
19 | public void oncancel() {
20 | RequestContext.getCurrentInstance().closeDialog(0);
21 | }
22 |
23 | public String getBookName() {
24 | return bookName;
25 | }
26 |
27 | public void setBookName(String bookName) {
28 | this.bookName = bookName;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter4/PanelBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter4;
2 |
3 | import org.primefaces.cookbook.utils.MessageUtil;
4 | import org.primefaces.event.CloseEvent;
5 | import org.primefaces.event.ToggleEvent;
6 |
7 | import javax.faces.view.ViewScoped;
8 | import javax.inject.Named;
9 | import java.io.Serializable;
10 |
11 | /**
12 | * User: mertcaliskan
13 | * Date: 8/4/12
14 | */
15 | @Named
16 | @ViewScoped
17 | public class PanelBean implements Serializable {
18 |
19 | public void handleClose(CloseEvent event) {
20 | MessageUtil.addInfoMessage("panel.closed", "Closed panel id:'" + event.getComponent().getId());
21 | }
22 |
23 | public void handleToggle(ToggleEvent event) {
24 | MessageUtil.addInfoMessage("panel.toggled", "Status:" + event.getVisibility().name());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/model/chapter11/CountryGdp.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.model.chapter11;
2 |
3 | import java.io.Serializable;
4 |
5 | public class CountryGdp implements Serializable {
6 |
7 | // name of the country
8 | private String name;
9 | // gross domestic product (GDP), in millions of US dollars
10 | private long gdp;
11 |
12 | public CountryGdp() {
13 | }
14 |
15 | public CountryGdp(String name, long gdp) {
16 | this.name = name;
17 | this.gdp = gdp;
18 | }
19 |
20 | public String getName() {
21 | return name;
22 | }
23 |
24 | public void setName(String name) {
25 | this.name = name;
26 | }
27 |
28 | public long getGdp() {
29 | return gdp;
30 | }
31 |
32 | public void setGdp(long gdp) {
33 | this.gdp = gdp;
34 | }
35 | }
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter11/ExceptionHandlerBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter11;
2 |
3 | import javax.enterprise.context.RequestScoped;
4 | import javax.faces.application.ViewExpiredException;
5 | import javax.faces.context.FacesContext;
6 | import javax.inject.Named;
7 |
8 | @Named
9 | @RequestScoped
10 | public class ExceptionHandlerBean {
11 |
12 | public void throwNullPointerException() {
13 | throw new NullPointerException("NullPointerException");
14 | }
15 |
16 | public void throwIllegalStateException() {
17 | throw new IllegalStateException("IllegalStateException");
18 | }
19 |
20 | public void throwViewExpiredException() {
21 | throw new ViewExpiredException("ViewExpiredException",
22 | FacesContext.getCurrentInstance().getViewRoot().getViewId());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter7/ContentFlowBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter7;
2 |
3 | import org.primefaces.cookbook.converter.CarConverter;
4 | import org.primefaces.cookbook.model.chapter3.Car;
5 | import org.primefaces.cookbook.utils.MessageUtil;
6 |
7 | import javax.faces.view.ViewScoped;
8 | import javax.inject.Named;
9 | import java.io.Serializable;
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | /**
14 | * Created by mertcaliskan
15 | * on 25/01/15.
16 | */
17 | @Named
18 | @ViewScoped
19 | public class ContentFlowBean implements Serializable {
20 |
21 | public List getCars() {
22 | return new ArrayList(CarConverter.cars.values());
23 | }
24 |
25 | public String showMessage() {
26 | MessageUtil.addInfoMessage("car.selected");
27 | return null;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter1/localizationWithResources.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Localization with Resources
8 |
9 |
10 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/cookbook.taglib.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | http://primefaces.org/ui/cookbook
8 |
9 |
10 | validateUnicode
11 |
12 |
13 | org.primefaces.cookbook.UnicodeValidator
14 |
15 |
16 |
17 | msgparam
18 | true
19 | java.lang.String
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter11/errors/viewExpired.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 | Session expired
12 |
13 |
14 | Message: #{pfExceptionHandler.message}
15 |
16 | Timestamp: #{pfExceptionHandler.formattedTimestamp}
17 |
18 | StackTrace:
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter9/chartInteraction.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Interacting with charts via AJAX
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter11/errors/illegalState.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 | Application state is illegal
12 |
13 |
14 | Message: #{pfExceptionHandler.message}
15 |
16 | Timestamp: #{pfExceptionHandler.formattedTimestamp}
17 |
18 | StackTrace:
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter11/errors/throwable.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 | Oops, an unexpected error occured
12 |
13 |
14 | Message: #{pfExceptionHandler.message}
15 |
16 | Timestamp: #{pfExceptionHandler.formattedTimestamp}
17 |
18 | StackTrace:
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter11/bookRating.xhtml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 | Rate the book!
12 |
13 |
14 |
15 | What is your rating for the book #{bookRatingBean.bookName}?
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter3/InplaceBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter3;
2 |
3 | import org.primefaces.component.layout.LayoutUnit;
4 | import org.primefaces.cookbook.utils.MessageUtil;
5 | import org.primefaces.event.SelectEvent;
6 |
7 | import javax.faces.event.AjaxBehaviorEvent;
8 | import javax.faces.view.ViewScoped;
9 | import javax.inject.Named;
10 | import java.io.Serializable;
11 |
12 | /**
13 | * Created by mertcaliskan
14 | * on 03/01/15.
15 | */
16 | @Named
17 | @ViewScoped
18 | public class InplaceBean implements Serializable {
19 | private boolean value;
20 |
21 | public boolean isValue() {
22 | return value;
23 | }
24 |
25 | public void setValue(boolean value) {
26 | this.value = value;
27 | }
28 |
29 | public void handleSave(AjaxBehaviorEvent event) {
30 | MessageUtil.addInfoMessageWithoutKey("Input Saved!", null);
31 | }
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/model/chapter5/CarDataModel.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.model.chapter5;
2 |
3 | import org.primefaces.cookbook.model.chapter3.Car;
4 | import org.primefaces.model.SelectableDataModel;
5 |
6 | import javax.faces.model.ListDataModel;
7 | import java.util.List;
8 |
9 | /**
10 | * Created by mertcaliskan
11 | * on 02/03/15.
12 | */
13 | public class CarDataModel extends ListDataModel implements SelectableDataModel {
14 |
15 | public CarDataModel(List data) {
16 | super(data);
17 | }
18 |
19 | @Override
20 | public Car getRowData(String rowKey) {
21 | List cars = (List) getWrappedData();
22 |
23 | for(Car car : cars) {
24 | if(car.getName().equals(rowKey))
25 | return car;
26 | }
27 | return null;
28 | }
29 |
30 | @Override
31 | public Object getRowKey(Car car) {
32 | return car.getName();
33 | }
34 | }
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter10/InstantCsvBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter10;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 | import java.io.Serializable;
6 | import java.util.Date;
7 |
8 | @Named
9 | @ViewScoped
10 | public class InstantCsvBean implements Serializable {
11 |
12 | private String value1;
13 | private Integer value2;
14 | private Date value3;
15 |
16 | public String getValue1() {
17 | return value1;
18 | }
19 |
20 | public void setValue1(String value1) {
21 | this.value1 = value1;
22 | }
23 |
24 | public Integer getValue2() {
25 | return value2;
26 | }
27 |
28 | public void setValue2(Integer value2) {
29 | this.value2 = value2;
30 | }
31 |
32 | public Date getValue3() {
33 | return value3;
34 | }
35 |
36 | public void setValue3(Date value3) {
37 | this.value3 = value3;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter2/formElements.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter3/RatingBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter3;
2 |
3 | import org.primefaces.cookbook.utils.MessageUtil;
4 | import org.primefaces.event.RateEvent;
5 |
6 | import javax.faces.view.ViewScoped;
7 | import javax.inject.Named;
8 | import java.io.Serializable;
9 |
10 | /**
11 | * User: mertcaliskan
12 | * Date: 7/23/12
13 | */
14 | @Named
15 | @ViewScoped
16 | public class RatingBean implements Serializable {
17 |
18 | private Integer rate;
19 |
20 | public Integer getRate() {
21 | return rate;
22 | }
23 |
24 | public void setRate(Integer rate) {
25 | this.rate = rate;
26 | }
27 |
28 | public void handleRate(RateEvent rateEvent) {
29 | Integer rate = (Integer) rateEvent.getRating();
30 | MessageUtil.addInfoMessage("rating.selected", rate);
31 | }
32 |
33 | public void cancelRate() {
34 | MessageUtil.addInfoMessage("rating.cancelled");
35 | }
36 | }
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/model/chapter5/Stat.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.model.chapter5;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by mertcaliskan
7 | * on 03/03/15.
8 | */
9 | public class Stat implements Serializable {
10 |
11 | private String match;
12 | private int win;
13 | private int loss;
14 |
15 | public Stat(String match, int win, int loss) {
16 | this.loss = loss;
17 | this.win = win;
18 | this.match = match;
19 | }
20 |
21 | public String getMatch() {
22 | return match;
23 | }
24 |
25 | public void setMatch(String match) {
26 | this.match = match;
27 | }
28 |
29 | public int getWin() {
30 | return win;
31 | }
32 |
33 | public void setWin(int win) {
34 | this.win = win;
35 | }
36 |
37 | public int getLoss() {
38 | return loss;
39 | }
40 |
41 | public void setLoss(int loss) {
42 | this.loss = loss;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/validator/ValidCVC.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.validator;
2 |
3 | import org.primefaces.validate.bean.ClientConstraint;
4 |
5 | import javax.validation.Constraint;
6 | import javax.validation.Payload;
7 | import java.lang.annotation.Retention;
8 | import java.lang.annotation.RetentionPolicy;
9 | import java.lang.annotation.Target;
10 |
11 | import static java.lang.annotation.ElementType.FIELD;
12 | import static java.lang.annotation.ElementType.METHOD;
13 |
14 | @Constraint(validatedBy = CvcConstraintValidator.class)
15 | @ClientConstraint(resolvedBy = CvcClientConstraint.class)
16 | @Target({FIELD, METHOD})
17 | @Retention(RetentionPolicy.RUNTIME)
18 | public @interface ValidCVC {
19 |
20 | String message() default "{invalid.cvc.message}";
21 |
22 | Class>[] groups() default {};
23 |
24 | Class extends Payload>[] payload() default {};
25 |
26 | // identifier of the select menu with cards
27 | String forCardMenu() default "";
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter11/caching.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
13 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter11/sticking.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter11/PollingBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter11;
2 |
3 | import javax.faces.application.FacesMessage;
4 | import javax.faces.context.FacesContext;
5 | import javax.faces.view.ViewScoped;
6 | import javax.inject.Named;
7 | import java.io.Serializable;
8 | import java.text.SimpleDateFormat;
9 | import java.util.Date;
10 |
11 | /**
12 | * PollingBean
13 | *
14 | * @author Oleg Varaksin / last modified by $Author: $
15 | * @version $Revision: 1.0 $
16 | */
17 | @Named
18 | @ViewScoped
19 | public class PollingBean implements Serializable {
20 |
21 | private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("hh:mm:ss");
22 |
23 | public void showMessage() {
24 | FacesMessage msg = new FacesMessage(
25 | FacesMessage.SEVERITY_INFO,
26 | "Updated feed at " + simpleDateFormat.format(new Date()) + " o'clock",
27 | null);
28 | FacesContext.getCurrentInstance().addMessage(null, msg);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter7/fileUploadDND.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | File Uploading with Drag and Drop
8 |
9 |
10 |
11 |
12 |
13 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter1/FragmentBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter1;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 | import java.io.Serializable;
6 |
7 | /**
8 | * Created by mertcaliskan
9 | * on 04/11/14.
10 | */
11 | @Named
12 | @ViewScoped
13 | public class FragmentBean implements Serializable {
14 |
15 | private String userName;
16 |
17 | private String address;
18 |
19 | public void saveUserInfo() {
20 | System.out.println("User Info saved");
21 | }
22 |
23 | public void saveAddressInfo() {
24 | System.out.println("Address Info saved");
25 | }
26 |
27 | public String getUserName() {
28 | return userName;
29 | }
30 |
31 | public void setUserName(String userName) {
32 | this.userName = userName;
33 | }
34 |
35 | public String getAddress() {
36 | return address;
37 | }
38 |
39 | public void setAddress(String address) {
40 | this.address = address;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter7/captureImage.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Capturing Images with PhotoCam
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter7/fileUpload.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Basic File Upload
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter1/resourceOrdering.xhtml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Hi!
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter3/SpinnerBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter3;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 | import java.io.Serializable;
6 |
7 | /**
8 | * User: mertcaliskan
9 | * Date: 7/1/12
10 | */
11 | @Named
12 | @ViewScoped
13 | public class SpinnerBean implements Serializable {
14 |
15 | private int intValue = 0;
16 | private int intValue2 = 0;
17 | private double doubleValue = 0.0;
18 |
19 | public int getIntValue() {
20 | return intValue;
21 | }
22 |
23 | public void setIntValue(int intValue) {
24 | this.intValue = intValue;
25 | }
26 |
27 | public int getIntValue2() {
28 | return intValue2;
29 | }
30 |
31 | public void setIntValue2(int intValue2) {
32 | this.intValue2 = intValue2;
33 | }
34 |
35 | public double getDoubleValue() {
36 | return doubleValue;
37 | }
38 |
39 | public void setDoubleValue(double doubleValue) {
40 | this.doubleValue = doubleValue;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter7/PhotoCamBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter7;
2 |
3 | import org.primefaces.event.CaptureEvent;
4 | import org.primefaces.model.DefaultStreamedContent;
5 | import org.primefaces.model.StreamedContent;
6 |
7 | import javax.enterprise.context.SessionScoped;
8 | import javax.inject.Named;
9 | import java.io.ByteArrayInputStream;
10 | import java.io.Serializable;
11 |
12 | /**
13 | * User: mertcaliskan
14 | * Date: 9/10/12
15 | */
16 | @Named
17 | @SessionScoped
18 | public class PhotoCamBean implements Serializable {
19 |
20 | private StreamedContent capturedImage;
21 |
22 | public StreamedContent getCapturedImage() {
23 | return capturedImage;
24 | }
25 |
26 | public void setCapturedImage(StreamedContent capturedImage) {
27 | this.capturedImage = capturedImage;
28 | }
29 |
30 | public void onCapture(CaptureEvent captureEvent) {
31 | byte[] data = captureEvent.getData();
32 | capturedImage = new DefaultStreamedContent(new ByteArrayInputStream(data));
33 | }
34 | }
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter1/partialSubmit.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Partial View Submit
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter5/DataListBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter5;
2 |
3 | import org.primefaces.cookbook.converter.CarConverter;
4 | import org.primefaces.cookbook.model.chapter3.Car;
5 | import org.primefaces.cookbook.model.chapter5.CountryList;
6 |
7 | import javax.faces.view.ViewScoped;
8 | import javax.inject.Named;
9 | import java.io.Serializable;
10 | import java.util.ArrayList;
11 | import java.util.Collection;
12 | import java.util.List;
13 |
14 | /**
15 | * User: mertcaliskan
16 | * Date: 8/19/12
17 | */
18 | @Named
19 | @ViewScoped
20 | public class DataListBean implements Serializable {
21 |
22 | public Collection getCars() {
23 | return new ArrayList(CarConverter.cars.values());
24 | }
25 |
26 | public List getCountriesShort() {
27 | return CountryList.countriesShort;
28 | }
29 |
30 | public List getCountries() {
31 | return CountryList.countries;
32 | }
33 |
34 | public int getCountriesSize() {
35 | return getCountries().size();
36 | }
37 | }
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/model/chapter5/TreeTableElement.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.model.chapter5;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * User: mertcaliskan
7 | * Date: 8/31/12
8 | */
9 | public class TreeTableElement implements Serializable {
10 |
11 | private String name;
12 | private String column1;
13 | private String column2;
14 |
15 | public TreeTableElement(String name, String column1, String column2) {
16 | this.name = name;
17 | this.column1 = column1;
18 | this.column2 = column2;
19 | }
20 |
21 | public String getName() {
22 | return name;
23 | }
24 |
25 | public void setName(String name) {
26 | this.name = name;
27 | }
28 |
29 | public String getColumn1() {
30 | return column1;
31 | }
32 |
33 | public void setColumn1(String column1) {
34 | this.column1 = column1;
35 | }
36 |
37 | public String getColumn2() {
38 | return column2;
39 | }
40 |
41 | public void setColumn2(String column2) {
42 | this.column2 = column2;
43 | }
44 | }
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter5/OrderListBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter5;
2 |
3 | import org.primefaces.cookbook.converter.CarConverter;
4 | import org.primefaces.cookbook.model.chapter3.Car;
5 |
6 | import javax.faces.view.ViewScoped;
7 | import javax.inject.Named;
8 | import java.io.Serializable;
9 | import java.util.ArrayList;
10 | import java.util.Collection;
11 | import java.util.List;
12 |
13 | /**
14 | * User: mertcaliskan
15 | * Date: 8/8/12
16 | */
17 | @Named
18 | @ViewScoped
19 | public class OrderListBean implements Serializable {
20 |
21 | private List countries;
22 |
23 | public OrderListBean() {
24 | countries = new ArrayList();
25 |
26 | countries.add("England");
27 | countries.add("Germany");
28 | countries.add("Switzerland");
29 | countries.add("Turkey");
30 | }
31 |
32 | public List getCountries() {
33 | return countries;
34 | }
35 |
36 | public Collection getCars() {
37 | return new ArrayList(CarConverter.cars.values());
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter11/DefaultCommandBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter11;
2 |
3 | import javax.faces.application.FacesMessage;
4 | import javax.faces.context.FacesContext;
5 | import javax.faces.view.ViewScoped;
6 | import javax.inject.Named;
7 | import java.io.Serializable;
8 |
9 | /**
10 | * DefaultCommandBean
11 | *
12 | * @author Oleg Varaksin / last modified by $Author: $
13 | * @version $Revision: 1.0 $
14 | */
15 | @Named
16 | @ViewScoped
17 | public class DefaultCommandBean implements Serializable {
18 |
19 | private String text;
20 |
21 | private String btn = "btn1";
22 |
23 | public String getText() {
24 | return text;
25 | }
26 |
27 | public void setText(String text) {
28 | this.text = text;
29 | }
30 |
31 | public String getBtn() {
32 | return btn;
33 | }
34 |
35 | public void setBtn(String btn) {
36 | this.btn = btn;
37 | }
38 |
39 | public void showMessage(String button) {
40 | FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Pressed button: " + button, null);
41 | FacesContext.getCurrentInstance().addMessage(null, msg);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter4/TabViewBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter4;
2 |
3 | import org.primefaces.cookbook.converter.CarConverter;
4 | import org.primefaces.cookbook.model.chapter3.Car;
5 | import org.primefaces.cookbook.utils.MessageUtil;
6 | import org.primefaces.event.TabChangeEvent;
7 | import org.primefaces.event.TabCloseEvent;
8 |
9 | import javax.faces.view.ViewScoped;
10 | import javax.inject.Named;
11 | import java.io.Serializable;
12 | import java.util.ArrayList;
13 | import java.util.List;
14 |
15 | /**
16 | * User: mertcaliskan
17 | * Date: 8/1/12
18 | */
19 | @Named
20 | @ViewScoped
21 | public class TabViewBean implements Serializable {
22 |
23 | public List getCars() {
24 | return new ArrayList(CarConverter.cars.values());
25 | }
26 |
27 | public void onTabChange(TabChangeEvent event) {
28 | MessageUtil.addInfoMessage("tab.changed", "Title: " + event.getTab().getTitle());
29 | }
30 |
31 | public void onTabClose(TabCloseEvent event) {
32 | MessageUtil.addInfoMessage("tab.closed", "Closed Tab: " + event.getTab().getTitle());
33 | }
34 | }
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter3/CalendarBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter3;
2 |
3 | import org.apache.commons.lang3.time.DateUtils;
4 | import org.primefaces.cookbook.utils.MessageUtil;
5 | import org.primefaces.event.SelectEvent;
6 |
7 | import javax.faces.view.ViewScoped;
8 | import javax.inject.Named;
9 | import java.io.Serializable;
10 | import java.util.Date;
11 |
12 | /**
13 | * User: mertcaliskan
14 | * Date: 6/28/12
15 | */
16 | @Named
17 | @ViewScoped
18 | public class CalendarBean implements Serializable {
19 |
20 | private Date date;
21 |
22 | public Date getDate() {
23 | return date;
24 | }
25 |
26 | public void setDate(Date date) {
27 | this.date = date;
28 | }
29 |
30 | public Date getYesterday() {
31 | return DateUtils.addDays(new Date(), -1);
32 | }
33 |
34 | public Date getTomorrow() {
35 | return DateUtils.addDays(new Date(), 1);
36 | }
37 |
38 | public void onDateSelect(SelectEvent event) {
39 | Date date = (Date)event.getObject();
40 | MessageUtil.addInfoMessage("selected.date", date);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter11/focusManagement.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/main/resources/ehcache.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
18 |
19 |
20 |
21 |
30 |
31 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter9/map.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | Basic Mapping with GMaps
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/validator/CvcClientConstraint.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.validator;
2 |
3 | import org.apache.commons.lang3.StringUtils;
4 | import org.primefaces.validate.bean.ClientValidationConstraint;
5 |
6 | import javax.validation.metadata.ConstraintDescriptor;
7 | import java.util.HashMap;
8 | import java.util.Map;
9 |
10 | public class CvcClientConstraint
11 | implements ClientValidationConstraint {
12 |
13 | private static final String CARDMENU_METADATA =
14 | "data-forcardmenu";
15 |
16 | @Override
17 | public Map getMetadata(
18 | ConstraintDescriptor constraintDescriptor) {
19 | Map metadata =
20 | new HashMap();
21 | Map attrs = constraintDescriptor.getAttributes();
22 | String forCardMenu = (String) attrs.get("forCardMenu");
23 | if (StringUtils.isNotBlank(forCardMenu)) {
24 | metadata.put(CARDMENU_METADATA, forCardMenu);
25 | }
26 |
27 | return metadata;
28 | }
29 |
30 | @Override
31 | public String getValidatorId() {
32 | return ValidCVC.class.getSimpleName();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter5/DataExportBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter5;
2 |
3 | import com.lowagie.text.Document;
4 | import com.lowagie.text.HeaderFooter;
5 | import com.lowagie.text.Phrase;
6 | import org.primefaces.cookbook.model.chapter5.CountryList;
7 |
8 | import javax.faces.view.ViewScoped;
9 | import javax.inject.Named;
10 | import java.io.Serializable;
11 | import java.util.List;
12 |
13 | /**
14 | * User: mertcaliskan
15 | * Date: 8/28/12
16 | */
17 | @Named
18 | @ViewScoped
19 | public class DataExportBean implements Serializable {
20 |
21 | private String[] selectedCountries;
22 |
23 | public List getCountries() {
24 | return CountryList.countries;
25 | }
26 |
27 | public void preProcessPDF(Object document) {
28 | Document pdf = (Document) document;
29 | HeaderFooter footer = new HeaderFooter(new Phrase("This is page: "), true);
30 | pdf.setFooter(footer);
31 | }
32 |
33 | public String[] getSelectedCountries() {
34 | return selectedCountries;
35 | }
36 |
37 | public void setSelectedCountries(String[] selectedCountries) {
38 | this.selectedCountries = selectedCountries;
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/model/chapter8/Document.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.model.chapter8;
2 |
3 | import java.io.Serializable;
4 | import java.util.Date;
5 |
6 | /**
7 | * Document
8 | *
9 | * @author Oleg Varaksin / last modified by $Author: $
10 | * @version $Revision: 1.0 $
11 | */
12 | public class Document implements Serializable {
13 |
14 | private String title;
15 | private int size;
16 | private String creator;
17 | private Date creationDate;
18 | private String extension;
19 |
20 | public Document(String title, int size, String creator, Date creationDate, String extension) {
21 | this.title = title;
22 | this.size = size;
23 | this.creator = creator;
24 | this.creationDate = creationDate;
25 | this.extension = extension;
26 | }
27 |
28 | public String getTitle() {
29 | return title;
30 | }
31 |
32 | public int getSize() {
33 | return size;
34 | }
35 |
36 | public String getCreator() {
37 | return creator;
38 | }
39 |
40 | public Date getCreationDate() {
41 | return creationDate;
42 | }
43 |
44 | public String getExtension() {
45 | return extension;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter11/dataTableColoring.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 | Conditional Coloring in DataTable
9 |
10 |
13 |
14 | #{countryGdp.name}
15 |
16 |
17 | #{countryGdp.gdp}
18 |
19 |
20 |
21 |
27 |
28 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/model/chapter5/Boxer.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.model.chapter5;
2 |
3 | import java.io.Serializable;
4 | import java.util.ArrayList;
5 | import java.util.List;
6 |
7 | /**
8 | * Created by mertcaliskan
9 | * on 03/03/15.
10 | */
11 | public class Boxer implements Serializable {
12 |
13 | private String name;
14 |
15 | private List stats = new ArrayList();
16 |
17 | public Boxer(String name) {
18 | this.name = name;
19 | }
20 |
21 | public String getName() {
22 | return name;
23 | }
24 |
25 | public void setName(String name) {
26 | this.name = name;
27 | }
28 |
29 | public List getStats() {
30 | return stats;
31 | }
32 |
33 | public void setStats(List stats) {
34 | this.stats = stats;
35 | }
36 |
37 | public int getAllWins() {
38 | int sum = 0;
39 |
40 | for(Stat s : stats) {
41 | sum += s.getWin();
42 | }
43 |
44 | return sum;
45 | }
46 |
47 | public int getAllLosses() {
48 | int sum = 0;
49 |
50 | for(Stat s : stats) {
51 | sum += s.getLoss();
52 | }
53 |
54 | return sum;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter3/InputMaskBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter3;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 | import java.io.Serializable;
6 |
7 | /**
8 | * User: mertcaliskan
9 | * Date: 6/11/12
10 | */
11 | @Named
12 | @ViewScoped
13 | public class InputMaskBean implements Serializable {
14 |
15 | private String phone;
16 | private String phone2;
17 | private String phoneExt;
18 | private String productKey;
19 |
20 | public String getPhone() {
21 | return phone;
22 | }
23 |
24 | public void setPhone(String phone) {
25 | this.phone = phone;
26 | }
27 |
28 | public String getPhone2() {
29 | return phone2;
30 | }
31 |
32 | public void setPhone2(String phone2) {
33 | this.phone2 = phone2;
34 | }
35 |
36 | public String getPhoneExt() {
37 | return phoneExt;
38 | }
39 |
40 | public void setPhoneExt(String phoneExt) {
41 | this.phoneExt = phoneExt;
42 | }
43 |
44 | public String getProductKey() {
45 | return productKey;
46 | }
47 |
48 | public void setProductKey(String productKey) {
49 | this.productKey = productKey;
50 | }
51 | }
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter3/SelectCheckboxBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter3;
2 |
3 | import org.primefaces.cookbook.utils.MessageUtil;
4 |
5 | import javax.faces.view.ViewScoped;
6 | import javax.inject.Named;
7 | import java.io.Serializable;
8 | import java.util.List;
9 |
10 | /**
11 | * User: mertcaliskan
12 | * Date: 6/26/12
13 | */
14 | @Named
15 | @ViewScoped
16 | public class SelectCheckboxBean implements Serializable {
17 |
18 | private boolean selectedValue;
19 |
20 | private List selectedCountries;
21 |
22 | public boolean isSelectedValue() {
23 | return selectedValue;
24 | }
25 |
26 | public void setSelectedValue(boolean selectedValue) {
27 | this.selectedValue = selectedValue;
28 | }
29 |
30 | public List getSelectedCountries() {
31 | return selectedCountries;
32 | }
33 |
34 | public void setSelectedCountries(List selectedCountries) {
35 | this.selectedCountries = selectedCountries;
36 | }
37 |
38 | public void addMessage() {
39 | String summaryKey = selectedValue ? "checkbox.checked" : "checkbox.unchecked";
40 |
41 | MessageUtil.addInfoMessage(summaryKey);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter6/menuButton.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
15 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter4/AccordionPanelBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter4;
2 |
3 | import org.primefaces.cookbook.converter.CarConverter;
4 | import org.primefaces.cookbook.model.chapter3.Car;
5 | import org.primefaces.cookbook.utils.MessageUtil;
6 | import org.primefaces.event.TabChangeEvent;
7 | import org.primefaces.event.TabCloseEvent;
8 |
9 | import javax.faces.application.FacesMessage;
10 | import javax.faces.context.FacesContext;
11 | import javax.faces.view.ViewScoped;
12 | import javax.inject.Named;
13 | import java.io.Serializable;
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | /**
18 | * User: mertcaliskan
19 | * Date: 7/28/12
20 | */
21 | @Named
22 | @ViewScoped
23 | public class AccordionPanelBean implements Serializable {
24 |
25 | public List getCars() {
26 | return new ArrayList(CarConverter.cars.values());
27 | }
28 |
29 | public void onTabChange(TabChangeEvent event) {
30 | MessageUtil.addInfoMessage("tab.changed", "Title: " + event.getTab().getTitle());
31 | }
32 |
33 | public void onTabClose(TabCloseEvent event) {
34 | MessageUtil.addInfoMessage("tab.closed", "Closed Tab: " + event.getTab().getTitle());
35 | }
36 | }
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter4/LayoutBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter4;
2 |
3 | import org.primefaces.component.layout.LayoutUnit;
4 | import org.primefaces.cookbook.utils.MessageUtil;
5 | import org.primefaces.event.CloseEvent;
6 | import org.primefaces.event.ResizeEvent;
7 | import org.primefaces.event.ToggleEvent;
8 |
9 | import javax.faces.view.ViewScoped;
10 | import javax.inject.Named;
11 | import java.io.Serializable;
12 |
13 | /**
14 | * User: mertcaliskan
15 | * Date: 8/6/12
16 | */
17 | @Named
18 | @ViewScoped
19 | public class LayoutBean implements Serializable {
20 |
21 | public void handleClose(CloseEvent event) {
22 | MessageUtil.addInfoMessageWithoutKey("Unit Closed", "Position:'" + ((LayoutUnit) event.getComponent()).getPosition());
23 | }
24 |
25 | public void handleToggle(ToggleEvent event) {
26 | MessageUtil.addInfoMessageWithoutKey(((LayoutUnit)event.getComponent()).getPosition() + " toggled", "Status:" + event.getVisibility().name());
27 | }
28 |
29 | public void handleResize(ResizeEvent event) {
30 | MessageUtil.addInfoMessageWithoutKey(((LayoutUnit)event.getComponent()).getPosition() + " resized", "Status:" + event.getComponent().getId());
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter5/LazyDataTableBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter5;
2 |
3 | import org.primefaces.cookbook.converter.CarConverter;
4 | import org.primefaces.cookbook.model.chapter3.Car;
5 | import org.primefaces.cookbook.model.chapter5.LazyCarDataModel;
6 | import org.primefaces.model.LazyDataModel;
7 |
8 | import javax.faces.view.ViewScoped;
9 | import javax.inject.Named;
10 | import java.io.Serializable;
11 | import java.util.ArrayList;
12 | import java.util.Collection;
13 | import java.util.List;
14 |
15 | /**
16 | * User: mertcaliskan
17 | * Date: 9/2/12
18 | */
19 | @Named
20 | @ViewScoped
21 | public class LazyDataTableBean implements Serializable {
22 |
23 | private List cars;
24 |
25 | private LazyDataModel lazyModel;
26 |
27 | public LazyDataTableBean() {
28 | Collection cars = CarConverter.cars.values();
29 | Collection bulkCars = new ArrayList();
30 | for (int i = 0; i< 1000; i++) {
31 | bulkCars.addAll(cars);
32 | }
33 | this.cars = new ArrayList(bulkCars);
34 | lazyModel = new LazyCarDataModel(this.cars);
35 | }
36 |
37 | public LazyDataModel getLazyModel() {
38 | return lazyModel;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter3/InputTextAreaBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter3;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 | import java.io.Serializable;
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | /**
10 | * User: mertcaliskan
11 | * Date: 6/25/12
12 | */
13 | @Named
14 | @ViewScoped
15 | public class InputTextAreaBean implements Serializable {
16 |
17 | private String value;
18 |
19 | public String getValue() {
20 | return value;
21 | }
22 |
23 | public void setValue(String value) {
24 | this.value = value;
25 | }
26 |
27 | public List complete(String query) {
28 | List results = new ArrayList();
29 |
30 | if(query.equals("PrimeFaces")) {
31 | results.add("PrimeFaces Rocks!!!");
32 | results.add("PrimeFaces has 100+ components.");
33 | results.add("PrimeFaces is lightweight.");
34 | results.add("PrimeFaces Cookbook is the best source for PrimeFaces!");
35 | }
36 | else {
37 | for(int i = 0; i < 10; i++) {
38 | results.add(query + i);
39 | }
40 | }
41 |
42 | return results;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter3/SelectOneMenuBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter3;
2 |
3 | import org.primefaces.cookbook.converter.CarConverter;
4 | import org.primefaces.cookbook.model.chapter3.Car;
5 |
6 | import javax.annotation.PostConstruct;
7 | import javax.faces.bean.ViewScoped;
8 | import javax.inject.Named;
9 | import java.io.Serializable;
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | /**
14 | * Created by mertcaliskan
15 | * on 04/01/15.
16 | */
17 | @Named
18 | @ViewScoped
19 | public class SelectOneMenuBean implements Serializable {
20 |
21 | private List cars;
22 | private Car selectedCar;
23 |
24 | @PostConstruct
25 | public void setup() {
26 | cars = new ArrayList(CarConverter.cars.values());
27 | }
28 |
29 | public char getGroup(Car car) {
30 | return car.getName().charAt(0);
31 | }
32 |
33 | public List getCars() {
34 | return cars;
35 | }
36 |
37 | public void setCars(List cars) {
38 | this.cars = cars;
39 | }
40 |
41 | public Car getSelectedCar() {
42 | return selectedCar;
43 | }
44 |
45 | public void setSelectedCar(Car selectedCar) {
46 | this.selectedCar = selectedCar;
47 | }
48 | }
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter8/droppable.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
11 |
14 |
15 |
16 |
17 |
18 |
19 |
21 | Drag me to my target
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter7/fileUploadCallback.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Client Side Callback for File Upload
8 |
9 |
10 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter11/DataTableColoringBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter11;
2 |
3 | import org.primefaces.cookbook.model.chapter11.CountryGdp;
4 |
5 | import javax.annotation.PostConstruct;
6 | import javax.faces.view.ViewScoped;
7 | import javax.inject.Named;
8 | import java.io.Serializable;
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | @Named
13 | @ViewScoped
14 | public class DataTableColoringBean implements Serializable {
15 |
16 | private List countryGdpList;
17 |
18 | @PostConstruct
19 | protected void init() {
20 | countryGdpList = new ArrayList();
21 | countryGdpList.add(new CountryGdp("United States", 16720000));
22 | countryGdpList.add(new CountryGdp("China", 9330000));
23 | countryGdpList.add(new CountryGdp("Japan", 5007000));
24 | countryGdpList.add(new CountryGdp("Germany", 3593000));
25 | countryGdpList.add(new CountryGdp("France", 2739000));
26 | countryGdpList.add(new CountryGdp("United Kingdom", 2490000));
27 | countryGdpList.add(new CountryGdp("Brazil", 2190000));
28 | countryGdpList.add(new CountryGdp("Russia", 2113000));
29 | }
30 |
31 | public List getCountryGdpList() {
32 | return countryGdpList;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter3/SliderBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter3;
2 |
3 | import org.primefaces.cookbook.utils.MessageUtil;
4 | import org.primefaces.event.SlideEndEvent;
5 |
6 | import javax.faces.view.ViewScoped;
7 | import javax.inject.Named;
8 | import java.io.Serializable;
9 |
10 | /**
11 | * User: mertcaliskan
12 | * Date: 7/1/12
13 | */
14 | @Named
15 | @ViewScoped
16 | public class SliderBean implements Serializable {
17 |
18 | private int intValue = 0;
19 | private int rangeStart = 20;
20 | private int rangeEnd = 60;
21 |
22 | public int getIntValue() {
23 | return intValue;
24 | }
25 |
26 | public void setIntValue(int intValue) {
27 | this.intValue = intValue;
28 | }
29 |
30 | public int getRangeStart() {
31 | return rangeStart;
32 | }
33 |
34 | public void setRangeStart(int rangeStart) {
35 | this.rangeStart = rangeStart;
36 | }
37 |
38 | public int getRangeEnd() {
39 | return rangeEnd;
40 | }
41 |
42 | public void setRangeEnd(int rangeEnd) {
43 | this.rangeEnd = rangeEnd;
44 | }
45 |
46 | public void onSlideEnd(SlideEndEvent event) {
47 | int value = event.getValue();
48 | MessageUtil.addInfoMessage("selected.sliderValue", value);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter5/dataScroller.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 | Visualizing data with DataScroller
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter6/BaseMenuBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter6;
2 |
3 | import javax.faces.application.FacesMessage;
4 | import javax.faces.context.FacesContext;
5 | import javax.faces.event.ActionEvent;
6 | import java.io.Serializable;
7 |
8 | /**
9 | * BaseMenuBean
10 | *
11 | * @author Oleg Varaksin / last modified by $Author: $
12 | * @version $Revision: 1.0 $
13 | */
14 | public abstract class BaseMenuBean implements Serializable {
15 |
16 | public void save(ActionEvent ae) {
17 | FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Saved", null);
18 | FacesContext.getCurrentInstance().addMessage(null, msg);
19 | }
20 |
21 | public void update(ActionEvent ae) {
22 | FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Updated", null);
23 | FacesContext.getCurrentInstance().addMessage(null, msg);
24 | }
25 |
26 | public void delete(ActionEvent ae) {
27 | FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Deleted", null);
28 | FacesContext.getCurrentInstance().addMessage(null, msg);
29 | }
30 |
31 | public String doSomething() {
32 | // do something
33 | FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Done", null);
34 | FacesContext.getCurrentInstance().addMessage(null, msg);
35 |
36 | return null;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/utils/FacesUtil.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.utils;
2 |
3 | import javax.el.ExpressionFactory;
4 | import javax.el.MethodExpression;
5 | import javax.faces.context.FacesContext;
6 | import javax.faces.event.MethodExpressionActionListener;
7 |
8 | /**
9 | * FacesUtil
10 | *
11 | * @author Oleg Varaksin / last modified by $Author: $
12 | * @version $Revision: 1.0 $
13 | */
14 | public class FacesUtil {
15 |
16 | public static MethodExpression createMethodExpression(String valueExpression, Class> expectedReturnType,
17 | Class>[] expectedParamTypes) {
18 | FacesContext fc = FacesContext.getCurrentInstance();
19 | ExpressionFactory factory = fc.getApplication().getExpressionFactory();
20 |
21 | return factory.createMethodExpression(fc.getELContext(), valueExpression, expectedReturnType, expectedParamTypes);
22 | }
23 |
24 | public static MethodExpressionActionListener createMethodActionListener(String valueExpression, Class> expectedReturnType,
25 | Class>[] expectedParamTypes) {
26 | return new MethodExpressionActionListener(createMethodExpression(valueExpression, expectedReturnType,
27 | expectedParamTypes));
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/converter/ThemeConverter.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.converter;
2 |
3 | import org.primefaces.cookbook.controller.chapter2.UserSettingsBean;
4 | import org.primefaces.cookbook.model.chapter2.Theme;
5 |
6 | import javax.enterprise.context.SessionScoped;
7 | import javax.faces.component.UIComponent;
8 | import javax.faces.context.FacesContext;
9 | import javax.faces.convert.Converter;
10 | import javax.inject.Inject;
11 | import javax.inject.Named;
12 | import java.io.Serializable;
13 | import java.util.List;
14 |
15 | /**
16 | * ThemeConverter
17 | *
18 | * @author Oleg Varaksin / last modified by $Author: $
19 | * @version $Revision: 1.0 $
20 | */
21 | @Named
22 | @SessionScoped
23 | public class ThemeConverter implements Serializable, Converter {
24 |
25 | @Inject
26 | private UserSettingsBean userSettingsBean;
27 |
28 | public Object getAsObject(FacesContext context, UIComponent component, String value) {
29 | List themes = userSettingsBean.getAvailableThemes();
30 | for (Theme theme : themes) {
31 | if (theme.getName().equals(value)) {
32 | return theme;
33 | }
34 | }
35 |
36 | return null;
37 | }
38 |
39 | public String getAsString(FacesContext context, UIComponent component, Object value) {
40 | return ((Theme) value).getName();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter6/tieredMenu.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 | Default TieredMenu
12 |
13 |
14 |
15 |
16 |
17 | TieredMenu without autoDisplay
18 |
19 |
20 |
21 |
22 |
23 | TieredMenu on Overlay
24 |
25 |
26 |
27 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/model/chapter5/DetailedCar.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.model.chapter5;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * User: mertcaliskan
7 | * Date: 7/9/12
8 | */
9 | public class DetailedCar implements Serializable {
10 |
11 | public String name;
12 | public int year;
13 | private String color;
14 | private int seatNumber;
15 |
16 | public DetailedCar(String name, int year, String color, int seatNumber) {
17 | this.name = name;
18 | this.year = year;
19 | this.color = color;
20 | this.seatNumber = seatNumber;
21 | }
22 |
23 | public String getName() {
24 | return name;
25 | }
26 |
27 | public void setName(String name) {
28 | this.name = name;
29 | }
30 |
31 | public int getYear() {
32 | return year;
33 | }
34 |
35 | public void setYear(int year) {
36 | this.year = year;
37 | }
38 |
39 | public String getColor() {
40 | return color;
41 | }
42 |
43 | public void setColor(String color) {
44 | this.color = color;
45 | }
46 |
47 | public int getSeatNumber() {
48 | return seatNumber;
49 | }
50 |
51 | public void setSeatNumber(int seatNumber) {
52 | this.seatNumber = seatNumber;
53 | }
54 |
55 | @Override
56 | public String toString() {
57 | return getName();
58 | }
59 | }
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter1/partialProcessing.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 | Partial Processing
9 |
10 |
11 |
12 |
13 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter11/ajaxCallbacks.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
13 |
14 |
15 |
19 |
20 |
21 |
22 | /* */
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter9/chart.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
14 |
15 |
16 | Charting with Line
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter2/customThemeStyles.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 | p:selectOneMenu (fix width)
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | p:tree (no background, no border)
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter11/RequestContextBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter11;
2 |
3 | import org.primefaces.context.RequestContext;
4 |
5 | import javax.faces.event.ActionEvent;
6 | import javax.faces.view.ViewScoped;
7 | import javax.inject.Named;
8 | import java.io.Serializable;
9 |
10 | /**
11 | * RequestContextBean
12 | *
13 | * @author Oleg Varaksin / last modified by $Author: $
14 | * @version $Revision: 1.0 $
15 | */
16 | @Named
17 | @ViewScoped
18 | public class RequestContextBean implements Serializable {
19 |
20 | private boolean firstOutput = true;
21 |
22 | private int counter = 0;
23 |
24 | public void incrementWithUpdate(ActionEvent ae) {
25 | counter++;
26 |
27 | RequestContext requestContext =
28 | RequestContext.getCurrentInstance();
29 |
30 | if (firstOutput) {
31 | requestContext.update("firstOutput");
32 | } else {
33 | requestContext.update("secondOutput");
34 | }
35 | }
36 |
37 | public void incrementWithScroll(ActionEvent ae) {
38 | counter++;
39 |
40 | RequestContext requestContext =
41 | RequestContext.getCurrentInstance();
42 | requestContext.scrollTo("counter");
43 | }
44 |
45 | public boolean isFirstOutput() {
46 | return firstOutput;
47 | }
48 |
49 | public void setFirstOutput(boolean firstOutput) {
50 | this.firstOutput = firstOutput;
51 | }
52 |
53 | public int getCounter() {
54 | return counter;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter10/instantCsv.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter3/rating.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 | Star Based Rating Input
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter11/dialogFramework.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter5/dataTableLazyDataModel.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 | Handling millions of data – LazyDataModel
9 |
10 |
11 |
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter11/JavaScriptExecBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter11;
2 |
3 | import org.primefaces.context.RequestContext;
4 |
5 | import javax.faces.event.ActionEvent;
6 | import javax.faces.view.ViewScoped;
7 | import javax.inject.Named;
8 | import java.io.Serializable;
9 |
10 | /**
11 | * JavaScriptExecBean
12 | *
13 | * @author Oleg Varaksin / last modified by $Author: $
14 | * @version $Revision: 1.0 $
15 | */
16 | @Named
17 | @ViewScoped
18 | public class JavaScriptExecBean implements Serializable {
19 |
20 | private boolean enabled = true;
21 |
22 | public void toogleMenuitems(ActionEvent ae) {
23 | RequestContext requestContext =
24 | RequestContext.getCurrentInstance();
25 |
26 | String script;
27 | if (enabled) {
28 | script =
29 | "$('#menu a').each(function() {"
30 | + "$(this).attr('data-href', $(this).attr('href'))"
31 | + ".removeAttr('href')"
32 | + ".addClass('ui-state-disabled');});";
33 | } else {
34 | script =
35 | "$('#menu a').each(function() {"
36 | + "$(this).attr('href', $(this).attr('data-href'))"
37 | + ".removeAttr('data-href')"
38 | + ".removeClass('ui-state-disabled');});";
39 | }
40 |
41 | requestContext.execute(script);
42 | enabled = !enabled;
43 | }
44 |
45 | public void toogleEnabled(ActionEvent ae) {
46 | enabled = !enabled;
47 | }
48 |
49 | public boolean isEnabled() {
50 | return enabled;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter2/statefulThemeSwitcher.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 | Stateful Theme Switcher
10 |
11 |
15 |
19 |
20 |
22 |
23 |
24 | #{t.displayName}
25 |
26 |
27 |
28 |
33 |
34 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter6/contextMenuIntegration.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
15 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter9/mapInfoView.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | Adding, Selecting and Dragging Markers in Maps
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter2/TreeBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter2;
2 |
3 | import org.primefaces.model.DefaultTreeNode;
4 | import org.primefaces.model.TreeNode;
5 |
6 | import javax.faces.view.ViewScoped;
7 | import javax.inject.Named;
8 | import java.io.Serializable;
9 |
10 | /**
11 | * TreeBean
12 | *
13 | * @author Oleg Varaksin / last modified by $Author: $
14 | * @version $Revision: 1.0 $
15 | */
16 | @Named
17 | @ViewScoped
18 | public class TreeBean implements Serializable {
19 |
20 | private TreeNode root;
21 |
22 | public TreeBean() {
23 | root = new DefaultTreeNode("Root", null);
24 |
25 | TreeNode node0 = new DefaultTreeNode("Tree node 0", root);
26 | node0.setExpanded(true);
27 |
28 | TreeNode node1 = new DefaultTreeNode("Tree node 1", root);
29 | new DefaultTreeNode("Tree node 2", root);
30 |
31 | TreeNode node00 = new DefaultTreeNode("Tree node 0.0", node0);
32 | node00.setExpanded(true);
33 |
34 | TreeNode node01 = new DefaultTreeNode("Tree node 0.1", node0);
35 |
36 | TreeNode node10 = new DefaultTreeNode("Tree node 1.0", node1);
37 | new DefaultTreeNode("Tree node 1.1", node1);
38 |
39 | TreeNode node000 = new DefaultTreeNode("Tree node 0.0.0", node00);
40 | node000.setExpanded(true);
41 |
42 | new DefaultTreeNode("Tree node 0.0.1", node00);
43 | new DefaultTreeNode("Tree node 0.1.0", node01);
44 |
45 | new DefaultTreeNode("Tree node 1.0.0", node10);
46 | }
47 |
48 | public TreeNode getRoot() {
49 | return root;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter6/megaMenu.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 | Horizontal MegaMenu
10 |
11 |
12 |
13 |
14 |
15 | Vertical MegaMenu
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
25 |
27 |
28 |
29 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter10/ExtendCsvBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter10;
2 |
3 | import org.primefaces.context.RequestContext;
4 | import org.primefaces.cookbook.validator.ValidCVC;
5 |
6 | import javax.faces.view.ViewScoped;
7 | import javax.inject.Named;
8 | import javax.validation.constraints.NotNull;
9 | import java.io.Serializable;
10 |
11 | @Named
12 | @ViewScoped
13 | public class ExtendCsvBean implements Serializable {
14 |
15 | private String firstName;
16 | private String lastName;
17 |
18 | @NotNull
19 | private String card;
20 | @NotNull
21 | @ValidCVC(forCardMenu = "@(.card)")
22 | private Integer cvc;
23 |
24 | public String getFirstName() {
25 | return firstName;
26 | }
27 |
28 | public void setFirstName(String firstName) {
29 | this.firstName = firstName;
30 | }
31 |
32 | public String getLastName() {
33 | return lastName;
34 | }
35 |
36 | public void setLastName(String lastName) {
37 | this.lastName = lastName;
38 | }
39 |
40 | public String getCard() {
41 | return card;
42 | }
43 |
44 | public void setCard(String card) {
45 | this.card = card;
46 | }
47 |
48 | public Integer getCvc() {
49 | return cvc;
50 | }
51 |
52 | public void setCvc(Integer cvc) {
53 | this.cvc = cvc;
54 | }
55 |
56 | public void save() {
57 | RequestContext.getCurrentInstance().execute(
58 | "alert('Saved!')");
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter11/polling.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
13 |
14 |
17 |
20 |
21 |
22 |
24 |
25 |
26 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/faces-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 | en
10 | tr_TR
11 |
12 |
13 | messages
14 | msg
15 |
16 |
17 | org.omnifaces.resourcehandler.UnmappedResourceHandler
18 |
19 |
20 | org.primefaces.application.DialogActionListener
21 |
22 |
23 | org.primefaces.application.DialogNavigationHandler
24 |
25 |
26 | org.primefaces.application.DialogViewHandler
27 |
28 |
29 |
30 | org.primefaces.application.exceptionhandler.PrimeExceptionHandlerELResolver
31 |
32 |
33 |
34 |
35 |
36 | org.primefaces.application.exceptionhandler.PrimeExceptionHandlerFactory
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter8/advancedDraggable.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 | I can be only dragged horizontally.
11 |
12 |
13 |
14 |
15 | I can be only dragged vertically
16 |
17 |
18 |
19 |
20 | I can be only dragged in a grid
21 |
22 |
23 |
24 | The image below can be only dragged within its parent's boundaries
25 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter7/media.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 | Embedding multimedia content in JSF pages
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter1/fragment.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 | Partial Process and Update with Fragment component
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter8/draggable.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 | Drag me around
11 |
12 |
13 |
14 |
15 | I can be only dragged by my header
16 |
17 |
18 |
19 |
20 | I display a clone as helper while being dragged
21 |
22 |
23 |
24 |
25 | I will be returned to my start position when dragging stops
26 |
27 |
28 |
29 |
30 | I use opacity for helper while being dragged
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter4/scrollPanel.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 | Displaying overflowed content with ScrollPanel
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter2/fontAwesome.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 | Integrating FontAwesome with PrimeFaces
11 |
12 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
39 |
40 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter11/targetableMessages.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 | Targetable Messages
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
19 |
21 |
23 |
24 | Severity Levels
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter4/toolbar.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 | Grouping Buttons and More with Toolbar
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter4/gridCSSNested.xhtml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
14 |
15 |
16 | Responsive layout with Grid CSS
17 |
18 |
19 |
20 |
21 |
3
22 |
9
23 |
24 |
25 |
4
26 |
4
27 |
4
28 |
29 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/main/webapp/resources/css/layout.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: Arial, "Trebuchet MS", Verdana, sans-serif;
3 | font-size: 12px;
4 | padding: 0 !important;
5 | margin: 0;
6 | }
7 |
8 | input,
9 | select,
10 | textarea,
11 | button,
12 | .ui-widget,
13 | .ui-widget input,
14 | .ui-widget select,
15 | .ui-widget textarea,
16 | .ui-widget button,
17 | .ui-widget-header,
18 | .ui-widget-content,
19 | .ui-widget-header .ui-widget-header,
20 | .ui-widget-content .ui-widget-content {
21 | font-family: Arial, "Trebuchet MS", Verdana, sans-serif;
22 | font-size: 12px !important;
23 | }
24 |
25 | #bookTree {
26 | width: auto;
27 | }
28 |
29 | .ui-treenode {
30 | padding: 2px 0 0;
31 | }
32 |
33 | .ui-chkbox {
34 | vertical-align: middle;
35 | }
36 |
37 | /*
38 | .ui-selectonemenu {
39 | display: block;
40 | }*/
41 |
42 | .ui-selectoneradio label,
43 | .ui-selectmanycheckbox label {
44 | margin-top: 2px;
45 | }
46 |
47 | .logo {
48 | margin: 10px 0 18px 0;
49 | }
50 |
51 | .chaptersMenuColumn {
52 | vertical-align: top;
53 | padding-left: 10px;
54 | }
55 |
56 | .chaptersContentColumn {
57 | vertical-align: top;
58 | padding: 120px 10px 0 40px;
59 | }
60 |
61 | .slogan {
62 | position: absolute;
63 | color: #A2A1A1;
64 | font-weight: bold;
65 | bottom: 30px;
66 | right: 40px;
67 | }
68 |
69 | table .formLabel,
70 | table .formEdit {
71 | vertical-align: middle;
72 | padding: 2px 20px 2px 0;
73 | }
74 |
75 | table .formLabel {
76 | padding: 2px 7px 2px 0;
77 | text-align: right;
78 | white-space: nowrap;
79 | width: 1%;
80 | }
81 |
82 | table .formEdit input,
83 | table .formEdit textarea {
84 | width: 160px;
85 | }
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter6/contextMenu.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
26 |
29 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter10/extendJsfCsv.xhtml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
12 |
13 |
15 |
16 |
17 |
18 |
19 |
20 |
22 |
23 |
24 |
25 |
26 |
27 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter9/mapDrawings.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | Creating Rectangles, Circles, Polylines and Polygons in Maps
13 |
14 |
15 |
16 |
17 |
18 |
20 |
21 |
22 |
24 |
25 |
26 |
28 |
29 |
30 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/converter/CarConverter.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.converter;
2 |
3 | /**
4 | * User: mertcaliskan
5 | * Date: 7/9/12
6 | */
7 |
8 | import org.apache.commons.lang3.StringUtils;
9 | import org.primefaces.cookbook.model.chapter3.Car;
10 |
11 | import javax.faces.component.UIComponent;
12 | import javax.faces.context.FacesContext;
13 | import javax.faces.convert.Converter;
14 | import javax.faces.convert.FacesConverter;
15 | import java.util.HashMap;
16 | import java.util.Map;
17 |
18 | @FacesConverter(value = "org.primefaces.cookbook.converter.CarConverter")
19 | public class CarConverter implements Converter {
20 |
21 | public static Map cars = new HashMap();
22 |
23 | static {
24 | cars.put("CC", new Car("CC", 2008));
25 | cars.put("Golf", new Car("Golf", 1974));
26 | cars.put("Jetta", new Car("Jetta", 1979));
27 | cars.put("Passat", new Car("Passat", 1973));
28 | cars.put("Polo", new Car("Polo", 1975));
29 | cars.put("Scirocco", new Car("Scirocco", 1974));
30 | cars.put("Touareg", new Car("Touareg", 2002));
31 | }
32 |
33 | public Object getAsObject(final FacesContext fc, final UIComponent component, final String value) {
34 | if (StringUtils.isBlank(value)) {
35 | return null;
36 | }
37 | else {
38 | return cars.get(value);
39 | }
40 | }
41 |
42 | public String getAsString(final FacesContext fc, final UIComponent component, final Object value) {
43 | if (value == null || value.equals("")) {
44 | return "";
45 | } else {
46 | return String.valueOf(((Car) value).getName());
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter9/mapMarkers.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | Adding, Selecting and Dragging Markers in Maps
13 |
14 |
15 |
16 |
17 |
18 |
20 |
21 |
22 |
24 |
25 |
26 |
27 |
28 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/main/resources/messages_en.properties:
--------------------------------------------------------------------------------
1 | broadcast.message=Hello Earthling!
2 |
3 | booleanButton.text=Barcelona is the best team in the world?
4 | booleanButton.onLabel=Yes
5 | booleanButton.offLabel=No
6 |
7 | selectBooleanCheckbox.label=Just Select It!
8 | selectBooleanButton.onLabel=Yup!
9 | selectBooleanButton.offLabel=Nope!
10 |
11 | checkbox.checked=Checked
12 | checkbox.unchecked=Unchecked
13 |
14 | selected.sliderValue=Selected Slider Value: {0}
15 | selected.date=Selected Date: {0}
16 | selected.object=Selected Object: {0}
17 |
18 | password.promptLabel=Please enter a password
19 | password.weakLabel=Weak
20 | password.goodLabel=Good
21 | password.strongLabel=Strong
22 |
23 | rating.selected=Selected Rating: {0}
24 | rating.cancelled=Rating Cancelled
25 |
26 | panel.closed=Panel Closed
27 | panel.toggled=Panel Toggled
28 |
29 | tab.changed=Tab Changed
30 | tab.closed=Tab Closed
31 |
32 | car.edit=Car Edited
33 | car.edit.cancelled=Car Edit Cancelled
34 |
35 | car.selected=Car Selected
36 | car.unselected=Car Unselected
37 |
38 | column.resized=Column Resized
39 |
40 | row.reordered=Row Reordered
41 | col.reordered=Column Reordered
42 | col.toggled=Column Toggled
43 |
44 | upload.successful=Upload Successful
45 |
46 | date.selected=Date Selected. Title: {0}.
47 | event.selected=Event Selected. Title: {0}.
48 | event.moved=Event Moved. Title: {0}. Day Change: {1}, Minute Change {2}.
49 | event.resized=Event Resized. Title: {0}. Day Change: {1}, Minute Change {2}.
50 | view.changed=View Changed. Title: {0}.
51 |
52 | firstName=First Name
53 | lastName=Last Name
54 | invalid.unicode={0} may only contain letters, spaces, hyphens and apostrophes
55 |
56 | items.transferred=Items transferred: {0}
57 | is.added=Added? : {0}
58 | is.removed= Removed? : {0}
59 |
60 | marker.dragged=Marker Dragged.
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter2/customInputStyles.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 | Default styles for input components
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Customized styles for input components
20 |
21 |
22 |
23 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter7/fileDownload.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Downloading Files
8 |
9 |
10 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter6/tieredMenuStructure.xhtml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
9 |
12 |
15 |
16 |
17 |
20 |
22 |
23 |
24 |
25 |
26 |
28 |
30 |
31 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter10/BasicCsvBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter10;
2 |
3 | import javax.faces.view.ViewScoped;
4 | import javax.inject.Named;
5 | import java.io.Serializable;
6 | import java.util.Date;
7 |
8 | @Named
9 | @ViewScoped
10 | public class BasicCsvBean implements Serializable {
11 |
12 | private String string1;
13 | private String string2;
14 | private String string3;
15 | private Integer int1;
16 | private Double double1;
17 | private Double double2;
18 | private Date date1;
19 |
20 | public String getString1() {
21 | return string1;
22 | }
23 |
24 | public void setString1(String string1) {
25 | this.string1 = string1;
26 | }
27 |
28 | public String getString2() {
29 | return string2;
30 | }
31 |
32 | public void setString2(String string2) {
33 | this.string2 = string2;
34 | }
35 |
36 | public String getString3() {
37 | return string3;
38 | }
39 |
40 | public void setString3(String string3) {
41 | this.string3 = string3;
42 | }
43 |
44 | public Integer getInt1() {
45 | return int1;
46 | }
47 |
48 | public void setInt1(Integer int1) {
49 | this.int1 = int1;
50 | }
51 |
52 | public Double getDouble1() {
53 | return double1;
54 | }
55 |
56 | public void setDouble1(Double double1) {
57 | this.double1 = double1;
58 | }
59 |
60 | public Double getDouble2() {
61 | return double2;
62 | }
63 |
64 | public void setDouble2(Double double2) {
65 | this.double2 = double2;
66 | }
67 |
68 | public Date getDate1() {
69 | return date1;
70 | }
71 |
72 | public void setDate1(Date date1) {
73 | this.date1 = date1;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/validator/RequiredCheckboxValidator.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.validator;
2 |
3 | import javax.faces.application.FacesMessage;
4 | import javax.faces.component.UIComponent;
5 | import javax.faces.component.UIInput;
6 | import javax.faces.component.UISelectBoolean;
7 | import javax.faces.context.FacesContext;
8 | import javax.faces.validator.FacesValidator;
9 | import javax.faces.validator.Validator;
10 | import javax.faces.validator.ValidatorException;
11 | import java.util.ResourceBundle;
12 |
13 | /**
14 | * RequiredCheckboxValidator
15 | *
16 | * @author Oleg Varaksin / last modified by $Author: $
17 | * @version $Revision: 1.0 $
18 | */
19 | @FacesValidator("org.primefaces.cookbook.validator.RequiredCheckboxValidator")
20 | public class RequiredCheckboxValidator implements Validator {
21 |
22 | @Override
23 | public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
24 | if (!(component instanceof UISelectBoolean)) {
25 | throw new IllegalArgumentException("RequiredCheckboxValidator must be registered on a UISelectBoolean");
26 | }
27 |
28 | if (!Boolean.TRUE.equals(value)) {
29 | String requiredMessage = ((UIInput) component).getRequiredMessage();
30 |
31 | if (requiredMessage == null && context.getApplication().getMessageBundle() != null) {
32 | requiredMessage =
33 | ResourceBundle.getBundle(context.getApplication().getMessageBundle(), context.getViewRoot().getLocale())
34 | .getString(UIInput.REQUIRED_MESSAGE_ID);
35 | }
36 |
37 | if (requiredMessage == null) {
38 | requiredMessage = component.getAttributes().get("label") + ": Validation Error: Value is required.";
39 | }
40 |
41 | throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, requiredMessage, null));
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter4/DashboardBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter4;
2 |
3 | import org.primefaces.cookbook.utils.MessageUtil;
4 | import org.primefaces.event.DashboardReorderEvent;
5 | import org.primefaces.model.DashboardColumn;
6 | import org.primefaces.model.DashboardModel;
7 | import org.primefaces.model.DefaultDashboardColumn;
8 | import org.primefaces.model.DefaultDashboardModel;
9 |
10 | import javax.faces.view.ViewScoped;
11 | import javax.inject.Named;
12 | import java.io.Serializable;
13 |
14 | /**
15 | * User: mertcaliskan
16 | * Date: 8/1/12
17 | */
18 | @Named
19 | @ViewScoped
20 | public class DashboardBean implements Serializable {
21 |
22 | private DashboardModel model;
23 |
24 | public DashboardBean() {
25 | model = new DefaultDashboardModel();
26 |
27 | DashboardColumn column1 = new DefaultDashboardColumn();
28 | DashboardColumn column2 = new DefaultDashboardColumn();
29 | DashboardColumn column3 = new DefaultDashboardColumn();
30 |
31 | column1.addWidget("calculator");
32 | column1.addWidget("calendar");
33 | column1.addWidget("contact");
34 |
35 | column2.addWidget("dictionary");
36 |
37 | column3.addWidget("weather");
38 | column3.addWidget("translation");
39 |
40 | model.addColumn(column1);
41 | model.addColumn(column2);
42 | model.addColumn(column3);
43 | }
44 |
45 | public void handleReorder(DashboardReorderEvent event) {
46 | MessageUtil.addInfoMessageWithoutKey("Reordered: " + event.getWidgetId(),
47 | "Item index: " + event.getItemIndex() + ", Column index: " + event.getColumnIndex() + ", Sender column index: " + event.getSenderColumnIndex());
48 | }
49 |
50 | public DashboardModel getModel() {
51 | return model;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter3/editor.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 | Rich Text Editing with the Editor
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter4/nestedLayout.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 | Nested layout – layout in layout
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter11/AjaxCallbackParamBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter11;
2 |
3 | import org.primefaces.context.RequestContext;
4 |
5 | import javax.faces.application.FacesMessage;
6 | import javax.faces.component.UIInput;
7 | import javax.faces.context.FacesContext;
8 | import javax.faces.event.ActionEvent;
9 | import javax.faces.view.ViewScoped;
10 | import javax.inject.Named;
11 | import java.io.Serializable;
12 |
13 | /**
14 | * AjaxCallbackParamBean
15 | *
16 | * @author Oleg Varaksin / last modified by $Author: $
17 | * @version $Revision: 1.0 $
18 | */
19 | @Named
20 | @ViewScoped
21 | public class AjaxCallbackParamBean implements Serializable {
22 |
23 | private String name;
24 |
25 | public void save(ActionEvent ae) {
26 | RequestContext requestContext = RequestContext.getCurrentInstance();
27 |
28 | String message;
29 | FacesMessage.Severity severity;
30 | UIInput input = (UIInput) ae.getComponent().findComponent("name");
31 |
32 | if ("PrimeFaces Cookbook".equals(name)) {
33 | message = "All right!";
34 | severity = FacesMessage.SEVERITY_INFO;
35 |
36 | requestContext.addCallbackParam("validName", true);
37 | input.setValid(true);
38 | } else {
39 | message = "Name is wrong, try again";
40 | severity = FacesMessage.SEVERITY_ERROR;
41 |
42 | requestContext.addCallbackParam("validName", false);
43 | input.setValid(false);
44 | }
45 |
46 | FacesMessage msg = new FacesMessage(severity, message, null);
47 | FacesContext.getCurrentInstance().addMessage(null, msg);
48 | }
49 |
50 | public String getName() {
51 | return name;
52 | }
53 |
54 | public void setName(String name) {
55 | this.name = name;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter10/extendBvCsv.xhtml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
12 |
13 |
15 |
17 |
19 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter6/breadcrumb.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 | Breadcrumb with icon for the root link
12 |
13 |
14 |
15 |
16 |
17 |
20 |
23 |
24 |
25 | Breadcrumb with text for the root link
26 |
27 |
28 |
29 |
30 |
31 |
34 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/converter/DetailedCarConverter.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.converter;
2 |
3 | /**
4 | * User: mertcaliskan
5 | * Date: 7/9/12
6 | */
7 |
8 | import org.apache.commons.lang3.StringUtils;
9 | import org.primefaces.cookbook.model.chapter5.DetailedCar;
10 |
11 | import javax.faces.component.UIComponent;
12 | import javax.faces.context.FacesContext;
13 | import javax.faces.convert.Converter;
14 | import javax.faces.convert.FacesConverter;
15 | import java.util.HashMap;
16 | import java.util.Map;
17 |
18 | @FacesConverter(value = "org.primefaces.cookbook.converter.DetailedCarConverter")
19 | public class DetailedCarConverter implements Converter {
20 |
21 | public static Map cars = new HashMap();
22 |
23 | static {
24 | cars.put("CC", new DetailedCar("CC", 2008, "black", 4));
25 | cars.put("Golf", new DetailedCar("Golf", 1974, "white", 2));
26 | cars.put("Jetta", new DetailedCar("Jetta", 1979, "blue", 5));
27 | cars.put("Passat", new DetailedCar("Passat", 1973, "magenta", 5));
28 | cars.put("Polo", new DetailedCar("Polo", 1975, "brown", 4));
29 | cars.put("Scirocco", new DetailedCar("Scirocco", 1974, "red", 2));
30 | cars.put("Touareg", new DetailedCar("Touareg", 2002, "silver", 7));
31 | }
32 |
33 | public Object getAsObject(final FacesContext fc, final UIComponent component, final String value) {
34 | if (StringUtils.isBlank(value)) {
35 | return null;
36 | }
37 | else {
38 | return cars.get(value);
39 | }
40 | }
41 |
42 | public String getAsString(final FacesContext fc, final UIComponent component, final Object value) {
43 | if (value == null || value.equals("")) {
44 | return "";
45 | } else {
46 | return String.valueOf(((DetailedCar) value).getName());
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter6/checkboxMenu.xhtml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 | Simple SelectCheckboxMenu
9 |
10 |
12 |
13 |
14 |
15 |
16 | Advanced SelectCheckboxMenu with filter and converter
17 |
18 |
19 |
21 |
22 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 | #{color}
34 |
35 |
36 | #{lang}
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter4/gridCSS.xhtml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
14 |
15 |
16 | Responsive layout with Grid CSS
17 |
18 |
19 |
20 |
21 |
1
22 |
1
23 |
1
24 |
1
25 |
1
26 |
1
27 |
1
28 |
1
29 |
1
30 |
1
31 |
1
32 |
1
33 |
34 |
38 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter7/FileBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter7;
2 |
3 | import org.primefaces.cookbook.utils.MessageUtil;
4 | import org.primefaces.event.FileUploadEvent;
5 | import org.primefaces.model.DefaultStreamedContent;
6 | import org.primefaces.model.StreamedContent;
7 | import org.primefaces.model.UploadedFile;
8 |
9 | import javax.faces.view.ViewScoped;
10 | import javax.inject.Named;
11 | import java.io.InputStream;
12 | import java.io.Serializable;
13 | import java.util.List;
14 |
15 | /**
16 | * User: mertcaliskan
17 | * Date: 9/5/12
18 | */
19 | @Named
20 | @ViewScoped
21 | public class FileBean implements Serializable {
22 |
23 | private UploadedFile file;
24 |
25 | private UploadedFile file1;
26 | private UploadedFile file2;
27 |
28 | private StreamedContent downloadFile;
29 |
30 | public FileBean() {
31 | InputStream stream = this.getClass().getResourceAsStream("/chapter7/PFSamplePDF.pdf");
32 | downloadFile = new DefaultStreamedContent(stream, "application/pdf", "PFSample.pdf");
33 | }
34 |
35 | public UploadedFile getFile() {
36 | return file;
37 | }
38 |
39 | public void setFile(UploadedFile file) {
40 | this.file = file;
41 | }
42 |
43 | public UploadedFile getFile1() {
44 | return file1;
45 | }
46 |
47 | public void setFile1(UploadedFile file1) {
48 | this.file1 = file1;
49 | }
50 |
51 | public UploadedFile getFile2() {
52 | return file2;
53 | }
54 |
55 | public void setFile2(UploadedFile file2) {
56 | this.file2 = file2;
57 | }
58 |
59 | public void handleFileUpload(FileUploadEvent event) {
60 | UploadedFile file = event.getFile();
61 | MessageUtil.addInfoMessage("upload.successful", file.getFileName() + " is uploaded.");
62 | }
63 |
64 | public StreamedContent getDownloadFile() {
65 | return downloadFile;
66 | }
67 | }
--------------------------------------------------------------------------------
/src/main/webapp/views/chapter8/snapping.xhtml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
12 |
15 |
16 |
17 |
18 |
20 | I'm with default snap and snap to all edges
21 | of other draggable elements
22 |
23 |
24 |
25 |
27 | I only snap to the outer edges - try with the big box
28 |
29 |
30 |
31 |
33 | I only snap to the inner edges - try with the big box
34 |
35 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter11/TargetableMessagesBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter11;
2 |
3 | import javax.faces.application.FacesMessage;
4 | import javax.faces.context.FacesContext;
5 | import javax.faces.view.ViewScoped;
6 | import javax.inject.Named;
7 | import java.io.Serializable;
8 |
9 | /**
10 | * TargetableMessagesBean
11 | *
12 | * @author Oleg Varaksin / last modified by $Author: $
13 | * @version $Revision: 1.0 $
14 | */
15 | @Named
16 | @ViewScoped
17 | public class TargetableMessagesBean implements Serializable {
18 |
19 | public String addSaveMessage() {
20 | addMessage("save", FacesMessage.SEVERITY_INFO,
21 | "Sample info message",
22 | "First data was successfully saved");
23 | addMessage("save", FacesMessage.SEVERITY_INFO,
24 | "Sample info message",
25 | "Second data was successfully saved");
26 |
27 | return null;
28 | }
29 |
30 | public String addChangeMessage() {
31 | addMessage("change", FacesMessage.SEVERITY_INFO,
32 | "Sample info message",
33 | "Data was successfully changed");
34 |
35 | return null;
36 | }
37 |
38 | public String addDeleteMessage() {
39 | addMessage(null, FacesMessage.SEVERITY_INFO,
40 | "Sample info message",
41 | "Data was successfully deleted");
42 |
43 | return null;
44 | }
45 |
46 | public String addErrorMessage() {
47 | addMessage(null, FacesMessage.SEVERITY_ERROR,
48 | "Sample error message",
49 | "Operation failed");
50 |
51 | return null;
52 | }
53 |
54 | private void addMessage(String key, FacesMessage.Severity severity, String message, String detail) {
55 | FacesMessage msg = new FacesMessage(severity, message, detail);
56 | FacesContext.getCurrentInstance().addMessage(key, msg);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/org/primefaces/cookbook/controller/chapter11/DialogFrameworkBean.java:
--------------------------------------------------------------------------------
1 | package org.primefaces.cookbook.controller.chapter11;
2 |
3 | import org.primefaces.context.RequestContext;
4 | import org.primefaces.event.SelectEvent;
5 |
6 | import javax.faces.application.FacesMessage;
7 | import javax.faces.context.FacesContext;
8 | import javax.faces.view.ViewScoped;
9 | import javax.inject.Named;
10 | import java.io.Serializable;
11 | import java.util.ArrayList;
12 | import java.util.HashMap;
13 | import java.util.List;
14 | import java.util.Map;
15 |
16 | @Named
17 | @ViewScoped
18 | public class DialogFrameworkBean implements Serializable {
19 |
20 | private String bookName;
21 |
22 | public void showRatingDialog() {
23 | Map options = new HashMap();
24 | options.put("modal", true);
25 | options.put("draggable", false);
26 | options.put("resizable", false);
27 | options.put("contentWidth", 500);
28 | options.put("contentHeight", 100);
29 | options.put("includeViewParams", true);
30 |
31 | Map> params = new HashMap>();
32 | List values = new ArrayList();
33 | values.add(bookName);
34 | params.put("bookName", values);
35 |
36 | RequestContext.getCurrentInstance().openDialog("/views/chapter11/bookRating", options, params);
37 | }
38 |
39 | public void onDialogReturn(SelectEvent event) {
40 | Object rating = event.getObject();
41 | FacesMessage message = new FacesMessage(
42 | FacesMessage.SEVERITY_INFO,
43 | "You rated the book with " + rating,
44 | null);
45 |
46 | FacesContext.getCurrentInstance().addMessage(null, message);
47 | }
48 |
49 | public String getBookName() {
50 | return bookName;
51 | }
52 |
53 | public void setBookName(String bookName) {
54 | this.bookName = bookName;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------