SlideShare a Scribd company logo
1 of 51
Download to read offline
Apache Wicket 
                            Deliver your web 
                           application on time
                                         Yoav Hakman
                                     Development Manager 
                                     & Consultant, AlphaCSP

                                                              2
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Agenda

         Overview

         The Wicket Way (Concepts)

         Features

         Demo
                A wicket application
                A custom component

         Q & A

                                                        3
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
From Roi’s JSF presentation:

          JSF 1.2 (JSR 252):
            Shortcomings 
                    Development
                           Customizing components is complicated
                           Exceptions are not descriptive
                           No support for annotations
                    Deployment
                           Unnecessary deployment step
                           Not JEE compliant (packaging, DI)
                    Components
                           Missing components
                           Limited component functionality (DataGrid)
                    Security
                           No security model (managed beans, resources)
                    Ajax
                                                                           4
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Overview
        • Component based Java web framework
               • rich component suite
        • Open source (Apache 2 Licensed)
        • Wicket makes developing web­apps simple and 
          enjoyable again
                    Flat learning curve
               •
                    No XML configuration files
               •
                    Very easy to create and reuse components!
               •
                    Pure Object Oriented!
               •



                                                                5
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
A little bit of history


                                                         1.2
          0.9                 1.0                 1.1                         1.3




   10/2004                                   10/2005              07/2007

                       06/2005                          05/2006             11/2007




                                                                                      6
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Good Documentation




        Wicket wiki:
               http://cwiki.apache.org/WICKET/


        Wicket Examples (Live Demo + sources):
               http://www.wicketstuff.org/wicket13/
                                                        7
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
From Roi’s JSF presentation:
         JSF 2.0 (JSR 314):
         Purpose
                    Max. development productivity (IDE)
               
                    Min. maintenance complexity
               
                    Integrate with other web tech.
               
                    More responsive UI (Ajax)
               
         Requirements
                    Ease of development
               
                    New Features & Fixes
               
                    Performance & Scalability
               
                    Technology Adoption
               
                                                          8
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Agenda

         Overview

         The Wicket Way (Concepts)

         Features

         Demo
                A wicket application
                A custom component

         Q & A

                                                        9
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Wicket Templates

        • HTML Templates contains 
               • static presentation code (markup)
               • wicket:id  attribute­ placeholder for wicket 
                 components

        • Forces the developer to keep “clean templates”

        • The html designer has no knowledge regarding 
          the business domain objects
               • vs jsf backing bean


                                                                 10
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Templates
                          <table> 
    JSP:                     <tr> 
                              <c:forEach var=quot;itemquot; items=quot;${sessionScope.list}quot;> 
                                <td> 
                                  <c:out value=quot;item.namequot; /> 
                                </td> 
                              </c:forEach> 
                            </tr> 
                          </table> 

                                 <h:dataTable value=quot;#{list}quot; var=quot;itemquot;> 
    JSF:                             <h:column> 
                                         <h:outputText value=quot;#{item.name}quot;/> 
                                     </h:column> 
                                 </h:dataTable> 
                                                                                         
                                    <table> 
                                      <tr> 
    WICKET:                             <td wicket:id=”list”> 
                                           <span wicket:id=”name”>power point</span> 
                                        </td> 
                                      </tr> 
                                    </table> 
                                                                         
                                                                                            11
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Wicket Templates

        • Most existing frameworks require special 
          HTML code.
        • fully compliant with the XHTML standard, 
          so you can use:
                      • Macromedia Dreamweaver
                      • Microsoft Front Page
                      • Any other HTML editor




                                                        12
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
If you know Java and HTML you already know a 
                       lot about Wicket!!




                                                        13
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Linking Java and HTML

        public class HelloWorld extends WebPage { 
         
            public HelloWorld() { 
                add(new Label(quot;messagequot;, quot;Hello World!quot;)); 
            } 
        } 


                                   Identifier           Model


    <html> 
    <body> 
        <span wicket:id=quot;messagequot; id=quot;messagequot;>to be replaced</span> 
    </body> 
    </html> 
     

                                                                        14
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Linking Java and HTML

               HTML and Java files resides in the same 
                classpath package




                                                          15
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Object Oriented

           • Object Oriented
               • Great for Java developers 
               • Everything is done in Java
               • Swing like programming …

       Form form = new Form(quot;customerformquot;,  
                             new CompoundPropertyModel(new Customer())); 
       TextField zipCodeComponent = new TextField(quot;zipquot;); 
       zipCodeComponent.add(new ZipCodeValidator()); 
       form.add(zipCodeComponent); 
        




                                                                            16
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Application Class
      public class DemoApplication extends WebApplication { 
       
          @Override public Class getHomePage() { 
              return HomePage.class; 
          } 
       
          @Override protected void init() { 
              getMarkupSettings().setCompressWhitespace(false); 
          } 
                                                                    
        • Settings
                    Application Settings
               –
                    Debug Settings
               –
                    Exception Settings
               –
                    Markup Settings
               –
                    Page Settings
               –
                    RequestCycle Settings
               –
                    Security Settings
               –
                    Session Settings
               –
                                                                       18
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Application Class

        • The only xml configuration is the web.xml configuration!



    <filter> 
        <filter­name>DemoApplication</filter­name> 
        <filter­class>org.apache.wicket.protocol.http.WicketFilter</filter­ 
        <init­param> 
            <param­name>applicationClassName</param­name> 
            <param­value>com.alphacsp.DemoApplication</param­value> 
        </init­param> 
        <init­param> 
            <param­name>configuration</param­name> 
            <param­value>development</param­value> 
            <!­­ <param­value>deployment</param­value> ­­> 
        </init­param> 
    </filter> 
                                                                           
                                                                              19
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
From Roi’s JSF presentation:

          JSF 1.2 (JSR 252):
            Shortcomings 
                    Development
                           Customizing components is complicated
                       Exceptions are not descriptive
                       No support for annotations
                    Deployment
                       Unnecessary deployment step
                       Not JEE compliant (packaging, DI)
                    Components
                       Missing components
                       Limited component functionality (DataGrid)
                    Security
                       No security model (managed beans, resources)

                                                                       20
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Customizing Components

            • Object Oriented Basics – how to extend:
                   • By Inheritance
                   • By Delegation
        public class PasswordTextField extends TextField { 
         
            public PasswordTextField(String id) { 
                super(id); 
            } 
         
            /** 
             * Processes the component tag 
             */   
            protected final void onComponentTag(final ComponentTag tag) { 
                super.onComponentTag(tag); 
                tag.put(quot;valuequot;, quot;quot;); 
            } 
         
        } 
                                                                              
                                                                             21
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Customizing Components

     Component Hook Methods
public class MyComponent extends Component { 
 
    protected void onAfterRender() { 
    } 
 
    protected void onBeforeRender() { 
    } 
 
    protected void onComponentTag(ComponentTag tag) { 
    } 
 
    protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) 
    } 
 
    protected void onModelChanged() { 
    } 
 
    protected void onRender(MarkupStream markupStream) { 
         
    } 
} 

                                                                                  22
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Customizing Components

            • Object Oriented Basics – how to extend:
                   • By Inheritance
                   • By Delegation




                                                        23
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Customizing Components

    public class SimpleAttributeModifier extends AbstractBehavior { 
        /** 
         * Called any time a component that has this behavior registered is  
         * rendering the component tag. 
         */ 
        public void onComponentTag(final Component component,  
                                   final ComponentTag tag) 
            { 
                   if (isEnabled(component)) 
                   { 
                           tag.getAttributes().put(attribute, value); 
                   } 
            } 
     
                                                                                 




                                                                            24
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Customizing Components

        SimpleAttributeModifer
    TextField myText = new TextField(quot;myTextquot;, new Model(quot;fooquot;)); 
    myText.add(new SimpleAttributeModifier(quot;classquot;, quot;greenquot;)); 
                                                                          
    With the following markup: 
     
    <input type=quot;textquot; wicket:id=quot;myTextquot;/> 
     
    Would be rendered as: 
     
    <input type=”text” wicket:id=”myText” name=”myText” class=”green” 
           value=”foo”/> 
     

                                                                             25
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Customizing Components

  item.add(new AbstractBehavior() { 
    /** 
     * Called any time a component that has this behavior registered is  
     * rendering the component tag. 
     */ 
    public void onComponentTag(Component component, ComponentTag tag) { 
      String css = (((Item) component).getIndex() % 2 == 0) ? quot;evenquot;:quot;oddquot;; 
      tag.put(quot;classquot;, css); 
    } 
  }); 
   
      Output:
      <tr class=“odd”>…</tr> 
      <tr class=“even”>…</tr> 
                                                         




                                                                         26
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Customizing Components

              • Behaviors are used for:
                             • Modifying attributes
                             • Adding Java Script events
                             • Adding Ajax Events



   TextField field = new TextField(quot;textfieldquot;, inputModel); 
   add(field); 
    
   field.add(new AjaxFormComponentUpdatingBehavior(quot;onblurquot;) { 
       protected void onUpdate(AjaxRequestTarget target) { 
       // do something here 
       } 
   }); 
                                                                   
                                                                      27
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Agenda

         Overview

         The Wicket Way (Concepts)

         Features

         Demo
                A wicket application
                A custom component

         Q & A

                                                        28
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
From Roi’s JSF presentation:

          JSF 1.2 (JSR 252):
            Shortcomings 
                    Development
                       Customizing components is complicated
                       Exceptions are not descriptive
                       No support for annotations
                    Deployment
                       Unnecessary deployment step
                       Not JEE compliant (packaging, DI)

                    Components
                           Missing components
                           Limited component functionality (DataGrid)
                       Security
                   
                          No security model (managed beans, resources)



                                                                          29
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Editable table




                                                        30
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Table




                                                        31
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Editable Tree Table




                                                        32
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
DatePicker




                                                        33
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Captcha




                                                        34
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Modal Window




                                                        35
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
File Upload




                                                        36
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Tabbed Panel



   <span wicket:id=quot;tabsquot;  
      class=quot;tabpanelquot;>[tabbed panel]</span> 
                                              List<ITab> tabs = new ArrayList<ITab>(); 
                                              tabs.add(new AbstractTab(new Model(quot;first tabquot;)) { 
                                                  public Panel getPanel(String panelId) { 
                                                      return new TabPanel1(panelId); 
                                                  } 
                                              }); 
                                              tabs.add(new AbstractTab(new Model(quot;second tabquot;)) { 
                                                  public Panel getPanel(String panelId) { 
                                                      return new TabPanel2(panelId); 
                                                  } 
                                              }); 
                                              tabs.add(new AbstractTab(new Model(quot;third tabquot;)) { 
                                                  public Panel getPanel(String panelId) { 
                                                      return new TabPanel3(panelId); 
                                                  } 
                                              }); 
                                                                                                     37
                                              add(new TabbedPanel(quot;tabsquot;, tabs)); 
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Auto Complete Component




                                                        38
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Models

     • Holds the values of the components
     • Mediate between the view and domain 
       layer



                                                            public interface IModel { 
                                                         
                                                                Object getObject(); 
                                                         
                                                                void setObject(Object object); 
                                                         
                                                            } 
                                                                                                   
                                                                                                      39
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Models
      public class HelloWorld extends WebPage { 
       
          public HelloWorld() { 
              add(new Label(quot;messagequot;, quot;Hello World!quot;)); 
          } 
      } 
                                                                       
      public class HelloWorld extends WebPage { 
       
          public HelloWorld() { 
              add(new Label(quot;messagequot;, new Model(quot;Hello World!quot;)); 
          } 
      } 
                                                                       
                                                                       
                   The data is constant 

                                                                          40
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Models

 public class HelloWorld extends WebPage { 
  
     public HelloWorld() { 
         add(new TextField(quot;namequot;, new Model(person.getName())); 
     } 
 } 
                                                                      
                                                                      
        • Immutable, not dynamic
        • Can produce null pointer exceptions!
               person.getAddress().getCity()



                                                                    41
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Models

    personForm.add(new TextField(quot;personNamequot;, new IModel() { 
                public Object getObject() { 
                    return person.getName(); 
                } 
     
                public void setObject(Serializable serializable) { 
                    person.setName((String) serializable); 
                } 
            })); 

     
        • Dynamic
        • Inconvenient!


                                                                      42
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Models

     new TextField(quot;personNamequot;, new PropertyModel(person, quot;namequot;)); 

                                                                         
        • The expression language is more compact 
          than the analogous Java code 
        • Simpler than to subclass a Model
        • No null pointer exceptions
               – “person.address.city”


                                                                            43
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Models

   Model                                                Description
   Model                                                Wraps a serializable object
   PropertyModel                                        Uses a property expression to 
                                                        dynamically access a property in 
                                                        your domain objects 
   CompoundPropertyModel                                Uses component identidiers as 
                                                        property expressions 

   LoadableDetachableModel                              Used for large data sets
   ResourceModel                                        Used for retrieving messages from 
                                                        resource bundles
   StringResourceModel                                  Adds property expressions and 
                                                        MessageFormat substitutions 
                                                                                             44
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
From Roi’s JSF presentation:

          JSF 1.2 (JSR 252):
            Shortcomings 
                    Development
                       Customizing components is complicated
                           Exceptions are not descriptive
                           No support for annotations
                    Deployment
                       Unnecessary deployment step
                       Not JEE compliant (packaging, DI)
                    Components
                       Missing components
                       Limited component functionality (DataGrid)
                    Security
                       No security model (managed beans, resources)


                                                                       45
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
descriptive exceptions!




                                                        46
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
More Features

        • Ajax Debug Window
               – Shows the ajax request and response
               – Shows exceptions 
        • Integration with other frameworks
                          Spring
                      •
                          Juice
                      •
                          Seam 2.0
                      •
                          Acegi Security
                      •
        • Nice and Secure URL’s

                                                        47
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Sessions

        • Strongly Typed Sessions

    public class MySession extends WebSession { 
       private String myAttribute; 
       private ShoppingCart cart; 
       private UserDetails userDetails; 
     
       public MySession(WebApplication application) { 
          super(application); 
       } 
       // ... getters and setters 
    } 
 

                                                         48
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Localization

             String Resource Search Order:
   •
                         Component
                  •
                         Panel (parent)
                  •
                         Page 
                  •
                         Application
                  •




                                                        49
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Agenda

         Overview

         The Wicket Way (Concepts)

         Features

         Demo
                A wicket application
                A custom component

         Q & A

                                                        50
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
Q&A
                                                        51
Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar

More Related Content

What's hot

Get Rid Of OutOfMemoryError messages
Get Rid Of OutOfMemoryError messagesGet Rid Of OutOfMemoryError messages
Get Rid Of OutOfMemoryError messagesPoonam Bajaj Parhar
 
Jaoo Michael Neale 09
Jaoo Michael Neale 09Jaoo Michael Neale 09
Jaoo Michael Neale 09Michael Neale
 
Visualizing and Analyzing GC Logs with R
Visualizing and Analyzing GC Logs with RVisualizing and Analyzing GC Logs with R
Visualizing and Analyzing GC Logs with RPoonam Bajaj Parhar
 
Whats Cool in Java E 6
Whats Cool in Java E 6Whats Cool in Java E 6
Whats Cool in Java E 6Arun Gupta
 
Making the HTML5 Video element interactive
Making the HTML5 Video element interactiveMaking the HTML5 Video element interactive
Making the HTML5 Video element interactiveCharles Hudson
 
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Bruno Borges
 
企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践Jacky Chi
 
Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7Bruno Borges
 
The Tantric Team: Getting Your Automated Build Groove On
The Tantric Team: Getting Your Automated Build Groove OnThe Tantric Team: Getting Your Automated Build Groove On
The Tantric Team: Getting Your Automated Build Groove OnAtlassian
 
Why should i switch to Java SE 7
Why should i switch to Java SE 7Why should i switch to Java SE 7
Why should i switch to Java SE 7Vinay H G
 
High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
High-Octane Dev Teams: Three Things You Can Do To Improve Code QualityHigh-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
High-Octane Dev Teams: Three Things You Can Do To Improve Code QualityAtlassian
 
Video.js - How to build and HTML5 Video Player
Video.js - How to build and HTML5 Video PlayerVideo.js - How to build and HTML5 Video Player
Video.js - How to build and HTML5 Video Playersteveheffernan
 
Java EE 8: On the Horizon
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the HorizonJosh Juneau
 
Building an HTML5 Video Player
Building an HTML5 Video PlayerBuilding an HTML5 Video Player
Building an HTML5 Video PlayerJim Jeffers
 

What's hot (20)

Get Rid Of OutOfMemoryError messages
Get Rid Of OutOfMemoryError messagesGet Rid Of OutOfMemoryError messages
Get Rid Of OutOfMemoryError messages
 
XPages Mobile, #dd13
XPages Mobile, #dd13XPages Mobile, #dd13
XPages Mobile, #dd13
 
Jaoo Michael Neale 09
Jaoo Michael Neale 09Jaoo Michael Neale 09
Jaoo Michael Neale 09
 
Visualizing and Analyzing GC Logs with R
Visualizing and Analyzing GC Logs with RVisualizing and Analyzing GC Logs with R
Visualizing and Analyzing GC Logs with R
 
The JavaFX Ecosystem
The JavaFX EcosystemThe JavaFX Ecosystem
The JavaFX Ecosystem
 
Whats Cool in Java E 6
Whats Cool in Java E 6Whats Cool in Java E 6
Whats Cool in Java E 6
 
Making the HTML5 Video element interactive
Making the HTML5 Video element interactiveMaking the HTML5 Video element interactive
Making the HTML5 Video element interactive
 
JavaFX Advanced
JavaFX AdvancedJavaFX Advanced
JavaFX Advanced
 
JavaEE 6 tools coverage
JavaEE 6 tools coverageJavaEE 6 tools coverage
JavaEE 6 tools coverage
 
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7
 
企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践
 
Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7
 
The Tantric Team: Getting Your Automated Build Groove On
The Tantric Team: Getting Your Automated Build Groove OnThe Tantric Team: Getting Your Automated Build Groove On
The Tantric Team: Getting Your Automated Build Groove On
 
Why should i switch to Java SE 7
Why should i switch to Java SE 7Why should i switch to Java SE 7
Why should i switch to Java SE 7
 
High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
High-Octane Dev Teams: Three Things You Can Do To Improve Code QualityHigh-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
High-Octane Dev Teams: Three Things You Can Do To Improve Code Quality
 
Video.js - How to build and HTML5 Video Player
Video.js - How to build and HTML5 Video PlayerVideo.js - How to build and HTML5 Video Player
Video.js - How to build and HTML5 Video Player
 
Java EE 8: On the Horizon
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the Horizon
 
Avatar 2.0
Avatar 2.0Avatar 2.0
Avatar 2.0
 
Web Application Defences
Web Application DefencesWeb Application Defences
Web Application Defences
 
Building an HTML5 Video Player
Building an HTML5 Video PlayerBuilding an HTML5 Video Player
Building an HTML5 Video Player
 

Similar to Wicket Deliver Your Webapp On Time

Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008
Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008
Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008Baruch Sadogursky
 
ocejwcd 6 preparation guide
ocejwcd 6 preparation guideocejwcd 6 preparation guide
ocejwcd 6 preparation guideGanesh P
 
Agile Java Testing With Open Source Frameworks
Agile Java Testing With Open Source FrameworksAgile Java Testing With Open Source Frameworks
Agile Java Testing With Open Source FrameworksViraf Karai
 
SCWCD 5 preparation guide
SCWCD 5 preparation guideSCWCD 5 preparation guide
SCWCD 5 preparation guideGanesh P
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Max Andersen
 
atomPub, ruby y la api de 11870
atomPub, ruby y la api de 11870atomPub, ruby y la api de 11870
atomPub, ruby y la api de 11870David Calavera
 
jQuery (MeshU)
jQuery (MeshU)jQuery (MeshU)
jQuery (MeshU)jeresig
 
Ajax World Oracle Ria
Ajax World Oracle RiaAjax World Oracle Ria
Ajax World Oracle Riarajivmordani
 
Ten Man-Years of JavaFX: Real World Project Experiences
Ten Man-Years of JavaFX: Real World Project ExperiencesTen Man-Years of JavaFX: Real World Project Experiences
Ten Man-Years of JavaFX: Real World Project ExperiencesHenrik Olsson
 
From Developer to Production, Promoting your Webservices
From Developer to Production, Promoting your WebservicesFrom Developer to Production, Promoting your Webservices
From Developer to Production, Promoting your Webserviceskingsfleet
 
Scripting Oracle Develop 2007
Scripting Oracle Develop 2007Scripting Oracle Develop 2007
Scripting Oracle Develop 2007Tugdual Grall
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureArun Gupta
 
Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1rajivmordani
 
ocejwsd 6 preparation guide
ocejwsd 6 preparation guideocejwsd 6 preparation guide
ocejwsd 6 preparation guideGanesh P
 
Google AppEngine (GAE/J) - Introduction and Overview from a Java Guy
Google AppEngine (GAE/J) - Introduction and Overview from a Java GuyGoogle AppEngine (GAE/J) - Introduction and Overview from a Java Guy
Google AppEngine (GAE/J) - Introduction and Overview from a Java GuyMax Völkel
 

Similar to Wicket Deliver Your Webapp On Time (20)

Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008
Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008
Wicket Presentation @ AlphaCSP Java Web Frameworks Playoff 2008
 
JavaFX Overview
JavaFX OverviewJavaFX Overview
JavaFX Overview
 
ocejwcd 6 preparation guide
ocejwcd 6 preparation guideocejwcd 6 preparation guide
ocejwcd 6 preparation guide
 
Agile Java Testing With Open Source Frameworks
Agile Java Testing With Open Source FrameworksAgile Java Testing With Open Source Frameworks
Agile Java Testing With Open Source Frameworks
 
SCWCD 5 preparation guide
SCWCD 5 preparation guideSCWCD 5 preparation guide
SCWCD 5 preparation guide
 
GlassFish Embedded API
GlassFish Embedded APIGlassFish Embedded API
GlassFish Embedded API
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
 
Ilog Ria2
Ilog Ria2Ilog Ria2
Ilog Ria2
 
atomPub, ruby y la api de 11870
atomPub, ruby y la api de 11870atomPub, ruby y la api de 11870
atomPub, ruby y la api de 11870
 
jQuery (MeshU)
jQuery (MeshU)jQuery (MeshU)
jQuery (MeshU)
 
Ajax World Oracle Ria
Ajax World Oracle RiaAjax World Oracle Ria
Ajax World Oracle Ria
 
Os Ramani
Os RamaniOs Ramani
Os Ramani
 
Ten Man-Years of JavaFX: Real World Project Experiences
Ten Man-Years of JavaFX: Real World Project ExperiencesTen Man-Years of JavaFX: Real World Project Experiences
Ten Man-Years of JavaFX: Real World Project Experiences
 
From Developer to Production, Promoting your Webservices
From Developer to Production, Promoting your WebservicesFrom Developer to Production, Promoting your Webservices
From Developer to Production, Promoting your Webservices
 
Scripting Oracle Develop 2007
Scripting Oracle Develop 2007Scripting Oracle Develop 2007
Scripting Oracle Develop 2007
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for future
 
Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1
 
ocejwsd 6 preparation guide
ocejwsd 6 preparation guideocejwsd 6 preparation guide
ocejwsd 6 preparation guide
 
SEASR Installation
SEASR InstallationSEASR Installation
SEASR Installation
 
Google AppEngine (GAE/J) - Introduction and Overview from a Java Guy
Google AppEngine (GAE/J) - Introduction and Overview from a Java GuyGoogle AppEngine (GAE/J) - Introduction and Overview from a Java Guy
Google AppEngine (GAE/J) - Introduction and Overview from a Java Guy
 

Recently uploaded

Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort ServiceCall US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Servicecallgirls2057
 
Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Americas Got Grants
 
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptxThe-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptxmbikashkanyari
 
Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...Peter Ward
 
Cyber Security Training in Office Environment
Cyber Security Training in Office EnvironmentCyber Security Training in Office Environment
Cyber Security Training in Office Environmentelijahj01012
 
APRIL2024_UKRAINE_xml_0000000000000 .pdf
APRIL2024_UKRAINE_xml_0000000000000 .pdfAPRIL2024_UKRAINE_xml_0000000000000 .pdf
APRIL2024_UKRAINE_xml_0000000000000 .pdfRbc Rbcua
 
8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR
8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR
8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCRashishs7044
 
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deckPitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deckHajeJanKamps
 
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607dollysharma2066
 
Annual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesAnnual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesKeppelCorporation
 
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCRashishs7044
 
Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.Anamaria Contreras
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCRashishs7044
 
Memorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMMemorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMVoces Mineras
 
International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...ssuserf63bd7
 
MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?Olivia Kresic
 
Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Seta Wicaksana
 
FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607dollysharma2066
 
Independent Call Girls Andheri Nightlaila 9967584737
Independent Call Girls Andheri Nightlaila 9967584737Independent Call Girls Andheri Nightlaila 9967584737
Independent Call Girls Andheri Nightlaila 9967584737Riya Pathan
 

Recently uploaded (20)

Enjoy ➥8448380779▻ Call Girls In Sector 18 Noida Escorts Delhi NCR
Enjoy ➥8448380779▻ Call Girls In Sector 18 Noida Escorts Delhi NCREnjoy ➥8448380779▻ Call Girls In Sector 18 Noida Escorts Delhi NCR
Enjoy ➥8448380779▻ Call Girls In Sector 18 Noida Escorts Delhi NCR
 
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort ServiceCall US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
 
Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...
 
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptxThe-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
 
Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...
 
Cyber Security Training in Office Environment
Cyber Security Training in Office EnvironmentCyber Security Training in Office Environment
Cyber Security Training in Office Environment
 
APRIL2024_UKRAINE_xml_0000000000000 .pdf
APRIL2024_UKRAINE_xml_0000000000000 .pdfAPRIL2024_UKRAINE_xml_0000000000000 .pdf
APRIL2024_UKRAINE_xml_0000000000000 .pdf
 
8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR
8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR
8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR
 
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deckPitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
 
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
 
Annual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesAnnual General Meeting Presentation Slides
Annual General Meeting Presentation Slides
 
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
 
Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.Traction part 2 - EOS Model JAX Bridges.
Traction part 2 - EOS Model JAX Bridges.
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
 
Memorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMMemorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQM
 
International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...
 
MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?
 
Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...
 
FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607
 
Independent Call Girls Andheri Nightlaila 9967584737
Independent Call Girls Andheri Nightlaila 9967584737Independent Call Girls Andheri Nightlaila 9967584737
Independent Call Girls Andheri Nightlaila 9967584737
 

Wicket Deliver Your Webapp On Time

  • 1.
  • 2. Apache Wicket  Deliver your web  application on time Yoav Hakman Development Manager  & Consultant, AlphaCSP 2 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 3. Agenda  Overview  The Wicket Way (Concepts)  Features  Demo  A wicket application  A custom component  Q & A 3 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 4. From Roi’s JSF presentation: JSF 1.2 (JSR 252):  Shortcomings   Development  Customizing components is complicated  Exceptions are not descriptive  No support for annotations  Deployment  Unnecessary deployment step  Not JEE compliant (packaging, DI)  Components  Missing components  Limited component functionality (DataGrid)  Security  No security model (managed beans, resources)  Ajax 4 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 5. Overview • Component based Java web framework • rich component suite • Open source (Apache 2 Licensed) • Wicket makes developing web­apps simple and  enjoyable again Flat learning curve • No XML configuration files • Very easy to create and reuse components! • Pure Object Oriented! • 5 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 6. A little bit of history 1.2 0.9 1.0 1.1 1.3 10/2004 10/2005 07/2007 06/2005 05/2006 11/2007 6 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 7. Good Documentation Wicket wiki: http://cwiki.apache.org/WICKET/ Wicket Examples (Live Demo + sources): http://www.wicketstuff.org/wicket13/ 7 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 8. From Roi’s JSF presentation: JSF 2.0 (JSR 314):  Purpose Max. development productivity (IDE)  Min. maintenance complexity  Integrate with other web tech.  More responsive UI (Ajax)   Requirements Ease of development  New Features & Fixes  Performance & Scalability  Technology Adoption  8 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 9. Agenda  Overview  The Wicket Way (Concepts)  Features  Demo  A wicket application  A custom component  Q & A 9 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 10. Wicket Templates • HTML Templates contains  • static presentation code (markup) • wicket:id  attribute­ placeholder for wicket  components • Forces the developer to keep “clean templates” • The html designer has no knowledge regarding  the business domain objects • vs jsf backing bean 10 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 11. Templates <table>  JSP:    <tr>      <c:forEach var=quot;itemquot; items=quot;${sessionScope.list}quot;>        <td>          <c:out value=quot;item.namequot; />        </td>      </c:forEach>    </tr>  </table>  <h:dataTable value=quot;#{list}quot; var=quot;itemquot;>  JSF:     <h:column>          <h:outputText value=quot;#{item.name}quot;/>      </h:column>  </h:dataTable>    <table>    <tr>  WICKET:     <td wicket:id=”list”>         <span wicket:id=”name”>power point</span>      </td>    </tr>  </table>    11 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 12. Wicket Templates • Most existing frameworks require special  HTML code. • fully compliant with the XHTML standard,  so you can use: • Macromedia Dreamweaver • Microsoft Front Page • Any other HTML editor 12 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 13. If you know Java and HTML you already know a  lot about Wicket!! 13 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 14. Linking Java and HTML public class HelloWorld extends WebPage {        public HelloWorld() {          add(new Label(quot;messagequot;, quot;Hello World!quot;));      }  }  Identifier Model <html>  <body>      <span wicket:id=quot;messagequot; id=quot;messagequot;>to be replaced</span>  </body>  </html>    14 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 15. Linking Java and HTML HTML and Java files resides in the same  classpath package 15 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 16. Object Oriented • Object Oriented • Great for Java developers  • Everything is done in Java • Swing like programming … Form form = new Form(quot;customerformquot;,                         new CompoundPropertyModel(new Customer()));  TextField zipCodeComponent = new TextField(quot;zipquot;);  zipCodeComponent.add(new ZipCodeValidator());  form.add(zipCodeComponent);    16 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 17.
  • 18. Application Class public class DemoApplication extends WebApplication {        @Override public Class getHomePage() {          return HomePage.class;      }        @Override protected void init() {          getMarkupSettings().setCompressWhitespace(false);      }    • Settings Application Settings – Debug Settings – Exception Settings – Markup Settings – Page Settings – RequestCycle Settings – Security Settings – Session Settings – 18 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 19. Application Class • The only xml configuration is the web.xml configuration! <filter>      <filter­name>DemoApplication</filter­name>      <filter­class>org.apache.wicket.protocol.http.WicketFilter</filter­      <init­param>          <param­name>applicationClassName</param­name>          <param­value>com.alphacsp.DemoApplication</param­value>      </init­param>      <init­param>          <param­name>configuration</param­name>          <param­value>development</param­value>          <!­­ <param­value>deployment</param­value> ­­>      </init­param>  </filter>    19 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 20. From Roi’s JSF presentation: JSF 1.2 (JSR 252):  Shortcomings   Development  Customizing components is complicated  Exceptions are not descriptive  No support for annotations  Deployment  Unnecessary deployment step  Not JEE compliant (packaging, DI)  Components  Missing components  Limited component functionality (DataGrid)  Security  No security model (managed beans, resources) 20 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 21. Customizing Components • Object Oriented Basics – how to extend: • By Inheritance • By Delegation public class PasswordTextField extends TextField {        public PasswordTextField(String id) {          super(id);      }        /**       * Processes the component tag       */        protected final void onComponentTag(final ComponentTag tag) {          super.onComponentTag(tag);          tag.put(quot;valuequot;, quot;quot;);      }    }    21 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 22. Customizing Components Component Hook Methods public class MyComponent extends Component {        protected void onAfterRender() {      }        protected void onBeforeRender() {      }        protected void onComponentTag(ComponentTag tag) {      }        protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)      }        protected void onModelChanged() {      }        protected void onRender(MarkupStream markupStream) {                }  }  22 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 23. Customizing Components • Object Oriented Basics – how to extend: • By Inheritance • By Delegation 23 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 24. Customizing Components public class SimpleAttributeModifier extends AbstractBehavior {      /**       * Called any time a component that has this behavior registered is        * rendering the component tag.       */      public void onComponentTag(final Component component,                                  final ComponentTag tag)    {      if (isEnabled(component))      {        tag.getAttributes().put(attribute, value);      }    }      24 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 25. Customizing Components SimpleAttributeModifer TextField myText = new TextField(quot;myTextquot;, new Model(quot;fooquot;));  myText.add(new SimpleAttributeModifier(quot;classquot;, quot;greenquot;));    With the following markup:    <input type=quot;textquot; wicket:id=quot;myTextquot;/>    Would be rendered as:    <input type=”text” wicket:id=”myText” name=”myText” class=”green”         value=”foo”/>    25 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 26. Customizing Components item.add(new AbstractBehavior() {    /**     * Called any time a component that has this behavior registered is      * rendering the component tag.     */    public void onComponentTag(Component component, ComponentTag tag) {      String css = (((Item) component).getIndex() % 2 == 0) ? quot;evenquot;:quot;oddquot;;      tag.put(quot;classquot;, css);    }  });    Output: <tr class=“odd”>…</tr>  <tr class=“even”>…</tr>    26 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 27. Customizing Components • Behaviors are used for: • Modifying attributes • Adding Java Script events • Adding Ajax Events TextField field = new TextField(quot;textfieldquot;, inputModel);  add(field);    field.add(new AjaxFormComponentUpdatingBehavior(quot;onblurquot;) {      protected void onUpdate(AjaxRequestTarget target) {      // do something here      }  });    27 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 28. Agenda  Overview  The Wicket Way (Concepts)  Features  Demo  A wicket application  A custom component  Q & A 28 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 29. From Roi’s JSF presentation: JSF 1.2 (JSR 252):  Shortcomings   Development  Customizing components is complicated  Exceptions are not descriptive  No support for annotations  Deployment  Unnecessary deployment step  Not JEE compliant (packaging, DI)  Components  Missing components  Limited component functionality (DataGrid) Security   No security model (managed beans, resources) 29 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 30. Editable table 30 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 31. Table 31 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 32. Editable Tree Table 32 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 33. DatePicker 33 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 34. Captcha 34 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 35. Modal Window 35 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 36. File Upload 36 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 37. Tabbed Panel <span wicket:id=quot;tabsquot;      class=quot;tabpanelquot;>[tabbed panel]</span>          List<ITab> tabs = new ArrayList<ITab>();          tabs.add(new AbstractTab(new Model(quot;first tabquot;)) {              public Panel getPanel(String panelId) {                  return new TabPanel1(panelId);              }          });          tabs.add(new AbstractTab(new Model(quot;second tabquot;)) {              public Panel getPanel(String panelId) {                  return new TabPanel2(panelId);              }          });          tabs.add(new AbstractTab(new Model(quot;third tabquot;)) {              public Panel getPanel(String panelId) {                  return new TabPanel3(panelId);              }          });  37         add(new TabbedPanel(quot;tabsquot;, tabs));  Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 38. Auto Complete Component 38 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 39. Models • Holds the values of the components • Mediate between the view and domain  layer     public interface IModel {      Object getObject();      void setObject(Object object);        }    39 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 40. Models public class HelloWorld extends WebPage {        public HelloWorld() {          add(new Label(quot;messagequot;, quot;Hello World!quot;));      }  }    public class HelloWorld extends WebPage {        public HelloWorld() {          add(new Label(quot;messagequot;, new Model(quot;Hello World!quot;));      }  }      The data is constant  40 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 41. Models public class HelloWorld extends WebPage {        public HelloWorld() {          add(new TextField(quot;namequot;, new Model(person.getName()));      }  }      • Immutable, not dynamic • Can produce null pointer exceptions! person.getAddress().getCity() 41 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 42. Models personForm.add(new TextField(quot;personNamequot;, new IModel() {              public Object getObject() {                  return person.getName();              }                public void setObject(Serializable serializable) {                  person.setName((String) serializable);              }          }));    • Dynamic • Inconvenient! 42 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 43. Models new TextField(quot;personNamequot;, new PropertyModel(person, quot;namequot;));    • The expression language is more compact  than the analogous Java code  • Simpler than to subclass a Model • No null pointer exceptions – “person.address.city” 43 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 44. Models Model Description Model Wraps a serializable object PropertyModel Uses a property expression to  dynamically access a property in  your domain objects  CompoundPropertyModel Uses component identidiers as  property expressions  LoadableDetachableModel Used for large data sets ResourceModel Used for retrieving messages from  resource bundles StringResourceModel Adds property expressions and  MessageFormat substitutions  44 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 45. From Roi’s JSF presentation: JSF 1.2 (JSR 252):  Shortcomings   Development  Customizing components is complicated  Exceptions are not descriptive  No support for annotations  Deployment  Unnecessary deployment step  Not JEE compliant (packaging, DI)  Components  Missing components  Limited component functionality (DataGrid)  Security  No security model (managed beans, resources) 45 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 46. descriptive exceptions! 46 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 47. More Features • Ajax Debug Window – Shows the ajax request and response – Shows exceptions  • Integration with other frameworks Spring • Juice • Seam 2.0 • Acegi Security • • Nice and Secure URL’s 47 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 48. Sessions • Strongly Typed Sessions public class MySession extends WebSession {     private String myAttribute;     private ShoppingCart cart;     private UserDetails userDetails;       public MySession(WebApplication application) {        super(application);     }     // ... getters and setters  }    48 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 49. Localization String Resource Search Order: • Component • Panel (parent) • Page  • Application • 49 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 50. Agenda  Overview  The Wicket Way (Concepts)  Features  Demo  A wicket application  A custom component  Q & A 50 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar
  • 51. Q&A 51 Copyright AlphaCSP Israel 2007 ­ The JavaEdge Seminar