Exemplo n.º 1
0
  public void handleChangeKullaniciRapor(AjaxBehaviorEvent event) {
    try {
      HtmlSelectOneMenu menu = (HtmlSelectOneMenu) event.getComponent();
      if (menu.getValue() instanceof Kullanicirapor) {
        setCalistirilacakRaporRID(((Kullanicirapor) menu.getValue()).getRID());
      } else {
        setCalistirilacakRaporRID(0L);
      }

    } catch (Exception e) {
      logYaz("Error KisiRaporlamaController @handleChangeKullaniciRapor :" + e.getMessage());
      logYaz("Exception @" + getModelName() + "Controller :", e);
    }
  }
Exemplo n.º 2
0
 public void setValueBinding(String s, ValueBinding vb) {
   if (s != null && s.indexOf("effect") != -1) {
     // If this is an effect attribute make sure Ice Extras is included
     JavascriptContext.includeLib(JavascriptContext.ICE_EXTRAS, getFacesContext());
   }
   super.setValueBinding(s, vb);
 }
  public boolean handleIcerikOrEditor(AjaxBehaviorEvent event1) {
    try {
      HtmlSelectOneMenu menuForIcerikOrEditor = (HtmlSelectOneMenu) event1.getComponent();
      if (menuForIcerikOrEditor.getValue() instanceof EvetHayir) {
        if (getIcerikOrEditor().equals(EvetHayir._EVET)) {
          return true;
        } else {
          return false;
        }

      } else {
        return false;
      }
    } catch (Exception e) {
      logYaz("Exception @" + getModelName() + "Controller :", e);
    }
    return true;
  }
