diff options
Diffstat (limited to 'server')
8 files changed, 61 insertions, 19 deletions
diff --git a/server/src/com/vaadin/data/util/IndexedContainer.java b/server/src/com/vaadin/data/util/IndexedContainer.java index b851baf674..8783c061ac 100644 --- a/server/src/com/vaadin/data/util/IndexedContainer.java +++ b/server/src/com/vaadin/data/util/IndexedContainer.java @@ -741,6 +741,10 @@ public class IndexedContainer extends */ @Override public Property getItemProperty(Object id) { + if (!propertyIds.contains(id)) { + return null; + } + return new IndexedContainerProperty(itemId, id); } diff --git a/server/src/com/vaadin/server/communication/ServerRpcHandler.java b/server/src/com/vaadin/server/communication/ServerRpcHandler.java index 3503a2d8b1..be261ede92 100644 --- a/server/src/com/vaadin/server/communication/ServerRpcHandler.java +++ b/server/src/com/vaadin/server/communication/ServerRpcHandler.java @@ -324,7 +324,7 @@ public class ServerRpcHandler implements Serializable { * @param invocationsData * JSON containing all information needed to execute all * requested RPC calls. - * @since + * @since 7.7 */ protected void handleInvocations(UI ui, int lastSyncIdSeenByClient, JsonArray invocationsData) { @@ -423,7 +423,7 @@ public class ServerRpcHandler implements Serializable { /** * Handles the given RPC method invocation for the given connector * - * @since + * @since 7.7 * @param ui * the UI containing the connector * @param connector @@ -446,7 +446,7 @@ public class ServerRpcHandler implements Serializable { * Handles the given Legacy variable change RPC method invocation for the * given connector * - * @since + * @since 7.7 * @param ui * the UI containing the connector * @param connector diff --git a/server/src/com/vaadin/server/communication/UidlRequestHandler.java b/server/src/com/vaadin/server/communication/UidlRequestHandler.java index db18bb9e1e..20b906c3e6 100644 --- a/server/src/com/vaadin/server/communication/UidlRequestHandler.java +++ b/server/src/com/vaadin/server/communication/UidlRequestHandler.java @@ -60,7 +60,7 @@ public class UidlRequestHandler extends SynchronizedRequestHandler implements /** * Creates the ServerRpcHandler to use * - * @since + * @since 7.7 * @return the ServerRpcHandler to use */ protected ServerRpcHandler createRpcHandler() { diff --git a/server/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java b/server/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java index 063f4f5346..45bd3751d3 100644 --- a/server/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java +++ b/server/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java @@ -495,7 +495,26 @@ public class ClassPathExplorer { * @return URL */ public static URL getDefaultSourceDirectory() { + return getWidgetsetSourceDirectory(null); + } + /** + * Find and return the source directory which contains the given widgetset + * file. + * + * If not applicable or widgetsetFileName is null, return the first + * directory (not a JAR file etc.) on the classpath. + * + * TODO this could be done better... + * + * @since 7.6.5 + * + * @param widgetsetFileName + * relative path for the widgetset + * + * @return URL + */ + public static URL getWidgetsetSourceDirectory(String widgetsetFileName) { if (debug) { debug("classpathLocations values:"); ArrayList<String> locations = new ArrayList<String>( @@ -505,6 +524,7 @@ public class ClassPathExplorer { } } + URL firstDirectory = null; Iterator<String> it = rawClasspathEntries.iterator(); while (it.hasNext()) { String entry = it.next(); @@ -513,13 +533,18 @@ public class ClassPathExplorer { if (directory.exists() && !directory.isHidden() && directory.isDirectory()) { try { - return new URL("file://" + directory.getCanonicalPath()); - } catch (MalformedURLException e) { - // ignore: continue to the next classpath entry - if (debug) { - e.printStackTrace(); + URL directoryUrl = directory.toURI().toURL(); + + // Store the first directory encountered. + if (firstDirectory == null) { + firstDirectory = directoryUrl; } - } catch (IOException e) { + + if (widgetsetFileName == null + || new File(directory, widgetsetFileName).exists()) { + return directoryUrl; + } + } catch (MalformedURLException e) { // ignore: continue to the next classpath entry if (debug) { e.printStackTrace(); @@ -527,7 +552,8 @@ public class ClassPathExplorer { } } } - return null; + + return firstDirectory; } /** diff --git a/server/src/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java b/server/src/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java index f810a63a38..b0d8cdd004 100644 --- a/server/src/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java +++ b/server/src/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java @@ -61,16 +61,17 @@ public class WidgetSetBuilder { Map<String, URL> availableWidgetSets = ClassPathExplorer .getAvailableWidgetSets(); + String widgetsetFileName = widgetset.replace(".", "/") + ".gwt.xml"; URL sourceUrl = availableWidgetSets.get(widgetset); if (sourceUrl == null) { // find first/default source directory - sourceUrl = ClassPathExplorer.getDefaultSourceDirectory(); + sourceUrl = ClassPathExplorer + .getWidgetsetSourceDirectory(widgetsetFileName); } - String widgetsetfilename = sourceUrl.getFile() + "/" - + widgetset.replace(".", "/") + ".gwt.xml"; + String wsFullPath = sourceUrl.getFile() + "/" + widgetsetFileName; - File widgetsetFile = new File(widgetsetfilename); + File widgetsetFile = new File(wsFullPath); if (!widgetsetFile.exists()) { // create empty gwt module file File parent = widgetsetFile.getParentFile(); @@ -137,7 +138,7 @@ public class WidgetSetBuilder { changed = changed || !content.equals(originalContent); if (changed) { - commitChanges(widgetsetfilename, content); + commitChanges(wsFullPath, content); } } else { System.out diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java index 4074672675..036fe8b756 100644 --- a/server/src/com/vaadin/ui/Grid.java +++ b/server/src/com/vaadin/ui/Grid.java @@ -4855,8 +4855,13 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, } /** - * Sets the grid data source. - * + * Sets the grid data source.<p> + * + * <strong>Note</strong> Grid columns are based on properties and try to detect a correct converter for + * the data type. The columns are not reinitialized automatically if the container is changed, and if the same + * properties are present after container change, the columns are reused. + * Properties with same names, but different data types will lead to unpredictable behaviour. + * * @param container * The container data source. Cannot be null. * @throws IllegalArgumentException diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java index b5cd384f53..70399ae566 100644 --- a/server/src/com/vaadin/ui/Window.java +++ b/server/src/com/vaadin/ui/Window.java @@ -1051,7 +1051,9 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, @Override public void handleAction(Object sender, Object target) { - window.close(); + if (window.isClosable()) { + window.close(); + } } public boolean equals(int keyCode, int... modifiers) { diff --git a/server/tests/src/com/vaadin/data/util/AbstractContainerTestBase.java b/server/tests/src/com/vaadin/data/util/AbstractContainerTestBase.java index 52acc5ab76..5fd4f8ae17 100644 --- a/server/tests/src/com/vaadin/data/util/AbstractContainerTestBase.java +++ b/server/tests/src/com/vaadin/data/util/AbstractContainerTestBase.java @@ -149,6 +149,10 @@ public abstract class AbstractContainerTestBase extends TestCase { } + // getItemProperty + Assert.assertNull(container.getItem(itemIdInSet).getItemProperty( + "notinset")); + } protected static final Object FULLY_QUALIFIED_NAME = "fullyQualifiedName"; |