Exemple #1
0
  private void applyCompositeComponent(FaceletContext ctx, UIComponent c) throws IOException {

    FacesContext facesContext = ctx.getFacesContext();
    FaceletFactory factory =
        (FaceletFactory) RequestStateManager.get(facesContext, RequestStateManager.FACELET_FACTORY);
    VariableMapper orig = ctx.getVariableMapper();

    UIPanel facetComponent;
    if (ComponentHandler.isNew(c)) {
      facetComponent = (UIPanel) facesContext.getApplication().createComponent("javax.faces.Panel");
      facetComponent.setRendererType("javax.faces.Group");
      c.getFacets().put(UIComponent.COMPOSITE_FACET_NAME, facetComponent);
    } else {
      facetComponent = (UIPanel) c.getFacets().get(UIComponent.COMPOSITE_FACET_NAME);
    }
    assert (null != facetComponent);

    try {
      Facelet f = factory.getFacelet(ccResource.getURL());

      VariableMapper wrapper =
          new VariableMapperWrapper(orig) {

            @Override
            public ValueExpression resolveVariable(String variable) {
              return super.resolveVariable(variable);
            }
          };
      ctx.setVariableMapper(wrapper);
      f.apply(facesContext, facetComponent);
    } finally {
      ctx.setVariableMapper(orig);
    }
  }
 /** @param interviewGuide */
 public void showPanel(InterviewEntity interviewGuide) {
   selectedInterviewEntity = interviewGuide;
   lstInterviewQuestionEntity =
       interviewQuestionFacade.getInterviewQuestionEntityByInterview(
           selectedInterviewEntity.getInterviewId());
   panelGroup.setRendered(true);
   panelInterviewQuestions.setRendered(false);
 }
Exemple #3
0
  @Override
  public BeanInfo getComponentMetadata(FacesContext context, Resource ccResource) {
    // PENDING this implementation is terribly wasteful.
    // Must find a better way.
    CompositeComponentBeanInfo result;
    FaceletContext ctx =
        (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
    FaceletFactory factory =
        (FaceletFactory) RequestStateManager.get(context, RequestStateManager.FACELET_FACTORY);
    VariableMapper orig = ctx.getVariableMapper();
    UIComponent tmp = context.getApplication().createComponent("javax.faces.NamingContainer");
    UIPanel facetComponent =
        (UIPanel) context.getApplication().createComponent("javax.faces.Panel");
    facetComponent.setRendererType("javax.faces.Group");
    tmp.getFacets().put(UIComponent.COMPOSITE_FACET_NAME, facetComponent);
    // We have to put the resource in here just so the classes that eventually
    // get called by facelets have access to it.
    tmp.getAttributes().put(Resource.COMPONENT_RESOURCE_KEY, ccResource);

    Facelet f;

    try {
      f = factory.getFacelet(ccResource.getURL());
      VariableMapper wrapper =
          new VariableMapperWrapper(orig) {

            @Override
            public ValueExpression resolveVariable(String variable) {
              return super.resolveVariable(variable);
            }
          };
      ctx.setVariableMapper(wrapper);
      context.getAttributes().put(IS_BUILDING_METADATA, Boolean.TRUE);
      f.apply(context, facetComponent);
    } catch (Exception e) {
      if (e instanceof FacesException) {
        throw (FacesException) e;
      } else {
        throw new FacesException(e);
      }
    } finally {
      context.getAttributes().remove(IS_BUILDING_METADATA);
      ctx.setVariableMapper(orig);
    }
    result = (CompositeComponentBeanInfo) tmp.getAttributes().get(UIComponent.BEANINFO_KEY);

    return result;
  }
Exemple #4
0
 @Override
 public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
   if (event instanceof PostAddToViewEvent) {
     GeoJsfJsLoader.pushJsToHead(this.getFacesContext(), "viewport.js");
     GeoJsfJsLoader.pushJsToHead(this.getFacesContext(), "GeoJsfUtil.js");
   }
   super.processEvent(event);
 }
 @Override
 public void broadcast(FacesEvent event) throws AbortProcessingException {
   super.broadcast(event);
   if (event instanceof PagerEvent) {
     // Tell JSF to switch to render response, like regular commands
     FacesContext context = getFacesContext();
     context.renderResponse();
   }
 }
 @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);
 }
 @Override
 public void restoreState(FacesContext context, Object state) {
   Object values[] = (Object[]) state;
   super.restoreState(context, values[0]);
   this._for = (String) values[1];
   this.partialExecute = (Boolean) values[2];
   this.partialRefresh = (Boolean) values[3];
   this.refreshId = (String) values[4];
   this.style = (String) values[5];
   this.styleClass = (String) values[6];
   this.ariaLabel = (String) values[7];
   this.title = (String) values[8];
 }
Exemple #8
0
  public void broadcast(javax.faces.event.FacesEvent event)
      throws javax.faces.event.AbortProcessingException {
    super.broadcast(event);

    FacesContext facesContext = FacesContext.getCurrentInstance();

    if (event instanceof org.primefaces.event.CloseEvent) {
      MethodExpression closeMe = getCloseListener();

      if (closeMe != null) {
        closeMe.invoke(facesContext.getELContext(), new Object[] {event});
      }
    } else if (event instanceof org.primefaces.event.ToggleEvent) {
      MethodExpression toggleMe = getToggleListener();

      if (toggleMe != null) {
        toggleMe.invoke(facesContext.getELContext(), new Object[] {event});
      }
    }
  }
