package org.gwtbootstrap3.client.ui.base;

/*
 * #%L
 * GwtBootstrap3
 * %%
 * Copyright (C) 2013 GwtBootstrap3
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import com.google.gwt.dom.client.Element;
import com.google.gwt.text.shared.Parser;
import com.google.gwt.text.shared.Renderer;
import org.gwtbootstrap3.client.ui.*;
import org.gwtbootstrap3.client.ui.base.helper.StyleHelper;
import org.gwtbootstrap3.client.ui.base.mixin.EnabledMixin;
import org.gwtbootstrap3.client.ui.base.mixin.IdMixin;

public class ValueBoxBase<T> extends com.google.gwt.user.client.ui.ValueBoxBase<T> implements HasId, HasResponsiveness, HasEnabled,
        HasPlaceholder, HasAutocomplete {
    private static final String MAX_LENGTH = "maxlength";

    private final IdMixin<ValueBoxBase<T>> idMixin = new IdMixin<ValueBoxBase<T>>(this);
    private final EnabledMixin<ValueBoxBase<T>> enabledMixin = new EnabledMixin<ValueBoxBase<T>>(this);

    /**
     * Creates a value box that wraps the given browser element handle. This is
     * only used by subclasses.
     *
     * @param elem the browser element to wrap
     */
    protected ValueBoxBase(final Element elem, final Renderer<T> renderer, final Parser<T> parser) {
        super(elem, renderer, parser);
    }

    public void setMaxLength(int maxLength) {
        getElement().setAttribute(MAX_LENGTH, Integer.toString(maxLength));
    }

    @Override
    public void setEnabled(boolean enabled) {
        enabledMixin.setEnabled(enabled);
    }

    @Override
    public boolean isEnabled() {
        return enabledMixin.isEnabled();
    }

    @Override
    public void setPlaceholder(final String placeHolder) {
        getElement().setAttribute(PLACEHOLDER, placeHolder != null ? placeHolder : "");
    }

    @Override
    public String getPlaceholder() {
        return getElement().getAttribute(PLACEHOLDER);
    }

    @Override
    public void setAutocomplete(final boolean autoComplete) {
        getElement().setAttribute(AUTOCOMPLETE, autoComplete ? ON : OFF);
    }

    @Override
    public String getAutocomplete() {
        return getElement().getAttribute(AUTOCOMPLETE);
    }

    @Override
    public void setId(final String id) {
        idMixin.setId(id);
    }

    @Override
    public String getId() {
        return idMixin.getId();
    }

    @Override
    public void setVisibleOn(final String deviceSizeString) {
        StyleHelper.setVisibleOn(this, deviceSizeString);
    }

    @Override
    public void setHiddenOn(final String deviceSizeString) {
        StyleHelper.setHiddenOn(this, deviceSizeString);
    }
}

@@ -911,68 +911,8 @@
 er;%0A
-import org.gwtbootstrap3.client.ui.base.mixin.EnabledMixin;%0A
 impo
@@ -1086,20 +1086,8 @@
 ess,
- HasEnabled,
 %0A   
@@ -1276,112 +1276,8 @@
 is);
-%0A    private final EnabledMixin%3CValueBoxBase%3CT%3E%3E enabledMixin = new EnabledMixin%3CValueBoxBase%3CT%3E%3E(this);
 %0A%0A  
@@ -1736,212 +1736,8 @@
  %7D%0A%0A
-    @Override%0A    public void setEnabled(boolean enabled) %7B%0A        enabledMixin.setEnabled(enabled);%0A    %7D%0A%0A    @Override%0A    public boolean isEnabled() %7B%0A        return enabledMixin.isEnabled();%0A    %7D%0A%0A
     

Remove duplicate HasEnabled definition and EnabledMixin