diff options
author | Artur Signell <artur@vaadin.com> | 2015-01-02 18:46:38 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2015-01-02 18:46:38 +0200 |
commit | 87bce70111765d1e56729a76804d76f3f071992a (patch) | |
tree | 1c1c2f7e05ea501f0357b5ed343ecef016cf1e28 | |
parent | e24e9af74ff9aedaf196ad6f6b014623a881df52 (diff) | |
parent | 26832b6947266ce5cffd92558c23e6556278038d (diff) | |
download | vaadin-framework-87bce70111765d1e56729a76804d76f3f071992a.tar.gz vaadin-framework-87bce70111765d1e56729a76804d76f3f071992a.zip |
Merge remote-tracking branch 'origin/master' into 7.4
76 files changed, 843 insertions, 381 deletions
diff --git a/WebContent/VAADIN/themes/chameleon/common/common.scss b/WebContent/VAADIN/themes/chameleon/common/common.scss index 7bee2f529c..82e0810bc2 100644 --- a/WebContent/VAADIN/themes/chameleon/common/common.scss +++ b/WebContent/VAADIN/themes/chameleon/common/common.scss @@ -34,7 +34,9 @@ $chameleon-line-height: 1.4; } .v-sa & .v-tooltip { - outline: 1px solid rgba(0,0,0,.2); + outline-color: #000000; /* Fallback for browsers that does not support RGBA such as IE8 */ + outline-color: rgba(0,0,0,.2); + outline: 1px solid; -webkit-border-radius: 0; -moz-border-radius: 0; border: none; @@ -92,6 +94,7 @@ $chameleon-line-height: 1.4; .v-Notification, .v-menubar-submenu { border: 1px solid #adadad; + border-color: #000000; /* Fallback for browsers that does not support RGBA such as IE8 */ border-color: rgba(0,0,0,.4); border-radius: 4px; -webkit-border-radius: 4px; @@ -104,8 +107,10 @@ $chameleon-line-height: 1.4; .v-datefield-popup, .v-contextmenu, .v-menubar-submenu{ - background: rgba(232,232,232,.90) url(../img/grad-light-top.png) repeat-x; - } + background: #e8e8e8; /* Fallback for browsers that does not support RGBA such as IE8 */ + background: rgba(232,232,232,.90); + background-image: url(../img/grad-light-top.png) repeat-x; + } .v-filterselect-suggestpopup, .v-contextmenu, .v-menubar-submenu { diff --git a/WebContent/release-notes.html b/WebContent/release-notes.html index a060372580..7be74ee1ed 100644 --- a/WebContent/release-notes.html +++ b/WebContent/release-notes.html @@ -112,7 +112,7 @@ <li>Declarative layout support for initializing a component hierarchy from an HTML file.</li> <li>Uses GWT 2.7 for improved compilation times when using Super Dev Mode.</li> <li>@Viewport annotation for declaratively defining a mobile viewport definition for a UI.</li> - <li>Captions can be configured to be displayed as HTML.</li> + <li>Component captions, TabSheet/Accordion tab captions and Calendar event captions can be configured to be displayed as HTML.</li> <li>Selects use converters when presenting itemids.</li> <li>Improved performance when server response contains no visual changing (e.g. empty polling responses).</li> <li>Unified JSON library for using the same API in both server-side and client-side code.</li> @@ -134,6 +134,7 @@ <p>Raw JSON values passed to AbstractJavaScriptComponent.callFunction and AbstractJavaScriptExtension.callFunction should be changed to use elemental.json types.</p> </li> <li>The semantics of empty and required for Field classes has been made more consistent. This mainly affects Checkbox which is now considered to be empty when it is not checked.</li> + <li>The previously inconsistent behavior in HTML vs plain text rendering of Calendar event captions has been made consistent.</li> <li>Support for Opera 12 has been dropped. Newer versions based on the Blink rendering engine are still supported.</li> </ul> <h3 id="knownissues">Known issues</h3> diff --git a/client-compiler/tests/src/com/vaadin/tools/CvalCheckerTest.java b/client-compiler/tests/src/com/vaadin/tools/CvalCheckerTest.java index 64a38fae2e..fb4799ae12 100644 --- a/client-compiler/tests/src/com/vaadin/tools/CvalCheckerTest.java +++ b/client-compiler/tests/src/com/vaadin/tools/CvalCheckerTest.java @@ -69,8 +69,8 @@ public class CvalCheckerTest { + "'expiredEpoch':1893511225000," + "'product':{'name':'" + productNameCval + "', 'version': 2}}"; - static final String responseJsonWithNullVersion = "{'licenseKey':'" + VALID_KEY + "'," - + "'licensee':'Test User','type':'normal'," + static final String responseJsonWithNullVersion = "{'licenseKey':'" + + VALID_KEY + "'," + "'licensee':'Test User','type':'normal'," + "'expiredEpoch':1893511225000," + "'product':{'name':'" + productNameCval + "', 'version': null}}"; @@ -462,10 +462,10 @@ public class CvalCheckerTest { out.println("5 = this-is-another-license"); out.close(); - assertEquals("this-is-a-license", licenseChecker.readKeyFromFile(tmpLicenseFile.toURI() - .toURL(), 3)); - assertEquals("this-is-a-license", licenseChecker.readKeyFromFile(tmpLicenseFile.toURI() - .toURL(), 4)); + assertEquals("this-is-a-license", licenseChecker.readKeyFromFile( + tmpLicenseFile.toURI().toURL(), 3)); + assertEquals("this-is-a-license", licenseChecker.readKeyFromFile( + tmpLicenseFile.toURI().toURL(), 4)); assertEquals("this-is-another-license", licenseChecker.readKeyFromFile( tmpLicenseFile.toURI().toURL(), 5)); @@ -473,17 +473,18 @@ public class CvalCheckerTest { } @Test - public void testReadKeyFromFile_FallbackToDefaultKeyReversed() throws Exception { + public void testReadKeyFromFile_FallbackToDefaultKeyReversed() + throws Exception { File tmpLicenseFile = File.createTempFile("license", "lic"); PrintWriter out = new PrintWriter(tmpLicenseFile); out.println("5 = this-is-another-license"); out.println("this-is-a-license"); out.close(); - assertEquals("this-is-a-license", licenseChecker.readKeyFromFile(tmpLicenseFile.toURI() - .toURL(), 3)); - assertEquals("this-is-a-license", licenseChecker.readKeyFromFile(tmpLicenseFile.toURI() - .toURL(), 4)); + assertEquals("this-is-a-license", licenseChecker.readKeyFromFile( + tmpLicenseFile.toURI().toURL(), 3)); + assertEquals("this-is-a-license", licenseChecker.readKeyFromFile( + tmpLicenseFile.toURI().toURL(), 4)); assertEquals("this-is-another-license", licenseChecker.readKeyFromFile( tmpLicenseFile.toURI().toURL(), 5)); diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java index bf79009f4c..2f39eaedd4 100644 --- a/client/src/com/vaadin/client/LayoutManager.java +++ b/client/src/com/vaadin/client/LayoutManager.java @@ -443,7 +443,7 @@ public class LayoutManager { try { String key = null; if (Profiler.isEnabled()) { - key = "layoutHorizontally() for " + key = "layoutVertically() for " + Util.getSimpleName(cl); Profiler.enter(key); } diff --git a/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java b/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java index dca5931640..e67fee96cf 100644 --- a/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java +++ b/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java @@ -161,7 +161,7 @@ public abstract class ConnectorBundleLoader { private HTML notice; // Not using Vaadin notifications (#14597) - private void notice(String productName) { + private void notice(String productName) { if (notice == null) { notice = new HTML(); notice.addClickHandler(new ClickHandler() { diff --git a/client/src/com/vaadin/client/ui/ShortcutActionHandler.java b/client/src/com/vaadin/client/ui/ShortcutActionHandler.java index 9e9279267d..a9d5f0731a 100644 --- a/client/src/com/vaadin/client/ui/ShortcutActionHandler.java +++ b/client/src/com/vaadin/client/ui/ShortcutActionHandler.java @@ -123,6 +123,9 @@ public class ShortcutActionHandler { final int modifiers = KeyboardListenerCollection .getKeyboardModifiers(event); final char keyCode = (char) DOM.eventGetKeyCode(event); + if (keyCode == 0) { + return; + } final ShortcutKeyCombination kc = new ShortcutKeyCombination(keyCode, modifiers); final Iterator<ShortcutAction> it = actions.iterator(); diff --git a/client/src/com/vaadin/client/ui/VCalendar.java b/client/src/com/vaadin/client/ui/VCalendar.java index c59a78108c..08d4351931 100644 --- a/client/src/com/vaadin/client/ui/VCalendar.java +++ b/client/src/com/vaadin/client/ui/VCalendar.java @@ -1342,6 +1342,7 @@ public class VCalendar extends Composite implements VHasDropHandler { private MouseEventListener mouseEventListener; private boolean forwardNavigationEnabled = true; private boolean backwardNavigationEnabled = true; + private boolean eventCaptionAsHtml = false; /** * Get the listener that listen to mouse events @@ -1467,4 +1468,33 @@ public class VCalendar extends Composite implements VHasDropHandler { public void setDropHandler(CalendarDropHandler dropHandler) { this.dropHandler = dropHandler; } + + /** + * Sets whether the event captions are rendered as HTML. + * <p> + * If set to true, the captions are rendered in the browser as HTML and the + * developer is responsible for ensuring no harmful HTML is used. If set to + * false, the caption is rendered in the browser as plain text. + * <p> + * The default is false, i.e. to render that caption as plain text. + * + * @param captionAsHtml + * true if the captions are rendered as HTML, false if rendered + * as plain text + */ + public void setEventCaptionAsHtml(boolean eventCaptionAsHtml) { + this.eventCaptionAsHtml = eventCaptionAsHtml; + } + + /** + * Checks whether event captions are rendered as HTML + * <p> + * The default is false, i.e. to render that caption as plain text. + * + * @return true if the captions are rendered as HTML, false if rendered as + * plain text + */ + public boolean isEventCaptionAsHtml() { + return eventCaptionAsHtml; + } } diff --git a/client/src/com/vaadin/client/ui/VPopupView.java b/client/src/com/vaadin/client/ui/VPopupView.java index 5b37a90915..1923fc55e6 100644 --- a/client/src/com/vaadin/client/ui/VPopupView.java +++ b/client/src/com/vaadin/client/ui/VPopupView.java @@ -92,7 +92,7 @@ public class VPopupView extends HTML implements HasEnabled, Iterable<Widget>, addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { - if(isEnabled()) { + if (isEnabled()) { preparePopup(popup); showPopup(popup); center(); @@ -206,8 +206,9 @@ public class VPopupView extends HTML implements HasEnabled, Iterable<Widget>, /** * Sets whether this popup is enabled. * - * @param enabled <code>true</code> to enable the popup, <code>false</code> - * to disable it + * @param enabled + * <code>true</code> to enable the popup, <code>false</code> to + * disable it * @since 7.3.4 */ @Override diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java index 2d34897986..96af09bb32 100644 --- a/client/src/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/VTabsheet.java @@ -735,9 +735,10 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware /** * The id of the tab at position scrollerIndex. This is used for keeping the * scroll position unchanged when a tab is removed from the server side and - * the removed tab lies to the left of the current scroll position. For other - * cases scrollerIndex alone would be sufficient. Since the tab at the current - * scroll position can be removed, scrollerIndex is required in addition to this variable. + * the removed tab lies to the left of the current scroll position. For + * other cases scrollerIndex alone would be sufficient. Since the tab at the + * current scroll position can be removed, scrollerIndex is required in + * addition to this variable. */ private String scrollerPositionTabId; @@ -1081,7 +1082,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware } private boolean isScrollerPrevDisabled() { - return scrollerPrev.getClassName().contains(PREV_SCROLLER_DISABLED_CLASSNAME); + return scrollerPrev.getClassName().contains( + PREV_SCROLLER_DISABLED_CLASSNAME); } private boolean isIndexSkippingHiddenTabs() { @@ -1103,9 +1105,9 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware // Should not set tabs visible if they are scrolled out of view tab.setVisible(false); } else { - //reset the scroller index back to zero if tab is visible - //again and tab is in view - if(isIndexSkippingHiddenTabs() && tabState.visible) { + // reset the scroller index back to zero if tab is visible + // again and tab is in view + if (isIndexSkippingHiddenTabs() && tabState.visible) { scrollerIndex = 0; } tab.setVisible(tabState.visible); @@ -1247,7 +1249,9 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware if (tb.getTabCount() > 0 && tb.isVisible() && (scrolled || clipped)) { scroller.getStyle().clearDisplay(); DOM.setElementProperty(scrollerPrev, "className", - SCROLLER_CLASSNAME + (scrolled ? "Prev" : PREV_SCROLLER_DISABLED_CLASSNAME)); + SCROLLER_CLASSNAME + + (scrolled ? "Prev" + : PREV_SCROLLER_DISABLED_CLASSNAME)); DOM.setElementProperty(scrollerNext, "className", SCROLLER_CLASSNAME + (clipped ? "Next" : "Next-disabled")); @@ -1861,8 +1865,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware } if (scrollerIndex >= 0 && scrollerIndex < tb.getTabCount()) { scrollerPositionTabId = tb.getTab(scrollerIndex).id; - } - else{ + } else { scrollerPositionTabId = null; } } diff --git a/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java b/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java index 8f5e9d9a59..8c92ef1233 100644 --- a/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java +++ b/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java @@ -345,6 +345,8 @@ public class CalendarConnector extends AbstractComponentConnector implements widget.setEventMoveAllowed(hasEventListener(CalendarEventId.EVENTMOVE)); widget.setEventResizeAllowed(hasEventListener(CalendarEventId.EVENTRESIZE)); + widget.setEventCaptionAsHtml(state.eventCaptionAsHtml); + List<CalendarState.Day> days = state.days; List<CalendarState.Event> events = state.events; diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java index 3b168b636c..8b08e9bc7a 100644 --- a/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java +++ b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java @@ -184,14 +184,20 @@ public class DateCellDayEvent extends FocusableHTML implements */ private void updateCaptions(boolean bigMode) { String innerHtml; - String escapedCaption = Util.escapeHTML(calendarEvent.getCaption()); String timeAsText = calendarEvent.getTimeAsText(); + String htmlOrText; + + if (dateCell.weekgrid.getCalendar().isEventCaptionAsHtml()) { + htmlOrText = calendarEvent.getCaption(); + } else { + htmlOrText = Util.escapeHTML(calendarEvent.getCaption()); + } + if (bigMode) { - innerHtml = "<span>" + timeAsText + "</span><br />" - + escapedCaption; + innerHtml = "<span>" + timeAsText + "</span><br />" + htmlOrText; } else { innerHtml = "<span>" + timeAsText + "<span>:</span></span> " - + escapedCaption; + + htmlOrText; } caption.setInnerHTML(innerHtml); eventContent.setInnerHTML(""); diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java b/client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java index 6fc2e430cd..31e600c8f9 100644 --- a/client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java +++ b/client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java @@ -20,6 +20,7 @@ import java.util.Date; import com.google.gwt.event.dom.client.ContextMenuEvent; import com.google.gwt.event.dom.client.ContextMenuHandler; import com.google.gwt.user.client.ui.HTML; +import com.vaadin.client.Util; import com.vaadin.client.ui.VCalendar; /** @@ -75,7 +76,8 @@ public class MonthEventLabel extends HTML implements HasTooltipKey { * Set the caption of the event label * * @param caption - * The caption string, can be HTML + * The caption string, can be HTML if + * {@link VCalendar#isEventCaptionAsHtml()} is true */ public void setCaption(String caption) { this.caption = caption; @@ -87,13 +89,20 @@ public class MonthEventLabel extends HTML implements HasTooltipKey { */ private void renderCaption() { StringBuilder html = new StringBuilder(); + String textOrHtml; + if (calendar.isEventCaptionAsHtml()) { + textOrHtml = caption; + } else { + textOrHtml = Util.escapeHTML(caption); + } + if (caption != null && time != null) { html.append("<span class=\"" + STYLENAME + "-time\">"); html.append(calendar.getTimeFormat().format(time)); html.append("</span> "); - html.append(caption); + html.append(textOrHtml); } else if (caption != null) { - html.append(caption); + html.append(textOrHtml); } else if (time != null) { html.append("<span class=\"" + STYLENAME + "-time\">"); html.append(calendar.getTimeFormat().format(time)); diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java b/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java index bd833e06a0..9488c8835a 100644 --- a/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java +++ b/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java @@ -102,7 +102,11 @@ public class WeeklyLongEvents extends HorizontalPanel implements HasTooltipKey { eventLabel.addStyleDependentName(extraStyle + "-all-day"); } if (!started) { - eventLabel.setText(calendarEvent.getCaption()); + if (calendar.isEventCaptionAsHtml()) { + eventLabel.setHTML(calendarEvent.getCaption()); + } else { + eventLabel.setText(calendarEvent.getCaption()); + } started = true; } } diff --git a/scripts/format.sh b/scripts/format.sh new file mode 100755 index 0000000000..540a35627c --- /dev/null +++ b/scripts/format.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Find eclipse binary +if [ "$ECLIPSE" = "" ] +then + ECLIPSE=`which eclipse` +fi + +if [ "$ECLIPSE" = "" ] +then + echo "Could not find 'eclipse' in PATH" + echo "Either add it to the PATH or set the ECLIPSE variable to point to the Eclipse binary" + echo "e.g. ECLIPSE=\"/some/where/eclipse\" $0" + exit 1 +fi + +# Resolve project root directory +basedir=`dirname $0`/.. +pushd "$basedir" > /dev/null +basedir=`pwd` +popd > /dev/null + +SRC=`ls -d $basedir/*/src $basedir/*/tests/src` + +# Use project formatting settings +config="$basedir/.settings/org.eclipse.jdt.core.prefs" + +"$ECLIPSE" -nosplash -application org.eclipse.jdt.core.JavaCodeFormatter -config "$config" $SRC diff --git a/server/src/com/vaadin/data/util/converter/StringToBigIntegerConverter.java b/server/src/com/vaadin/data/util/converter/StringToBigIntegerConverter.java index 6695aa71ac..adaa8c6111 100644 --- a/server/src/com/vaadin/data/util/converter/StringToBigIntegerConverter.java +++ b/server/src/com/vaadin/data/util/converter/StringToBigIntegerConverter.java @@ -56,7 +56,8 @@ public class StringToBigIntegerConverter extends BigDecimal bigDecimalValue = (BigDecimal) convertToNumber(value, BigDecimal.class, locale); - return (bigDecimalValue != null) ? bigDecimalValue.toBigInteger() : null; + return (bigDecimalValue != null) ? bigDecimalValue.toBigInteger() + : null; } @Override diff --git a/server/src/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java b/server/src/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java index 21a486a017..2fc7ebd544 100644 --- a/server/src/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java +++ b/server/src/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java @@ -262,7 +262,7 @@ public class DefaultSQLGenerator implements SQLGenerator { count++; } if (versionColumn != null) { - if(!item.getItemPropertyIds().contains(versionColumn)) { + if (!item.getItemPropertyIds().contains(versionColumn)) { throw new IllegalArgumentException(String.format( "Table '%s' does not contain version column '%s'.", tableName, versionColumn)); diff --git a/server/src/com/vaadin/server/ClientMethodInvocation.java b/server/src/com/vaadin/server/ClientMethodInvocation.java index 97caa7614a..33b88a168b 100644 --- a/server/src/com/vaadin/server/ClientMethodInvocation.java +++ b/server/src/com/vaadin/server/ClientMethodInvocation.java @@ -109,7 +109,8 @@ public class ClientMethodInvocation implements Serializable, if (type instanceof Class<?>) { Class<?> clazz = (Class<?>) type; if (JsonArray.class.isAssignableFrom(clazz)) { - parameters[i] = JsonUtil.stringify((JsonArray) parameters[i]); + parameters[i] = JsonUtil + .stringify((JsonArray) parameters[i]); } } } @@ -127,7 +128,8 @@ public class ClientMethodInvocation implements Serializable, Class<?> clazz = (Class<?>) type; if (JsonArray.class.isAssignableFrom(clazz)) { try { - parameters[i] = JsonUtil.<JsonArray>parse((String) parameters[i]); + parameters[i] = JsonUtil + .<JsonArray> parse((String) parameters[i]); } catch (JsonException e) { throw new IOException(e); } diff --git a/server/src/com/vaadin/server/JavaScriptCallbackHelper.java b/server/src/com/vaadin/server/JavaScriptCallbackHelper.java index 2552db6d13..ac4a586d00 100644 --- a/server/src/com/vaadin/server/JavaScriptCallbackHelper.java +++ b/server/src/com/vaadin/server/JavaScriptCallbackHelper.java @@ -94,7 +94,8 @@ public class JavaScriptCallbackHelper implements Serializable { + name + " on the client because a callback with the same name is registered on the server."); } - JsonArray args = (JsonArray) JsonCodec.encode(arguments, null, Object[].class, null).getEncodedValue(); + JsonArray args = (JsonArray) JsonCodec.encode(arguments, null, + Object[].class, null).getEncodedValue(); connector.addMethodInvocationToQueue( JavaScriptCallbackRpc.class.getName(), CALL_METHOD, new Object[] { name, args }); diff --git a/server/src/com/vaadin/server/JsonCodec.java b/server/src/com/vaadin/server/JsonCodec.java index 1e9438453a..1f7b4ead43 100644 --- a/server/src/com/vaadin/server/JsonCodec.java +++ b/server/src/com/vaadin/server/JsonCodec.java @@ -66,10 +66,12 @@ import elemental.json.impl.JreJsonArray; public class JsonCodec implements Serializable { /* Immutable Encode Result representing null */ - private static final EncodeResult ENCODE_RESULT_NULL = new EncodeResult(Json.createNull()); + private static final EncodeResult ENCODE_RESULT_NULL = new EncodeResult( + Json.createNull()); /* Immutable empty JSONArray */ - private static final JsonArray EMPTY_JSON_ARRAY = new JreJsonArray(Json.instance()) { + private static final JsonArray EMPTY_JSON_ARRAY = new JreJsonArray( + Json.instance()) { @Override public void set(int index, JsonValue value) { throw new UnsupportedOperationException( @@ -316,7 +318,8 @@ public class JsonCodec implements Serializable { .getGenericComponentType(); return decodeArray(componentType, (JsonArray) value, connectorTracker); - } else if (JsonValue.class.isAssignableFrom(getClassForType(targetType))) { + } else if (JsonValue.class + .isAssignableFrom(getClassForType(targetType))) { return value; } else if (Enum.class.isAssignableFrom(getClassForType(targetType))) { Class<?> classForType = getClassForType(targetType); @@ -479,8 +482,7 @@ public class JsonCodec implements Serializable { } private static Map<Object, Object> decodeObjectMap(Type keyType, - Type valueType, JsonArray jsonMap, ConnectorTracker connectorTracker) - { + Type valueType, JsonArray jsonMap, ConnectorTracker connectorTracker) { JsonArray keys = jsonMap.getArray(0); JsonArray values = jsonMap.getArray(1); @@ -766,7 +768,8 @@ public class JsonCodec implements Serializable { * @param referenceValue * @return */ - private static boolean jsonEquals(JsonValue fieldValue, JsonValue referenceValue) { + private static boolean jsonEquals(JsonValue fieldValue, + JsonValue referenceValue) { if (fieldValue instanceof JsonNull) { fieldValue = null; } @@ -795,13 +798,14 @@ public class JsonCodec implements Serializable { Collection<?> collection, ConnectorTracker connectorTracker) { JsonArray jsonArray = Json.createArray(); for (Object o : collection) { - jsonArray.set(jsonArray.length(), encodeChild(targetType, 0, o, connectorTracker)); + jsonArray.set(jsonArray.length(), + encodeChild(targetType, 0, o, connectorTracker)); } return jsonArray; } - private static JsonValue encodeChild(Type targetType, int typeIndex, Object o, - ConnectorTracker connectorTracker) { + private static JsonValue encodeChild(Type targetType, int typeIndex, + Object o, ConnectorTracker connectorTracker) { if (targetType instanceof ParameterizedType) { Type childType = ((ParameterizedType) targetType) .getActualTypeArguments()[typeIndex]; diff --git a/server/src/com/vaadin/server/LegacyCommunicationManager.java b/server/src/com/vaadin/server/LegacyCommunicationManager.java index e1beb1153c..485084b515 100644 --- a/server/src/com/vaadin/server/LegacyCommunicationManager.java +++ b/server/src/com/vaadin/server/LegacyCommunicationManager.java @@ -85,7 +85,8 @@ public class LegacyCommunicationManager implements Serializable { * @deprecated As of 7.1. See #11411. */ @Deprecated - public static JsonObject encodeState(ClientConnector connector, SharedState state) { + public static JsonObject encodeState(ClientConnector connector, + SharedState state) { UI uI = connector.getUI(); ConnectorTracker connectorTracker = uI.getConnectorTracker(); Class<? extends SharedState> stateType = connector.getStateType(); diff --git a/server/src/com/vaadin/server/communication/ClientRpcWriter.java b/server/src/com/vaadin/server/communication/ClientRpcWriter.java index 6631f6176d..2ecf81287e 100644 --- a/server/src/com/vaadin/server/communication/ClientRpcWriter.java +++ b/server/src/com/vaadin/server/communication/ClientRpcWriter.java @@ -67,7 +67,8 @@ public class ClientRpcWriter implements Serializable { // add invocation to rpcCalls try { JsonArray invocationJson = Json.createArray(); - invocationJson.set(0, invocation.getConnector().getConnectorId()); + invocationJson.set(0, invocation.getConnector() + .getConnectorId()); invocationJson.set(1, invocation.getInterfaceName()); invocationJson.set(2, invocation.getMethodName()); JsonArray paramJson = Json.createArray(); diff --git a/server/src/com/vaadin/server/communication/JSONSerializer.java b/server/src/com/vaadin/server/communication/JSONSerializer.java index e318b6b145..7f673d01e8 100644 --- a/server/src/com/vaadin/server/communication/JSONSerializer.java +++ b/server/src/com/vaadin/server/communication/JSONSerializer.java @@ -52,12 +52,13 @@ public interface JSONSerializer<T> { * the connector tracker instance for the UI * @return A deserialized object */ - T deserialize(Type type, JsonValue jsonValue, ConnectorTracker connectorTracker); + T deserialize(Type type, JsonValue jsonValue, + ConnectorTracker connectorTracker); /** * Serialize the given object into JSON. Must be compatible with - * {@link #deserialize(Type, JsonValue, ConnectorTracker)} and the client side - * com.vaadin.client.communication.JSONSerializer + * {@link #deserialize(Type, JsonValue, ConnectorTracker)} and the client + * side com.vaadin.client.communication.JSONSerializer * * @param value * The object to serialize diff --git a/server/src/com/vaadin/server/communication/ServerRpcHandler.java b/server/src/com/vaadin/server/communication/ServerRpcHandler.java index d1b1be6b97..450c11f5c4 100644 --- a/server/src/com/vaadin/server/communication/ServerRpcHandler.java +++ b/server/src/com/vaadin/server/communication/ServerRpcHandler.java @@ -93,7 +93,8 @@ public class ServerRpcHandler implements Serializable { if (request.getService().getDeploymentConfiguration() .isSyncIdCheckEnabled()) { - syncId = (int) json.getNumber(ApplicationConstants.SERVER_SYNC_ID); + syncId = (int) json + .getNumber(ApplicationConstants.SERVER_SYNC_ID); } else { syncId = -1; } @@ -373,7 +374,8 @@ public class ServerRpcHandler implements Serializable { String methodName = invocationJson.getString(2); if (connectorTracker.getConnector(connectorId) == null - && !connectorId.equals(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID)) { + && !connectorId + .equals(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID)) { if (!connectorTracker.connectorWasPresentAsRequestWasSent( connectorId, lastSyncIdSeenByClient)) { diff --git a/server/src/com/vaadin/server/communication/UIInitHandler.java b/server/src/com/vaadin/server/communication/UIInitHandler.java index 1216d2b689..018274330f 100644 --- a/server/src/com/vaadin/server/communication/UIInitHandler.java +++ b/server/src/com/vaadin/server/communication/UIInitHandler.java @@ -80,7 +80,8 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler { String initialUIDL = getInitialUidl(request, uI); params.put("uidl", initialUIDL); - return commitJsonResponse(request, response, JsonUtil.stringify(params)); + return commitJsonResponse(request, response, + JsonUtil.stringify(params)); } catch (JsonException e) { throw new IOException("Error producing initial UIDL", e); } diff --git a/server/src/com/vaadin/ui/Calendar.java b/server/src/com/vaadin/ui/Calendar.java index 5b5c390fa1..206cc01d1a 100644 --- a/server/src/com/vaadin/ui/Calendar.java +++ b/server/src/com/vaadin/ui/Calendar.java @@ -297,6 +297,11 @@ public class Calendar extends AbstractComponent implements } @Override + protected CalendarState getState(boolean markAsDirty) { + return (CalendarState) super.getState(markAsDirty); + } + + @Override public void beforeClientResponse(boolean initial) { super.beforeClientResponse(initial); @@ -1667,7 +1672,7 @@ public class Calendar extends AbstractComponent implements * weekly mode */ public boolean isMonthlyMode() { - CalendarState state = (CalendarState) getState(false); + CalendarState state = getState(false); if (state.days != null) { return state.days.size() > 7; } else { @@ -1895,4 +1900,34 @@ public class Calendar extends AbstractComponent implements dropHandler.getAcceptCriterion().paint(target); } } + + /** + * Sets whether the event captions are rendered as HTML. + * <p> + * If set to true, the captions are rendered in the browser as HTML and the + * developer is responsible for ensuring no harmful HTML is used. If set to + * false, the caption is rendered in the browser as plain text. + * <p> + * The default is false, i.e. to render that caption as plain text. + * + * @param captionAsHtml + * true if the captions are rendered as HTML, false if rendered + * as plain text + */ + public void setEventCaptionAsHtml(boolean eventCaptionAsHtml) { + getState().eventCaptionAsHtml = eventCaptionAsHtml; + } + + /** + * Checks whether event captions are rendered as HTML + * <p> + * The default is false, i.e. to render that caption as plain text. + * + * @return true if the captions are rendered as HTML, false if rendered as + * plain text + */ + public boolean isEventCaptionAsHtml() { + return getState(false).eventCaptionAsHtml; + } + } diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index 4bd4b67259..66f893e04a 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -1164,7 +1164,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements * The new theme name */ public void setTheme(String theme) { - if(theme == null) { + if (theme == null) { getState().theme = null; } else { getState().theme = VaadinServlet.stripSpecialChars(theme); diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/SQLContainerTableQueryTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/SQLContainerTableQueryTest.java index 2d66b728a7..bef57fd7d1 100644 --- a/server/tests/src/com/vaadin/data/util/sqlcontainer/SQLContainerTableQueryTest.java +++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/SQLContainerTableQueryTest.java @@ -70,8 +70,7 @@ public class SQLContainerTableQueryTest { } @Test - public void itemWithExistingVersionColumnIsRemoved() - throws SQLException { + public void itemWithExistingVersionColumnIsRemoved() throws SQLException { container.setAutoCommit(true); peopleQuery.setVersionColumn("ID"); @@ -79,7 +78,8 @@ public class SQLContainerTableQueryTest { } @Test(expected = IllegalArgumentException.class) - public void itemWithNonExistingVersionColumnCannotBeRemoved() throws SQLException { + public void itemWithNonExistingVersionColumnCannotBeRemoved() + throws SQLException { peopleQuery.setVersionColumn("version"); container.removeItem(container.lastItemId()); @@ -99,33 +99,32 @@ public class SQLContainerTableQueryTest { SQLContainer container = new SQLContainer(new TableQuery("people", connectionPool, SQLTestsConstants.sqlGen)); - assertTrue(container.containsId(new RowId( - new Object[]{1 + offset}))); + assertTrue(container.containsId(new RowId(new Object[] { 1 + offset }))); Assert.assertTrue(container.containsId(new RowId( new Object[] { 1 + offset }))); assertTrue(this.container.containsId(new RowId( - new Object[]{1 + offset}))); + new Object[] { 1 + offset }))); } @Test public void containsId_withTableQueryAndNonexistingId_returnsFalse() throws SQLException { Assert.assertFalse(container.containsId(new RowId( - new Object[]{1337 + offset}))); + new Object[] { 1337 + offset }))); } @Test public void getContainerProperty_tableExistingItemIdAndNonexistingPropertyId_returnsNull() throws SQLException { Assert.assertNull(container.getContainerProperty(new RowId( - new Object[]{1 + offset}), "asdf")); + new Object[] { 1 + offset }), "asdf")); } @Test public void getContainerProperty_tableNonexistingItemId_returnsNull() throws SQLException { Assert.assertNull(container.getContainerProperty(new RowId( - new Object[]{1337 + offset}), "NAME")); + new Object[] { 1337 + offset }), "NAME")); } @Test @@ -156,24 +155,23 @@ public class SQLContainerTableQueryTest { "Ville", container .getContainerProperty( - new RowId(new Object[]{new BigDecimal( - 0 + offset)}), "NAME").getValue()); + new RowId(new Object[] { new BigDecimal( + 0 + offset) }), "NAME").getValue()); } else { Assert.assertEquals( "Ville", container.getContainerProperty( - new RowId(new Object[]{0 + offset}), "NAME") + new RowId(new Object[] { 0 + offset }), "NAME") .getValue()); } } - @Test public void getContainerPropertyIds_table_returnsIDAndNAME() throws SQLException { Collection<?> propertyIds = container.getContainerPropertyIds(); Assert.assertEquals(3, propertyIds.size()); - Assert.assertArrayEquals(new String[]{"ID", "NAME", "AGE"}, + Assert.assertArrayEquals(new String[] { "ID", "NAME", "AGE" }, propertyIds.toArray()); } @@ -288,10 +286,10 @@ public class SQLContainerTableQueryTest { throws SQLException { if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertEquals(3, container.indexOfId(new RowId( - new Object[]{new BigDecimal(3 + offset)}))); + new Object[] { new BigDecimal(3 + offset) }))); } else { Assert.assertEquals(3, - container.indexOfId(new RowId(new Object[]{3 + offset}))); + container.indexOfId(new RowId(new Object[] { 3 + offset }))); } } @@ -301,14 +299,14 @@ public class SQLContainerTableQueryTest { DataGenerator.addFiveThousandPeople(connectionPool); if (SQLTestsConstants.db == DB.ORACLE) { - container.getItem(new RowId(new Object[]{new BigDecimal( - 1337 + offset)})); + container.getItem(new RowId(new Object[] { new BigDecimal( + 1337 + offset) })); Assert.assertEquals(1337, container.indexOfId(new RowId( - new Object[]{new BigDecimal(1337 + offset)}))); + new Object[] { new BigDecimal(1337 + offset) }))); } else { - container.getItem(new RowId(new Object[]{1337 + offset})); + container.getItem(new RowId(new Object[] { 1337 + offset })); Assert.assertEquals(1337, container.indexOfId(new RowId( - new Object[]{1337 + offset}))); + new Object[] { 1337 + offset }))); } } @@ -332,7 +330,7 @@ public class SQLContainerTableQueryTest { throws SQLException { DataGenerator.addFiveThousandPeople(connectionPool); - Object itemId = container.getIdByIndex(1337); + Object itemId = container.getIdByIndex(1337); if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertEquals( new RowId(new Object[] { 1337 + offset }).toString(), @@ -367,10 +365,10 @@ public class SQLContainerTableQueryTest { Object itemId = container.getIdByIndex(1337); if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertEquals( - new RowId(new Object[]{1336 + offset}).toString(), + new RowId(new Object[] { 1336 + offset }).toString(), container.prevItemId(itemId).toString()); } else { - Assert.assertEquals(new RowId(new Object[]{1336 + offset}), + Assert.assertEquals(new RowId(new Object[] { 1336 + offset }), container.prevItemId(itemId)); } } @@ -379,10 +377,10 @@ public class SQLContainerTableQueryTest { public void firstItemId_table_returnsItemId0() throws SQLException { if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertEquals( - new RowId(new Object[]{0 + offset}).toString(), + new RowId(new Object[] { 0 + offset }).toString(), container.firstItemId().toString()); } else { - Assert.assertEquals(new RowId(new Object[]{0 + offset}), + Assert.assertEquals(new RowId(new Object[] { 0 + offset }), container.firstItemId()); } } @@ -394,10 +392,10 @@ public class SQLContainerTableQueryTest { if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertEquals( - new RowId(new Object[]{4999 + offset}).toString(), + new RowId(new Object[] { 4999 + offset }).toString(), container.lastItemId().toString()); } else { - Assert.assertEquals(new RowId(new Object[]{4999 + offset}), + Assert.assertEquals(new RowId(new Object[] { 4999 + offset }), container.lastItemId()); } } @@ -406,10 +404,10 @@ public class SQLContainerTableQueryTest { public void isFirstId_tableActualFirstId_returnsTrue() throws SQLException { if (SQLTestsConstants.db == DB.ORACLE) { assertTrue(container.isFirstId(new RowId( - new Object[]{new BigDecimal(0 + offset)}))); + new Object[] { new BigDecimal(0 + offset) }))); } else { assertTrue(container.isFirstId(new RowId( - new Object[]{0 + offset}))); + new Object[] { 0 + offset }))); } } @@ -417,10 +415,10 @@ public class SQLContainerTableQueryTest { public void isFirstId_tableSecondId_returnsFalse() throws SQLException { if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertFalse(container.isFirstId(new RowId( - new Object[]{new BigDecimal(1 + offset)}))); + new Object[] { new BigDecimal(1 + offset) }))); } else { Assert.assertFalse(container.isFirstId(new RowId( - new Object[]{1 + offset}))); + new Object[] { 1 + offset }))); } } @@ -428,10 +426,10 @@ public class SQLContainerTableQueryTest { public void isLastId_tableSecondId_returnsFalse() throws SQLException { if (SQLTestsConstants.db == DB.ORACLE) { Assert.assertFalse(container.isLastId(new RowId( - new Object[]{new BigDecimal(1 + offset)}))); + new Object[] { new BigDecimal(1 + offset) }))); } else { Assert.assertFalse(container.isLastId(new RowId( - new Object[]{1 + offset}))); + new Object[] { 1 + offset }))); } } @@ -439,10 +437,10 @@ public class SQLContainerTableQueryTest { public void isLastId_tableLastId_returnsTrue() throws SQLException { if (SQLTestsConstants.db == DB.ORACLE) { assertTrue(container.isLastId(new RowId( - new Object[]{new BigDecimal(3 + offset)}))); + new Object[] { new BigDecimal(3 + offset) }))); } else { - assertTrue(container.isLastId(new RowId( - new Object[]{3 + offset}))); + assertTrue(container + .isLastId(new RowId(new Object[] { 3 + offset }))); } } @@ -451,10 +449,10 @@ public class SQLContainerTableQueryTest { DataGenerator.addFiveThousandPeople(connectionPool); if (SQLTestsConstants.db == DB.ORACLE) { assertTrue(container.isLastId(new RowId( - new Object[]{new BigDecimal(4999 + offset)}))); + new Object[] { new BigDecimal(4999 + offset) }))); } else { assertTrue(container.isLastId(new RowId( - new Object[]{4999 + offset}))); + new Object[] { 4999 + offset }))); } } @@ -862,6 +860,7 @@ public class SQLContainerTableQueryTest { assertTrue(garbageContainer.removeItem(first)); Assert.assertSame(second, garbageContainer.firstItemId()); } + @Test public void lastItemId_tableLastItemRemoved_resultChanges() throws SQLException { diff --git a/server/tests/src/com/vaadin/server/JSONSerializerTest.java b/server/tests/src/com/vaadin/server/JSONSerializerTest.java index 393cea1c4c..6c57445564 100644 --- a/server/tests/src/com/vaadin/server/JSONSerializerTest.java +++ b/server/tests/src/com/vaadin/server/JSONSerializerTest.java @@ -57,8 +57,8 @@ public class JSONSerializerTest extends TestCase { stringToStateMap.put("string - state 1", s); stringToStateMap.put("String - state 2", s2); - JsonValue encodedMap = JsonCodec.encode(stringToStateMap, null, mapType, - null).getEncodedValue(); + JsonValue encodedMap = JsonCodec.encode(stringToStateMap, null, + mapType, null).getEncodedValue(); ensureDecodedCorrectly(stringToStateMap, encodedMap, mapType); } @@ -74,8 +74,8 @@ public class JSONSerializerTest extends TestCase { stateToStringMap.put(s, "string - state 1"); stateToStringMap.put(s2, "String - state 2"); - JsonValue encodedMap = JsonCodec.encode(stateToStringMap, null, mapType, - null).getEncodedValue(); + JsonValue encodedMap = JsonCodec.encode(stateToStringMap, null, + mapType, null).getEncodedValue(); ensureDecodedCorrectly(stateToStringMap, encodedMap, mapType); } diff --git a/server/tests/src/com/vaadin/tests/server/TestClientMethodSerialization.java b/server/tests/src/com/vaadin/tests/server/TestClientMethodSerialization.java index ad70024af4..d6a71028db 100644 --- a/server/tests/src/com/vaadin/tests/server/TestClientMethodSerialization.java +++ b/server/tests/src/com/vaadin/tests/server/TestClientMethodSerialization.java @@ -71,7 +71,8 @@ public class TestClientMethodSerialization extends TestCase { ClientMethodInvocation copy = (ClientMethodInvocation) serializeAndDeserialize(original); JsonArray copyArray = (JsonArray) copy.getParameters()[1]; - assertEquals(JsonUtil.stringify(originalArray), JsonUtil.stringify(copyArray)); + assertEquals(JsonUtil.stringify(originalArray), + JsonUtil.stringify(copyArray)); } public void testClientMethodSerialization_WithBasicParams_NoChanges() diff --git a/shared/src/com/vaadin/shared/ui/calendar/CalendarState.java b/shared/src/com/vaadin/shared/ui/calendar/CalendarState.java index 93bd05bc1e..c26c4ead16 100644 --- a/shared/src/com/vaadin/shared/ui/calendar/CalendarState.java +++ b/shared/src/com/vaadin/shared/ui/calendar/CalendarState.java @@ -38,6 +38,7 @@ public class CalendarState extends AbstractComponentState { public List<CalendarState.Day> days; public List<CalendarState.Event> events; public List<CalendarState.Action> actions; + public boolean eventCaptionAsHtml; public static class Day implements java.io.Serializable { public String date; diff --git a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java index f00a05e810..871111ad8b 100644 --- a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java +++ b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java @@ -48,7 +48,6 @@ import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.server.ssl.SslSocketConnector; -import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.util.Scanner; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.webapp.WebAppContext; @@ -257,7 +256,6 @@ public class DevelopmentServerLauncher { webappcontext.stop(); server.stop(); webappcontext.start(); - disableAtmosphereAnnotationScan(webappcontext); server.start(); } }); @@ -278,8 +276,6 @@ public class DevelopmentServerLauncher { // Read web.xml to find all configured servlets webappcontext.start(); - disableAtmosphereAnnotationScan(webappcontext); - try { server.start(); @@ -351,19 +347,6 @@ public class DevelopmentServerLauncher { return "http://localhost:" + port + serverArgs.get("context"); } - private static void disableAtmosphereAnnotationScan( - WebAppContext webappcontext) { - // Reconfigure all servlets to avoid startup delay - for (ServletHolder servletHolder : webappcontext.getServletHandler() - .getServlets()) { - if (servletHolder - .getInitParameter("org.atmosphere.cpr.scanClassPath") == null) { - servletHolder.setInitParameter( - "org.atmosphere.cpr.scanClassPath", "false"); - } - } - } - /** * Assign default value for given key. * diff --git a/uitest/src/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java b/uitest/src/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java index 2ab6be25ac..c015b65e1f 100644 --- a/uitest/src/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java +++ b/uitest/src/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java @@ -35,7 +35,7 @@ public class WindowWaiAriaRoles extends AbstractTestUI { /* * (non-Javadoc) - * + * * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. * VaadinRequest) */ @@ -86,7 +86,7 @@ public class WindowWaiAriaRoles extends AbstractTestUI { /* * (non-Javadoc) - * + * * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() */ @Override @@ -96,7 +96,7 @@ public class WindowWaiAriaRoles extends AbstractTestUI { /* * (non-Javadoc) - * + * * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() */ @Override diff --git a/uitest/src/com/vaadin/tests/actions/ActionsWithoutKeyCode.java b/uitest/src/com/vaadin/tests/actions/ActionsWithoutKeyCode.java new file mode 100644 index 0000000000..e94a4b1ade --- /dev/null +++ b/uitest/src/com/vaadin/tests/actions/ActionsWithoutKeyCode.java @@ -0,0 +1,39 @@ +package com.vaadin.tests.actions; + +import com.vaadin.event.Action; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.TextField; + +@SuppressWarnings("serial") +public class ActionsWithoutKeyCode extends AbstractTestUIWithLog { + + @Override + protected void setup(VaadinRequest request) { + TextField tf = new TextField(); + tf.setWidth("100%"); + tf.setInputPrompt("Enter text with å,ä or ä or press windows key while textfield is focused"); + addComponent(tf); + + addActionHandler(new Action.Handler() { + + private Action[] actions; + { + actions = new Action[] { new Action("test1") }; + } + + @Override + public Action[] getActions(Object target, Object sender) { + return actions; + } + + @Override + public void handleAction(Action action, Object sender, Object target) { + log("action " + action.getCaption() + " triggered by " + + sender.getClass().getSimpleName() + " on " + + target.getClass().getSimpleName()); + } + }); + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java index cee71fdf4e..9e37fef7d9 100644 --- a/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java +++ b/uitest/src/com/vaadin/tests/components/button/ButtonToggleIcons.java @@ -1,38 +1,38 @@ -package com.vaadin.tests.components.button;
-
-import com.vaadin.server.ThemeResource;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.NativeButton;
-import com.vaadin.ui.UI;
-import com.vaadin.ui.VerticalLayout;
-
-@SuppressWarnings("serial")
-public class ButtonToggleIcons extends UI {
-
- @Override
- protected void init(final VaadinRequest request) {
- final VerticalLayout layout = new VerticalLayout();
- setContent(layout);
-
- final ThemeResource iconResource = new ThemeResource(
- "../runo/icons/16/arrow-left.png");
-
- final ClickListener iconToggleListener = new ClickListener() {
- @Override
- public void buttonClick(final ClickEvent event) {
- final Button btn = event.getButton();
- if (btn.getIcon() == null) {
- btn.setIcon(iconResource);
- } else {
- btn.setIcon(null);
- }
- }
- };
-
- layout.addComponent(new Button("Toggle icon", iconToggleListener));
- layout.addComponent(new NativeButton("Toggle icon", iconToggleListener));
- }
-}
+package com.vaadin.tests.components.button; + +import com.vaadin.server.ThemeResource; +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.NativeButton; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalLayout; + +@SuppressWarnings("serial") +public class ButtonToggleIcons extends UI { + + @Override + protected void init(final VaadinRequest request) { + final VerticalLayout layout = new VerticalLayout(); + setContent(layout); + + final ThemeResource iconResource = new ThemeResource( + "../runo/icons/16/arrow-left.png"); + + final ClickListener iconToggleListener = new ClickListener() { + @Override + public void buttonClick(final ClickEvent event) { + final Button btn = event.getButton(); + if (btn.getIcon() == null) { + btn.setIcon(iconResource); + } else { + btn.setIcon(null); + } + } + }; + + layout.addComponent(new Button("Toggle icon", iconToggleListener)); + layout.addComponent(new NativeButton("Toggle icon", iconToggleListener)); + } +} diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarHtmlInEvents.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarHtmlInEvents.java new file mode 100644 index 0000000000..15cde71838 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarHtmlInEvents.java @@ -0,0 +1,101 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * 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.vaadin.tests.components.calendar; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.data.util.MethodProperty; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Calendar; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.NativeSelect; +import com.vaadin.ui.components.calendar.event.BasicEvent; +import com.vaadin.ui.components.calendar.event.CalendarEvent; +import com.vaadin.ui.components.calendar.event.CalendarEventProvider; + +public class CalendarHtmlInEvents extends AbstractTestUIWithLog { + + private Calendar calendar = new Calendar(); + + @Override + protected void setup(VaadinRequest request) { + final NativeSelect ns = new NativeSelect("Period"); + ns.addItems("Day", "Week", "Month"); + ns.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + if ("Day".equals(ns.getValue())) { + calendar.setStartDate(new Date(2014 - 1900, 1 - 1, 1)); + calendar.setEndDate(new Date(2014 - 1900, 1 - 1, 1)); + } else if ("Week".equals(ns.getValue())) { + calendar.setStartDate(new Date(2014 - 1900, 1 - 1, 1)); + calendar.setEndDate(new Date(2014 - 1900, 1 - 1, 7)); + } else if ("Month".equals(ns.getValue())) { + calendar.setStartDate(new Date(2014 - 1900, 1 - 1, 1)); + calendar.setEndDate(new Date(2014 - 1900, 2 - 1, 1)); + } + } + }); + ns.setValue("Month"); + final CheckBox allowHtml = new CheckBox("Allow HTML in event caption", + new MethodProperty<Boolean>(calendar, "eventCaptionAsHtml")); + allowHtml.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + log("HTML in event caption: " + allowHtml.getValue()); + } + }); + HorizontalLayout hl = new HorizontalLayout(); + hl.setDefaultComponentAlignment(Alignment.BOTTOM_LEFT); + hl.addComponents(ns, allowHtml); + hl.setSpacing(true); + hl.setMargin(true); + calendar.setEventProvider(new CalendarEventProvider() { + + @Override + public List<CalendarEvent> getEvents(Date startDate, Date endDate) { + Date d = startDate; + ArrayList<CalendarEvent> events = new ArrayList<CalendarEvent>(); + while (d.before(endDate)) { + BasicEvent ce = new BasicEvent(); + ce.setAllDay(false); + ce.setCaption("<b>Hello</b> <u>world</u>!"); + ce.setDescription("Nothing really important"); + Date start = new Date(d.getTime()); + start.setHours(d.getDay()); + Date end = new Date(d.getTime()); + end.setHours(d.getDay() + 3); + ce.setStart(start); + ce.setEnd(end); + events.add(ce); + d.setTime(d.getTime() + 1000 * 60 * 60 * 24); + } + + return events; + } + + }); + addComponent(hl); + addComponent(calendar); + } +} diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarHtmlInEventsTest.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarHtmlInEventsTest.java new file mode 100644 index 0000000000..31e3f754e3 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarHtmlInEventsTest.java @@ -0,0 +1,103 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * 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.vaadin.tests.components.calendar; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.elements.CalendarElement; +import com.vaadin.testbench.elements.CheckBoxElement; +import com.vaadin.testbench.elements.NativeSelectElement; +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class CalendarHtmlInEventsTest extends SingleBrowserTest { + + private NativeSelectElement periodSelect; + private CheckBoxElement htmlAllowed; + private CalendarElement calendar; + + @Override + public void setup() throws Exception { + super.setup(); + openTestURL(); + periodSelect = $(NativeSelectElement.class).first(); + htmlAllowed = $(CheckBoxElement.class).first(); + calendar = $(CalendarElement.class).first(); + } + + @Test + public void monthViewEventCaptions() { + Assert.assertEquals(getMonthEvent(0).getText(), + "12:00 AM <b>Hello</b> <u>world</u>!"); + + // Switch to HTML mode + click(htmlAllowed); + Assert.assertEquals("1. HTML in event caption: true", getLogRow(0)); + + Assert.assertEquals(getMonthEvent(0).getText(), "12:00 AM Hello world!"); + } + + @Test + public void weekViewEventCaptions() { + periodSelect.selectByText("Week"); + Assert.assertEquals("4:00 AM\n<b>Hello</b> <u>world</u>!", + getWeekEvent(1).getText()); + + // Switch to HTML mode + click(htmlAllowed); + Assert.assertEquals("1. HTML in event caption: true", getLogRow(0)); + + Assert.assertEquals("4:00 AM\nHello world!", getWeekEvent(1).getText()); + } + + @Test + public void dayViewEventCaptions() { + periodSelect.selectByText("Day"); + Assert.assertEquals("3:00 AM\n<b>Hello</b> <u>world</u>!", + getWeekEvent(0).getText()); + + // Switch to HTML mode + click(htmlAllowed); + Assert.assertEquals("1. HTML in event caption: true", getLogRow(0)); + Assert.assertEquals("3:00 AM\nHello world!", getWeekEvent(0).getText()); + } + + private WebElement getMonthEvent(int dayInCalendar) { + return getMonthDay(dayInCalendar).findElement( + By.className("v-calendar-event")); + } + + private WebElement getWeekEvent(int dayInCalendar) { + return getWeekDay(dayInCalendar).findElement( + By.className("v-calendar-event")); + } + + private void click(CheckBoxElement htmlAllowed2) { + htmlAllowed2.findElement(By.xpath("input")).click(); + } + + private WebElement getMonthDay(int i) { + return calendar.findElements(By.className("v-calendar-month-day")).get( + i); + } + + private WebElement getWeekDay(int i) { + return calendar.findElements(By.className("v-calendar-day-times")).get( + i); + } +} diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarNotificationsTestIE.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarNotificationsTestIE.java index 933bca8c7d..62223ccc25 100644 --- a/uitest/src/com/vaadin/tests/components/calendar/CalendarNotificationsTestIE.java +++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarNotificationsTestIE.java @@ -62,7 +62,9 @@ public class CalendarNotificationsTestIE extends MultiBrowserTest { WebElement day = findElements(By.className("v-calendar-day-number")) .get(2); // IE8 requires you to click on the text part to fire the event - new Actions(getDriver()).moveToElement(day, day.getSize().getWidth() - 3, day.getSize().getHeight() / 2).click().perform(); + new Actions(getDriver()) + .moveToElement(day, day.getSize().getWidth() - 3, + day.getSize().getHeight() / 2).click().perform(); // check that a notification was opened, this is done with a log instead // of a screenshot or element presence check due to problems with IE diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.java index 1d2c85c974..a35bc46390 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.java @@ -14,18 +14,21 @@ public class ComboBoxValueInput extends AbstractTestUI { ComboBox cb = getComboBox("A combobox", false, "default"); addComponent(cb); - cb = getComboBox("A combobox with input prompt", false, "default-prompt"); + cb = getComboBox("A combobox with input prompt", false, + "default-prompt"); cb.setInputPrompt("Please select"); addComponent(cb); cb = getComboBox("A combobox with null item", true, "null"); addComponent(cb); - cb = getComboBox("A combobox with null item and input prompt", true, "null-prompt"); + cb = getComboBox("A combobox with null item and input prompt", true, + "null-prompt"); cb.setInputPrompt("Please select"); addComponent(cb); - cb = getComboBox("A combobox with filteringMode off", false, "filtering-off"); + cb = getComboBox("A combobox with filteringMode off", false, + "filtering-off"); cb.setFilteringMode(FilteringMode.OFF); addComponent(cb); diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxValueInputTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxValueInputTest.java index b2b3c29098..318ffbe549 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxValueInputTest.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxValueInputTest.java @@ -131,9 +131,10 @@ public class ComboBoxValueInputTest extends MultiBrowserTest { assertThat(getComboBoxValue(comboBox), is("")); - //selectByText doesn't work when filtering is off. + // selectByText doesn't work when filtering is off. comboBox.openPopup(); - List<WebElement> filteredItems = findElements(By.className("gwt-MenuItem")); + List<WebElement> filteredItems = findElements(By + .className("gwt-MenuItem")); filteredItems.get(1).click(); sendKeysToComboBox(comboBox, "mnop"); diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboSelectedValueBeyondTheFirstDropdownPage.java b/uitest/src/com/vaadin/tests/components/combobox/ComboSelectedValueBeyondTheFirstDropdownPage.java index 41b61c9062..acfb7b165f 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboSelectedValueBeyondTheFirstDropdownPage.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboSelectedValueBeyondTheFirstDropdownPage.java @@ -8,7 +8,8 @@ import com.vaadin.ui.ComboBox; import com.vaadin.ui.Label; @SuppressWarnings("serial") -public class ComboSelectedValueBeyondTheFirstDropdownPage extends AbstractTestUI { +public class ComboSelectedValueBeyondTheFirstDropdownPage extends + AbstractTestUI { protected static final int ITEM_COUNT = 21; protected static final String ITEM_NAME_TEMPLATE = "Item %d"; diff --git a/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibilityTest.java b/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibilityTest.java index 4e0204604b..9f1fc6b03e 100644 --- a/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibilityTest.java +++ b/uitest/src/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibilityTest.java @@ -25,5 +25,4 @@ public class CustomComponentChildVisibilityTest extends MultiBrowserTest { return $(LabelElement.class).all().size() > 1; } - }
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffset.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffset.java index 62db60be76..a6fda534b2 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffset.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffset.java @@ -29,7 +29,7 @@ public class DateFieldDayResolutionOffset extends AbstractTestUI { addComponent(dateValue); addComponent(dateField); - dateField.addValueChangeListener( new Property.ValueChangeListener(){ + dateField.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { dateValue.setValue(dateformat.format(dateField.getValue())); @@ -37,7 +37,8 @@ public class DateFieldDayResolutionOffset extends AbstractTestUI { }); } - private DateField getDateField(TimeZone timezone, SimpleDateFormat dateformat) { + private DateField getDateField(TimeZone timezone, + SimpleDateFormat dateformat) { final DateField dateField = new DateField(); try { Date initialDate = dateformat.parse(initialDateString); @@ -51,7 +52,8 @@ public class DateFieldDayResolutionOffset extends AbstractTestUI { } private SimpleDateFormat getDateFormat(TimeZone timezone) { - final SimpleDateFormat dateformat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); + final SimpleDateFormat dateformat = new SimpleDateFormat( + "MM/dd/yyyy HH:mm:ss"); dateformat.setTimeZone(timezone); return dateformat; } diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffsetTest.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffsetTest.java index c3b3af9aa4..4ee9597f68 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffsetTest.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldDayResolutionOffsetTest.java @@ -25,8 +25,9 @@ public class DateFieldDayResolutionOffsetTest extends MultiBrowserTest { } private void select2ndOfSeptember() { - for(WebElement e : findElements(By.className("v-datefield-calendarpanel-day"))) { - if(e.getText().equals("2")) { + for (WebElement e : findElements(By + .className("v-datefield-calendarpanel-day"))) { + if (e.getText().equals("2")) { e.click(); break; } @@ -36,8 +37,7 @@ public class DateFieldDayResolutionOffsetTest extends MultiBrowserTest { private void openDatePicker() { DateFieldElement dateField = $(DateFieldElement.class).first(); - dateField.findElement(By.tagName("button")) - .click(); + dateField.findElement(By.tagName("button")).click(); } }
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrollingTest.java b/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrollingTest.java index 3a0dcafe1f..29476b9ae6 100644 --- a/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrollingTest.java +++ b/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrollingTest.java @@ -13,11 +13,10 @@ public class TableInFormLayoutCausesScrollingTest extends MultiBrowserTest { @Test @Ignore - //This test is actually testing that #7309 is NOT fixed. - //Ignoring the test because it is not stable and it's - //occasionally failing on browsers even when it shouldn't. - - //There's no point fixing this test before #7309 is actually fixed. + // This test is actually testing that #7309 is NOT fixed. + // Ignoring the test because it is not stable and it's + // occasionally failing on browsers even when it shouldn't. + // There's no point fixing this test before #7309 is actually fixed. public void pageIsNotScrolled() throws IOException { openTestURL(); diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java index 6c23e4e4a5..ce528df373 100644 --- a/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java +++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewResizeWhileOpenTest.java @@ -69,7 +69,7 @@ public class PopupViewResizeWhileOpenTest extends MultiBrowserTest { } private WebElement getPopupShadow() { - //Shadows with index 0: tooltip, index 1: popup + // Shadows with index 0: tooltip, index 1: popup return findElements(By.className("v-shadow")).get(1); } diff --git a/uitest/src/com/vaadin/tests/components/table/LongMultiselectTest.java b/uitest/src/com/vaadin/tests/components/table/LongMultiselectTest.java index ebf2c1dc47..e9f3bbb355 100644 --- a/uitest/src/com/vaadin/tests/components/table/LongMultiselectTest.java +++ b/uitest/src/com/vaadin/tests/components/table/LongMultiselectTest.java @@ -38,7 +38,8 @@ public class LongMultiselectTest extends MultiBrowserTest { TableElement table = getTable(); assertThat(table.getCell(LASTSELECTEDROW, 1).getText(), is("updated")); - assertThat(table.getCell(LASTSELECTEDROW-1, 1).getText(), is("updated")); + assertThat(table.getCell(LASTSELECTEDROW - 1, 1).getText(), + is("updated")); } private void selectRows() { @@ -47,8 +48,9 @@ public class LongMultiselectTest extends MultiBrowserTest { scrollToBottom(); - new Actions(getDriver()).keyDown(Keys.SHIFT).click(getTable().getCell(LASTSELECTEDROW, 0)).keyUp(Keys.SHIFT) - .build().perform(); + new Actions(getDriver()).keyDown(Keys.SHIFT) + .click(getTable().getCell(LASTSELECTEDROW, 0)) + .keyUp(Keys.SHIFT).build().perform(); } private TableElement getTable() { diff --git a/uitest/src/com/vaadin/tests/components/table/SelectAllConstantViewportTest.java b/uitest/src/com/vaadin/tests/components/table/SelectAllConstantViewportTest.java index 0e7a7c08a4..504957e773 100644 --- a/uitest/src/com/vaadin/tests/components/table/SelectAllConstantViewportTest.java +++ b/uitest/src/com/vaadin/tests/components/table/SelectAllConstantViewportTest.java @@ -51,7 +51,8 @@ public class SelectAllConstantViewportTest extends MultiBrowserTest { int rowLocation = row.getLocation().getY(); - // use click x,y with non-zero offset to actually toggle the checkbox. (#13763) + // use click x,y with non-zero offset to actually toggle the checkbox. + // (#13763) checkbox.click(5, 5); int newRowLocation = row.getLocation().getY(); diff --git a/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponentsTest.java b/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponentsTest.java index aee8cc96d9..4a9d17c02d 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponentsTest.java +++ b/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponentsTest.java @@ -105,8 +105,8 @@ public class TableClickAndDragOnIconAndComponentsTest extends MultiBrowserTest { } private void assertThatFocusTextFieldHasText(String text) { - List<WebElement> focused = getTable().findElements(By - .className("v-textfield-focus")); + List<WebElement> focused = getTable().findElements( + By.className("v-textfield-focus")); assertThat(focused.get(0).getAttribute("value"), is(text)); } @@ -114,7 +114,7 @@ public class TableClickAndDragOnIconAndComponentsTest extends MultiBrowserTest { private int getSelectedRowTextValue() { WebElement selectedRow = getSelectedRow(); - //i.e. 'red 1foo' + // i.e. 'red 1foo' String text = getText(selectedRow, 2); return Integer.parseInt(text.substring(4, 5)); @@ -127,13 +127,11 @@ public class TableClickAndDragOnIconAndComponentsTest extends MultiBrowserTest { } private List<WebElement> getCellContents(WebElement row) { - return row.findElements( - By.className("v-table-cell-content")); + return row.findElements(By.className("v-table-cell-content")); } private WebElement getSelectedRow() { - return getTable().findElement(By - .className("v-selected")); + return getTable().findElement(By.className("v-selected")); } private void clickOnTextField(int row) { @@ -157,15 +155,13 @@ public class TableClickAndDragOnIconAndComponentsTest extends MultiBrowserTest { } private WebElement getElement(int row, int index, String className) { - return getRows() - .get(row) - .findElements(By.className(className)) + return getRows().get(row).findElements(By.className(className)) .get(index); } private List<WebElement> getRows() { return getTable().findElement(By.className("v-table-body")) - .findElements(By.tagName("tr")); + .findElements(By.tagName("tr")); } private void selectRow(int row) { @@ -178,7 +174,6 @@ public class TableClickAndDragOnIconAndComponentsTest extends MultiBrowserTest { return $(TableElement.class).first(); } - private void clickOnLabel(int row) { WebElement label = getElement(row, "v-label"); label.click(); @@ -200,9 +195,9 @@ public class TableClickAndDragOnIconAndComponentsTest extends MultiBrowserTest { private int getSelectedRowIndex() { List<WebElement> rows = getRows(); - //Unfortunately rows.getIndexOf(getSelectedRow()) doesn't work. - for(WebElement r : rows) { - if(r.getAttribute("class").contains("v-selected")) { + // Unfortunately rows.getIndexOf(getSelectedRow()) doesn't work. + for (WebElement r : rows) { + if (r.getAttribute("class").contains("v-selected")) { return rows.indexOf(r); } } diff --git a/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidthTest.java b/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidthTest.java index 3ae66de684..5faee3cc59 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidthTest.java +++ b/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidthTest.java @@ -42,7 +42,8 @@ public class TableColumnResizeContentsWidthTest extends MultiBrowserTest { public List<DesiredCapabilities> getBrowsersToTest() { List<DesiredCapabilities> browsersToTest = super.getBrowsersToTest(); - //Can't get IE8 to hit the resizer, extracted IE8 to it's own test class. + // Can't get IE8 to hit the resizer, extracted IE8 to it's own test + // class. browsersToTest.remove(Browser.IE8.getDesiredCapabilities()); return browsersToTest; @@ -54,7 +55,8 @@ public class TableColumnResizeContentsWidthTest extends MultiBrowserTest { List<ButtonElement> buttons = $(ButtonElement.class).all(); - WebElement resizer = getTable().findElement(By.className("v-table-resizer")); + WebElement resizer = getTable().findElement( + By.className("v-table-resizer")); assertEquals(100, getTextFieldWidth()); @@ -84,7 +86,8 @@ public class TableColumnResizeContentsWidthTest extends MultiBrowserTest { private int getTextFieldWidth() { TableElement table = getTable(); - final WebElement textField = table.findElement(By.className("v-textfield")); + final WebElement textField = table.findElement(By + .className("v-textfield")); return textField.getSize().width; } @@ -94,8 +97,7 @@ public class TableColumnResizeContentsWidthTest extends MultiBrowserTest { } private void moveResizer(WebElement resizer, int offset) { - new Actions(driver).clickAndHold(resizer).moveByOffset(offset, 0).release().perform(); + new Actions(driver).clickAndHold(resizer).moveByOffset(offset, 0) + .release().perform(); } } - - diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java b/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java index fffc766e7c..63d50e0464 100755 --- a/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java @@ -1,42 +1,42 @@ -package com.vaadin.tests.components.tabsheet;
-
-import com.vaadin.annotations.Theme;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.ui.HorizontalSplitPanel;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.UI;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.themes.Runo;
-
-@Theme("runo")
-public class ExtraScrollbarsInTabSheet extends UI {
-
- @Override
- public void init(VaadinRequest request) {
-
- VerticalLayout vl = new VerticalLayout();
- vl.setSizeFull();
-
- HorizontalSplitPanel horizontalSplit = new HorizontalSplitPanel();
-
- TabSheet ts = new TabSheet();
-
- VerticalLayout tabContent = new VerticalLayout();
- tabContent.setSizeFull();
-
- Panel p = new Panel();
- p.addStyleName(Runo.PANEL_LIGHT);
- p.setHeight("400px");
- tabContent.addComponent(p);
-
- ts.addTab(tabContent);
- horizontalSplit.setSecondComponent(ts);
-
- vl.addComponent(horizontalSplit);
-
- setContent(vl);
-
- }
-
-}
+package com.vaadin.tests.components.tabsheet; + +import com.vaadin.annotations.Theme; +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.HorizontalSplitPanel; +import com.vaadin.ui.Panel; +import com.vaadin.ui.TabSheet; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.Runo; + +@Theme("runo") +public class ExtraScrollbarsInTabSheet extends UI { + + @Override + public void init(VaadinRequest request) { + + VerticalLayout vl = new VerticalLayout(); + vl.setSizeFull(); + + HorizontalSplitPanel horizontalSplit = new HorizontalSplitPanel(); + + TabSheet ts = new TabSheet(); + + VerticalLayout tabContent = new VerticalLayout(); + tabContent.setSizeFull(); + + Panel p = new Panel(); + p.addStyleName(Runo.PANEL_LIGHT); + p.setHeight("400px"); + tabContent.addComponent(p); + + ts.addTab(tabContent); + horizontalSplit.setSecondComponent(ts); + + vl.addComponent(horizontalSplit); + + setContent(vl); + + } + +} diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleInTabsheet.java b/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleInTabsheet.java index c21c702bd0..3e132c583b 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleInTabsheet.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleInTabsheet.java @@ -18,18 +18,20 @@ public class FirstTabNotVisibleInTabsheet extends AbstractTestUI { TabSheet tabSheet = new TabSheet(); tabSheet.setWidth("600px"); - firstTab = tabSheet.addTab(new Label("first visible tab"), "first visible tab"); + firstTab = tabSheet.addTab(new Label("first visible tab"), + "first visible tab"); for (int i = 2; i < 10; i++) { tabSheet.addTab(new Label("visible tab " + i), "visible tab " + i); } - addComponent(new VerticalLayout(tabSheet, new Button("Toggle first tab", new Button.ClickListener() { - @Override - public void buttonClick(Button.ClickEvent event) { - firstTab.setVisible(!firstTab.isVisible()); - } - }))); + addComponent(new VerticalLayout(tabSheet, new Button( + "Toggle first tab", new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + firstTab.setVisible(!firstTab.isVisible()); + } + }))); } @Override diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleInTabsheetTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleInTabsheetTest.java index e57651ba03..99c47b1703 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleInTabsheetTest.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/FirstTabNotVisibleInTabsheetTest.java @@ -1,6 +1,5 @@ package com.vaadin.tests.components.tabsheet; - import com.vaadin.testbench.elements.ButtonElement; import com.vaadin.testbench.elements.TabSheetElement; import com.vaadin.tests.tb3.MultiBrowserTest; @@ -17,8 +16,8 @@ public class FirstTabNotVisibleInTabsheetTest extends MultiBrowserTest { TabSheetElement tabSheet = $(TabSheetElement.class).first(); - Assert.assertTrue("TabSheet should have first tab visible", - tabSheet.getTabCaptions().contains("first visible tab")); + Assert.assertTrue("TabSheet should have first tab visible", tabSheet + .getTabCaptions().contains("first visible tab")); } private void toggleFirstTabVisibility() { diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/MoveComponentBetweenTabsheets.java b/uitest/src/com/vaadin/tests/components/tabsheet/MoveComponentBetweenTabsheets.java index 3323d6a8d7..624fac6e75 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/MoveComponentBetweenTabsheets.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/MoveComponentBetweenTabsheets.java @@ -1,69 +1,69 @@ -package com.vaadin.tests.components.tabsheet;
-
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractTestUI;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.TabSheet;
-
-/**
- * Main UI class
- */
-@SuppressWarnings("serial")
-public class MoveComponentBetweenTabsheets extends AbstractTestUI {
-
- TabSheet left, right;
- private Label l1;
- private Label l2;
- private Label r1;
- private Label r2;
-
- void doTestOperation() {
- right.addTab(l1, "L1");
- right.setSelectedTab(l1);
- }
-
- @Override
- protected void setup(VaadinRequest request) {
-
- // TODO Auto-generated method stub
- Button button = new Button("Move L1 to the right tabsheet");
- button.addClickListener(new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- doTestOperation();
- }
- });
-
- getLayout().addComponent(button);
-
- left = new TabSheet();
- l1 = new Label("Left 1");
- left.addTab(l1, "L1");
- l2 = new Label("Left 2");
- left.addTab(l2, "L2");
- left.setWidth("400px");
-
- right = new TabSheet();
- r1 = new Label("Right 1");
- right.addTab(r1, "R1");
- r2 = new Label("Right 2");
- right.addTab(r2, "R2");
- right.setWidth("400px");
-
- getLayout().addComponent(new HorizontalLayout(left, right));
- }
-
- @Override
- protected String getTestDescription() {
- return "Moving a component from a tabsheet to another sometimes causes a client-side error";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 10839;
- }
-
-}
+package com.vaadin.tests.components.tabsheet; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.TabSheet; + +/** + * Main UI class + */ +@SuppressWarnings("serial") +public class MoveComponentBetweenTabsheets extends AbstractTestUI { + + TabSheet left, right; + private Label l1; + private Label l2; + private Label r1; + private Label r2; + + void doTestOperation() { + right.addTab(l1, "L1"); + right.setSelectedTab(l1); + } + + @Override + protected void setup(VaadinRequest request) { + + // TODO Auto-generated method stub + Button button = new Button("Move L1 to the right tabsheet"); + button.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + doTestOperation(); + } + }); + + getLayout().addComponent(button); + + left = new TabSheet(); + l1 = new Label("Left 1"); + left.addTab(l1, "L1"); + l2 = new Label("Left 2"); + left.addTab(l2, "L2"); + left.setWidth("400px"); + + right = new TabSheet(); + r1 = new Label("Right 1"); + right.addTab(r1, "R1"); + r2 = new Label("Right 2"); + right.addTab(r2, "R2"); + right.setWidth("400px"); + + getLayout().addComponent(new HorizontalLayout(left, right)); + } + + @Override + protected String getTestDescription() { + return "Moving a component from a tabsheet to another sometimes causes a client-side error"; + } + + @Override + protected Integer getTicketNumber() { + return 10839; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/textfield/LocaleChangeOnReadOnlyField.java b/uitest/src/com/vaadin/tests/components/textfield/LocaleChangeOnReadOnlyField.java index a1cabe914e..06469550c9 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/LocaleChangeOnReadOnlyField.java +++ b/uitest/src/com/vaadin/tests/components/textfield/LocaleChangeOnReadOnlyField.java @@ -1,6 +1,5 @@ package com.vaadin.tests.components.textfield; - import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java b/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java index 9ecaa05315..0e37aa36fb 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java @@ -43,7 +43,7 @@ public class UIAccessTest extends MultiBrowserTest { waitForLogToContainText("0. Current UI matches in beforeResponse? true"); waitForLogToContainText("1. Current session matches in beforeResponse? true"); } - + @Test public void canBeAccessedFromUIThread() { $(ButtonElement.class).first().click(); @@ -96,7 +96,7 @@ public class UIAccessTest extends MultiBrowserTest { waitForLogToContainText("1. Thread started, waiting for interruption"); waitForLogToContainText("2. I was interrupted"); } - + @Test public void testAccessSynchronously() { $(ButtonElement.class).get(5).click(); @@ -106,7 +106,7 @@ public class UIAccessTest extends MultiBrowserTest { assertTrue(logContainsText("2. has request after accessSynchronously? true")); assertTrue(logContainsText("3. Test value after accessSynchornously: Set in accessSynchronosly")); } - + @Test public void currentInstanceCanAccessValue() { $(ButtonElement.class).get(6).click(); diff --git a/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java b/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java index 2b6ba40e8c..f499f29b9b 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java @@ -11,7 +11,8 @@ import static org.junit.Assert.assertThat; public class UISerializationTest extends SingleBrowserTest { @Test - @Ignore //Broken on all browsers since 9696e6c3e7e952b66ac3f5c9ddc3dfca4233451e + @Ignore + // Broken on all browsers since 9696e6c3e7e952b66ac3f5c9ddc3dfca4233451e public void tb2test() throws Exception { openTestURL(); $(ButtonElement.class).first().click(); diff --git a/uitest/src/com/vaadin/tests/components/window/WindowBGColorChameleonIE8.java b/uitest/src/com/vaadin/tests/components/window/WindowBGColorChameleonIE8.java new file mode 100644 index 0000000000..121d6300bc --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/WindowBGColorChameleonIE8.java @@ -0,0 +1,27 @@ +package com.vaadin.tests.components.window; + +import com.vaadin.annotations.Theme; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.UI; +import com.vaadin.ui.Window; + +@SuppressWarnings("serial") +@Theme("chameleon") +public class WindowBGColorChameleonIE8 extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + + final Window window = new Window(); + window.setCaption("Window"); + window.setModal(true); + window.setClosable(true); + window.setDraggable(true); + window.setWidth("400px"); + window.setHeight("300px"); + window.center(); + final UI ui = UI.getCurrent(); + ui.addWindow(window); + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/window/WindowBGColorChameleonIE8Test.java b/uitest/src/com/vaadin/tests/components/window/WindowBGColorChameleonIE8Test.java new file mode 100644 index 0000000000..18cb012cb2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/WindowBGColorChameleonIE8Test.java @@ -0,0 +1,32 @@ +package com.vaadin.tests.components.window; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +import org.junit.Test; +import org.openqa.selenium.remote.DesiredCapabilities; + +import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class WindowBGColorChameleonIE8Test extends SingleBrowserTest { + + /* + * We care about IE8 here only (Or any very very old browsers) + * + * @see com.vaadin.tests.tb3.SingleBrowserTest#getBrowsersToTest() + */ + @Override + public List<DesiredCapabilities> getBrowsersToTest() { + + return Arrays.asList(MultiBrowserTest.Browser.IE8 + .getDesiredCapabilities()); + } + + @Test + public void testWindowColor() throws IOException { + openTestURL(); + compareScreen("grey-background-window"); + } +} diff --git a/uitest/src/com/vaadin/tests/extensions/JavascriptManagerTest.java b/uitest/src/com/vaadin/tests/extensions/JavascriptManagerTest.java index 4807bb9029..f2a8b24cb1 100644 --- a/uitest/src/com/vaadin/tests/extensions/JavascriptManagerTest.java +++ b/uitest/src/com/vaadin/tests/extensions/JavascriptManagerTest.java @@ -37,7 +37,8 @@ public class JavascriptManagerTest extends AbstractTestUI { @Override public void call(JsonArray arguments) { log.log("Got " + arguments.length() + " arguments"); - log.log("Argument 1 as a number: " + (int) arguments.getNumber(0)); + log.log("Argument 1 as a number: " + + (int) arguments.getNumber(0)); log.log("Argument 2 as a string: " + arguments.getString(1)); log.log("Argument 3.p as a boolean: " + arguments.getObject(2).getBoolean("p")); diff --git a/uitest/src/com/vaadin/tests/fieldgroup/MultipleValidationErrors.java b/uitest/src/com/vaadin/tests/fieldgroup/MultipleValidationErrors.java index 5110bf6dcf..58f2292f84 100644 --- a/uitest/src/com/vaadin/tests/fieldgroup/MultipleValidationErrors.java +++ b/uitest/src/com/vaadin/tests/fieldgroup/MultipleValidationErrors.java @@ -39,21 +39,27 @@ public class MultipleValidationErrors extends AbstractTestUI { try { fieldGroup.commit(); } catch (FieldGroup.CommitException e) { - if (e.getCause() != null && e.getCause() instanceof Validator.InvalidValueException) { - validationErrors.setValue(StringEscapeUtils.unescapeHtml( - AbstractErrorMessage.getErrorMessageForException(e.getCause()).getFormattedHtmlMessage())); + if (e.getCause() != null + && e.getCause() instanceof Validator.InvalidValueException) { + validationErrors.setValue(StringEscapeUtils + .unescapeHtml(AbstractErrorMessage + .getErrorMessageForException( + e.getCause()) + .getFormattedHtmlMessage())); } } - } }); } - private void bindTextField(BeanItem<PersonBeanWithValidationAnnotations> item, FieldGroup fieldGroup, - String caption, String propertyId) { - TextField textfield = new TextField(caption, item.getItemProperty(propertyId)); - textfield.addValidator(new BeanValidator(PersonBeanWithValidationAnnotations.class, propertyId)); + private void bindTextField( + BeanItem<PersonBeanWithValidationAnnotations> item, + FieldGroup fieldGroup, String caption, String propertyId) { + TextField textfield = new TextField(caption, + item.getItemProperty(propertyId)); + textfield.addValidator(new BeanValidator( + PersonBeanWithValidationAnnotations.class, propertyId)); fieldGroup.bind(textfield, propertyId); diff --git a/uitest/src/com/vaadin/tests/fieldgroup/MultipleValidationErrorsTest.java b/uitest/src/com/vaadin/tests/fieldgroup/MultipleValidationErrorsTest.java index 175b650be6..14527cff04 100644 --- a/uitest/src/com/vaadin/tests/fieldgroup/MultipleValidationErrorsTest.java +++ b/uitest/src/com/vaadin/tests/fieldgroup/MultipleValidationErrorsTest.java @@ -16,7 +16,8 @@ public class MultipleValidationErrorsTest extends MultiBrowserTest { } private void clearTextField(String caption) { - TextFieldElement textField = $(TextFieldElement.class).caption(caption).first(); + TextFieldElement textField = $(TextFieldElement.class).caption(caption) + .first(); textField.clear(); } @@ -29,9 +30,14 @@ public class MultipleValidationErrorsTest extends MultiBrowserTest { commitTextFields(); - String validationErrors = $(LabelElement.class).id("validationErrors").getText(); + String validationErrors = $(LabelElement.class).id("validationErrors") + .getText(); - assertThat(validationErrors, containsString(MultipleValidationErrors.FIRST_NAME_NOT_EMPTY_VALIDATION_MESSAGE)); - assertThat(validationErrors, containsString(MultipleValidationErrors.LAST_NAME_NOT_EMPTY_VALIDATION_MESSAGE)); + assertThat( + validationErrors, + containsString(MultipleValidationErrors.FIRST_NAME_NOT_EMPTY_VALIDATION_MESSAGE)); + assertThat( + validationErrors, + containsString(MultipleValidationErrors.LAST_NAME_NOT_EMPTY_VALIDATION_MESSAGE)); } } diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a3/JSAPIUI.java b/uitest/src/com/vaadin/tests/minitutorials/v7a3/JSAPIUI.java index e98fe6d066..ea9cd52d34 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7a3/JSAPIUI.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7a3/JSAPIUI.java @@ -28,7 +28,8 @@ public class JSAPIUI extends UI { } else { // type should be in [1] Notification.show(caption, - Type.values()[((int) arguments.getNumber(1))]); + Type.values()[((int) arguments + .getNumber(1))]); } } catch (JsonException e) { diff --git a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersLongPollingTest.java b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersLongPollingTest.java index fd89982253..c00f95a950 100644 --- a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersLongPollingTest.java +++ b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersLongPollingTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.push; -public class SendMultibyteCharactersLongPollingTest extends SendMultibyteCharactersTest { +public class SendMultibyteCharactersLongPollingTest extends + SendMultibyteCharactersTest { @Override protected String getTransport() { diff --git a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersStreamingTest.java b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersStreamingTest.java index 7b9ec38487..bc1debb9da 100644 --- a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersStreamingTest.java +++ b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersStreamingTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.push; -public class SendMultibyteCharactersStreamingTest extends SendMultibyteCharactersTest { +public class SendMultibyteCharactersStreamingTest extends + SendMultibyteCharactersTest { @Override protected String getTransport() { diff --git a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersTest.java b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersTest.java index 1ced2fb506..a639f7dbe3 100644 --- a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersTest.java +++ b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersTest.java @@ -25,7 +25,7 @@ public abstract class SendMultibyteCharactersTest extends MultiBrowserTest { TextAreaElement textArea = $(TextAreaElement.class).first(); StringBuilder text = new StringBuilder(); - for(int i=0;i < 20;i++) { + for (int i = 0; i < 20; i++) { text.append("之は日本語です、テストです。"); } diff --git a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersWebSocketTest.java b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersWebSocketTest.java index f37fb2efcb..f9ae472b99 100644 --- a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersWebSocketTest.java +++ b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersWebSocketTest.java @@ -1,11 +1,11 @@ package com.vaadin.tests.push; - import org.openqa.selenium.remote.DesiredCapabilities; import java.util.List; -public class SendMultibyteCharactersWebSocketTest extends SendMultibyteCharactersTest { +public class SendMultibyteCharactersWebSocketTest extends + SendMultibyteCharactersTest { @Override public List<DesiredCapabilities> getBrowsersToTest() { diff --git a/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java b/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java index dcba561599..1624a89a01 100644 --- a/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java +++ b/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java @@ -86,8 +86,10 @@ public class SerializerTestTest extends MultiBrowserTest { getLogRow(logRow++)); Assert.assertEquals("state.floatArray: [57, 0, -12]", getLogRow(logRow++)); - Assert.assertTrue(getLogRow(logRow++).startsWith("state.floatObjectValue: 1.0000001")); - Assert.assertTrue(getLogRow(logRow++).startsWith("state.floatValue: 3.14159")); + Assert.assertTrue(getLogRow(logRow++).startsWith( + "state.floatObjectValue: 1.0000001")); + Assert.assertTrue(getLogRow(logRow++).startsWith( + "state.floatValue: 3.14159")); Assert.assertEquals("state.longArray: [-57841235865, 57]", getLogRow(logRow++)); Assert.assertEquals("state.longObjectValue: 577431841360", diff --git a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java index ebcb02002e..5a25a4ebb8 100644 --- a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java +++ b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java @@ -41,7 +41,8 @@ import org.openqa.selenium.remote.DesiredCapabilities; public abstract class MultiBrowserTest extends PrivateTB3Configuration { protected List<DesiredCapabilities> getBrowsersSupportingWebSocket() { - List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(getAllBrowsers()); + List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( + getAllBrowsers()); browsers.remove(Browser.IE8.getDesiredCapabilities()); browsers.remove(Browser.IE9.getDesiredCapabilities()); @@ -51,7 +52,8 @@ public abstract class MultiBrowserTest extends PrivateTB3Configuration { } protected List<DesiredCapabilities> getBrowsersExcludingPhantomJS() { - List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(getAllBrowsers()); + List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( + getAllBrowsers()); browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); @@ -59,7 +61,8 @@ public abstract class MultiBrowserTest extends PrivateTB3Configuration { } protected List<DesiredCapabilities> getBrowsersExcludingIE() { - List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(getAllBrowsers()); + List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( + getAllBrowsers()); browsers.remove(Browser.IE8.getDesiredCapabilities()); browsers.remove(Browser.IE9.getDesiredCapabilities()); browsers.remove(Browser.IE10.getDesiredCapabilities()); @@ -69,14 +72,15 @@ public abstract class MultiBrowserTest extends PrivateTB3Configuration { } protected List<DesiredCapabilities> getBrowsersSupportingShiftClick() { - List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(getAllBrowsers()); + List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( + getAllBrowsers()); - //IE supports shift click only when require window focus is true + // IE supports shift click only when require window focus is true browsers.remove(Browser.FIREFOX.getDesiredCapabilities()); browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); - return browsers; - } + return browsers; + } protected List<DesiredCapabilities> getIEBrowsersOnly() { List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(); @@ -88,7 +92,6 @@ public abstract class MultiBrowserTest extends PrivateTB3Configuration { return browsers; } - public enum Browser { FIREFOX(BrowserUtil.firefox(24)), CHROME(BrowserUtil.chrome(33)), SAFARI( BrowserUtil.safari(7)), IE8(BrowserUtil.ie(8)), IE9(BrowserUtil diff --git a/uitest/src/com/vaadin/tests/tb3/RetryOnFail.java b/uitest/src/com/vaadin/tests/tb3/RetryOnFail.java index 3c22057863..7a1656a0d2 100644 --- a/uitest/src/com/vaadin/tests/tb3/RetryOnFail.java +++ b/uitest/src/com/vaadin/tests/tb3/RetryOnFail.java @@ -50,9 +50,10 @@ public class RetryOnFail implements TestRule { } private int getRetryCount() { - String retryCount = System.getProperty("com.vaadin.testbench.max.retries"); + String retryCount = System + .getProperty("com.vaadin.testbench.max.retries"); - if(retryCount != null && retryCount != "") { + if (retryCount != null && retryCount != "") { return Integer.parseInt(retryCount); } diff --git a/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java b/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java index ddcc6d5d76..7f65357a65 100644 --- a/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java +++ b/uitest/src/com/vaadin/tests/tb3/WebsocketTest.java @@ -39,6 +39,7 @@ public abstract class WebsocketTest extends MultiBrowserTest { @Override public List<DesiredCapabilities> getBrowsersToTest() { - return new ArrayList<DesiredCapabilities>(getBrowsersSupportingWebSocket()); + return new ArrayList<DesiredCapabilities>( + getBrowsersSupportingWebSocket()); } } diff --git a/uitest/src/com/vaadin/tests/themes/FaviconTest.java b/uitest/src/com/vaadin/tests/themes/FaviconTest.java index 31134f656f..3ba86fd3e4 100644 --- a/uitest/src/com/vaadin/tests/themes/FaviconTest.java +++ b/uitest/src/com/vaadin/tests/themes/FaviconTest.java @@ -44,8 +44,10 @@ public class FaviconTest extends SingleBrowserTest { private int getResponseCode(String theme) { try { - URL url = new URL(String.format("%s/VAADIN/themes/%s/favicon.ico", getBaseURL(), theme)); - HttpURLConnection connection = (HttpURLConnection)url.openConnection(); + URL url = new URL(String.format("%s/VAADIN/themes/%s/favicon.ico", + getBaseURL(), theme)); + HttpURLConnection connection = (HttpURLConnection) url + .openConnection(); connection.setRequestMethod("GET"); connection.connect(); diff --git a/uitest/src/com/vaadin/tests/themes/chameleon/ChameleonNotification.java b/uitest/src/com/vaadin/tests/themes/chameleon/ChameleonNotification.java index efb953530c..fc26a7b4f4 100644 --- a/uitest/src/com/vaadin/tests/themes/chameleon/ChameleonNotification.java +++ b/uitest/src/com/vaadin/tests/themes/chameleon/ChameleonNotification.java @@ -12,7 +12,6 @@ public class ChameleonNotification extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { - addButton("Notification", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { diff --git a/uitest/src/com/vaadin/tests/themes/chameleon/ChameleonNotificationTest.java b/uitest/src/com/vaadin/tests/themes/chameleon/ChameleonNotificationTest.java index ef41ef3df9..46c7382726 100644 --- a/uitest/src/com/vaadin/tests/themes/chameleon/ChameleonNotificationTest.java +++ b/uitest/src/com/vaadin/tests/themes/chameleon/ChameleonNotificationTest.java @@ -16,8 +16,8 @@ public class ChameleonNotificationTest extends MultiBrowserTest { openTestURL(); $(ButtonElement.class).first().click(); - NotificationElement notificationElement - = $(NotificationElement.class).first(); + NotificationElement notificationElement = $(NotificationElement.class) + .first(); assertThat(notificationElement.getCssValue("background-image"), containsString("chameleon/img/grad")); diff --git a/uitest/src/com/vaadin/tests/themes/valo/ModalWindowTest.java b/uitest/src/com/vaadin/tests/themes/valo/ModalWindowTest.java index b97ce43ed6..0b21d4f34c 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ModalWindowTest.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ModalWindowTest.java @@ -23,9 +23,11 @@ public class ModalWindowTest extends SingleBrowserTest { openModalWindow(); - WebElement modalityCurtain = findElement(By.className("v-window-modalitycurtain")); + WebElement modalityCurtain = findElement(By + .className("v-window-modalitycurtain")); - assertThat(modalityCurtain.getCssValue("-webkit-animation-name"), is("none")); + assertThat(modalityCurtain.getCssValue("-webkit-animation-name"), + is("none")); } private void openModalWindow() { diff --git a/uitest/src/com/vaadin/tests/themes/valo/TableSortIndicator.java b/uitest/src/com/vaadin/tests/themes/valo/TableSortIndicator.java index 74e5fcd0ef..8e873b0f1a 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/TableSortIndicator.java +++ b/uitest/src/com/vaadin/tests/themes/valo/TableSortIndicator.java @@ -12,8 +12,8 @@ public class TableSortIndicator extends AbstractTestUI { Table table = new Table(); table.addContainerProperty("Index", Integer.class, ""); - for(int i=0;i<10;i++) { - table.addItem(new Object[] {i}, i); + for (int i = 0; i < 10; i++) { + table.addItem(new Object[] { i }, i); } table.setPageLength(0); @@ -23,8 +23,8 @@ public class TableSortIndicator extends AbstractTestUI { @Override protected String getTestDescription() { - return "For Valo, sorting indicators should point up when sorted asc " + - "and down when sorted desc."; + return "For Valo, sorting indicators should point up when sorted asc " + + "and down when sorted desc."; } @Override diff --git a/uitest/tb2/com/vaadin/tests/components/datefield/DateFieldRanges_NextYearClickableIfRangeAcceptsFractionOfNextYear.html b/uitest/tb2/com/vaadin/tests/components/datefield/DateFieldRanges_NextYearClickableIfRangeAcceptsFractionOfNextYear.html index f5d7ee97ca..5304a5af38 100644 --- a/uitest/tb2/com/vaadin/tests/components/datefield/DateFieldRanges_NextYearClickableIfRangeAcceptsFractionOfNextYear.html +++ b/uitest/tb2/com/vaadin/tests/components/datefield/DateFieldRanges_NextYearClickableIfRangeAcceptsFractionOfNextYear.html @@ -134,7 +134,7 @@ <tr> <td>select</td> <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::PID_SresoSelect/domChild[0]</td> - <td>label=MONTH</td> + <td>label=Month</td> </tr> <tr> <td>mouseClick</td> @@ -164,7 +164,7 @@ <tr> <td>select</td> <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::PID_SresoSelect/domChild[0]</td> - <td>label=YEAR</td> + <td>label=Year</td> </tr> <tr> <td>mouseClick</td> |