001    package org.gwtbootstrap3.client.ui.gwt;
002    
003    /*
004     * #%L
005     * GwtBootstrap3
006     * %%
007     * Copyright (C) 2013 - 2014 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 org.gwtbootstrap3.client.ui.base.HasId;
024    import org.gwtbootstrap3.client.ui.base.HasPull;
025    import org.gwtbootstrap3.client.ui.base.HasResponsiveness;
026    import org.gwtbootstrap3.client.ui.base.helper.StyleHelper;
027    import org.gwtbootstrap3.client.ui.base.mixin.EnabledMixin;
028    import org.gwtbootstrap3.client.ui.base.mixin.IdMixin;
029    import org.gwtbootstrap3.client.ui.base.mixin.PullMixin;
030    import org.gwtbootstrap3.client.ui.constants.DeviceSize;
031    import org.gwtbootstrap3.client.ui.constants.Pull;
032    
033    import com.google.gwt.dom.client.Element;
034    
035    public abstract class ButtonBase extends com.google.gwt.user.client.ui.ButtonBase implements HasResponsiveness, HasId,
036            HasPull {
037    
038        private final IdMixin<ButtonBase> idMixin = new IdMixin<ButtonBase>(this);
039        private final PullMixin<ButtonBase> pullMixin = new PullMixin<ButtonBase>(this);
040        private final EnabledMixin<ButtonBase> enabledMixin = new EnabledMixin<ButtonBase>(this);
041    
042        protected ButtonBase(Element elem) {
043            super(elem);
044        }
045    
046        @Override
047        public void setEnabled(boolean enabled) {
048            enabledMixin.setEnabled(enabled);
049        }
050    
051        @Override
052        public boolean isEnabled() {
053            return enabledMixin.isEnabled();
054        }
055    
056        /**
057         * {@inheritDoc}
058         */
059        @Override
060        public void setId(final String id) {
061            idMixin.setId(id);
062        }
063    
064        /**
065         * {@inheritDoc}
066         */
067        @Override
068        public String getId() {
069            return idMixin.getId();
070        }
071    
072        /**
073         * {@inheritDoc}
074         */
075        @Override
076        public void setVisibleOn(final DeviceSize deviceSize) {
077            StyleHelper.setVisibleOn(this, deviceSize);
078        }
079    
080        /**
081         * {@inheritDoc}
082         */
083        @Override
084        public void setHiddenOn(final DeviceSize deviceSize) {
085            StyleHelper.setHiddenOn(this, deviceSize);
086        }
087    
088        /**
089         * {@inheritDoc}
090         */
091        @Override
092        public void setPull(final Pull pull) {
093            pullMixin.setPull(pull);
094        }
095    
096        /**
097         * {@inheritDoc}
098         */
099        @Override
100        public Pull getPull() {
101            return pullMixin.getPull();
102        }
103    
104    }