Package javax.faces.application

Examples of javax.faces.application.FacesMessage


        VariableResolver vr = fc.getApplication().getVariableResolver();
        AdvancedFilter af = (AdvancedFilter) vr.resolveVariable(fc, "advancedFilter");
       
        DataFilterEntry entry = af.getEntry();
        if (entry.getOperator() == null) {
            fc.addMessage("msg", new FacesMessage("Operator is not filled!"));
        } else if (entry.getOperator().needsValue() && Utilities.isEmpty(entry.getValue())) {
            fc.addMessage("msg", new FacesMessage("Value is not filled!"));
        } else {
            af.addCurrentEntry();
        }
       
        return current();
View Full Code Here


                dco.saveUpdate(false);
            }
           
        } catch (ValidationException ve) {
            FacesContext fc = FacesContext.getCurrentInstance();
            fc.addMessage("saveError", new FacesMessage(ve.getMessage()));
            return current();
        }
       
        if (wo.isNew()) {
            wo.initialize(wo.getModule());
View Full Code Here

               
                if (wf.getIndex() == field.getIndex()) {
                   
                    if (Utilities.isEmpty(wf.getValue()) && field.isRequired()) {
                        valid = false;
                        fc.addMessage("msg" + msg++, new FacesMessage("Required field " + field.getLabel() + " has not been filled."));
                        continue;

                    } else if (!Utilities.isEmpty(wf.getValue()) &&
                               (field.getValueType() == DcRepository.ValueTypes._BIGINTEGER ||
                                field.getValueType() == DcRepository.ValueTypes._LONG)) {
                        try {
                            Long.valueOf(String.valueOf(wf.getValue()));
                        } catch (NumberFormatException nfe) {
                            valid = false;
                            fc.addMessage("msg" + msg++, new FacesMessage(field.getLabel() + " should contain a numeric value."));
                            continue;
                        }
                    }
                }
            }
View Full Code Here

            SecuredUser su = SecurityCentre.getInstance().login(wu.getUsername(), wu.getPassword(), true);
            wu.setSecuredUser(su);
            DcWebModules modules = (DcWebModules) vr.resolveVariable(fc, "modules");
            modules.load();
        } catch (SecurityException se) {
            fc.addMessage("loginError", new FacesMessage(se.getMessage()));
            return "login";
        }
       
        return "search";
    }
View Full Code Here

                                context, value, this.getParameters(), errors, this.validatorAction,
                                field
                            });
                        if (!errors.isEmpty())
                        {
                            throw new ValidatorException(new FacesMessage(
                                    FacesMessage.SEVERITY_ERROR,
                                    (String)errors.iterator().next(),
                                    null));
                        }
                    }
View Full Code Here

      {
         smallest = guess + 1;
      }
      if (guess == number)
      {
         FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Correct!"));
      }
      remainingGuesses--;
      return null;
   }
View Full Code Here

   {
      int input = (Integer) value;

      if (remainingGuesses <= 0)
      {
       FacesMessage message = new FacesMessage("No guesses left!");
       context.addMessage(toValidate.getClientId(context), message);
       ((UIInput)toValidate).setValid(false);
       return;
      }

      if (input < smallest || input > biggest)
      {
  ((UIInput)toValidate).setValid(false);

  FacesMessage message = new FacesMessage("Invalid guess");
  context.addMessage(toValidate.getClientId(context), message);
      }
   }
View Full Code Here

    void convert(@Observes @Before @RenderResponse final PhaseEvent event, Messages messages) {
        Set<Message> savedMessages = (Set<Message>) context.get(FLASH_MESSAGES_KEY);
        if (savedMessages != null) {
            for (Message m : savedMessages) {
                event.getFacesContext().addMessage(m.getTargets(),
                        new FacesMessage(getSeverity(m.getLevel()), m.getText(), null));
            }
        }

        for (Message m : messages.getAll()) {
            event.getFacesContext().addMessage(m.getTargets(), new FacesMessage(getSeverity(m.getLevel()), m.getText(), null));
        }
        messages.clear();
    }
View Full Code Here

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            FacesMessage message = (FacesMessage) messages.next();
            assert message.getSummary().equals("Check out date must be later than check in date");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
View Full Code Here

      @Override
      protected void renderResponse() {
        Iterator messages = FacesContext.getCurrentInstance().getMessages();
        assert messages.hasNext();
        FacesMessage message = (FacesMessage) messages.next();
        assert message.getSummary().equals("Check out date must be later than check in date");
        assert !messages.hasNext();
        assert Manager.instance().isLongRunningConversation();
      }

      @Override
View Full Code Here

TOP

Related Classes of javax.faces.application.FacesMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.