Wednesday, March 28, 2012

Configurator: Add Infromation Message

Add below code to add information message to the page on some ac tion.

 InformationalMessage message= new InformationalMessage("message",runtimeNode);
        runtimeNode.getConfiguration().addInformationalMessage(message);


9 comments:

  1. Thanks for the post!
    Is it also possible to display a validation error message to the user, while the user saves the configuration (with the event binding pre/postConfigSave)?
    I would like to validate the whole configuration after finished and give the user an exception, if its incorrect.

    Thanks and regards,
    Frank

    ReplyDelete
    Replies
    1. hi frank

      yes ,it should work

      you can also make it work,by using Totals and Resources on model or component.

      Delete
    2. Hi Kaushal!

      If it should work, HOW does it work? :)

      If you add an informational message while calling preConfigSave, the user will never see this message, because of the finishing event of the configuration.
      I would like to have a "breaking" event / message, for example a message "you have to change your input values, before you can save your configuration".
      For example, I'm using a method, that fills in the UserStr01. If you save the configuration and have not calling this function, the error message shall be displayed.
      How can I solve such a problem?

      Thanks and regards,
      Frank

      Delete
    3. hi frank

      for this you need to make a custom validation failure.

      what you will do is...

      import oracle.apps.cz.cio.CustomValidationFailure;

      using this class,you will regsiter a failure.

      CustomValidationFailure failure = ("your messages"==null)?null:new CustomValidationFailure("your messages",(RuntimeNode) rtNode, true);

      after that you need to get the validator.

      and update teh validationfailure

      rtNode.getConfiguration().updateValidationFailure(failure).

      you need to write a CX for this.

      Delete
  2. Hi Kaushal,

    thanks for your explanation! It was my failure, because I've used still the postConfigSave binding.
    With the preConfigSummary and the preConfigSave event it works perftectly.

    Thanks so much!

    Regards,
    Frank

    ReplyDelete
  3. Hi Kaushal,

    if you want to remove this CustomValidationMessages on a node, I have written the following method:


    private void removeValidationFailuresOnNode(final IRuntimeNode node) {
    final Collection c = node.getConfiguration().getValidationFailures();

    for (final Iterator i = c.iterator(); i.hasNext();) {
    final Object o = i.next();

    if (o instanceof CustomValidationFailure) {
    ((CustomValidationFailure)o).removeCustomValidationFailure();
    }
    }
    }


    It's working correctly, but is there a handier method to remove them? ;)

    Great Blog by the way!! Keep going!

    Regards,
    Frank

    ReplyDelete
  4. hi frank

    I have not tried it, but i will forward the code,you can try it yourself.
    give me your email id.

    Regards,
    Kaushal

    ReplyDelete
    Replies
    1. frankiefigs(at)gmx-topmail(dot)de

      Thanks and regards,
      Frank

      Delete