// Path: src/main/java/com/tractionsoftware/gwt/user/client/ui/AutoSizingTextArea.java
// public class AutoSizingTextArea extends AutoSizingBase<TextAreaWithSelection, TextArea> implements ResizeHandler {
// 
//     protected int divExtra = 0;
//     protected HandlerRegistration resizeRegistration = null;
// 
//     public AutoSizingTextArea() {
// 	this(new TextAreaWithSelection());
//     }
//     private AutoSizingTextArea(TextAreaWithSelection box) {
// 	super(box, new TextArea());
//     }
//     public AutoSizingTextArea(TextAreaWithSelection box, int minSize, int maxSize) {
// 	super(box, new TextArea());
// 	setMinSize(minSize);
// 	setMaxSize(maxSize);
//     }
// 
//     @Override
//     protected void onLoad() {
// 	Element boxElement = box.getElement();
// 
// 	int lineHeight = MiscUtils.getComputedStyleInt(boxElement, "lineHeight");
// 	setExtraSize(lineHeight);
// 
// 	setMinFromCss("minHeight");
// 	setMaxFromCss("maxHeight");
// 
// 	// we also need to make sure the widths are the same.
//  	matchStyles("width");
// 
// 	// don't let the shadow have any size
// 	shadow.setHeight("0");
// 
// 	divExtra = 0;
// 	divExtra += MiscUtils.getComputedStyleInt(boxElement, "paddingTop");
// 	divExtra += MiscUtils.getComputedStyleInt(boxElement, "paddingBottom");
// 
// 	resizeRegistration = Window.addResizeHandler(this);
// 
// 	super.onLoad();
//     }
// 
//     @Override
//     protected void onUnload() {
//         // fix leak reported in issue #4
//         if (resizeRegistration != null) {
//             resizeRegistration.removeHandler();
//             resizeRegistration = null;
//         }
// 
//         super.onUnload();
//     }
// 
//     @Override
//     public void onResize(ResizeEvent event) {
//  	matchStyles("width");
// 	adjustSize();
//     }
// 
//     @Override
//     public void setHeight(int height) {
// 	div.setHeight(divExtra+height+"px");
// 	box.setHeight(height+"px");
//     }
// 
//     /**
//      * Returns the size of the shadow element
//      */
//     @Override
//     public int getShadowSize() {
// 	Element shadowElement = shadow.getElement();
// 	shadowElement.setScrollTop(10000);
// 	return shadowElement.getScrollTop();
//     }
// 
//     /**
//      * @param text the text that should be set on the shadow to
//      * determine the appropriate size of the widget
//      */
//     @Override
//     public void setShadowText(String text) {
// 	shadow.setValue(text);
//     }
// 
//     /**
//      * @param size will take into account minSize, maxSize, and
//      * extraSize. the implementation should just call setWidth or
//      * setHeight as appropriate.
//      */
//     @Override
//     public void setSize(int size) {
// 	setHeight(size);
// 	if (size == maxSize) {
// 	    box.getElement().getStyle().setProperty("overflow", "auto");
// 	}
//     }
// 
//     @Override
//     public void setText(String text) {
// 	box.setText(text);
// 	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
//             @Override
//             public void execute() {
//                 sync();
//             }
//         });
//     }
// 
// }
// 
// Path: src/main/java/com/tractionsoftware/gwt/user/client/ui/TextAreaWithSelection.java
// public final class TextAreaWithSelection extends TextArea implements HasTextSelection {}


import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.tractionsoftware.gwt.user.client.ui.AutoSizingTextArea;
import com.tractionsoftware.gwt.user.client.ui.TextAreaWithSelection;
/*
 * Copyright 2010 Traction Software, Inc.
 * 
 * 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.
 */
package com.tractionsoftware.gwt.demo.autosizingtextarea.client;


public class AutoSizingTextAreaDemo implements EntryPoint {

