richfaces cdk: rapid jsf component development

65
Rapid JSF Component Development RichFaces CDK

Upload: lukas-fryc

Post on 07-Nov-2014

3.062 views

Category:

Technology


1 download

DESCRIPTION

JSF component libraries provide you with a solid basis for building enterprise UIs as they are covering most common use cases. But what can you do in a case that no existing component fits your project requirements?There are many JavaScript component projects which offer together nearly infinite possibilities. But it might not be evident that leveraging these JavaScript frameworks is as easy as writing plain old HTML code, separating component and page development efforts. But how to wrap these components to fit into JSF eco-system?That’s exactly where RichFaces CDK comes into play.

TRANSCRIPT

Page 1: RichFaces CDK: Rapid JSF Component Development

Rapid JSF Component Development RichFaces CDK

Page 2: RichFaces CDK: Rapid JSF Component Development

JSFComponentLibraries

“...are essential part of JSF ecosystem, deliveringgreat user experience”

Page 3: RichFaces CDK: Rapid JSF Component Development

ProperLevel ofAbstraction

“Components encapsulates complexlogic, which is exposed with easy to useinterface”

Page 4: RichFaces CDK: Rapid JSF Component Development

BuildingBlocks

“Components inter-cooperatesin order to build complex applicationlogic.”

Page 5: RichFaces CDK: Rapid JSF Component Development

“But what to do when is same component missing in your favoritecomponent library?”

Page 6: RichFaces CDK: Rapid JSF Component Development

Bootstrap

“Fortunately there are many JavaScript widgetlibraries, which can be simplyused just for your needs”

Page 7: RichFaces CDK: Rapid JSF Component Development

Only for JavaScript kiddies?

Page 8: RichFaces CDK: Rapid JSF Component Development

“It's very simply to use these widgets,they have as accessible API as JSF components”

Page 9: RichFaces CDK: Rapid JSF Component Development

““It is like going to library and choosingIt is like going to library and choosingbook which best fit in your mood -book which best fit in your mood -you can go and reuse JS widget”you can go and reuse JS widget”

Page 10: RichFaces CDK: Rapid JSF Component Development

4waysof reusingJavaScriptwidgets

Page 11: RichFaces CDK: Rapid JSF Component Development

#1 Direct JavaScript#2 JSF Component#3 JSF Composite Component#4 RichFaces CDK

Page 12: RichFaces CDK: Rapid JSF Component Development

#1 Direct JavaScript

Page 13: RichFaces CDK: Rapid JSF Component Development

““Imagine big JSF application where you startedImagine big JSF application where you startedincorporating JavaScript widgets:incorporating JavaScript widgets:looks inconsistent and hardly readable.”looks inconsistent and hardly readable.”

Page 14: RichFaces CDK: Rapid JSF Component Development

#2 JSF Component

Page 15: RichFaces CDK: Rapid JSF Component Development

““Let's build custom JSF component...”Let's build custom JSF component...”

Page 16: RichFaces CDK: Rapid JSF Component Development

What is component?

Page 17: RichFaces CDK: Rapid JSF Component Development

What is component?

Tag

Page 18: RichFaces CDK: Rapid JSF Component Development

““Tag is representation of the componentTag is representation of the componentin the page template code”in the page template code”

Page 19: RichFaces CDK: Rapid JSF Component Development

What is component?

Tag Component Interface

Page 20: RichFaces CDK: Rapid JSF Component Development

Component

““The component provides interfaceThe component provides interfacefor changing its configuration”for changing its configuration”

Page 21: RichFaces CDK: Rapid JSF Component Development

““This is source code of JSF componentThis is source code of JSF componenta4j:commandLink”a4j:commandLink”

Page 22: RichFaces CDK: Rapid JSF Component Development

““This is source code of JSF componentThis is source code of JSF componenta4j:commandLink.”a4j:commandLink.”

““Let's look at the fragment.”Let's look at the fragment.”

Page 23: RichFaces CDK: Rapid JSF Component Development

““The component is interface with list attributes,The component is interface with list attributes,Represented as getters/setters of the componentRepresented as getters/setters of the componentclass”class”

““Each getter and setter just delegates to StateHelperEach getter and setter just delegates to StateHelperto keep the state of the component between subsequentto keep the state of the component between subsequentrequests”requests”

