Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.0-beta1, 1.3.0-beta2, 1.3.0-beta3
    • Fix Version/s: 1.3.0-beta4
    • Component/s: wicket
    • Labels:
      None

      Description

      Currently, org.apache.wicket.feedback.FeedbackMessage defines six message levels:

      DEBUG, ERROR, FATAL, INFO, UNDEFINED, WARNING

      Could you add one more level to FeedbackMessage called SUCCESS?

      My web application needs to display 3 types of messages to our end users: success messages, info messages, and error messages. I'm planning to use CSS to style the success messages differently from the info messages.

      Related javadocs: http://www.wicketstuff.org/wicket13doc/org/apache/wicket/feedback/FeedbackMessage.html

        Issue Links

          Activity

          Hide
          Sean Sullivan added a comment -

          Thanks Igor!

          Show
          Sean Sullivan added a comment - Thanks Igor!
          Hide
          Eelco Hillenius added a comment -

          No problem with that.

          Show
          Eelco Hillenius added a comment - No problem with that.
          Hide
          Sean Sullivan added a comment -

          Before closing this issue, I'd like to know if the Wicket developers would be willing to change the constant int values in FeedbackMessage.

          Can you use 100, 200, 300, 400, 500 instead of 1, 2, 3, 4, 5?

          The reason being is that I may want the int value for my custom level to be located between the existing int values.

          BTW, the level value is used in the isLevel method to check if a level is greater than or equal to another int:

          public final boolean isLevel(int level)

          { return (getLevel() >= level); }

          FeedbackMessage.java

          /** Constant for debug level. */
          public static final int DEBUG = 1;

          /** Constant for error level. */
          public static final int ERROR = 4;

          /** Constant for fatal level. */
          public static final int FATAL = 5;

          /** Constant for info level. */
          public static final int INFO = 2;

          /**

          • Constant for an undefined level; note that components might decide not to
          • render anything when this level is used.
            */
            public static final int UNDEFINED = 0;

          /** Constant for warning level. */
          public static final int WARNING = 3;

          Show
          Sean Sullivan added a comment - Before closing this issue, I'd like to know if the Wicket developers would be willing to change the constant int values in FeedbackMessage. Can you use 100, 200, 300, 400, 500 instead of 1, 2, 3, 4, 5? The reason being is that I may want the int value for my custom level to be located between the existing int values. BTW, the level value is used in the isLevel method to check if a level is greater than or equal to another int: public final boolean isLevel(int level) { return (getLevel() >= level); } FeedbackMessage.java /** Constant for debug level. */ public static final int DEBUG = 1; /** Constant for error level. */ public static final int ERROR = 4; /** Constant for fatal level. */ public static final int FATAL = 5; /** Constant for info level. */ public static final int INFO = 2; /** Constant for an undefined level; note that components might decide not to render anything when this level is used. */ public static final int UNDEFINED = 0; /** Constant for warning level. */ public static final int WARNING = 3;
          Hide
          Igor Vaynberg added a comment -

          so then you ok with closing this?

          Show
          Igor Vaynberg added a comment - so then you ok with closing this?
          Hide
          Sean Sullivan added a comment -

          For now, I implemented my own custom subclass of FeedbackMessage:

          import java.io.Serializable;

          import org.apache.wicket.Component;

          public class FeedbackMessage
          extends org.apache.wicket.feedback.FeedbackMessage
          {
          public static final int SUCCESS = 101;

          /**

          • @param reporter
          • @param message
          • @param level
            */
            public FeedbackMessage(Component reporter, Serializable message, int level) { super(reporter, message, level); }

          public String getLevelAsString()
          {
          if (this.getLevel() == SUCCESS)

          { return "SUCCESS"; }

          else

          { return super.getLevelAsString(); }

          }

          public boolean isSuccess()

          { return (SUCCESS == getLevel()); }

          }

          Show
          Sean Sullivan added a comment - For now, I implemented my own custom subclass of FeedbackMessage: import java.io.Serializable; import org.apache.wicket.Component; public class FeedbackMessage extends org.apache.wicket.feedback.FeedbackMessage { public static final int SUCCESS = 101; /** @param reporter @param message @param level */ public FeedbackMessage(Component reporter, Serializable message, int level) { super(reporter, message, level); } public String getLevelAsString() { if (this.getLevel() == SUCCESS) { return "SUCCESS"; } else { return super.getLevelAsString(); } } public boolean isSuccess() { return (SUCCESS == getLevel()); } }
          Hide
          Sean Sullivan added a comment -

          For my application, an INFO message would be "The system is accepting votes until 5 PM on Friday"

          A SUCCESS message would be "Your vote has been recorded. Thank you for voting."

          I'd like to avoid mapping WARNING to info and INFO to success.

          Show
          Sean Sullivan added a comment - For my application, an INFO message would be "The system is accepting votes until 5 PM on Friday" A SUCCESS message would be "Your vote has been recorded. Thank you for voting." I'd like to avoid mapping WARNING to info and INFO to success.
          Hide
          Igor Vaynberg added a comment -

          i dont know if we should do that, i believe you can already map this as

          error - error
          warning - info
          info -success

          at least thats how ive been using them so far

          what is the difference between your info and success?

          Show
          Igor Vaynberg added a comment - i dont know if we should do that, i believe you can already map this as error - error warning - info info -success at least thats how ive been using them so far what is the difference between your info and success?

            People

            • Assignee:
              Igor Vaynberg
              Reporter:
              Sean Sullivan
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development