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