Skip to content

Commit

Permalink
Update Organization and package name for release purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
ilgun committed Sep 13, 2017
1 parent a04a408 commit 31e508c
Show file tree
Hide file tree
Showing 12 changed files with 159 additions and 159 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.vaadin.hene.expandingtextarea;
package org.vaadin.ilgun.expandingtextarea;

import java.io.Serializable;
import java.lang.reflect.Method;

import org.vaadin.hene.expandingtextarea.widgetset.client.ui.ExpandingTextAreaServerRpc;
import org.vaadin.hene.expandingtextarea.widgetset.client.ui.ExpandingTextAreaState;
import org.vaadin.ilgun.expandingtextarea.widgetset.client.ui.ExpandingTextAreaServerRpc;
import org.vaadin.ilgun.expandingtextarea.widgetset.client.ui.ExpandingTextAreaState;

import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.vaadin.hene.expandingtextarea.widgetset.client.ui;
package org.vaadin.ilgun.expandingtextarea.widgetset.client.ui;

import org.vaadin.hene.expandingtextarea.ExpandingTextArea;
import org.vaadin.hene.expandingtextarea.widgetset.client.ui.VExpandingTextArea.HeightChangedListener;
import org.vaadin.ilgun.expandingtextarea.ExpandingTextArea;
import org.vaadin.ilgun.expandingtextarea.widgetset.client.ui.VExpandingTextArea.HeightChangedListener;

import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.vaadin.hene.expandingtextarea.widgetset.client.ui;
package org.vaadin.ilgun.expandingtextarea.widgetset.client.ui;

import com.vaadin.shared.communication.ServerRpc;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.vaadin.hene.expandingtextarea.widgetset.client.ui;
package org.vaadin.ilgun.expandingtextarea.widgetset.client.ui;

import com.vaadin.v7.shared.ui.textarea.TextAreaState;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,140 +1,140 @@
package org.vaadin.hene.expandingtextarea.widgetset.client.ui;

import java.util.ArrayList;
import java.util.List;

import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;
import com.vaadin.v7.client.ui.VTextArea;

/**
* Client side widget which communicates with the server. Messages from the
* server are shown as HTML and mouse clicks are sent to the server.
*/
public class VExpandingTextArea extends VTextArea {

/** Set the CSS class name to allow styling. */
public static final String CLASSNAME = "v-expandingtextarea";

private static int REPEAT_INTERVAL = 400;

private Integer maxRows = null;

private final HeightObserver heightObserver;

private boolean appendExtraRow = false;

public VExpandingTextArea() {
setStyleName(CLASSNAME);
sinkEvents(Event.ONFOCUS | Event.ONFOCUS);

heightObserver = new HeightObserver();
}

@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
if (event.getTypeInt() == Event.ONFOCUS) {
heightObserver.scheduleRepeating(REPEAT_INTERVAL);
getElement().addClassName(CLASSNAME + "-focus");
} else if (event.getTypeInt() == Event.ONBLUR) {
heightObserver.cancel();
getElement().removeClassName(CLASSNAME + "-focus");
}
}

public void checkHeight() {
int origRows = getRows(getElement());

// Check if we have to increase textarea's height
int rows = origRows;
rows++;
while ((maxRows == null || rows <= maxRows)
&& getElement().getScrollHeight() > getOffsetHeight()) {
setRows(rows++);
}

// Check if we can reduce textarea's height
rows = getRows(getElement());
while (rows > 1) {
setRows(rows - 1);
if (!(getElement().getScrollHeight() > getOffsetHeight())) {
rows -= 1;
continue;
} else {
setRows(rows);
break;
}
}

int extraRow = appendExtraRow ? 1 : 0;
int updatedRowCount = getRows(getElement()) + extraRow;
// Add stylename if we have reached maximum row number, so we can show a
// scroll bar
if (maxRows != null && updatedRowCount > maxRows) {
addStyleName("max");
updatedRowCount = updatedRowCount > maxRows ? maxRows
: updatedRowCount;
} else {
removeStyleName("max");
}

setRows(updatedRowCount);

if (origRows != getRows(getElement())) {
for (HeightChangedListener listener : heightChangedListeners) {
listener.heightChanged(getRows(getElement()));
}
}
}

public void setMaxRows(Integer maxRows) {
this.maxRows = maxRows;
}

public void setAppendExtraRow(boolean appendExtraRow) {
this.appendExtraRow = appendExtraRow;
}

public int getRows() {
return getRows(getElement());
}

private native int getRows(Element e)
/*-{
try {
return e.rows;
} catch (e) {
return -1;
}
}-*/;

private class HeightObserver extends Timer {

@Override
public void run() {
checkHeight();
}
}

@Override
protected void onDetach() {
heightObserver.cancel();
super.onDetach();
}

List<HeightChangedListener> heightChangedListeners = new ArrayList<VExpandingTextArea.HeightChangedListener>();

public interface HeightChangedListener {
void heightChanged(int newHeight);
}

public void addHeightChangedListener(HeightChangedListener listener) {
heightChangedListeners.add(listener);
}

public void removeHeightChangedListener(HeightChangedListener listener) {
heightChangedListeners.remove(listener);
}
}
package org.vaadin.ilgun.expandingtextarea.widgetset.client.ui;

import java.util.ArrayList;
import java.util.List;

import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;
import com.vaadin.v7.client.ui.VTextArea;