    @Override
    public void onModuleLoad() {

        AutoSizingTextArea small = new AutoSizingTextArea(new TextAreaWithSelection(), 50, 600);
        small.addStyleName("small");
        RootPanel.get("small").add(small);

        AutoSizingTextArea large = new AutoSizingTextArea(new TextAreaWithSelection(), 50, 600);
        large.addStyleName("large");
// Path: src/main/java/com/tractionsoftware/gwt/user/client/ui/AutoSizingTextArea.java
// public class AutoSizingTextArea extends AutoSizingBase<TextAreaWithSelection, TextArea> implements ResizeHandler {
// 
//     protected int divExtra = 0;
//     protected HandlerRegistration resizeRegistration = null;
// 
//     public AutoSizingTextArea() {
// 	this(new TextAreaWithSelection());
//     }
//     private AutoSizingTextArea(TextAreaWithSelection box) {
// 	super(box, new TextArea());
//     }
//     public AutoSizingTextArea(TextAreaWithSelection box, int minSize, int maxSize) {
// 	super(box, new TextArea());
// 	setMinSize(minSize);
// 	setMaxSize(maxSize);
//     }
// 
//     @Override
//     protected void onLoad() {
// 	Element boxElement = box.getElement();
// 
// 	int lineHeight = MiscUtils.getComputedStyleInt(boxElement, "lineHeight");
// 	setExtraSize(lineHeight);
// 
// 	setMinFromCss("minHeight");
// 	setMaxFromCss("maxHeight");
// 
// 	// we also need to make sure the widths are the same.
//  	matchStyles("width");
// 
// 	// don't let the shadow have any size
// 	shadow.setHeight("0");
// 
// 	divExtra = 0;
// 	divExtra += MiscUtils.getComputedStyleInt(boxElement, "paddingTop");
// 	divExtra += MiscUtils.getComputedStyleInt(boxElement, "paddingBottom");
// 
// 	resizeRegistration = Window.addResizeHandler(this);
// 
// 	super.onLoad();
//     }
// 
//     @Override
//     protected void onUnload() {
//         // fix leak reported in issue #4
//         if (resizeRegistration != null) {
//             resizeRegistration.removeHandler();
//             resizeRegistration = null;
//         }
// 
//         super.onUnload();
//     }
// 
//     @Override
//     public void onResize(ResizeEvent event) {
//  	matchStyles("width");
// 	adjustSize();
//     }
// 
//     @Override
//     public void setHeight(int height) {
// 	div.setHeight(divExtra+height+"px");
// 	box.setHeight(height+"px");
//     }
// 
//     /**
//      * Returns the size of the shadow element
//      */
//     @Override
//     public int getShadowSize() {
// 	Element shadowElement = shadow.getElement();
// 	shadowElement.setScrollTop(10000);
// 	return shadowElement.getScrollTop();
//     }
// 
//     /**
//      * @param text the text that should be set on the shadow to
//      * determine the appropriate size of the widget
//      */
//     @Override
//     public void setShadowText(String text) {
// 	shadow.setValue(text);
//     }
// 
//     /**
//      * @param size will take into account minSize, maxSize, and
//      * extraSize. the implementation should just call setWidth or
//      * setHeight as appropriate.
//      */
//     @Override
//     public void setSize(int size) {
// 	setHeight(size);
// 	if (size == maxSize) {
// 	    box.getElement().getStyle().setProperty("overflow", "auto");
// 	}
//     }
// 
//     @Override
//     public void setText(String text) {
// 	box.setText(text);
// 	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
//             @Override
//             public void execute() {
//                 sync();
//             }
//         });
//     }
// 
// }
// 
// Path: src/main/java/com/tractionsoftware/gwt/user/client/ui/TextAreaWithSelection.java
// public final class TextAreaWithSelection extends TextArea implements HasTextSelection {}


// Path: src-demo/com/tractionsoftware/gwt/demo/autosizingtextarea/client/AutoSizingTextAreaDemo.java
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.tractionsoftware.gwt.user.client.ui.AutoSizingTextArea;
import com.tractionsoftware.gwt.user.client.ui.TextAreaWithSelection;

/*
 * Copyright 2010 Traction Software, Inc.
 * 
 * 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.
 */
package com.tractionsoftware.gwt.demo.autosizingtextarea.client;


public class AutoSizingTextAreaDemo implements EntryPoint {

    @Override
    public void onModuleLoad() {

        AutoSizingTextArea small = new AutoSizingTextArea(new TextAreaWithSelection(), 50, 600);
        small.addStyleName("small");
        RootPanel.get("small").add(small);

        AutoSizingTextArea large = new AutoSizingTextArea(new TextAreaWithSelection(), 50, 600);
        large.addStyleName("large");
        RootPanel.get("large").add(large);