Examples of UITreeListbox


Examples of org.apache.myfaces.tobago.component.UITreeListbox

  public void encodeEnd(FacesContext facesContext, UIComponent component)
      throws IOException {

    int level = ((UITreeListboxBox) component).getLevel();

    UITreeListbox tree = (UITreeListbox) component.getParent();
    List<UITreeOldNode> selectionPath = tree.getSelectionPath();
    String className = "tobago-treeListbox-default";
    if (selectionPath.size() > 0 &&  selectionPath.size() - 1 <= level
        && selectionPath.get(selectionPath.size() - 1).getTreeNode().isLeaf()) {
      className += " tobago-treeListbox-unused";
    }

    String treeId = tree.getClientId(facesContext);
    TobagoResponseWriter writer = (TobagoResponseWriter) facesContext.getResponseWriter();

    final boolean siblingMode
        = "siblingLeafOnly".equals(tree.getAttributes().get(ATTR_SELECTABLE));

    String listboxId = treeId + SUBCOMPONENT_SEP + "cont_" + level;
    String onChange = "tbgTreeListboxChange(this, '" + treeId + "')";
    String onClick  = "tbgTreeListboxClick(this, '" + treeId + "')";
    writer.startElement(HtmlConstants.SELECT, component);
    writer.writeIdAttribute(listboxId);
    writer.writeClassAttribute(className);
    writer.writeAttribute(HtmlAttributes.STYLE , null, ATTR_STYLE);
    writer.writeAttribute(HtmlAttributes.SIZE, "2", null);
    if (siblingMode) {
      writer.writeAttribute(HtmlAttributes.ONCHANGE, onChange, null);
    } else {
      writer.writeAttribute(HtmlAttributes.ONCLICK, onClick, null);
    }
    writer.writeAttribute(HtmlAttributes.MULTIPLE, siblingMode);


    List nodes = ((UITreeListboxBox) component).getNodes();

    for (int i = 0; i < nodes.size(); i++) {
      UITreeOldNode treeNode = (UITreeOldNode) nodes.get(i);
      DefaultMutableTreeNode node = treeNode.getTreeNode();

      writer.startElement(HtmlConstants.OPTION, treeNode);
//      writer.writeAttribute(HtmlAttributes.ONCLICK, "tbgTreeListboxClick(this, '" + treeId + "')", null);
      writer.writeAttribute(HtmlAttributes.VALUE, Integer.toString(i), null);
      if (treeNode.equals(tree.getSelectedNode(level))
          || tree.isSelectedNode(node)) {
        writer.writeAttribute(HtmlAttributes.SELECTED, true);
      }
      writer.writeAttribute(HtmlAttributes.TITLE, null, ATTR_TIP);
      writer.writeText(treeNode.getAttributes().get(ATTR_NAME), null);
      if (node.getChildCount() > 0) {
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITreeListbox

  @Override
  public void encodeBegin(
      FacesContext facesContext, UIComponent component) throws IOException {


    UITreeListbox tree = (UITreeListbox) component;
    tree.createSelectionPath();

    String clientId = tree.getClientId(facesContext);
    UITreeOldNode root = tree.getRoot();


    UIPage page = ComponentUtil.findPage(tree);
    if (LOG.isDebugEnabled()) {
      page.getOnloadScripts().add("tbgTreeStates('" + clientId + "')");
    }
    TobagoResponseWriter writer
        = (TobagoResponseWriter) facesContext.getResponseWriter();
    writer.startElement(HtmlConstants.DIV, tree);
    writer.writeComponentClass();
    writer.writeAttribute(HtmlAttributes.STYLE, null, ATTR_STYLE);

    StringBuilder value = new StringBuilder(";");
    List<UITreeOldNode> expandPath = tree.getExpandPath();
    for (UITreeOldNode node : expandPath) {
      value.append(nodeStateId(facesContext, node));
      value.append(";");
    }

    writer.startElement(HtmlConstants.INPUT, tree);
    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", null);
    writer.writeNameAttribute(clientId);
    writer.writeIdAttribute(clientId);
    writer.writeAttribute(HtmlAttributes.VALUE, value, null);
    writer.endElement(HtmlConstants.INPUT);


    Set<DefaultMutableTreeNode> selection = tree.getState().getSelection();
    value = new StringBuilder(";");
    for (DefaultMutableTreeNode node : selection) {
      value.append(nodeStateId(facesContext, tree.findUITreeNode(root, node)));
      value.append(";");
    }
    writer.startElement(HtmlConstants.INPUT, tree);
    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", null);
    writer.writeNameAttribute(clientId + UITreeListbox.SELECT_STATE);
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITreeListbox

  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UITreeListbox component = (UITreeListbox) uiComponent;
    final FacesContext context = FacesContext.getCurrentInstance();
    final Application application = context.getApplication();
    if (markup != null) {
      if (!markup.isLiteralText()) {
        component.setValueExpression("markup", markup);
      } else {
        component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
      }
    }
    if (state != null) {
      if (!state.isLiteralText()) {
        component.setValueExpression("state", state);
      /*} else {
        component.setState(state.getExpressionString());*/
      }
    }
    if (required != null) {
      if (!required.isLiteralText()) {
        component.setValueExpression("required", required);
      } else {
        component.setRequired(Boolean.parseBoolean(required.getExpressionString()));
      }
    }
    if (selectable != null) {
      component.setValueExpression("selectable", selectable);
    }

  }
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITreeListbox

  @Override
  public void encodeBegin(
      FacesContext facesContext, UIComponent component) throws IOException {


    UITreeListbox tree = (UITreeListbox) component;
    tree.createSelectionPath();

    String clientId = tree.getClientId(facesContext);
    UITreeOldNode root = tree.getRoot();


    UIPage page = ComponentUtil.findPage(facesContext, tree);
    if (LOG.isDebugEnabled()) {
      page.getOnloadScripts().add("tbgTreeStates('" + clientId + "')");
    }
    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
    writer.startElement(HtmlConstants.DIV, tree);
    writer.writeClassAttribute();
    writer.writeStyleAttribute();

    StringBuilder value = new StringBuilder(";");
    List<UITreeOldNode> expandPath = tree.getExpandPath();
    for (UITreeOldNode node : expandPath) {
      value.append(nodeStateId(facesContext, node));
      value.append(";");
    }

    writer.startElement(HtmlConstants.INPUT, tree);
    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
    writer.writeNameAttribute(clientId);
    writer.writeIdAttribute(clientId);
    writer.writeAttribute(HtmlAttributes.VALUE, value.toString(), true);
    writer.endElement(HtmlConstants.INPUT);


    Set<DefaultMutableTreeNode> selection = tree.getState().getSelection();
    value = new StringBuilder(";");
    for (DefaultMutableTreeNode node : selection) {
      value.append(nodeStateId(facesContext, tree.findUITreeNode(root, node)));
      value.append(";");
    }
    writer.startElement(HtmlConstants.INPUT, tree);
    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
    writer.writeNameAttribute(clientId + UITreeListbox.SELECT_STATE);
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITreeListbox

  public void encodeEnd(FacesContext facesContext, UIComponent component)
      throws IOException {

    int level = ((UITreeListboxBox) component).getLevel();

    UITreeListbox tree = (UITreeListbox) component.getParent();
    List<UITreeOldNode> selectionPath = tree.getSelectionPath();
    String className = "tobago-treeListbox-default";
    if (selectionPath.size() > 0 &&  selectionPath.size() - 1 <= level
        && selectionPath.get(selectionPath.size() - 1).getTreeNode().isLeaf()) {
      className += " tobago-treeListbox-unused";
    }

    String treeId = tree.getClientId(facesContext);
    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    final boolean siblingMode
        = "siblingLeafOnly".equals(tree.getAttributes().get(ATTR_SELECTABLE));

    String listboxId = treeId + SUBCOMPONENT_SEP + "cont_" + level;
    String onChange = "tbgTreeListboxChange(this, '" + treeId + "')";
    String onClick  = "tbgTreeListboxClick(this, '" + treeId + "')";
    writer.startElement(HtmlConstants.SELECT, component);
    writer.writeIdAttribute(listboxId);
    writer.writeClassAttribute(className);
    writer.writeStyleAttribute();
    writer.writeAttribute(HtmlAttributes.SIZE, 2);
    if (siblingMode) {
      writer.writeAttribute(HtmlAttributes.ONCHANGE, onChange, null);
    } else {
      writer.writeAttribute(HtmlAttributes.ONCLICK, onClick, null);
    }
    writer.writeAttribute(HtmlAttributes.MULTIPLE, siblingMode);


    List nodes = ((UITreeListboxBox) component).getNodes();

    for (int i = 0; i < nodes.size(); i++) {
      UITreeOldNode treeNode = (UITreeOldNode) nodes.get(i);
      DefaultMutableTreeNode node = treeNode.getTreeNode();

      writer.startElement(HtmlConstants.OPTION, treeNode);
//      writer.writeAttribute(HtmlAttributes.ONCLICK, "tbgTreeListboxClick(this, '" + treeId + "')", null);
      writer.writeAttribute(HtmlAttributes.VALUE, i);
      if (treeNode.equals(tree.getSelectedNode(level))
          || tree.isSelectedNode(node)) {
        writer.writeAttribute(HtmlAttributes.SELECTED, true);
      }
      HtmlRendererUtil.renderTip(treeNode, writer);
      writer.writeText(treeNode.getAttributes().get(ATTR_NAME), null);
      if (node.getChildCount() > 0) {
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITreeListbox

  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UITreeListbox component = (UITreeListbox) uiComponent;
    final FacesContext context = FacesContext.getCurrentInstance();
    final Application application = context.getApplication();
    if (markup != null) {
      if (!markup.isLiteralText()) {
        component.setValueExpression("markup", markup);
      } else {
        component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
      }
    }
    if (var != null) {
      component.setValueExpression("var", var);
    }

    if (state != null) {
      if (!state.isLiteralText()) {
        component.setValueExpression("state", state);
      /*} else {
        component.setState(state.getExpressionString());*/
      }
    }
    if (value != null) {
      component.setValueExpression("value", value);
    }

    if (required != null) {
      if (!required.isLiteralText()) {
        component.setValueExpression("required", required);
      } else {
        component.setRequired(Boolean.parseBoolean(required.getExpressionString()));
      }
    }
    if (selectable != null) {
      component.setValueExpression("selectable", selectable);
    }

  }
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITreeListbox

  public void encodeEnd(FacesContext facesContext, UIComponent component)
      throws IOException {

    int level = ((UITreeListboxBox) component).getLevel();

    UITreeListbox tree = (UITreeListbox) component.getParent();
    List<UITreeOldNode> selectionPath = tree.getSelectionPath();
    String className = "tobago-treeListbox-default";
    if (selectionPath.size() > 0 &&  selectionPath.size() - 1 <= level
        && selectionPath.get(selectionPath.size() - 1).getTreeNode().isLeaf()) {
      className += " tobago-treeListbox-unused";
    }

    String treeId = tree.getClientId(facesContext);
    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    final boolean siblingMode
        = "siblingLeafOnly".equals(tree.getAttributes().get(ATTR_SELECTABLE));

    String listboxId = treeId + SUBCOMPONENT_SEP + "cont_" + level;
    String onChange = "tbgTreeListboxChange(this, '" + treeId + "')";
    String onClick  = "tbgTreeListboxClick(this, '" + treeId + "')";
    writer.startElement(HtmlConstants.SELECT, component);
    writer.writeIdAttribute(listboxId);
    writer.writeClassAttribute(className);
    writer.writeStyleAttribute();
    writer.writeAttribute(HtmlAttributes.SIZE, 2);
    if (siblingMode) {
      writer.writeAttribute(HtmlAttributes.ONCHANGE, onChange, null);
    } else {
      writer.writeAttribute(HtmlAttributes.ONCLICK, onClick, null);
    }
    writer.writeAttribute(HtmlAttributes.MULTIPLE, siblingMode);


    List nodes = ((UITreeListboxBox) component).getNodes();

    for (int i = 0; i < nodes.size(); i++) {
      UITreeOldNode treeNode = (UITreeOldNode) nodes.get(i);
      DefaultMutableTreeNode node = treeNode.getTreeNode();

      writer.startElement(HtmlConstants.OPTION, treeNode);
//      writer.writeAttribute(HtmlAttributes.ONCLICK, "tbgTreeListboxClick(this, '" + treeId + "')", null);
      writer.writeAttribute(HtmlAttributes.VALUE, i);
      if (treeNode.equals(tree.getSelectedNode(level))
          || tree.isSelectedNode(node)) {
        writer.writeAttribute(HtmlAttributes.SELECTED, true);
      }
      writer.writeAttributeFromComponent(HtmlAttributes.TITLE, ATTR_TIP);
      writer.writeText(treeNode.getAttributes().get(ATTR_NAME), null);
      if (node.getChildCount() > 0) {
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITreeListbox

  @Override
  public void encodeBegin(
      FacesContext facesContext, UIComponent component) throws IOException {


    UITreeListbox tree = (UITreeListbox) component;
    tree.createSelectionPath();

    String clientId = tree.getClientId(facesContext);
    UITreeOldNode root = tree.getRoot();


    UIPage page = ComponentUtil.findPage(facesContext, tree);
    if (LOG.isDebugEnabled()) {
      page.getOnloadScripts().add("tbgTreeStates('" + clientId + "')");
    }
    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
    writer.startElement(HtmlConstants.DIV, tree);
    writer.writeClassAttribute();
    writer.writeStyleAttribute();

    StringBuilder value = new StringBuilder(";");
    List<UITreeOldNode> expandPath = tree.getExpandPath();
    for (UITreeOldNode node : expandPath) {
      value.append(nodeStateId(facesContext, node));
      value.append(";");
    }

    writer.startElement(HtmlConstants.INPUT, tree);
    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
    writer.writeNameAttribute(clientId);
    writer.writeIdAttribute(clientId);
    writer.writeAttribute(HtmlAttributes.VALUE, value.toString(), true);
    writer.endElement(HtmlConstants.INPUT);


    Set<DefaultMutableTreeNode> selection = tree.getState().getSelection();
    value = new StringBuilder(";");
    for (DefaultMutableTreeNode node : selection) {
      value.append(nodeStateId(facesContext, tree.findUITreeNode(root, node)));
      value.append(";");
    }
    writer.startElement(HtmlConstants.INPUT, tree);
    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
    writer.writeNameAttribute(clientId + UITreeListbox.SELECT_STATE);
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITreeListbox

  @Override
  public void encodeBegin(
      FacesContext facesContext, UIComponent component) throws IOException {


    UITreeListbox tree = (UITreeListbox) component;
    tree.createSelectionPath();

    String clientId = tree.getClientId(facesContext);
    UITreeOldNode root = tree.getRoot();


    UIPage page = ComponentUtil.findPage(facesContext, tree);
    if (LOG.isDebugEnabled()) {
      page.getOnloadScripts().add("tbgTreeStates('" + clientId + "')");
    }
    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
    writer.startElement(HtmlConstants.DIV, tree);
    writer.writeClassAttribute();
    writer.writeStyleAttribute();

    StringBuilder value = new StringBuilder(";");
    List<UITreeOldNode> expandPath = tree.getExpandPath();
    for (UITreeOldNode node : expandPath) {
      value.append(nodeStateId(facesContext, node));
      value.append(";");
    }

    writer.startElement(HtmlConstants.INPUT, tree);
    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
    writer.writeNameAttribute(clientId);
    writer.writeIdAttribute(clientId);
    writer.writeAttribute(HtmlAttributes.VALUE, value.toString(), true);
    writer.endElement(HtmlConstants.INPUT);


    Set<DefaultMutableTreeNode> selection = tree.getState().getSelection();
    value = new StringBuilder(";");
    for (DefaultMutableTreeNode node : selection) {
      value.append(nodeStateId(facesContext, tree.findUITreeNode(root, node)));
      value.append(";");
    }
    writer.startElement(HtmlConstants.INPUT, tree);
    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
    writer.writeNameAttribute(clientId + UITreeListbox.SELECT_STATE);
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UITreeListbox

  public void encodeBeginTobago(
      FacesContext facesContext, UIComponent component) throws IOException {


    UITreeListbox tree = (UITreeListbox) component;
    tree.createSelectionPath();

    String clientId = tree.getClientId(facesContext);
    UITreeNode root = tree.getRoot();


    UIPage page = ComponentUtil.findPage(tree);
    if (LOG.isDebugEnabled()) {
      page.getOnloadScripts().add("tbgTreeStates('" + clientId + "')");
    }
    TobagoResponseWriter writer
        = (TobagoResponseWriter) facesContext.getResponseWriter();
    writer.startElement("div", tree);
    writer.writeComponentClass();
    writer.writeAttribute("style", null, ATTR_STYLE);

    String value = ";";
    List<UITreeNode> expandPath = tree.getExpandPath();
    for (UITreeNode node : expandPath) {
      value += nodeStateId(facesContext, node) + ";";
    }

    writer.startElement("input", tree);
    writer.writeAttribute("type", "hidden", null);
    writer.writeNameAttribute(clientId);
    writer.writeIdAttribute(clientId);
    writer.writeAttribute("value", value, null);
    writer.endElement("input");


    final Set<DefaultMutableTreeNode> selection = tree.getState().getSelection();
    value = ";";
    for (DefaultMutableTreeNode node : selection) {
      value += nodeStateId(facesContext, tree.findUITreeNode(root, node)) + ";";
    }
    writer.startElement("input", tree);
    writer.writeAttribute("type", "hidden", null);
    writer.writeNameAttribute(clientId + UITreeListbox.SELECT_STATE);
    writer.writeIdAttribute(clientId + UITreeListbox.SELECT_STATE);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.