Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7945433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:51:51+00:00 2026-06-04T00:51:51+00:00

In Tapestry5 tree component allows a user to select multiple items. Each selected item

  • 0

In Tapestry5 tree component allows a user to select multiple items. Each selected item looks colored in bold. How do I make a restriction on tree component so is possible to select one single item?

I’ve been checking TreeSelectionModel for this purpose, but all I can do is to store TreeNode values on a collection, but not to restrict user selection on client side.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:51:52+00:00Added an answer on June 4, 2026 at 12:51 am

    That’s a tricky one. You have to place the tree component within a zone and update the zone when the selection changes.

    Geoff Callender posted an example at jumpstart:
    http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/treefromdatabasewithzones

    Psydo-code example:

    Tml:

    <t:zone t:id="treeZone" id="treeZone">
      <t:tree t:id="Tree" t:model="treeModel" t:node="treeNode" t:value="categoryNode"  class="prop:leafClass">
        <p:label>
          <t:if test="treeNode.leaf">
            <a t:type="EventLink" t:event="leafSelected" t:context="categoryNode.category.id" t:zone="selectedZone" href="#">
              ${treeNode.label}
            </a>
          </t:if>
          <t:if test="!treeNode.leaf">
            ${treeNode.label}
          </t:if>
         </p:label>
      </t:tree>
    </t:zone>
    

    Java:

    @InjectComponent
    private Zone treeZone;
    
    @Inject
    private AjaxResponseRenderer ajaxResponseRenderer;
    
    @Inject
    private Request request;
    
    void onLeafSelected(Integer categoryId) {
        CategoryNode categoryNode = categoryService.findCategoryInfo(categoryId);
        selectedCategory = categoryNode.getCategory();
    
        if (request.isXHR()) {
            ajaxResponseRenderer.addRender(treeZone).addRender(selectedZone);
        }
    }
    
    public String getLeafClass() {
        if (selectedCategory != null && categoryNode.getCategory().equals(selectedCategory)) {
            return "selected";
        }
        else {
            return "";
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using tapestry5-jquery and Dialog component, ¿How do I implement a close action for the
I want to display in a t:grid component a List of items, but i
I'm facing a problem when using tapestry 5.2.0 : using multiple times a component
I have a tapestry url that looks like http://localhost:8888/forwardtask/88 how do i get the
Is it possible to have more than one tapestry5 module in one web application?
in tapestry we can use the component in two ways <t:type=grid t:source=persons t:row=person t:encoder=personEncoder
is it possible to create a form in tapestry that has multiple input fields
Apache Wicket ( http://wicket.apache.org/ ) and Apache Tapestry ( http://wicket.apache.org/ ) are both component
I'm using the Tapestry5 tapx template library to send an html email, as per
I'm trying to follow a tutorial on Tapestry. (http://tapestry.apache.org/tapestry5.1/tutorial1/env.html) The tutorial recommends Jetty 5.1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.