Exemplo n.º 4
0
 /** Perform any processing required to restore the state from the entries in the state Object. */
 public void restoreState(FacesContext context, Object state) {
   Object values[] = (Object[]) state;
   super.restoreState(context, values[0]);
   partialSubmit = (Boolean) values[1];
   enabledOnUserRole = (String) values[2];
   renderedOnUserRole = (String) values[3];
   styleClass = (String) values[4];
   effect = (Effect) values[5];
   onclickeffect = (Effect) values[6];
   ondblclickeffect = (Effect) values[7];
   onmousedowneffect = (Effect) values[8];
   onmouseupeffect = (Effect) values[9];
   onmousemoveeffect = (Effect) values[10];
   onmouseovereffect = (Effect) values[11];
   onmouseouteffect = (Effect) values[12];
   onkeypresseffect = (Effect) values[13];
   onkeydowneffect = (Effect) values[14];
   onkeyupeffect = (Effect) values[15];
   onchangeeffect = (Effect) values[16];
   autocomplete = (String) values[17];
   currentStyle = (CurrentStyle) values[18];
   visible = (Boolean) values[19];
   partialSubmitOnBlur = (Boolean) values[20];
 }
  /**
   * Takes a parent UIComponent and adds all UIComponents which are required for configuring a
   * metric. i.e. metric name, math expression, value, etc.
   *
   * @param metric
   * @param parent
   */
  private void helperCreateUICompsForMetricConfig(MetricBean metric, UIComponent parent) {

    // 1)remove all existing child elements that may have been created previously from ALL
    // pConfigVeryGood, pConfigGood, etc.
    removeAllInputHelpersForMetricConfig();

    // 2) now build the gui elements for building a metric configuration
    // 2a) Add an output text with the metric's name
    HtmlOutputText mnameText = new HtmlOutputText();
    mnameText.setId("metricName" + metric.getInternalID());
    mnameText.setValue(metric.getName());
    // add on parent
    parent.getChildren().add(mnameText);

    // 2b) Select a math expression
    HtmlSelectOneMenu select2 = new HtmlSelectOneMenu();
    select2.setId("mathSelect" + metric.getInternalID());
    UISelectItems items2 = new UISelectItems();
    items2.setId("mathvals" + metric.getInternalID());
    items2.setValue(metric.getAllAvailableTypes());
    Class[] parms2 = new Class[] {ValueChangeEvent.class};
    ExpressionFactory ef =
        FacesContext.getCurrentInstance().getApplication().getExpressionFactory();
    MethodExpression mb =
        ef.createMethodExpression(
            FacesContext.getCurrentInstance().getELContext(),
            "#{AutoEvalSerUserConfigBean.processMathExprChange}",
            null,
            parms2);
    MethodExpressionValueChangeListener vcl = new MethodExpressionValueChangeListener(mb);
    select2.addValueChangeListener(vcl);
    select2.getChildren().add(items2);
    select2.setImmediate(true);

    // place an ajax support on the selectonemenu field
    HtmlAjaxSupport ajaxSupport2 = new HtmlAjaxSupport();
    // Class[] parms = new Class[]{ActionEvent.class};
    // ajaxSupport.setAction(FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{AutoEvalSerUserConfigBean.sliderValue}", parms));
    ajaxSupport2.setEvent("onchange");
    // to add multiple ids for rerendering, separate them with a ","
    ajaxSupport2.setReRender(select2.getId());
    ajaxSupport2.setEventsQueue("foo");
    select2.getFacets().put("a4jsupport2", ajaxSupport2);

    // add to parent
    parent.getChildren().add(select2);

    // 2c) For all input types except boolean values:
    if (metric.isHtmlInputTextUsed()) {
      // enter a boundary value for a specific added metric
      HtmlInputText inputText = new HtmlInputText();
      inputText.setId("metricBoundary" + metric.getInternalID());
      inputText.setValue(metric.getEvalBoundary());
      inputText.setSize(10);
      Class[] parms = new Class[] {ValueChangeEvent.class};
      MethodExpression mb2 =
          ef.createMethodExpression(
              FacesContext.getCurrentInstance().getELContext(),
              "#{AutoEvalSerUserConfigBean.processMetricBoundaryValueChange}",
              null,
              parms);
      MethodExpressionValueChangeListener vcl2 = new MethodExpressionValueChangeListener(mb2);
      inputText.addValueChangeListener(vcl2);
      inputText.setImmediate(true);

      // place an ajax support on the InputText field
      HtmlAjaxSupport ajaxSupport = new HtmlAjaxSupport();
      // Class[] parms = new Class[]{ActionEvent.class};
      // ajaxSupport.setAction(FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{AutoEvalSerUserConfigBean.sliderValue}", parms));
      ajaxSupport.setEvent("onchange");
      // to add multiple ids for rerendering, separate them with a ","
      ajaxSupport.setReRender(inputText.getId());
      ajaxSupport.setEventsQueue("foo");
      inputText.getFacets().put("a4jsupport", ajaxSupport);

      // add to parent
      parent.getChildren().add(inputText);
    } else {
      // add a drop-down box for boolean values
      HtmlSelectOneMenu select = new HtmlSelectOneMenu();
      select.setId("booleanSelect" + metric.getInternalID());
      UISelectItems items = new UISelectItems();
      items.setId("vals" + metric.getInternalID());
      List<SelectItem> l = new ArrayList<SelectItem>();
      l.add(new SelectItem("true"));
      l.add(new SelectItem("false"));
      items.setValue(l);
      Class[] parms = new Class[] {ValueChangeEvent.class};
      MethodExpression mb3 =
          ef.createMethodExpression(
              FacesContext.getCurrentInstance().getELContext(),
              "#{AutoEvalSerUserConfigBean.processMetricBoundaryValueChange}",
              null,
              parms);
      MethodExpressionValueChangeListener vcl3 = new MethodExpressionValueChangeListener(mb3);
      select.addValueChangeListener(vcl3);
      select.getChildren().add(items);
      select.setImmediate(true);

      // place an ajax support on the selectonemenu field
      HtmlAjaxSupport ajaxSupport = new HtmlAjaxSupport();
      // Class[] parms = new Class[]{ActionEvent.class};
      // ajaxSupport.setAction(FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{AutoEvalSerUserConfigBean.sliderValue}", parms));
      ajaxSupport.setEvent("onchange");
      // to add multiple ids for rerendering, separate them with a ","
      ajaxSupport.setReRender(select.getId());
      ajaxSupport.setEventsQueue("foo");
      select.getFacets().put("a4jsupport", ajaxSupport);

      // add to parent
      parent.getChildren().add(select);
    }

    // 2d) finally the submit button for saving the configuration
    HtmlCommandButton button_save = new HtmlCommandButton();
    button_save.setId("buttonSave" + metric.getInternalID());
    button_save.setValue("add config");
    Class[] parms3 = new Class[] {ActionEvent.class};
    MethodExpression mb4 =
        ef.createMethodExpression(
            FacesContext.getCurrentInstance().getELContext(),
            "#{AutoEvalSerUserConfigBean.command_saveMetricConfiguration}",
            null,
            parms3);
    MethodExpressionActionListener vcl4 = new MethodExpressionActionListener(mb4);
    button_save.addActionListener(vcl4);
    UIParameter p = new UIParameter();
    p.setId("param_save_button" + metric.getInternalID());
    p.setName("pConfigPanel");
    p.setValue(parent.getId());
    button_save.getChildren().add(p);

    parent.getChildren().add(button_save);

    HtmlOutputText message = new HtmlOutputText();
    message.setId("message" + metric.getInternalID());
    message.setStyle("color:red;");
    parent.getChildren().add(message);
  }
