001 package echopoint.jquery;
002
003 import echopoint.ContainerEx;
004 import nextapp.echo.app.ImageReference;
005
006 /**
007 * CarouselContainer is a component that can be positioned anywhere on the screen with an specified size attributes.
008 * The components put inside will be able to navigate between in a carousel-style widget.
009 * This component is built around the jQuery project jCarousel Lite: http://www.gmarwaha.com/jquery/jcarousellite
010 *
011 * This component is a PaneContainer and hence can have components that implement Pane as a child.
012 * @author HansH 2009-07-09
013 * @version $Id$
014 */
015 public class CarouselContainer extends ContainerEx {
016
017 public static final String PROPERTY_LEFT_ICON = "leftIcon";
018 public static final String PROPERTY_RIGHT_ICON = "rightIcon";
019 public static final String PROPERTY_LEFT_ICON_OVER = "leftIconOver";
020 public static final String PROPERTY_RIGHT_ICON_OVER = "rightIconOver";
021 public static final String PROPERTY_VISIBLE = "visible";
022 public static final String PROPERTY_CIRCULAR = "circular";
023
024
025 public CarouselContainer() {
026 super();
027
028 set(PROPERTY_CIRCULAR, false);
029 }
030
031 /**
032 * Returns the left icon displayed in the button.
033 *
034 * @return the icon
035 */
036 public ImageReference getLeftIcon() {
037 return (ImageReference) get(PROPERTY_LEFT_ICON);
038 }
039
040 /**
041 * Sets the left icon displayed in the button.
042 *
043 * @param newValue the new icon
044 */
045 public void setLeftIcon(ImageReference newValue) {
046 set(PROPERTY_LEFT_ICON, newValue);
047 }
048
049 /**
050 * Returns the right icon displayed in the button.
051 *
052 * @return the icon
053 */
054 public ImageReference getRightIcon() {
055 return (ImageReference) get(PROPERTY_RIGHT_ICON);
056 }
057
058 /**
059 * Sets the right icon displayed in the button.
060 *
061 * @param newValue the new icon
062 */
063 public void setRightIcon(ImageReference newValue) {
064 set(PROPERTY_RIGHT_ICON, newValue);
065 }
066
067 /**
068 * Returns the left icon displayed in the button.
069 *
070 * @return the icon
071 */
072 public ImageReference getLeftMouseOverIcon() {
073 return (ImageReference) get(PROPERTY_LEFT_ICON_OVER);
074 }
075
076 /**
077 * Sets the left icon displayed in the button.
078 *
079 * @param newValue the new icon
080 */
081 public void setLeftMouseOverIcon(ImageReference newValue) {
082 set(PROPERTY_LEFT_ICON_OVER, newValue);
083 }
084
085 /**
086 * Returns the right icon displayed in the button.
087 *
088 * @return the icon
089 */
090 public ImageReference getRightMouseOverIcon() {
091 return (ImageReference) get(PROPERTY_RIGHT_ICON_OVER);
092 }
093
094 /**
095 * Sets the right icon displayed in the button.
096 *
097 * @param newValue the new icon
098 */
099 public void setRightMouseOverIcon(ImageReference newValue) {
100 set(PROPERTY_RIGHT_ICON_OVER, newValue);
101 }
102
103 /**
104 * Returns the number of visible items
105 * @return
106 */
107 public int getVisible() {
108 return get(PROPERTY_VISIBLE, 3);
109 }
110
111 /**
112 * Sets the number of visible items.
113 * @param newVisible
114 */
115 public void setVisible(int newVisible) {
116 set(PROPERTY_VISIBLE, newVisible);
117 }
118
119
120 /**
121 * Returns true if the carousel is circular
122 * @return
123 */
124 public boolean isCircular() {
125 return get(PROPERTY_CIRCULAR, false);
126 }
127
128 /**
129 * Sets whether the carousel should be circular or not
130 * @param isCircular
131 */
132 public void setCircular(boolean isCircular) {
133 set(PROPERTY_CIRCULAR, isCircular);
134 }
135 }