001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package com.sun.rave.web.ui.component;
042:
043: import java.util.Iterator;
044: import javax.faces.context.FacesContext;
045: import javax.faces.component.EditableValueHolder;
046: import javax.faces.component.UIComponent;
047:
048: /**
049: * This interface is used to allow both list components which
050: * allow the user to select from a set of Options (e.g. Listbox,
051: * AddRemove) and list components which allow the user to edit
052: * a list to use the same renderer.
053: *
054: * TODO: consider making this a base class instead. There
055: * is code which is shared between Selectors and Editable List,
056: * Orderable List. (getConvertedValue, getValueAsString, ...)
057: *
058: * @author avk
059: */
060: public interface ListManager extends EditableValueHolder,
061: SelectorManager, ComplexComponent {
062:
063: /**
064: * Get an Iterator of the items to display. The items are of
065: * type <code>com.sun.rave.web.ui.model.list.ListItem</code> and
066: * are an abstraction over different types of actual data
067: * to be used by the renderer
068: * @param rulerAtEnd If this attribute is set to true, the iterator will contain, as the last item, a disabled list option with a blank label whose sole function is to guarantee that the list stays the same size
069: * @return An Iterator of <code>com.sun.rave.web.ui.model.list.ListItem</code>
070: */
071: public Iterator getListItems(FacesContext context,
072: boolean rulerAtEnd);
073:
074: /**
075: * Retrieves the tooltip for the list
076: * @return A string with the text for the tool tip
077: */
078: public String getToolTip();
079:
080: /**
081: * Get the value of the component as a String array. The array consists
082: * of the converted value of each list item is shown.
083: * @param context The FacesContext of the request
084: * @return A string representation of the value
085: */
086: public String[] getValueAsStringArray(FacesContext context);
087:
088: /**
089: * Get the number of rows to display (the size of the HTML
090: * select element)
091: * @return The size of the list
092: */
093: public int getRows();
094:
095: /**
096: * Returns a UIComponent used to display the readonly value for this
097: * component
098: * @return a UIComponent used to display the readonly value for this
099: * component
100: */
101: public UIComponent getReadOnlyValueComponent();
102:
103: public boolean isVisible();
104:
105: // return true if the select element associated with the component
106: // represents the value in the HTTP request.
107: public boolean mainListSubmits();
108:
109: }
|