Exemple #9
0
 public void restoreState(FacesContext context, Object state) {
   Object values[] = (Object[]) state;
   super.restoreState(context, values[0]);
   _widgetVar = (java.lang.String) values[1];
   _header = (java.lang.String) values[2];
   _footer = (java.lang.String) values[3];
   _toggleable = (java.lang.Boolean) values[4];
   _toggleSpeed = (java.lang.Integer) values[5];
   _style = (java.lang.String) values[6];
   _styleClass = (java.lang.String) values[7];
   _collapsed = (java.lang.Boolean) values[8];
   _closable = (java.lang.Boolean) values[9];
   _closeListener = (javax.el.MethodExpression) values[10];
   _onCloseUpdate = (java.lang.String) values[11];
   _onCloseStart = (java.lang.String) values[12];
   _onCloseComplete = (java.lang.String) values[13];
   _closeSpeed = (java.lang.Integer) values[14];
   _visible = (java.lang.Boolean) values[15];
   _onToggleUpdate = (java.lang.String) values[16];
   _toggleListener = (javax.el.MethodExpression) values[17];
 }
 public void showSecondPanel() {
   panelGroup.setRendered(false);
   // Initalizes to false
   panelInterviewQuestions.setRendered(true);
 }
  protected void setProperties(UIComponent component) {
    super.setProperties(component);
    javax.faces.component.UIPanel panel = null;
    try {
      panel = (javax.faces.component.UIPanel) component;
    } catch (ClassCastException cce) {
      throw new IllegalStateException(
          "Component "
              + component.toString()
              + " not expected type.  Expected: javax.faces.component.UIPanel.  Perhaps you're missing a tag?");
    }

    if (bgcolor != null) {
      if (!bgcolor.isLiteralText()) {
        panel.setValueExpression("bgcolor", bgcolor);
      } else {
        panel.getAttributes().put("bgcolor", bgcolor.getExpressionString());
      }
    }
    if (border != null) {
      if (!border.isLiteralText()) {
        panel.setValueExpression("border", border);
      } else {
        panel
            .getAttributes()
            .put("border", java.lang.Integer.valueOf(border.getExpressionString()));
      }
    }
    if (columnClasses != null) {
      if (!columnClasses.isLiteralText()) {
        panel.setValueExpression("columnClasses", columnClasses);
      } else {
        panel.getAttributes().put("columnClasses", columnClasses.getExpressionString());
      }
    }
    if (columns != null) {
      if (!columns.isLiteralText()) {
        panel.setValueExpression("columns", columns);
      } else {
        panel
            .getAttributes()
            .put("columns", java.lang.Integer.valueOf(columns.getExpressionString()));
      }
    }
    if (onclick != null) {
      if (!onclick.isLiteralText()) {
        panel.setValueExpression("onclick", onclick);
      } else {
        panel.getAttributes().put("onclick", onclick.getExpressionString());
      }
    }
    if (ondblclick != null) {
      if (!ondblclick.isLiteralText()) {
        panel.setValueExpression("ondblclick", ondblclick);
      } else {
        panel.getAttributes().put("ondblclick", ondblclick.getExpressionString());
      }
    }
    if (onkeydown != null) {
      if (!onkeydown.isLiteralText()) {
        panel.setValueExpression("onkeydown", onkeydown);
      } else {
        panel.getAttributes().put("onkeydown", onkeydown.getExpressionString());
      }
    }
    if (onkeypress != null) {
      if (!onkeypress.isLiteralText()) {
        panel.setValueExpression("onkeypress", onkeypress);
      } else {
        panel.getAttributes().put("onkeypress", onkeypress.getExpressionString());
      }
    }
    if (onkeyup != null) {
      if (!onkeyup.isLiteralText()) {
        panel.setValueExpression("onkeyup", onkeyup);
      } else {
        panel.getAttributes().put("onkeyup", onkeyup.getExpressionString());
      }
    }
    if (onmousedown != null) {
      if (!onmousedown.isLiteralText()) {
        panel.setValueExpression("onmousedown", onmousedown);
      } else {
        panel.getAttributes().put("onmousedown", onmousedown.getExpressionString());
      }
    }
    if (onmousemove != null) {
      if (!onmousemove.isLiteralText()) {
        panel.setValueExpression("onmousemove", onmousemove);
      } else {
        panel.getAttributes().put("onmousemove", onmousemove.getExpressionString());
      }
    }
    if (onmouseout != null) {
      if (!onmouseout.isLiteralText()) {
        panel.setValueExpression("onmouseout", onmouseout);
      } else {
        panel.getAttributes().put("onmouseout", onmouseout.getExpressionString());
      }
    }
    if (onmouseover != null) {
      if (!onmouseover.isLiteralText()) {
        panel.setValueExpression("onmouseover", onmouseover);
      } else {
        panel.getAttributes().put("onmouseover", onmouseover.getExpressionString());
      }
    }
    if (onmouseup != null) {
      if (!onmouseup.isLiteralText()) {
        panel.setValueExpression("onmouseup", onmouseup);
      } else {
        panel.getAttributes().put("onmouseup", onmouseup.getExpressionString());
      }
    }
    if (rowClasses != null) {
      if (!rowClasses.isLiteralText()) {
        panel.setValueExpression("rowClasses", rowClasses);
      } else {
        panel.getAttributes().put("rowClasses", rowClasses.getExpressionString());
      }
    }
    if (style != null) {
      if (!style.isLiteralText()) {
        panel.setValueExpression("style", style);
      } else {
        panel.getAttributes().put("style", style.getExpressionString());
      }
    }
    if (styleClass != null) {
      if (!styleClass.isLiteralText()) {
        panel.setValueExpression("styleClass", styleClass);
      } else {
        panel.getAttributes().put("styleClass", styleClass.getExpressionString());
      }
    }
  }