Building A More Responsive Design JSF Bootstrap 3

2y ago
131 Views
3 Downloads
5.70 MB
28 Pages
Last View : 9d ago
Last Download : 3m ago
Upload by : Jerry Bolanos
Transcription

JSF Bootstrap 3Building a more responsive designKCDC PresentationBrandon KlimekThursday, June 25, 2015 at 10:10 amAgility. Delivered.www.sixthpoint.com

Titanium SponsorsPlatinum SponsorsGold Sponsors

PrecursorState of the WebWhere are we headed? lity. Delivered.

AgendaIntroduction Java Server FacesBootstrap 3 Bootstrap CSS grid and other form classesFont Awesome Best practice to implement in JSFLeveraging Bootstrap with JSF Bootstrap validation using component bindingsResponsive Bootstrap modalsWhat are they? How do you use them together?Agility. Delivered.

Example AppAgility. Delivered.

Example AppAgility. Delivered.

Example AppLots of other JSF component librariesCover best practices Bootstrap validation using component bindingsFont awesome icons usageBootstrap CSS grid and other form classesResponsive Bootstrap modalsAgility. Delivered. PrimefacesIcefacesRichfaces

Example AppSoftware Used Netbeans 8 TomEE 1.7 MySQL JSF 2.0 Deltaspike 1.4 (used for viewscoped) Bootstrap 3 Font Awesome 4.2Agility. Delivered.

Java Server FacesWhat is JSF?Java specification for building component-based user interfaces for web applications. It gives you the tools tocommunicate with java backing beans. JSF has all the javascript behind the scenes, creates the endpoints from JSFmanaged beans, and wires it all together.A brief history JSF 1.0 - 2004 Starting point, major drawback that got alot of criticism was no inline html tags. In the nextrelease JSF 1.1 bug release the ability was added using the f:verbatim JSF 1.2 - 2006 allowed for plain HTML tags to be inline without the verbatim tag JSF from JSP completely detached lacked conversation scope, which caused many developers to abuse session scopeJSF 2.0 - 2009 ajax support, what all modern applications are using now (that or web sockets) facelets introduced to create composite components - reusable codeThe weight is put on the server “Java SERVER faces” whereas newer javascript libraries put the weight on the client.Agility. Delivered.

Bootstrap CSS JSWhat is Bootstrap?Bootstrap is a out of the box, ready to use CSS framework. Very little customization should be needed. The frameworkmakes core decisions for you by bundling helpful premade css components; forms, buttons, menus, etc. It was built withmobile-first in mind.What are some benefits? Flat trendy design Makes design simpler, no longer have to fill your time with complex layouts Improves performance when browser has to draw all elements to the screen Grid system It allows you to target different screen densities using a 4 level grid system: http://getbootstrap.com/css/#gridAgility. Delivered.

Bootstrap CSS JSScreen DensitiesAgility. Delivered.

Bootstrap CSS JSResponsive DesignRow with 2 columns divided equally div class "row" div class "col-md-6" left column /div div class "col-md-6" right column /div /div Row with 2 columns divided in a 1:3 ratio div class "row" div class "col-md-3" left column /div div class "col-md-9" right column /div /div Agility. Delivered.

Bootstrap CSS JSAgility. Delivered.

Bootstrap CSS JSAgility. Delivered.

Font AwesomeWhat is FA FA?An open source icon font kit. It does not have to be used with Bootstrap, but it most commonly is. It is used so much,that the standard glyphicons that come with Bootstrap are being removed in Bootstrap 4 because they are not beingused.Facts 519 pictographic icons Easily scalable vector graphicsTraditional Usage i class "fa fa-check" /i This becomes annoying when using JSFUgly Code h:commandLink action "#{myBean.backing}" styleClass "btn btn-default" iclass "fa fa-check" /i Create /h:commandLink Agility. Delivered.

Font AwesomeCheat SheetUsing the content property generated content can placed :before and :after wesome/cheatsheet/Agility. Delivered.

Font AwesomeWhat is FA FA?CSS Submit Class.act-submit:before {font-family: FontAwesome;display: inline-block;content: "\f00c";padding-right: .4em;}Ugly Code h:commandLink action "#{myBean.backing}" styleClass "btn btn-default" iclass "fa fa-check" /i Create /h:commandLink New Code h:commandLink value "Create" action "#{myBean.backing}" styleClass "btnbtn-default act-submit"/ Agility. Delivered.

Agenda UpdateIntroduction Java Server FacesBootstrap 3 Bootstrap CSS grid and other form classesFont Awesome Best practice to implement in JSFLeveraging Bootstrap with JSF Bootstrap validation using component bindingsResponsive Bootstrap modalsAgility. Delivered.

Java Server FacesComponent BindingsJSF provides a simple way to access component properties. Gives you access #{mybinding.clientId}, #{mybinding.value},#{mybinding.valid}, #{mybinding.submittedValue} properties in the EL scope.2 ways to use component bindings1. Bind the component to the current view scope2. Bind the component to a UIComponent object on the backing bean, then perform validation / manipulationTypical Usage (Primefaces) p:outputLabel for "firstname" value "Firstname:" / p:inputText id "firstname" value "#{userView.firstname}" required "true" label "Firstname" f:validateLength minimum "2" / /p:inputText This has too much magic for me.Agility. Delivered.

Java Server FacesUsing Bootstrap 3 classesEx. Binding to View Only div class "form-group #{!name.valid ? 'has-error' : 'none'}" label for "name" Enter name /label h:inputText value "#{myController.name}" binding "#{name}" id "name" styleClass "form-control" f:validateLength minimum "4" maximum "6" / /h:inputText /div Bootstrap CSS.form-group: Provides optimum spacing for label / inputs.has-error: validation style for a error. Also has other validationstates such as .has-warning, and .has-success.form-control: Provides formatting to input , textarea , and select elements.Agility. Delivered.

