001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kew.web;
017
018import java.util.ArrayList;
019import java.util.List;
020
021/**
022 * A tree of boolean flags which represent the state of show/hide for the GUI.
023 * 
024 * @author Kuali Rice Team (rice.collab@kuali.org)
025 */
026public class ShowHideTree implements java.io.Serializable {
027
028        private static final long serialVersionUID = 6048341469002946402L;
029
030        private Boolean show = Boolean.TRUE;
031    private List children = new ArrayList();
032    
033    public ShowHideTree() {
034    }
035    
036    public List getChildren() {
037        return children;
038    }
039    
040    public void setChildren(List children) {
041        this.children = children;
042    }
043        
044    public ShowHideTree getChild(Integer value) {
045        return getChild(value.intValue());
046    }
047    
048    public ShowHideTree getChild(int value) {
049        for (int index = children.size(); index <= value; index++) {
050            children.add(new ShowHideTree());
051        }
052        return (ShowHideTree)children.get(value);
053    }
054    
055    public ShowHideTree append() {
056        return getChild(children.size());
057    }
058    
059    public ShowHideTree remove(Integer index) {
060        return remove(index.intValue());
061    }
062    
063    public ShowHideTree remove(int index) {
064        return (ShowHideTree)children.remove(index);
065    }
066        
067    public Boolean getShow() {
068        return show;
069    }
070    
071    public void setShow(Boolean show) {
072        this.show = show;
073    }
074        
075}