Page 24: RichFaces CDK: Rapid JSF Component Development

What is component?

Tag Component Interface Renderer

Page 25: RichFaces CDK: Rapid JSF Component Development

Component

Renderer

““A renderer is responsible for translatingA renderer is responsible for translatingthe component to the page representationthe component to the page representationand then encoding the user input back to theand then encoding the user input back to thecomponent instance”component instance”

Page 26: RichFaces CDK: Rapid JSF Component Development

““A renderer is as verbose asA renderer is as verbose ascomponent code,component code,let's look at the sample oflet's look at the sample ofh:dataTable component'sh:dataTable component'scode”code”

Page 27: RichFaces CDK: Rapid JSF Component Development

““The renderer uses ResponseWriterThe renderer uses ResponseWriterto add elements, attributes and textto add elements, attributes and textcontent to the page.”content to the page.”

“The Java representation of the“The Java representation of therenderer is very verbose, which leadsrenderer is very verbose, which leadsto readability and maintainabilityto readability and maintainabilityconcerns.”concerns.”

Page 28: RichFaces CDK: Rapid JSF Component Development

What is component?

Tag Component interface Renderer XML descriptors

● taglib.xml

Page 29: RichFaces CDK: Rapid JSF Component Development

Component

Renderer

““taglib.xml descriptor is responsible for bindingtaglib.xml descriptor is responsible for bindingthe component from the page templatethe component from the page templateto the component class”to the component class”

Page 30: RichFaces CDK: Rapid JSF Component Development
Page 31: RichFaces CDK: Rapid JSF Component Development

What is component?

Tag Component interface Renderer XML descriptors

● taglib.xml● faces-config.xml

Page 32: RichFaces CDK: Rapid JSF Component Development

Component

Renderer

JSF

““Faces-config.xml registers component into JSF ecosystem”Faces-config.xml registers component into JSF ecosystem”

Page 33: RichFaces CDK: Rapid JSF Component Development
Page 34: RichFaces CDK: Rapid JSF Component Development

What is component?

Tag Component interface Renderer XML descriptors

● faces-config.xml● taglib.xml

Documentation

Page 35: RichFaces CDK: Rapid JSF Component Development

““Documentation is necessary for easiness of reuse of the components.”Documentation is necessary for easiness of reuse of the components.”

Page 36: RichFaces CDK: Rapid JSF Component Development

But developing and maintaining all of these informationsBut developing and maintaining all of these informationsis not really the way how to develop componentsis not really the way how to develop componentsin the big scale.in the big scale.

Page 37: RichFaces CDK: Rapid JSF Component Development

#2 Composite Components

Page 38: RichFaces CDK: Rapid JSF Component Development

Composite Components

● JSF2 feature● Provides XML representation● Allowing to write

● HTML directly● Or compose JSF components

● Developer needs to provide● Interface● Implementation

Page 39: RichFaces CDK: Rapid JSF Component Development

Rapid Turnaround

● In the Development stage of the project● The composite component can be reloaded● Just with change of the source

Page 40: RichFaces CDK: Rapid JSF Component Development

But...

Page 41: RichFaces CDK: Rapid JSF Component Development

Immature / Incomplete

● CC have still issues:● Partial state saving

– JAVASERVERFACES-2040● AJAX

– JAVASERVERFACES-1825● Submitted UIInput gets lost

– JAVASERVERFACES-1991

Page 42: RichFaces CDK: Rapid JSF Component Development

CC works great for composition of components

Page 43: RichFaces CDK: Rapid JSF Component Development

But they don't replace full-fledged component development

Page 44: RichFaces CDK: Rapid JSF Component Development

Full-Fledged Development?

Tag XML descriptors

● faces-config.xml● taglib.xml

Component interface Renderer Documentation

“So it means we need to get stuck withfull-fledged component development?”

Page 45: RichFaces CDK: Rapid JSF Component Development

What we actually need?

Tag XML descriptors

● faces-config.xml● taglib.xml

Component interface Renderer (XML) Documentation

“Let's imagine that the most of the informationsare duplicates, which are actually expressedby Component interface”

Page 46: RichFaces CDK: Rapid JSF Component Development

““And at this point, you recognize that some toolkitAnd at this point, you recognize that some toolkitmay be needed to do the job!”may be needed to do the job!”

