예제 #1
0
 protected void setEventPhase(FacesEvent event) {
   if (isImmediate()) {
     event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
   } else {
     event.setPhaseId(PhaseId.INVOKE_APPLICATION);
   }
 }
 protected void setEventPhase(FacesEvent event) {
   if (isImmediate()) {
     event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
   } else if (isBypassUpdates()) {
     event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
   } else {
     event.setPhaseId(PhaseId.INVOKE_APPLICATION);
   }
 }
 @Override
 public void decode(FacesContext context, UIComponent component) {
   Map requestParameterMap = context.getExternalContext().getRequestParameterMap();
   String clientId =
       component.getClientId(context) + Rendering.CLIENT_ID_SUFFIX_SEPARATOR + "action";
   if (!requestParameterMap.containsKey(clientId)) return;
   EventEditorPage eventEditorPage = (EventEditorPage) component;
   FacesEvent event = new ActionEvent(eventEditorPage);
   event.setPhaseId(PhaseId.INVOKE_APPLICATION);
   eventEditorPage.queueEvent(event);
 }
 @Override
 public void queueEvent(FacesEvent e) {
   if (e instanceof PagerEvent) {
     if (isPartialExecute()) {
       e.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
     } else {
       e.setPhaseId(PhaseId.INVOKE_APPLICATION);
     }
   }
   super.queueEvent(e);
 }
예제 #5
0
 public void setEventPhase(FacesEvent event) {
   if (event instanceof ItemChangeEvent) {
     AbstractPanelMenuItem actItm = (AbstractPanelMenuItem) ((ItemChangeEvent) event).getNewItem();
     if (isImmediate() || (actItm != null && actItm.isImmediate())) {
       event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
     } else if (actItm != null && actItm.isBypassUpdates()) {
       event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
     } else {
       event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
     }
   }
 }
  @Override
  public void queueEvent(FacesEvent event) {
    if (event instanceof DropEvent) {

      if (isImmediate()) {
        event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
      } else if (isBypassUpdates()) {
        event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
      } else {
        event.setPhaseId(PhaseId.INVOKE_APPLICATION);
      }
    }
    super.queueEvent(event);
  }
  //
  // Decode
  //
  @SuppressWarnings("unchecked")
  @Override
  protected void decode(
      FacesContext facesContext,
      UIComponent component,
      @SuppressWarnings("unused") FacesBean facesBean,
      @SuppressWarnings("unused") String clientId) {
    UIXCollection table = (UIXCollection) component;
    Object oldKey = table.getRowKey();

    try {
      // Set the row key to null to force the clientId to be correct
      table.setRowKey(null);

      String selectionParam = __getSelectionParameterName(facesContext, table);

      Map<String, String> parameters = facesContext.getExternalContext().getRequestParameterMap();

      _LOG.finest("Params:{0}", parameters);

      String selection = parameters.get(selectionParam);

      if (selection != null) {
        final RowKeySet state;
        if (table instanceof UIXTable) state = ((UIXTable) table).getSelectedRowKeys();
        else state = ((UIXTree) table).getSelectedRowKeys();

        table.setClientRowKey(selection);
        // If the key is not already selected, or the state is more than one
        // (someone changed the table selection from multiple to single),
        // update the keys
        if (!state.isContained() || state.size() > 1) {
          RowKeySet unselected = state.clone();
          // TODO : do not mutate the selectedRowKeys here.
          // instead, mutate when event is broadcast:
          state.clear();
          state.add();
          // clone, so that subsequent mutations of "state" will
          // not affect the parameters of this event: bug 4733858:
          RowKeySet selected = state.clone();
          FacesEvent event = new SelectionEvent(table, unselected, selected);
          event.queue();
        }
      }
    } finally {
      table.setRowKey(oldKey);
    }
  }
예제 #8
0
 @Override
 public void queueEvent(FacesEvent event) {
   if ((event instanceof ItemChangeEvent) && (event.getComponent() == this)) {
     setEventPhase((ItemChangeEvent) event);
   }
   super.queueEvent(event);
 }
    public void processEvent(FacesEvent event) throws AbortProcessingException {

      FacesContext faces = FacesContext.getCurrentInstance();
      if (faces == null) {
        return;
      }

      L instance = null;
      if (this.binding != null) {
        instance = (L) binding.getValue(faces.getELContext());
      }
      if (instance == null && this.type != null) {
        try {
          instance = (L) TagHandlerUtils.loadClass(this.type, Object.class).newInstance();
        } catch (Exception e) {
          throw new AbortProcessingException("Couldn't Lazily instantiate EventListener", e);
        }
        if (this.binding != null) {
          binding.setValue(faces.getELContext(), instance);
        }
      }

      if (instance != null) {
        event.processListener(instance);
      }
    }
예제 #10
0
  private void methodInvoker(String methodName, FacesEvent event) {
    AbstractLovItemBean bean =
        (AuthorityRelationLookup) JsfUtils.resolveVariable("bean_auth_relation_lookup");
    try {
      Method actionMethod = bean.getClass().getMethod(methodName, event.getClass());
      try {
        actionMethod.invoke(bean, event);

      } catch (IllegalArgumentException e) {
        e.printStackTrace();

      } catch (IllegalAccessException e) {
        e.printStackTrace();

      } catch (InvocationTargetException e) {
        e.printStackTrace();
      }

    } catch (SecurityException e) {
      e.printStackTrace();

    } catch (NoSuchMethodException e) {
      e.printStackTrace();
    }
  }