Exemplo n.º 6
0
  /** Renders the open tag for the text. */
  @Override
  public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
    ResponseWriter out = context.getResponseWriter();

    String id = component.getId();

    String accesskey;
    String dir;
    boolean disabled;
    String disabledClass;
    String enabledClass;
    String lang;

    String onblur;
    String onchange;
    String onclick;
    String ondblclick;
    String onfocus;

    String onkeydown;
    String onkeypress;
    String onkeyup;

    String onmousedown;
    String onmousemove;
    String onmouseout;
    String onmouseover;
    String onmouseup;

    String onselect;

    boolean readonly;
    String style;
    String styleClass;
    String tabindex;
    String title;
    Object value;

    if (component instanceof HtmlSelectOneMenu) {
      HtmlSelectOneMenu htmlComponent = (HtmlSelectOneMenu) component;

      accesskey = htmlComponent.getAccesskey();
      dir = htmlComponent.getDir();
      disabled = htmlComponent.isDisabled();
      disabledClass = htmlComponent.getDisabledClass();
      enabledClass = htmlComponent.getEnabledClass();
      lang = htmlComponent.getLang();

      onblur = htmlComponent.getOnblur();
      onchange = htmlComponent.getOnchange();
      onclick = htmlComponent.getOnclick();
      ondblclick = htmlComponent.getOndblclick();
      onfocus = htmlComponent.getOnfocus();

      onkeydown = htmlComponent.getOnkeydown();
      onkeypress = htmlComponent.getOnkeypress();
      onkeyup = htmlComponent.getOnkeyup();

      onmousedown = htmlComponent.getOnmousedown();
      onmousemove = htmlComponent.getOnmousemove();
      onmouseout = htmlComponent.getOnmouseout();
      onmouseover = htmlComponent.getOnmouseover();
      onmouseup = htmlComponent.getOnmouseup();

      onselect = htmlComponent.getOnselect();

      readonly = htmlComponent.isReadonly();
      style = htmlComponent.getStyle();
      styleClass = htmlComponent.getStyleClass();
      tabindex = htmlComponent.getTabindex();
      title = htmlComponent.getTitle();

      value = htmlComponent.getValue();
    } else {
      Map<String, Object> attrMap = component.getAttributes();

      accesskey = (String) attrMap.get("accesskey");
      dir = (String) attrMap.get("dir");
      disabled = Boolean.TRUE.equals(attrMap.get("disabled"));
      disabledClass = (String) attrMap.get("disabledClass");
      enabledClass = (String) attrMap.get("enabledClass");
      lang = (String) attrMap.get("lang");

      onblur = (String) attrMap.get("onblur");
      onchange = (String) attrMap.get("onchange");
      onclick = (String) attrMap.get("onclick");
      ondblclick = (String) attrMap.get("ondblclick");
      onfocus = (String) attrMap.get("onfocus");

      onkeydown = (String) attrMap.get("onkeydown");
      onkeypress = (String) attrMap.get("onkeypress");
      onkeyup = (String) attrMap.get("onkeyup");

      onmousedown = (String) attrMap.get("onmousedown");
      onmousemove = (String) attrMap.get("onmousemove");
      onmouseout = (String) attrMap.get("onmouseout");
      onmouseover = (String) attrMap.get("onmouseover");
      onmouseup = (String) attrMap.get("onmouseup");

      onselect = (String) attrMap.get("onselect");

      readonly = Boolean.TRUE.equals(attrMap.get("readonly"));
      style = (String) attrMap.get("style");
      styleClass = (String) attrMap.get("styleClass");
      tabindex = (String) attrMap.get("tabindex");
      title = (String) attrMap.get("title");

      value = attrMap.get("value");
    }

    UIViewRoot viewRoot = context.getViewRoot();

    out.startElement("select", component);

    if (style != null) out.writeAttribute("style", style, "style");

    if (styleClass != null) out.writeAttribute("class", styleClass, "class");

    String clientId = component.getClientId(context);
    out.writeAttribute("name", clientId, "name");

    if (id != null && !id.startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
      out.writeAttribute("id", clientId, "id");

    if (disabled) out.writeAttribute("disabled", "disabled", "disabled");

    if (accesskey != null) out.writeAttribute("accesskey", accesskey, "accesskey");

    if (dir != null) out.writeAttribute("dir", dir, "dir");

    if (lang != null) out.writeAttribute("lang", lang, "lang");

    if (onblur != null) out.writeAttribute("onblur", onblur, "onblur");

    if (onchange != null) out.writeAttribute("onchange", onchange, "onchange");

    if (onclick != null) out.writeAttribute("onclick", onclick, "onclick");

    if (ondblclick != null) out.writeAttribute("ondblclick", ondblclick, "ondblclick");

    if (onfocus != null) out.writeAttribute("onfocus", onfocus, "onfocus");

    if (onkeydown != null) out.writeAttribute("onkeydown", onkeydown, "onkeydown");

    if (onkeypress != null) out.writeAttribute("onkeypress", onkeypress, "onkeypress");

    if (onkeyup != null) out.writeAttribute("onkeyup", onkeyup, "onkeyup");

    if (onmousedown != null) out.writeAttribute("onmousedown", onmousedown, "onmousedown");

    if (onmousemove != null) out.writeAttribute("onmousemove", onmousemove, "onmousemove");

    if (onmouseout != null) out.writeAttribute("onmouseout", onmouseout, "onmouseout");

    if (onmouseover != null) out.writeAttribute("onmouseover", onmouseover, "onmouseover");

    if (onmouseup != null) out.writeAttribute("onmouseup", onmouseup, "onmouseup");

    if (onselect != null) out.writeAttribute("onselect", onselect, "onselect");

    if (readonly) out.writeAttribute("readonly", "readonly", "readonly");

    if (tabindex != null) out.writeAttribute("tabindex", tabindex, "tabindex");

    if (title != null) out.writeAttribute("title", title, "title");

    out.writeAttribute("size", "1", "size");

    out.write("\n");

    encodeOneChildren(out, context, component, value, enabledClass, disabledClass);

    out.endElement("select");
    out.write("\n");

    for (UIComponent child : component.getChildren()) {
      if (child instanceof UIComponent) child.encodeAll(context);
    }
  }
 @Override
 public void handleChange(AjaxBehaviorEvent event) {
   try {
     HtmlSelectOneMenu menu = (HtmlSelectOneMenu) event.getComponent();
     if (menu.getValue() instanceof Sehir) {
       changeIlce(((Sehir) menu.getValue()).getRID());
     } else if (menu.getValue() instanceof Ilce) {
       changeMahalle(((Ilce) menu.getValue()).getRID());
     } else if (menu.getValue() instanceof Ulke) {
       changeIl(((Ulke) menu.getValue()).getRID());
     } else if (menu.getValue() instanceof AdresTipi) {
       changeUlke((AdresTipi) menu.getValue());
     } else if (menu.getValue() instanceof Universite) {
       changeFakulte(((Universite) menu.getValue()).getRID());
     } else if (menu.getValue() instanceof Fakulte) {
       changeBolum(((Fakulte) menu.getValue()).getRID());
     }
   } catch (Exception e) {
     logger.error("Exception @" + getModelName() + "Controller :", e);
   }
 }