Sure, sounds good. Can you make a proposal please? It's kind of where
we started in the first versions, but then again, much was different
and this time that can work.

Eelco


On 3/31/07, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
> I don't like the addition of the 4 bytes to the component. Apparently
> the usecase is pretty rare (only discovered after 2 years of
> production use), and this will increase memory usage considerably for
> a small benefit.
>
> Isn't a message queue that isn't bound to a component but to the
> current thread, that registers the object that receives the feedback,
> and is queried at the end of the request to store any messages at the
> appropriate place?
>
> Martijn
>
> On 4/1/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > Fix it like this:
> >
> > Index: 
> > /Users/eelcohillenius/Documents/workspace_wicket/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java
> > ===================================================================
> > --- 
> > /Users/eelcohillenius/Documents/workspace_wicket/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java
> >       (revision
> > 524461)
> > +++ 
> > /Users/eelcohillenius/Documents/workspace_wicket/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java
> >       (working
> > copy)
> > @@ -33,6 +33,7 @@
> >  import wicket.authorization.UnauthorizedActionException;
> >  import wicket.behavior.IBehavior;
> >  import wicket.feedback.FeedbackMessage;
> > +import wicket.feedback.FeedbackMessages;
> >  import wicket.markup.ComponentTag;
> >  import wicket.markup.MarkupException;
> >  import wicket.markup.MarkupStream;
> > @@ -457,6 +458,8 @@
> >         private static final int FLAG_ATTACHING = 0x40000000;
> >         private static final int FLAG_DETACHING = 0x80000000;
> >
> > +       /** List of feedback messages to add. */
> > +       private transient List feedbackMessages;
> >
> >         /** Basic model IModelComparator implementation for normal object 
> > models */
> >         private static final IModelComparator defaultModelComparator = new
> > IModelComparator()
> > @@ -662,7 +665,7 @@
> >          */
> >         public final void debug(final String message)
> >         {
> > -               getPage().getFeedbackMessages().debug(this, message);
> > +               add(new FeedbackMessage(this, message, 
> > FeedbackMessage.DEBUG));
> >         }
> >
> >         /**
> > @@ -685,7 +688,7 @@
> >          */
> >         public final void error(final Serializable message)
> >         {
> > -               getPage().getFeedbackMessages().error(this, message);
> > +               add(new FeedbackMessage(this, message, 
> > FeedbackMessage.ERROR));
> >         }
> >
> >         /**
> > @@ -696,7 +699,7 @@
> >          */
> >         public final void fatal(final String message)
> >         {
> > -               getPage().getFeedbackMessages().fatal(this, message);
> > +               add(new FeedbackMessage(this, message, 
> > FeedbackMessage.FATAL));
> >         }
> >
> >         /**
> > @@ -1235,7 +1238,7 @@
> >          */
> >         public final void info(final String message)
> >         {
> > -               getPage().getFeedbackMessages().info(this, message);
> > +               add(new FeedbackMessage(this, message, 
> > FeedbackMessage.INFO));
> >         }
> >
> >         /**
> > @@ -2376,7 +2379,7 @@
> >          */
> >         public final void warn(final String message)
> >         {
> > -               getPage().getFeedbackMessages().warn(this, message);
> > +               add(new FeedbackMessage(this, message, 
> > FeedbackMessage.WARNING));
> >         }
> >
> >         /**
> > @@ -2734,6 +2737,7 @@
> >                 {
> >                         setFlag(FLAG_ATTACHING, true);
> >                         setFlag(FLAG_ATTACHED, true);
> > +
> >                         onAttach();
> >                         if (getFlag(FLAG_ATTACHING))
> >                         {
> > @@ -3023,6 +3027,40 @@
> >         }
> >
> >         /**
> > +        * Called by the containing page to enable components to add their
> > +        * temporarily stored feedback messages to the messages instance of 
> > the
> > +        * page.
> > +        *
> > +        * @param msgs
> > +        *            The feedback messages. Components can add messages to 
> > it
> > +        */
> > +       final void addFeedback(final FeedbackMessages msgs)
> > +       {
> > +               // add deferred messages if any
> > +               if (feedbackMessages != null)
> > +               {
> > +                       for (Iterator i = feedbackMessages.iterator(); 
> > i.hasNext();)
> > +                       {
> > +                               msgs.add((FeedbackMessage)i.next());
> > +                       }
> > +                       // reset
> > +                       feedbackMessages = null;
> > +               }
> > +               if (this instanceof MarkupContainer)
> > +               {
> > +                       MarkupContainer container = (MarkupContainer)this;
> > +                       container.visitChildren(new IVisitor()
> > +                       {
> > +                               public Object component(Component component)
> > +                               {
> > +                                       component.addFeedback(msgs);
> > +                                       return IVisitor.CONTINUE_TRAVERSAL;
> > +                               }
> > +                       });
> > +               }
> > +       }
> > +
> > +       /**
> >          * Gets the component at the given path.
> >          *
> >          * @param path
> > @@ -3163,6 +3201,21 @@
> >         }
> >
> >         /**
> > +        * Adds a feedback message to be added to the page later.
> > +        *
> > +        * @param msg
> > +        *            message
> > +        */
> > +       private final void add(FeedbackMessage msg)
> > +       {
> > +               if (feedbackMessages == null)
> > +               {
> > +                       feedbackMessages = new ArrayList();
> > +               }
> > +               feedbackMessages.add(msg);
> > +       }
> > +
> > +       /**
> >          * Finds the root object for an IModel
> >          *
> >          * @param model
> > Index: 
> > /Users/eelcohillenius/Documents/workspace_wicket/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/feedback/FeedbackMessages.java
> > ===================================================================
> > --- 
> > /Users/eelcohillenius/Documents/workspace_wicket/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/feedback/FeedbackMessages.java
> >       (revision
> > 524461)
> > +++ 
> > /Users/eelcohillenius/Documents/workspace_wicket/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/feedback/FeedbackMessages.java
> >       (working
> > copy)
> > @@ -311,7 +311,7 @@
> >          * @param message
> >          *            the message
> >          */
> > -       final void add(FeedbackMessage message)
> > +       public final void add(FeedbackMessage message)
> >         {
> >                 if (log.isDebugEnabled())
> >                 {
> > Index: 
> > /Users/eelcohillenius/Documents/workspace_wicket/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Page.java
> > ===================================================================
> > --- 
> > /Users/eelcohillenius/Documents/workspace_wicket/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Page.java
> >    (revision
> > 524461)
> > +++ 
> > /Users/eelcohillenius/Documents/workspace_wicket/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Page.java
> >    (working
> > copy)
> > @@ -341,6 +341,9 @@
> >                 // Set form component values from cookies
> >                 setFormComponentValuesFromCookies();
> >
> > +               // adds temporarily stored feedback messages
> > +               addFeedback(getFeedbackMessages());
> > +
> >                 // First, give priority to IFeedback instances, as they 
> > have to
> >                 // collect their messages before components like ListViews
> >                 // remove any child components
> >
> >
> > That works fine. It's 4 extra bytes for the temp messages pointer and
> > a little bit of extra overhead, but I think it is just wrong we don't
> > support setting messages anywhere. Even if it is not a common case,
> > every once in a while people will Serban will stumble on it, and I
> > think it is just not very consistent to not support it.
> >
> > One issue with this patch is that there are a couple of unit tests
> > that presume too much of the internal workings of the framework and
> > fail. Fixing those shouldn't be too hard though.
> >
> > Eelco
> >
> >
> > On 3/31/07, Matej Knopp <[EMAIL PROTECTED]> wrote:
> > > Why don't we fix this how? Errors are stored in page. In component
> > > constructor you don't know the page. What could work would be a
> > > temporary array in component that would be copied to page in onattach,
> > > but i don't really this is a common usecase.
> > >
> > > If you need to add errors, just do it in onAttach.
> > >
> > > -Matej
> > >
> > > On 3/31/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > > > Ok, I see.
> > > >
> > > >         public final void error(final Serializable message)
> > > >         {
> > > >                 getPage().getFeedbackMessages().error(this, message);
> > > >         }
> > > >
> > > > Why don't we fix this?
> > > >
> > > > Eelco
> > > >
> > > >
> > > > On 3/31/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > > > it works fine because you are calling error on a page and not on a
> > > > > component. errors are stored at page-level.
> > > > >
> > > > > -igor
> > > > >
> > > > >
> > > > >
> > > > > On 3/31/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > Weird problem. Can you give us a stack trace please? I tried this:
> > > > > >
> > > > > > Index:
> > > > > /Users/eelcohillenius/Documents/workspace_wicket/wicket-1.x/jdk-1.5/wicket-examples/src/main/java/wicket/examples/helloworld/HelloWorld.java
> > > > > >
> > > > > ===================================================================
> > > > > > ---
> > > > > /Users/eelcohillenius/Documents/workspace_wicket/wicket-1.x/jdk-1.5/wicket-examples/src/main/java/wicket/examples/helloworld/HelloWorld.java
> > > > >        (revision
> > > > > > 524461)
> > > > > > +++
> > > > > /Users/eelcohillenius/Documents/workspace_wicket/wicket-1.x/jdk-1.5/wicket-examples/src/main/java/wicket/examples/helloworld/HelloWorld.java
> > > > >        (working
> > > > > > copy)
> > > > > > @@ -17,7 +17,7 @@
> > > > > > package wicket.examples.helloworld ;
> > > > > >
> > > > > > import wicket.examples.WicketExamplePage;
> > > > > > -import wicket.markup.html.basic.Label;
> > > > > > +import wicket.markup.html.panel.FeedbackPanel;
> > > > > >
> > > > > > /**
> > > > > >   * Everybody's favorite example!
> > > > > > @@ -31,6 +31,7 @@
> > > > > >          */
> > > > > >         public HelloWorld()
> > > > > >         {
> > > > > > -               add(new Label("message", "Hello World!"));
> > > > > > +               error("test");
> > > > > > +               add(new FeedbackPanel("message"));
> > > > > >         }
> > > > > > }
> > > > > > \ No newline at end of file
> > > > > >
> > > > > > And that works fine...
> > > > > >
> > > > > > Eelco
> > > > > >
> > > > > >
> > > > > > On 3/31/07, serban.balamaci <[EMAIL PROTECTED]> wrote:
> > > > > > >
> > > > > > > Hi.
> > > > > > >
> > > > > > > I have a problem in that inside the constructor of a page(panel
> > > > > actually) i
> > > > > > > invoke a stored procedure which needs to get the model for the 
> > > > > > > panel.
> > > > > The
> > > > > > > stored procedure may throw an error message. The error message 
> > > > > > > should be
> > > > > > > seen by the user, he can understand what he did wrong. So inside 
> > > > > > > the
> > > > > > > constructor i have something like this:
> > > > > > >
> > > > > > > public PanelConstructor() {
> > > > > > >       try {
> > > > > > >       } catch(UserPresentableException e) {
> > > > > > >            error(e.getMessage);
> > > > > > >       }
> > > > > > > }
> > > > > > >
> > > > > > > The problem is that if the error is thrown i get a No page found 
> > > > > > > for
> > > > > > > component. I understand that the cause of the error is that the 
> > > > > > > "error
> > > > > > > component" not being instantiated because of the constructor not 
> > > > > > > being
> > > > > > > finished(or i think that's the cause).
> > > > > > >
> > > > > > > Any ideas of solutions that i can implement?
> > > > > > > I know that i could set wicket to production instead of 
> > > > > > > development and
> > > > > get
> > > > > > > rid of the stack trace. The problem is that i would like to keep 
> > > > > > > the
> > > > > error
> > > > > > > message - to show the error message back to the user-. Should i 
> > > > > > > instead
> > > > > of
> > > > > > > doing error(e.getMessage) rethrow the message inside a new defined
> > > > > exception
> > > > > > > and have a custom error page for that exception in which i would 
> > > > > > > show
> > > > > only
> > > > > > > the message of the error.
> > > > > > >
> > > > > > > Is there any option that would keep me from treating the errors 
> > > > > > > in the
> > > > > > > constructor other than how i treat an error from a button push?
> > > > > > >
> > > > > > > Thanks.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > View this message in context:
> > > > > http://www.nabble.com/error%28...%29-No-page-found-for-component-tf3497125.html#a9767935
> > > > > > > Sent from the Wicket - User mailing list archive at Nabble.com.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > -------------------------------------------------------------------------
> > > > > > > Take Surveys. Earn Cash. Influence the Future of IT
> > > > > > > Join SourceForge.net's Techsay panel and you'll get the chance to 
> > > > > > > share
> > > > > your
> > > > > > > opinions on IT & business topics through brief surveys-and earn 
> > > > > > > cash
> > > > > > >
> > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > > > > > _______________________________________________
> > > > > > > Wicket-user mailing list
> > > > > > > [email protected]
> > > > > > >
> > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > > > > >
> > > > > >
> > > > > >
> > > > > -------------------------------------------------------------------------
> > > > > > Take Surveys. Earn Cash. Influence the Future of IT
> > > > > > Join SourceForge.net's Techsay panel and you'll get the chance to 
> > > > > > share
> > > > > your
> > > > > > opinions on IT & business topics through brief surveys-and earn cash
> > > > > >
> > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > > > > _______________________________________________
> > > > > > Wicket-user mailing list
> > > > > > [email protected]
> > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > > > >
> > > > >
> > > > >
> > > > > -------------------------------------------------------------------------
> > > > > Take Surveys. Earn Cash. Influence the Future of IT
> > > > > Join SourceForge.net's Techsay panel and you'll get the chance to 
> > > > > share your
> > > > > opinions on IT & business topics through brief surveys-and earn cash
> > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > > > _______________________________________________
> > > > > Wicket-user mailing list
> > > > > [email protected]
> > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > > >
> > > > >
> > > >
> > > > -------------------------------------------------------------------------
> > > > Take Surveys. Earn Cash. Influence the Future of IT
> > > > Join SourceForge.net's Techsay panel and you'll get the chance to share 
> > > > your
> > > > opinions on IT & business topics through brief surveys-and earn cash
> > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > > _______________________________________________
> > > > Wicket-user mailing list
> > > > [email protected]
> > > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > > >
> > >
> > > -------------------------------------------------------------------------
> > > Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to share 
> > > your
> > > opinions on IT & business topics through brief surveys-and earn cash
> > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > _______________________________________________
> > > Wicket-user mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share your
> > opinions on IT & business topics through brief surveys-and earn cash
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>
> --
> Learn Wicket at ApacheCon Europe: http://apachecon.com
> Join the wicket community at irc.freenode.net: ##wicket
> Wicket 1.2.5 will keep your server alive. Download Wicket now!
> http://wicketframework.org
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to