At constructor time, the panel still isn't 'added' to the page, so the
feedback list cannot be retrieved. In your case, you could alter the
model you provide to the attribute modifier, making the evaluation
'lazy':

if(feedbackul!=null) {
    add(new AttributeModifier("class", true, new ReadOnlyModel() {
        public Object getObject() {
            if(anyMessage()) {
                // provide own algorithm here
                return "feedbackULINFO";
            } else {
                return "feedbackULNONE";
            }
        }}));
    }
}

This way, you can even 'not' show the ul in the css:

feedbackULNONE { display : none; }

Martijn

On 11/27/05, Nick Heudecker <[EMAIL PROTECTED]> wrote:
> I tried making my own CSSFeedbackPanel and I'm running into the
> following Exception:
>
> Caused by: java.lang.IllegalStateException: No Page found for
> component [MarkupContainer [Component id = messages, page = <No Page>,
> path = feedback:feedbackul:messages.FeedbackPanel$MessageListView]]
>     at wicket.Component.getPage(Component.java:756)
>     at 
> wicket.feedback.FeedbackMessagesModel.onGetObject(FeedbackMessagesModel.java:81)
>     at 
> wicket.model.AbstractDetachableModel.getObject(AbstractDetachableModel.java:100)
>     at wicket.Component.getModelObject(Component.java:703)
>     at 
> wicket.markup.html.panel.FeedbackPanel.getCurrentMessages(FeedbackPanel.java:256)
>     at 
> wicket.markup.html.panel.FeedbackPanel.anyMessage(FeedbackPanel.java:221)
>     at 
> wicket.markup.html.panel.FeedbackPanel.anyMessage(FeedbackPanel.java:208)
>
> Here's the code:
>
> public class CSSFeedbackPanel extends FeedbackPanel {
>
>     public CSSFeedbackPanel(final String id) {
>         super(id);
>         WebMarkupContainer feedbackul = (WebMarkupContainer) 
> get("feedbackul");
>         if (feedbackul != null) {
>             if (anyMessage()) {
>                 System.out.println("Has Messages");
>                 /*
>                 if (anyMessage(FeedbackMessage.INFO)) {
>                     System.out.println("Has INFO Messages");
>                     feedbackul.add(new AttributeModifier("class",
> true, new Model("feedbackulINFO")));
>                 }
>                 else if (anyMessage(FeedbackMessage.ERROR)) {
>                     System.out.println("Has ERROR Messages");
>                     feedbackul.add(new AttributeModifier("class",
> true, new Model("feedbackulERROR")));
>                 }
>                 */
>             }
>         }
>     }
>
> }
>
> It breaks at the call to anyMessages().  Any suggestions?
>
>
> On 10/25/05, Nick Heudecker <[EMAIL PROTECTED]> wrote:
> > I think I'll end up creating my own FeedbackPanel subclass.
> >
> >  Is there any way to have messages only display for one page refresh?
> > Currently, the messages stay visible on the page.
> >
> >
> >
> > On 10/25/05, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > > You could assign a class on the element you attach the panel on. Like
> > > <div wicket:id="panel" class="myfeedback">..</div> and then in css:
> > > .myfeedback ul { ... }.
> > >
> > > Another option, for more flexibility, is to extend FeebackPanel, and
> > > provide your own markup. Basically you would copy n paste the
> > > feedbackpanel markup, but you'd also provide the class you want for
> > > the ul element.
> > >
> > > Eelco
> > >
> > >
> > > On 10/24/05, Nick Heudecker < [EMAIL PROTECTED]> wrote:
> > > > It only adds that CSS for the individual items.  Not for the containing
> > <UL>
> > > > element.
> > > >
> > > >
> > > > On 10/24/05, Andrew Berman < [EMAIL PROTECTED]> wrote:
> > > > > A FeedbackPanel will automatically add a class of
> > feedbackPanel<Feedback
> > > > Level>  to all li elements.   So, for example, you can create a CSS
> > class
> > > > called feedbackPanelERROR.  If you don't like the naming of the classes,
> > you
> > > > can just override the getCSSClass() method.
> > > > >
> > > > > --Andrew
> > > > >
> > > > >
> > > > >
> > > > > On 10/24/05, Nick Heudecker < [EMAIL PROTECTED] > wrote:
> > > > > > Is it possible to add a CSS style to the <UL> tag used by the
> > > > FeedbackPanel?  My panels are either going to display INFO messages or
> > ERROR
> > > > messages.
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.Net email is sponsored by the JBoss Inc.
> > > Get Certified Today * Register for a JBoss Training Course
> > > Free Certification Exam for All Training Attendees Through End of 2005
> > > Visit http://www.jboss.com/services/certification for
> > more information
> > > _______________________________________________
> > > Wicket-user mailing list
> > > Wicket-user@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> >
> >
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


--
Living a wicket life...

Martijn Dashorst - http://www.jroller.com/page/dashorst

Wicket 1.1 is out: http://wicket.sourceforge.net/wicket-1.1


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to