Package com.sun.jsft.event

Examples of com.sun.jsft.event.Command


    /**
     *  <p> This command conditionally executes its child commands.</p>
     */
    public void _if(boolean condition) {
  Command command = (Command) FacesContext.getCurrentInstance().
    getExternalContext().getRequestMap().get(Command.COMMAND_KEY);
  if (condition) {
      command.invokeChildCommands();
  } else {
      command = command.getElseCommand();
      if (command != null) {
    command.invoke();
      }
  }
    }
View Full Code Here


  // Get the Request Map
  Map<String, Object> reqMap = FacesContext.getCurrentInstance().
    getExternalContext().getRequestMap();

  // Get the Current Command...
  Command command = (Command) reqMap.get(Command.COMMAND_KEY);

  // Iterate over each item in the List
  List<Command> childCommands = null;
  for (Object item : list) {
      // Set the item in the request scope under the given key
      reqMap.put(var, item);

      // Invoke all the child commands
      childCommands = command.getChildCommands();
      if (childCommands != null) {
    for (Command childCommand : childCommands) {
        childCommand.invoke();
    }
      }
View Full Code Here

      variable = commandLine.substring(0, idx).trim();
      commandLine = commandLine.substring(++idx).trim();
  }

  // If "if" handle "else" if present
  Command elseCommand = null;
  if (commandLine.startsWith("if")) {
      // First convert "if" to the real if handler...
      commandLine = "jsft._if" + commandLine.substring(2);

      // Check the next few characters to see if they are "else"...
      _parser.skipCommentsAndWhiteSpace(CommandParser.SIMPLE_WHITE_SPACE);
      int next[] = new int[] {
    _parser.nextChar(),
    _parser.nextChar(),
    _parser.nextChar(),
    _parser.nextChar(),
    _parser.nextChar()
      };
      if ((next[0] == 'e')
        && (next[1] == 'l')
        && (next[2] == 's')
        && (next[3] == 'e')
        && (Character.isWhitespace((char) next[4]))) {
    // This is an else case, parse it...
    elseCommand = readCommand();
      } else {
    // Not an else, restore the parser state
    for (idx=4; idx > -1; idx--) {
        if (next[idx] != -1) {
      _parser.unread(next[idx]);
        }
    }
      }
  }

  // Create the Command
  Command command = null;
  if ((commandLine.length() > 0) || (commandChildren != null)) {
      command = new ELCommand(
        variable,
        convertKeywords(commandLine),
        commandChildren,
View Full Code Here

     *  <p> This method reads Commands until a closing '}' is encountered.</p>
     */
    private List<Command> readCommandList() throws IOException {
  int ch = _parser.nextChar();
  List<Command> commands = new ArrayList<Command>();
  Command command = null;
  while (ch != '}') {
      // Make sure readCommand gets the full command line...
      if (ch != '{') {
    // We want to throw this char away...
    _parser.unread(ch);
View Full Code Here

TOP

Related Classes of com.sun.jsft.event.Command

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.