ArticlesTutorialsInterview Questions & AnswersCertificationsFree Books & Sample ChaptersTechnical Discussions  Your Account | Advertise with us | Feedback |
Few pages of this site are under construction and we are constantly trying to improve it. If you have any suggestions or ideas about how to improve the site, please Let us know.
Tomahawk CollapsiblePanel

 t:checkbox Tomahawk Tag Home t:column 

<t:collapsiblePanel>


Contents

  1. Introduction
  2. Tag Attributes
  3. Example

Introduction

The t:collapsiblePanel tag is a collapsible panel that can show or hide its children elements. When collapsed, there is a single button rendered that will reopen the panel and display the children. The title attribute defines the visible label displayed at the top of the panel.


Tag Attributes


AttributeDescription   Type    
binding The value-binding expression linking this component tag to a backing bean property.String
dir The dir attribute is a standard HTML attribute that overrides the default text directionality for this component. The values accepted for this component are "LTR" (left-to-right) and "RTL" (right-to-left).String
enabledOnUserRole The enabledOnUserRole attribute determines if this component will be rendered normally or not depending on the user's roles.String
id The unique identifier value for this component. The value must be unique within the closest naming container (e.g.,h:form or f:subview).This value must be a static value.String
rendered A value-binding expression that evaluates to a Boolean condition indicating if this component should be rendered.String
value Boolean value indicating whether the panel is collapsed by default. In collapsed state, the body of the panel is not rendered. If you provide a facet with name 'closedContent', this facet is rendered instead.String
var The var attribute sets the name of a request-scope attribute exposing the data for each iteration over the rows in the underlying data model for this table.String
visibleOnUserRole The visibleOnUserRole attribute determines if this component will be visible or not depending on the user's roles.String
onblur, onchange,etc., DHTML EventsString


Example


 As an example suppose we need to display person information overview or details. First thing to do is to create the Person class with the id,type and color.


Person.java

package com.developersBook.tomahawk.examples.collapsiblePanelExample;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.Serializable;

public class Person implements Serializable
{
private String surName;
private String firstName;
private boolean collapsed;
private static Log log = LogFactory.getLog(Person.class);
public boolean isCollapsed(){
return collapsed;
}
public void setCollapsed(boolean collapsed){
this.collapsed = collapsed;
}
public String getFirstName(){
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getSurName(){
return surName;
}
public void setSurName(String surName){
this.surName = surName;
}
public String test()
{
log.info("test called for " + Person.class +
           " with name: "+getFirstName());
return null;
  }
}


CollapsiblePanelBean.java

package com.developersBook.tomahawk.examples.collapsiblePanelExample;

import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.io.Serializable;
public class CollapsiblePanelBean implements Serializable {
private boolean collapsed;
private String firstName = "Tom Brady";
private String surName;
private Date birthDate;
private List persons;
public List getPersons() {
if (persons == null) {
persons = new ArrayList();

Person person = new Person();
person.setFirstName("Tom");
person.setSurName("Brady");
persons.add(person);
person = new Person();
person.setFirstName("John");
person.setSurName("Deo");
persons.add(person);
person = new Person();
person.setFirstName("Michel");
person.setSurName("Jackson");
persons.add(person);
}
return persons;
}

public void setPersons(List persons) {
persons = persons;
}
public Date getBirthDate() {
return birthDate;
}

public void setBirthDate(Date birthDate) {
this.birthDate = birthDate;
}

public boolean isCollapsed() {
return collapsed;
}

public void setCollapsed(boolean collapsed) {
this.collapsed = collapsed;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getSurName() {
return surName;
}
public void setSurName(String surName) {
this.surName = surName;
  }
}

CollapsiblePanel.jsp

<%@ page session="false" contentType="text/html;charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<html>
<body>
<f:view>

  <t:saveState value="#{collapsiblePanelBean}"/>
   <h:form id="form">

      <t:collapsiblePanel id="test"
       value="#{collapsiblePanelBean.collapsed}" title="testTitle" var="test2collapsed">
      <f:facet name="header">
        <t:div style="width:500px;background-color:#CCCCCC;">
          <h:outputText value="Person"/>
          <t:headerLink immediate="true">
            <h:outputText value="> Details" rendered="#{test2collapsed}"/>
            <h:outputText value="Overview" rendered="#{!test2collapsed}"/>
          </t:headerLink>
        </t:div>
      </f:facet>
      <f:facet name="closedContent">
        <h:panelGroup>
          <h:outputText value="#{collapsiblePanelBean.firstName}"/>
          <h:outputText value=" "/>
          <h:outputText value="#{collapsiblePanelBean.surName}"/>
          <h:outputText value=", born on: "/>
          <h:outputText value="#{collapsiblePanelBean.birthDate}"/>
        </h:panelGroup>
      </f:facet>
      <h:panelGrid>
        <h:outputText value="#{collapsiblePanelBean.firstName}"/>
        <h:inputText value="#{collapsiblePanelBean.surName}"/>
        <t:inputCalendar value="#{collapsiblePanelBean.birthDate}" renderAsPopup="true"/>
      </h:panelGrid>
    </t:collapsiblePanel>