Page 47: RichFaces CDK: Rapid JSF Component Development

RichFaces CDKComponent Development Kit

““Which is exactly what RichFaces CDK offers!”Which is exactly what RichFaces CDK offers!”

Page 48: RichFaces CDK: Rapid JSF Component Development

RichFaces CDK

● Renderer● XML Templates● with syntax very close to Composite Components

● Generated in the build-time● with Convention-over-Configuration in mind

Page 49: RichFaces CDK: Rapid JSF Component Development

But it is build-time tool, right?But it is build-time tool, right?Is it not too heavy-weight to use in development?Is it not too heavy-weight to use in development?

Page 50: RichFaces CDK: Rapid JSF Component Development

Rapid Turnaround

● You can just use your IDE● And let Java Hot Deployment solutions to do

the job● JRebel works very nice here

Page 51: RichFaces CDK: Rapid JSF Component Development

Resource Development

● But Resources are as needed to develop rapidly as component/renderer code● JavaScript● CSS

● Hot Deployment● using JSF application Development stage

Page 52: RichFaces CDK: Rapid JSF Component Development

Development Demo

Page 53: RichFaces CDK: Rapid JSF Component Development

Bootstrap

“Nothing prevents you to wrap all those libraries!”

Page 54: RichFaces CDK: Rapid JSF Component Development

Date-picker Development Demo

Page 55: RichFaces CDK: Rapid JSF Component Development

Let's wrap those widgets!

Page 56: RichFaces CDK: Rapid JSF Component Development

Right level of abstraction

● Let's take● favorite UI widget● or favorite widget set

● Expose it to JSF

Page 57: RichFaces CDK: Rapid JSF Component Development

Don't reinvent a wheel!

● When you want RichFaces component bend to use for your needs...● Take the component from GitHub

● Fork the component● It's just matter of one click with GitHub!

● Make it work as you need

Page 58: RichFaces CDK: Rapid JSF Component Development

Publish Your Work

● Let others● review it● find bugs

● Cooperate with others● More knowledge● Get bugs fixed

Page 59: RichFaces CDK: Rapid JSF Component Development

The Open Source WayRichFaces Sandbox

““And when you want to be part of the successfulAnd when you want to be part of the successfulcommunity, you can go and open the source!”community, you can go and open the source!”

““That's exactly how RichFaces Sandbox works.”That's exactly how RichFaces Sandbox works.”

Page 60: RichFaces CDK: Rapid JSF Component Development

“The community contributions are hosted on the GitHub.You can reuse them for your needs!”

Page 61: RichFaces CDK: Rapid JSF Component Development

Bootstrap

“RichFaces team is investigating integrationIn direction of several of open-sourceJavaScript UI widgets.”

“The RichFaces Sandbox is used as part of this effort.”

Page 62: RichFaces CDK: Rapid JSF Component Development

References

bit.ly/rf-cdk

bit.ly/rf-planet

bit.ly/rf-forums

@RichFaces, #RichFaces, @LFryc

#richfaces – irc.freenode.net

Page 63: RichFaces CDK: Rapid JSF Component Development

Enjoy the Rich User Experience

Page 64: RichFaces CDK: Rapid JSF Component Development

@LFRYCBIT.LY/RF-PLANET

THANK YOU!

Page 65: RichFaces CDK: Rapid JSF Component Development

““Photographs used in presentationPhotographs used in presentationhave been authored by various authors,have been authored by various authors,published under Creative Commons license”published under Creative Commons license”

http://www.flickr.com/photos/lonelyplanetexchange/2416006280/http://www.flickr.com/photos/davidbolton/4454944721/http://www.flickr.com/photos/bjvs/4283146424/http://www.flickr.com/photos/egansnow/288478628/http://www.flickr.com/photos/negativz/74267002/http://www.flickr.com/photos/kyknoord/5333012356/http://www.flickr.com/photos/wilhei/109403306/http://www.flickr.com/photos/kalmyket/691478431/http://www.flickr.com/photos/friarsbalsam/4609210182/http://www.flickr.com/photos/paul_lowry/2266388742/http://www.flickr.com/photos/breatheindigital/4689159475/http://www.flickr.com/photos/eschipul/206714304/