Java Server FacesLocation.xhtml pageEx. Binding to UIComponent h:selectOneMenu binding "#{state}" value "#{myBean.selectedState}" f:selectItems value "#{myBean.states}" / /h:selectOneMenu h:inputText value "#{myBean.city}" f:attribute name "state" value "#{state.value}" / f:validator validatorId "locationValidator" / /h:inputText idator")public class LocationValidator implements Validator {@Overridepublic void validate(FacesContext context, UIComponent component,Object value) {Object item component.getAttributes().get("state");}}Agility. Delivered.

Bootstrap JSFAgility. Delivered.

Bootstrap JSFComposite ComponentA composite component is a special type of template that acts as a component. It allows forcode to easily be reused.1.Define a namespace with the xhtmlxmlns:sat s"2.Create composite component in resources folder3.Implement the composite component4.Use the composite component on the view sat:statesModal id "statePreview" contentId "content"modalTitle "Preview State" selectedState "#{taxesViewController.current.state}"/ Agility. Delivered.

Bootstrap JSFComposite ComponentImplement the composite component composite:interface composite:attribute name "contentId" required "true"/ composite:attribute name "selectedState" required "true"/ composite:attribute name "modalTitle" required "true"/ /composite:interface composite:implementation // . Modal code omitted /composite:implementation Agility. Delivered.

Bootstrap JSFCreating a ModalBootstrap HTML Code div class "modal fade" div class "modal-dialog" div class "modal-content" div class "modal-header" button type "button" class "close" data-dismiss "modal" aria-label "Close" span aria-hidden "true" × /span /button h4 class "modal-title" Modal title /h4 /div div class "modal-body" p One fine body… /p /div div class "modal-footer" button type "button" class "btn btn-default" data-dismiss "modal" Close /button button type "button" class "btn btn-primary" Save changes /button /div /div !-- /.modal-content -- /div !-- /.modal-dialog -- /div !-- /.modal -- Agility. Delivered.

Bootstrap JSFCreating a ModalBootstrap Usage button type "button" class "btn btn-primary btn-lg" data-toggle "modal" data-target "#myModal" Launch demo modal /button Bootstrap uses custom data attributes data-toggle or data-target. Data-toggle tells Bootstrap JS what it is going to do Data-target tells Bootstrap JS what element or ID to perform onJavascript ('#modal-content').modal('show');Agility. Delivered.

Pro & ConsWhy would I use JSF?Pros: Large community Integrates well with Java EE Ajax component re rendering is simple and easyCons: Server side presentation layer Component design hides functionality from developers; creates a layer of abstraction which can lead tooverhead.Side Note: Client Side Validation based on JSR-303 Bean Validation specification has been implemented inPrimefaces and Richfaces.Bottom Line: JSF provides a quick and easy way to implement a UI given your requirements fit within theabilities of the provided components.Agility. Delivered.

Questions?Agility. Delivered.

What is JSF? Java Server Faces Java specification for building component-based user interfaces for web applications. It gives you the tools to communicate with java backing beans. JSF has all the javascript behind the scenes, creates the endpoints from JSF managed beans, and wires it all together. Agility. D

Related Documents:

alization, visualization authoring, and responsive web design. Responsive Web Design While responsive visualization is still a nascent area, respon-sive web design has received more attention. Patterns and principles of responsive web design have been studied [15, 16]. HTML5 and CSS3 are popular standards to implement responsive designs [9].

alization, visualization authoring, and responsive web design. Responsive Web Design While responsive visualization is still a nascent area, respon-sive web design has received more attention. Patterns and principles of responsive web design have been studied [15, 16]. HTML5 and CSS3 are popular standards to implement responsive designs [9].

Enterprises 2 i/l nail jigs tibia 4 2 36,000 720 M/s Mian Enterprises 3 recon nail jigs 4 2 36,000 720 M/s Surgiquips Non Responsive Non Responsive . kocher forceps large M/s Mian Enterprises 549.00 Responsive A.M Ortho Local Responsive M/s M.J Marketing & Services (SMC-Pvt) Ltd Non Responsive Non Responsive 26 allis forceps large

1.1. Possible Solutions for Multi-channel Web Design 7 RESPONSIVE WEB DESIGN 7 2.1. Core Ingredients of RWD 8 2.2. Tools for RWD 9 DESIGNING A RESPONSIVE WEB SITE 9 3.1. The Business Case 10 3.2. The Design Approach 10 CREATING A RESPONSIVE SHAREPOINT SITE 14 4.1. Building a SharePoint Master Page 15 4.2. Making the Master Page Responsive 15 4.2.1.

actually pretty easy to implement a responsive layout. (Responsive Images, on the other hand, are an entirely different story). setup Create a new project called responsive-design and a new file called responsive.html. It's the emptiest web page that we've seen in awhile, but it'll help us demonstrate something

that’s what responsive web design is: a possible solution, a way to more fully design for the web’s inherent flexibility. If we’re willing to research the needs of our users, and apply those ingredients carefully, then responsive web design is a powerful approach indeed. Ethan Marcotte, “Responsive Web Design”

Responsive Web Design Ethan Marcottecoined the term responsive web design and . Responsive Web Design (RWD) is a Web design approach aimed at crafting sites to provide an optimal viewing experience, easy reading and navigation with a minimum of resizing, panning, and scrolling, across a wide range of screen sizes and devices.

Keywords Responsive design, pattern, principles, mobile first, relative units . Contents 1 Introduction 1 2 Responsive Web Design 2 3 Principles and Patterns 8 3.1 Mobile First 8 3.2 Relative Unit and Media Query 13 . Although Responsive Web Design is widely known as a feasible solution, the process to