예제 #11
0
 public void processListener(FacesListener listener) {
   ForEach owner = (ForEach) this.getComponent();
   Integer currentIndex = owner.getIndex();
   owner.setIndex(index);
   originalEvent.processListener(listener);
   owner.setIndex(currentIndex);
 }
예제 #12
0
 @Override
 public void broadcast(FacesEvent event) throws AbortProcessingException {
   if (event instanceof IndexedEvent) {
     IndexedEvent indexedEvent = (IndexedEvent) event;
     Integer eventIndex = indexedEvent.getIndex();
     Integer currentIndex = getIndex();
     try {
       setIndex(eventIndex);
       FacesEvent originalEvent = indexedEvent.getOriginalEvent();
       originalEvent.getComponent().broadcast(originalEvent);
     } finally {
       this.setIndex(currentIndex);
     }
   } else {
     super.broadcast(event);
   }
 }
예제 #13
0
 @Override
 public void broadcast(FacesEvent event) {
   if (event instanceof AliasEvent) {
     FacesContext context = getFacesContext();
     AliasVariableMapper alias = getAliasVariableMapper(context);
     try {
       AliasVariableMapper.exposeAliasesToRequest(context, alias);
       FacesEvent origEvent = ((AliasEvent) event).getOriginalEvent();
       origEvent.getComponent().broadcast(origEvent);
     } finally {
       if (alias != null) {
         AliasVariableMapper.removeAliasesExposedToRequest(context, alias.getId());
       }
     }
   } else {
     super.broadcast(event);
   }
 }
예제 #14
0
 @Override
 public void broadcast(FacesEvent event) {
   super.broadcast(event);
   if (this.equals(event.getComponent()) && event instanceof FormChageEvent) {
     MethodExpression listener = (MethodExpression) getAttributes().get("listener");
     if (listener != null) {
       listener.invoke(FacesContext.getCurrentInstance().getELContext(), null);
     }
   }
 }
예제 #15
0
  @Override
  public void queueEvent(FacesEvent event) {
    if (event instanceof ActionEvent) {
      if (event.getComponent() == this) {
        if (isImmediate()) {
          event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
        } else if (isBypassUpdates()) {
          event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
        } else {
          event.setPhaseId(PhaseId.INVOKE_APPLICATION);
        }
      }

      // UICommand set Phase ID for all ActionEvents - bypass it.
      getParent().queueEvent(event);
    } else {
      super.queueEvent(event);
    }
  }
예제 #16
0
 @Override
 public void broadcast(FacesEvent event) throws AbortProcessingException {
   if (event instanceof ItemChangeEvent) {
     setValue(((ItemChangeEvent) event).getNewItemName());
     setSubmittedActiveItem(null);
     if (event.getPhaseId() != PhaseId.UPDATE_MODEL_VALUES) {
       FacesContext.getCurrentInstance().renderResponse();
     }
   }
   super.broadcast(event);
 }
예제 #17
0
 @Override
 public void broadcast(FacesEvent event) throws AbortProcessingException {
   FacesContext facesContext = FacesContext.getCurrentInstance();
   if (event instanceof ItemChangeEvent) {
     setValue(((ItemChangeEvent) event).getNewItemName());
     setSubmittedActiveItem(null);
     if (event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES) {
       try {
         updateModel(facesContext);
       } catch (RuntimeException e) {
         facesContext.renderResponse();
         throw e;
       }
     } else {
       facesContext.renderResponse();
     }
   }
   super.broadcast(event);
 }
  public void broadcast(FacesContext context) throws AbortProcessingException {
    // Set up the correct context and fire our wrapped event
    UIDataAdaptor dataAdaptor = getComponent();
    initialRowKey = dataAdaptor.getRowKey();

    UIComponent compositeParent = null;

    UIComponent targetComponent = event.getComponent();

    try {
      if (!UIComponent.isCompositeComponent(targetComponent)) {
        compositeParent = UIComponent.getCompositeComponentParent(targetComponent);
      }

      if (compositeParent != null) {
        compositeParent.pushComponentToEL(context, null);
      }

      setupEventContext(context);

      targetComponent.pushComponentToEL(context, null);
      targetComponent.broadcast(event);
    } finally {
      try {
        dataAdaptor.setRowKey(context, initialRowKey);
      } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
      }

      initialRowKey = null;

      targetComponent.popComponentFromEL(context);

      if (compositeParent != null) {
        compositeParent.popComponentFromEL(context);
      }
    }
  }
예제 #19
0
 public String toString() {
   return originalEvent.toString();
 }
예제 #20
0
 public void queue() {
   originalEvent.queue();
 }
예제 #21
0
 public boolean isAppropriateListener(FacesListener listener) {
   return originalEvent.isAppropriateListener(listener);
 }
예제 #22
0
 public void setPhaseId(PhaseId phaseId) {
   originalEvent.setPhaseId(phaseId);
 }
예제 #23
0
 public PhaseId getPhaseId() {
   return originalEvent.getPhaseId();
 }
예제 #24
0
 @Override
 public PhaseId getPhaseId() {
   return event.getPhaseId();
 }
예제 #25
0
 @Override
 public void setPhaseId(PhaseId phaseId) {
   event.setPhaseId(phaseId);
 }