// Path: src/main/java/com/tractionsoftware/gwt/user/client/util/MiscUtils.java
// public class MiscUtils {
// 
//     /**
//      * Note: It seems like NativeEvent.getCharCode() would be equivalent.
//      */
//     public static native char getCharCode(NativeEvent e)
//     /*-{
//       return e.charCode || e.keyCode;
//     }-*/;
// 
//     public static final String getComputedStyle(Element e, String camelName) {
// 	// sometimes IE throws an exception. thanks IE!
//         try {
//             return getStyleImpl().getComputedStyle(e, hyphenize(camelName), camelName);
//         }
//         catch (Exception xcp) {
//             return null;
//         }
//     }
// 
//     public static final int getComputedStyleInt(Element e, String camelName) {
//         String num = getComputedStyle(e, camelName);
// 	return num != null ? parseInt(num) : 0;
//     }
// 
//     public static final int parseInt(String val) {
// 	return parseInt(val, 10);
//     }
// 
//     public static final native int parseInt(String val, int radix)
//     /*-{
//       return parseInt(val, radix) || 0;
//     }-*/;
// 
//     // ----------------------------------------------------------------------
//     // DocumentStyleImpl.getComputedStyle from gwtquery
// 
//     private static DocumentStyleImpl styleImpl = null;
//     private static DocumentStyleImpl getStyleImpl() {
//         if (styleImpl == null) {
//             styleImpl = GWT.create(DocumentStyleImpl.class);
//         }
//         return styleImpl;
//     }
// 
//     /**
//      * Hyphenize style property names. for instance: fontName ->
//      * font-name
//      */
//     private static native String hyphenize(String name) /*-{
//         return name.replace(/([A-Z])/g, "-$1").toLowerCase();
//     }-*/;
// 
// }


import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.dom.client.HasKeyDownHandlers;
import com.google.gwt.event.dom.client.HasKeyUpHandlers;
import com.google.gwt.event.dom.client.KeyCodeEvent;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.event.logical.shared.HasValueChangeHandlers;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Focusable;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.Widget;
import com.tractionsoftware.gwt.user.client.util.MiscUtils;
    }
    public final void setExtraSize(int extraSize) {
	this.extraSize = extraSize;
    }

    // ----------------------------------------------------------------------
    // check for max-height and min-height properties and use them
    // instead of anything configured. if you need to control the
    // min/max in code, don't set those css properties.
    //
    // also note that we remove the properties from the textarea AND
    // the shadow. this is important because otherwise they interfere
    // with the auto-sizing
    //

    public final void setMinFromCss(String property) {
	int min = getAndResetValueFromCss(property, "0");
	if (min > 0) {
	    setMinSize(min);
	}
    }

    public final void setMaxFromCss(String property) {
	int max = getAndResetValueFromCss(property, "none");
	if (max > 0) {
	    setMaxSize(max);
	}
    }

    public final int getAndResetValueFromCss(String property, String reset) {
// Path: src/main/java/com/tractionsoftware/gwt/user/client/util/MiscUtils.java
// public class MiscUtils {
// 
//     /**
//      * Note: It seems like NativeEvent.getCharCode() would be equivalent.
//      */
//     public static native char getCharCode(NativeEvent e)
//     /*-{
//       return e.charCode || e.keyCode;
//     }-*/;
// 
//     public static final String getComputedStyle(Element e, String camelName) {
// 	// sometimes IE throws an exception. thanks IE!
//         try {
//             return getStyleImpl().getComputedStyle(e, hyphenize(camelName), camelName);
//         }
//         catch (Exception xcp) {
//             return null;
//         }
//     }
// 
//     public static final int getComputedStyleInt(Element e, String camelName) {
//         String num = getComputedStyle(e, camelName);
// 	return num != null ? parseInt(num) : 0;
//     }
// 
//     public static final int parseInt(String val) {
// 	return parseInt(val, 10);
//     }
// 
//     public static final native int parseInt(String val, int radix)
//     /*-{
//       return parseInt(val, radix) || 0;
//     }-*/;
// 
//     // ----------------------------------------------------------------------
//     // DocumentStyleImpl.getComputedStyle from gwtquery
// 
//     private static DocumentStyleImpl styleImpl = null;
//     private static DocumentStyleImpl getStyleImpl() {
//         if (styleImpl == null) {
//             styleImpl = GWT.create(DocumentStyleImpl.class);
//         }
//         return styleImpl;
//     }
// 
//     /**
//      * Hyphenize style property names. for instance: fontName ->
//      * font-name
//      */
//     private static native String hyphenize(String name) /*-{
//         return name.replace(/([A-Z])/g, "-$1").toLowerCase();
//     }-*/;
// 
// }


// Path: src/main/java/com/tractionsoftware/gwt/user/client/ui/AutoSizingBase.java
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.dom.client.HasKeyDownHandlers;
import com.google.gwt.event.dom.client.HasKeyUpHandlers;
import com.google.gwt.event.dom.client.KeyCodeEvent;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.event.logical.shared.HasValueChangeHandlers;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Focusable;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.Widget;
import com.tractionsoftware.gwt.user.client.util.MiscUtils;

    }
    public final void setExtraSize(int extraSize) {
	this.extraSize = extraSize;
    }

    // ----------------------------------------------------------------------
    // check for max-height and min-height properties and use them
    // instead of anything configured. if you need to control the
    // min/max in code, don't set those css properties.
    //
    // also note that we remove the properties from the textarea AND
    // the shadow. this is important because otherwise they interfere
    // with the auto-sizing
    //

    public final void setMinFromCss(String property) {
	int min = getAndResetValueFromCss(property, "0");
	if (min > 0) {
	    setMinSize(min);
	}
    }

    public final void setMaxFromCss(String property) {
	int max = getAndResetValueFromCss(property, "none");
	if (max > 0) {
	    setMaxSize(max);
	}
    }

    public final int getAndResetValueFromCss(String property, String reset) {
	int value = MiscUtils.getComputedStyleInt(box.getElement(), property);