001: /*
002: #IFNDEF ALT_LICENSE
003: ThinWire(R) RIA Ajax Framework
004: Copyright (C) 2003-2007 Custom Credit Systems
005:
006: This library is free software; you can redistribute it and/or modify it under
007: the terms of the GNU Lesser General Public License as published by the Free
008: Software Foundation; either version 2.1 of the License, or (at your option) any
009: later version.
010:
011: This library is distributed in the hope that it will be useful, but WITHOUT ANY
012: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
013: PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
014:
015: You should have received a copy of the GNU Lesser General Public License along
016: with this library; if not, write to the Free Software Foundation, Inc., 59
017: Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:
019: Users who would rather have a commercial license, warranty or support should
020: contact the following company who invented, built and supports the technology:
021:
022: Custom Credit Systems, Richardson, TX 75081, USA.
023: email: info@thinwire.com ph: +1 (888) 644-6405
024: http://www.thinwire.com
025: #ENDIF
026: [ v1.2_RC2 ]
027: */
028: package thinwire.ui;
029:
030: import java.util.List;
031:
032: import thinwire.ui.layout.Layout;
033:
034: /**
035: * A <code>Container</code> is a <code>Component</code> that maintains a collection of other <code>Component</code>s as a group.
036: * Additionally, <code>Container</code> is the foundation of all other container types in the framework such as <code>Panel</code>, <code>Frame</code>,
037: * <code>Dialog</code>, <code>TabSheet</code>, etc. It is worth noting that components within a <code>Container</code>, maintain there
038: * X and Y coordinates relative to the <code>Container</code> itself. Therefore, a <code>Component</code> with an X value of 5 that
039: * is placed in a <code>Container</code> with an X value of 10, will actually be positioned at X coordinate 15.
040: * @author Joshua J. Gertzen
041: */
042: public interface Container<T extends Component> extends
043: ItemChangeEventComponent {
044: public enum ScrollType {
045: NONE, AS_NEEDED, ALWAYS
046: }
047:
048: /**
049: * Contains the formal property name for the scroll type of the container.
050: * @see #setScrollType(ScrollType)
051: * @see #getScrollType()
052: * @see ScrollType
053: */
054: public static final String PROPERTY_SCROLL_TYPE = "scrollType";
055:
056: /**
057: * Contains the formal property name for the layout manager of the container.
058: * @see #setLayout(Layout)
059: * @see #getLayout()
060: * @see thinwire.ui.layout.Layout
061: */
062: public static final String PROPERTY_LAYOUT = "layout";
063:
064: /**
065: * Gets the current scrollType defined for the Container.
066: * @return the current scrollType defined for the Container.
067: */
068: ScrollType getScrollType();
069:
070: /**
071: * Sets the scrollType for the X and Y axis of this Container.
072: * By default the scroll type is ScrollType.NONE.
073: * @param scrollType one of the enum ScrollType constants.
074: * @see #PROPERTY_SCROLL
075: * @see thinwire.ui.event.PropertyChangeEvent
076: */
077: void setScrollType(ScrollType scrollType);
078:
079: /**
080: * Gets the current layout manager that is responsible for sizing and
081: * positioning components of this <code>Container</code>.
082: * @return the </code>Layout</code> implementation used by this <code>Container</code>.
083: * @see #setLayout(Layout)
084: * @see Component#getLimit
085: * @see Component#setLimit(Object)
086: * @see thinwire.ui.layout.Layout
087: */
088: Layout getLayout();
089:
090: /**
091: * Sets the layout manager that is used to size and position components of this <code>Container</code>.
092: * If a <code>Layout</code> is not specified for a container, then you must size and position of the components
093: * within a container manually.
094: * <b>Default:</b> null (i.e. fixed absolute coordinate positioning)
095: * @param layout any class implementing the <code>Layout</code> interface, or null.
096: * @see #PROPERTY_LAYOUT
097: * @see Component#getLimit
098: * @see Component#setLimit(Object)
099: * @see thinwire.ui.layout.Layout
100: * @see thinwire.ui.event.PropertyChangeEvent
101: */
102: void setLayout(Layout layout);
103:
104: /**
105: * Returns a list of components in the container.
106: * @return this Container's children.
107: */
108: List<T> getChildren();
109:
110: /**
111: * Get the child Component for this container that currently has the focus.
112: * If this container contains another container and that container contains the
113: * Component at the bottom of the component hiearchy with the focus, this method
114: * will return the <code>Container</code> contained by this container, not the
115: * <code>Component</code>. If you want the component at the bottom of the component
116: * hiearchy that has the focus, use <code>getComponentWithFocus()</code>.
117: * @return the child Component with focus, or null if there is no child with focus.
118: */
119: T getChildWithFocus();
120:
121: /**
122: * Get the Component at the bottom of the component hiearchy that has the focus.
123: * This method first walks up the component hiearchy to find the root Container, then
124: * it walks down the hiearchy to locate the component at the bottom of the component
125: * hiearchy that has the focus.
126: * @return the Component at the bottom of component hiearchy that has the focus, or null if no component does.
127: */
128: T getComponentWithFocus();
129:
130: /**
131: * Returns the usable inner width of the <code>Container</code>.
132: * @return the usable inner width of the <code>Container</code>.
133: */
134: int getInnerWidth();
135:
136: /**
137: * Returns the usable inner height of the <code>Container</code>.
138: * @return the usable inner height of the <code>Container</code>.
139: */
140: int getInnerHeight();
141: }
|