/**
* Client side widget which communicates with the server. Messages from the
* server are shown as HTML and mouse clicks are sent to the server.
*/
public class VExpandingTextArea extends VTextArea {

/** Set the CSS class name to allow styling. */
public static final String CLASSNAME = "v-expandingtextarea";

private static int REPEAT_INTERVAL = 400;

private Integer maxRows = null;

private final HeightObserver heightObserver;

private boolean appendExtraRow = false;

public VExpandingTextArea() {
setStyleName(CLASSNAME);
sinkEvents(Event.ONFOCUS | Event.ONFOCUS);

heightObserver = new HeightObserver();
}

@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
if (event.getTypeInt() == Event.ONFOCUS) {
heightObserver.scheduleRepeating(REPEAT_INTERVAL);
getElement().addClassName(CLASSNAME + "-focus");
} else if (event.getTypeInt() == Event.ONBLUR) {
heightObserver.cancel();
getElement().removeClassName(CLASSNAME + "-focus");
}
}

public void checkHeight() {
int origRows = getRows(getElement());

// Check if we have to increase textarea's height
int rows = origRows;
rows++;
while ((maxRows == null || rows <= maxRows)
&& getElement().getScrollHeight() > getOffsetHeight()) {
setRows(rows++);
}

// Check if we can reduce textarea's height
rows = getRows(getElement());
while (rows > 1) {
setRows(rows - 1);
if (!(getElement().getScrollHeight() > getOffsetHeight())) {
rows -= 1;
continue;
} else {
setRows(rows);
break;
}
}

int extraRow = appendExtraRow ? 1 : 0;
int updatedRowCount = getRows(getElement()) + extraRow;
// Add stylename if we have reached maximum row number, so we can show a
// scroll bar
if (maxRows != null && updatedRowCount > maxRows) {
addStyleName("max");
updatedRowCount = updatedRowCount > maxRows ? maxRows
: updatedRowCount;
} else {
removeStyleName("max");
}

setRows(updatedRowCount);

if (origRows != getRows(getElement())) {
for (HeightChangedListener listener : heightChangedListeners) {
listener.heightChanged(getRows(getElement()));
}
}
}

public void setMaxRows(Integer maxRows) {
this.maxRows = maxRows;
}

public void setAppendExtraRow(boolean appendExtraRow) {
this.appendExtraRow = appendExtraRow;
}

public int getRows() {
return getRows(getElement());
}

private native int getRows(Element e)
/*-{
try {
return e.rows;
} catch (e) {
return -1;
}
}-*/;

private class HeightObserver extends Timer {

@Override
public void run() {
checkHeight();
}
}

@Override
protected void onDetach() {
heightObserver.cancel();
super.onDetach();
}

List<HeightChangedListener> heightChangedListeners = new ArrayList<VExpandingTextArea.HeightChangedListener>();

public interface HeightChangedListener {
void heightChanged(int newHeight);
}

public void addHeightChangedListener(HeightChangedListener listener) {
heightChangedListeners.add(listener);
}

public void removeHeightChangedListener(HeightChangedListener listener) {
heightChangedListeners.remove(listener);
}
}
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name := "ExpandingTextArea"

version in ThisBuild := "2.0"

organization in ThisBuild := "org.vaadin.hene"
organization in ThisBuild := "org.vaadin.ilgun"

crossPaths in ThisBuild := false

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.vaadin.hene.expandingtextarea.demo;
package org.vaadin.ilgun.expandingtextarea.demo;

import org.vaadin.hene.expandingtextarea.ExpandingTextArea;
import org.vaadin.hene.expandingtextarea.ExpandingTextArea.RowsChangeListener;
import org.vaadin.ilgun.expandingtextarea.ExpandingTextArea;
import org.vaadin.ilgun.expandingtextarea.ExpandingTextArea.RowsChangeListener;

import com.vaadin.annotations.PreserveOnRefresh;
import com.vaadin.annotations.Theme;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
<inherits name="org.vaadin.hene.expandingtextarea.widgetset.ExpandingtextareaWidgetset" />
<inherits name="org.vaadin.ilgun.expandingtextarea.widgetset.ExpandingtextareaWidgetset" />
</module>
10 changes: 5 additions & 5 deletions demo/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>ExpandingTextArea</display-name>
<context-param>
<description>
Expand All @@ -16,12 +16,12 @@
<init-param>
<description>Vaadin root</description>
<param-name>ui</param-name>
<param-value>org.vaadin.hene.expandingtextarea.demo.ExpandingTextAreaUI</param-value>
<param-value>org.vaadin.ilgun.expandingtextarea.demo.ExpandingTextAreaUI</param-value>
</init-param>
<init-param>
<description>Application widgetset</description>
<param-name>widgetset</param-name>
<param-value>org.vaadin.hene.expandingtextarea.demo.ExpandingTextAreaDemoWidgetset</param-value>
<param-value>org.vaadin.ilgun.expandingtextarea.demo.ExpandingTextAreaDemoWidgetset</param-value>
</init-param>
</servlet>
<servlet-mapping>
Expand Down
2 changes: 1 addition & 1 deletion project/sbt-vaadin-plugin.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolvers += "sbt-vaadin-plugin repo" at "http://henrikerola.github.io/repository/releases"
resolvers += "sbt-vaadin-plugin repo" at "https://ilgun.github.io/ExpandingTextArea/repository/releases"

addSbtPlugin("org.vaadin.sbt" % "sbt-vaadin-plugin" % "1.2.0")

Expand Down

0 comments on commit 31e508c

Please sign in to comment.