Results 1 to 7 of 7

Thread: CRUD application with Wicket

  1. #1
    Join Date
    Apr 2010
    Posts
    81

    CRUD application with Wicket

    For several days I am working now with the development of a no further exceptional CRUD application with Wicket. While the concept behind it is somewhat disconcerting at first when you come out of the Struts-stock, but you learn the component-based approach to estimate quickly. But is this or that question. Maybe I have problems in the eyes, but one point me so far is not clear how this "problem solve" with a wicket in the rule: I often want parts of the page displays only if certain conditions are met, with Struts So a simple If statement in the JSP. If I have understood correctly Wicket, dissolve this by outsourcing the relevant parts into components and shows them or not. However, this is very tedious after a while, particularly when it is very often little things like links. for every time a not inconsiderable extra piece of code must be written. If it just so, then I will accept it that way. However, I would be interested but how they solve the everyday that have something to do even more with Wicket.

  2. #2
    Join Date
    Dec 2008
    Posts
    183

    Re: CRUD application with Wicket

    You can instantiate the component always as an anonymous inner class and then the method isVisible () override. The following example will help you :
    Code:
    add (new Label ("comp", "Invisible") ( 
    public boolean isVisible () ( 
    return false; 
    ) 
    ));

  3. #3
    Join Date
    Dec 2008
    Posts
    202

    Re: CRUD application with Wicket

    But actually I now have not answered the real question. I think that accurately represents the use of components of the stimulus. Instead of packing all sorts of components on one "side", one can simply replace existing components as required:
    Code:
    someContainer = new WebMarkupContainer ("someContainer"); 
    someContainer.setOutputMarkupId (true); 
    add (someContainer); 
    
    someContainer.replaceWith (anotherContainer); 
    someContainer = anotherContainer;

  4. #4
    Join Date
    Dec 2008
    Posts
    161

    Re: CRUD application with Wicket

    I unfortunately (?) No experience with Wicket, but plenty of Tapestry, also a component based framework. In Tapestry, it is an if component in Wicket it is not. But a For / Repeat component, there must be yes or not? So if there is a possibility to share, from the Template / Component Body repeated arbitrarily many times, then you can repeat it zero times.

  5. #5
    Join Date
    Jan 2009
    Posts
    140

    Re: CRUD application with Wicket

    The add () method is in final wicket, so there's nothing to override. According to my interpretation of the wicket-philosophy, I would propose, concepts such as session and request only once removed from the memory - of course you need them, but to come up with the component it is based on this trip are a hindrance. Ackley's solution was the best, here is a WebMarkupContainer:
    Code:
    add (new WebMarkupContainer ("comp") ( 
    public boolean isVisible () ( 
    return false; 
    ) 
    )

  6. #6
    Join Date
    Jul 2006
    Posts
    442

    Re: CRUD application with Wicket

    Note the 'Pull' model, ie the current state of isVisible () is calculated again and again. Often attached to it so complicated technical requirements, such as:
    Code:
     public boolean isVisible () ( 
    isSuperUser return () & & (isLeapYear () | | foo.getBar (). getBaz ());
    )
    Since there is no danger that once the call to setVisible () was forgotten.

  7. #7
    Join Date
    Nov 2008
    Posts
    996

    Re: CRUD application with Wicket

    Since I am decidedly different opinion. If I understand correctly the application's well so dependent on one side of a component of any condition show times, sometimes not display. If you wanted to be regulated under this add (Component) component of the Father, we would have probably produce the component again and again. Obviously, you would need for the two cases provide markup. boolean isVisible () is exactly the place for determining whether a component should be shown. Simple example:
    Code:
     add (new Link ("logoff") ( 
    public boolean isVisible () 
    ( 
    LoginHelper.userIsLoggedIn return (); 
    ) 
    public void onClick () 
    ( 
    LoginHelper.logoff (); 
    ) 
    ));
    So natural and elegant I cannot imagine.

Similar Threads

  1. Replies: 4
    Last Post: 07-04-2012, 07:19 PM
  2. Replies: 5
    Last Post: 07-04-2012, 07:12 PM
  3. Replies: 3
    Last Post: 22-06-2011, 10:38 AM
  4. Replies: 6
    Last Post: 06-03-2011, 10:33 AM
  5. Replies: 1
    Last Post: 21-03-2009, 01:48 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,003,038.83760 seconds with 17 queries