001 package org.gwtbootstrap3.client.ui;
002
003 /*
004 * #%L
005 * GwtBootstrap3
006 * %%
007 * Copyright (C) 2013 GwtBootstrap3
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 *
013 * http://www.apache.org/licenses/LICENSE-2.0
014 *
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023 import java.util.List;
024
025 import org.gwtbootstrap3.client.ui.base.ComplexWidget;
026 import org.gwtbootstrap3.client.ui.base.HasActive;
027 import org.gwtbootstrap3.client.ui.base.HasDataTarget;
028 import org.gwtbootstrap3.client.ui.base.mixin.ActiveMixin;
029 import org.gwtbootstrap3.client.ui.base.mixin.DataTargetMixin;
030 import org.gwtbootstrap3.client.ui.constants.Attributes;
031
032 import com.google.gwt.dom.client.Document;
033 import com.google.gwt.user.client.ui.Widget;
034
035 /**
036 * @author Joshua Godi
037 */
038 public class CarouselIndicator extends ComplexWidget implements HasDataTarget, HasActive {
039
040 private final DataTargetMixin<CarouselIndicator> targetMixin = new DataTargetMixin<CarouselIndicator>(this);
041 private final ActiveMixin<CarouselIndicator> activeMixin = new ActiveMixin<CarouselIndicator>(this);
042
043 public CarouselIndicator() {
044 setElement(Document.get().createLIElement());
045 }
046
047 public void setDataSlideTo(final String dataSlideTo) {
048 getElement().setAttribute(Attributes.DATA_SLIDE_TO, dataSlideTo);
049 }
050
051 public String getDataSlideTo() {
052 return getElement().getAttribute(Attributes.DATA_SLIDE_TO);
053 }
054
055 @Override
056 public void setActive(final boolean active) {
057 activeMixin.setActive(active);
058 }
059
060 @Override
061 public boolean isActive() {
062 return activeMixin.isActive();
063 }
064
065 @Override
066 public void setDataTargetWidgets(final List<Widget> widgets) {
067 targetMixin.setDataTargetWidgets(widgets);
068 }
069
070 @Override
071 public void setDataTargetWidget(final Widget widget) {
072 targetMixin.setDataTargetWidget(widget);
073 }
074
075 @Override
076 public void setDataTarget(final String dataTarget) {
077 targetMixin.setDataTarget(dataTarget);
078 }
079
080 @Override
081 public String getDataTarget() {
082 return targetMixin.getDataTarget();
083 }
084 }