    </h:form>
</f:view>

</body>
</html>


In the end, this is how it looks;


When you click on overview this is how it looks;



 t:checkbox Tomahawk Tag Home t:column 
Related Links

Tomahawk
t:aliasBean
t:aliasBeansScope
t:buffer
t:checkbox
t:collapsiblePanel
t:column
t:columns
t:commandButton
t:commandLink
t:commandNavigation
t:commandNavigation2
t:commandSortHeader
t:dataList
t:dataScroller
t:dataTable
t:div
t:document
t:documentBody
t:documentHead
t:dojoInitializer
t:graphicImage
t:headerLink
t:htmlTag
t:iconProvider
t:inputCalendar
t:inputDate
t:inputFileUpload
t:inputHidden
t:inputHtml
t:inputSecret
t:inputText
t:inputTextHelp
t:inputTextarea
t:jsValueChangeListener
t:jsValueSet
t:jscookMenu
t:message
t:messages
t:navigationMenuItem
t:navigationMenuItems
t:newspaperTable
t:outputLabel
t:outputText
t:panelGrid
t:panelGroup
t:panelLayout
t:panelNavigation
t:panelNavigation2
t:panelStack
t:panelTab
t:panelTabbedPane
t:popup
t:radio
t:saveState
t:schedule
t:selectBooleanCheckbox
t:selectItems
t:selectManyCheckbox
t:selectManyListbox
t:selectManyMenu
t:selectOneCountry
t:selectOneLanguage
t:selectOneListbox
t:selectOneMenu
t:selectOneRadio
t:stylesheet
t:swapImage
t:tabChangeListener
t:tree
t:tree2
t:treeCheckbox
t:treeColumn
t:treeSelectionListener
t:updateActionListener
t:validateCreditCard
t:validateEmail
t:validateEqual
t:validateRegExpr
Core Tags
f:actionListener
f:attribute
f:converter
f:convertDateTime
f:convertNumber
f:facet
f:loadBundle
f:param
f:selectitem
f:selectitems
f:subview
f:validateDoubleRange
f:validateLength
f:validateLongRange
f:validator
f:valueChangeListener
f:verbatim
f:view
HTML Tags
h:column
h:commandButton
h:commandLink
h:dataTable
h:form
h:graphicImage
h:inputHidden
h:inputSecret
h:inputText
h:inputTextarea
h:message
h:messages
h:outputFormat
h:outputLabel
h:outputLink
h:outputText
h:panelGrid
h:panelGroup
h:selectBooleanCheckbox
h:selectManyCheckbox
h:selectManyListbox
h:selectManyMenu
h:selectOneListbox
h:selectOneMenu
h:selectOneRadio
Tomahawk
t:aliasBean
t:aliasBeansScope
t:buffer
t:checkbox
t:collapsiblePanel
t:column
t:columns
t:commandButton
t:commandLink
t:commandNavigation
t:commandNavigation2
t:commandSortHeader
t:dataList
t:dataScroller
t:dataTable
t:div
t:document
t:documentBody
t:documentHead
t:dojoInitializer
t:graphicImage
t:headerLink
t:htmlTag
t:iconProvider
t:inputCalendar
t:inputDate
t:inputFileUpload
t:inputHidden
t:inputHtml
t:inputSecret
t:inputText
t:inputTextHelp
t:inputTextarea
t:jsValueChangeListener
t:jsValueSet
t:jscookMenu
t:message
t:messages
t:navigationMenuItem
t:navigationMenuItems
t:newspaperTable
t:outputLabel
t:outputText
t:panelGrid
t:panelGroup
t:panelLayout
t:panelNavigation
t:panelNavigation2
t:panelStack
t:panelTab
t:panelTabbedPane
t:popup
t:radio
t:saveState
t:schedule
t:selectBooleanCheckbox
t:selectItems
t:selectManyCheckbox
t:selectManyListbox
t:selectManyMenu
t:selectOneCountry
t:selectOneLanguage
t:selectOneListbox
t:selectOneMenu
t:selectOneRadio
t:stylesheet
t:swapImage
t:tabChangeListener
t:tree
t:tree2
t:treeCheckbox
t:treeColumn
t:treeSelectionListener
t:updateActionListener
t:validateCreditCard
t:validateEmail
t:validateEqual
t:validateRegExpr
Core Tags
f:actionListener
f:attribute
f:converter
f:convertDateTime
f:convertNumber
f:facet
f:loadBundle
f:param
f:selectitem
f:selectitems
f:subview
f:validateDoubleRange
f:validateLength
f:validateLongRange
f:validator
f:valueChangeListener
f:verbatim
f:view

  ALSO SEE :

About Us | Our Mission | Terms of use | Author Terms |    Search        | Contact Us | Advertise With Us | Link to Us | Sitemap
Copyright © 2016 developersbook.com. All rights reserved.