diff options
author | Jonatan Kronqvist <jonatan@vaadin.com> | 2014-02-10 09:39:50 +0200 |
---|---|---|
committer | Jonatan Kronqvist <jonatan@vaadin.com> | 2014-02-10 09:39:51 +0200 |
commit | ca911b69ee3bae0ca1f0ecc4002595ee81cb6b70 (patch) | |
tree | 742f083732699df2550dc71f533ff9a217841d5e /server/src | |
parent | ad5e882b4dda5458ff16ce9c2321407a1d255ec6 (diff) | |
parent | e5dee6a7417e4466ad35bd9150174f86204bca3e (diff) | |
download | vaadin-framework-ca911b69ee3bae0ca1f0ecc4002595ee81cb6b70.tar.gz vaadin-framework-ca911b69ee3bae0ca1f0ecc4002595ee81cb6b70.zip |
Merge changes from origin/7.1
c551507 Selected option is updated when item caption changes in Select (#9250)
3595685 Converted TestUIWidgetset test to TB3 and fixed wrong text in assertion.
89d860c Convinience methods for getting mouse and keyboard in test.
d00397f Converted TB2 test to TB3 and fixed text assertion.
857de0f Renamed test according to conventions and fixed assertion text.
b9a6a48 Update textbox when Select item caption changes (#9250)
1687889 Retain focus while changing DOM in OrderedLayout (#12967)
f93c870 Remove unselected rows from selection on client side (#13008)
1d1ccf4 Fix Firefox and Vaadin 7 scroll distance (#11353)
62ac53a Ensure widgetset compile messages go to stdout (#7516)
171d02a Remove references to read/write through modes (#13184)
3f09c10 Better-looking CSS for Vaadin API Javadocs (#13219)
f0a4ea9 Do not throw NPE for equals(null) (#8910)
3897025 Add deprecated expand ratio methods to FormLayout (#12876)
b89dba9 Exclude a possible bin directory when building (#13258)
69983d0 Re-adjusted the rendering order of TabSheet tabs to prevent an NPE in isClipped (#12343)
e5dee6a Use Calendar as sender for action handlers (#13191)
Change-Id: I581ec7517aaa19a2e46b48e31cdefdd3db2c05c5
Diffstat (limited to 'server/src')
9 files changed, 104 insertions, 70 deletions
diff --git a/server/src/com/vaadin/data/Buffered.java b/server/src/com/vaadin/data/Buffered.java index 0d6722f71f..c4c79ae13f 100644 --- a/server/src/com/vaadin/data/Buffered.java +++ b/server/src/com/vaadin/data/Buffered.java @@ -23,29 +23,20 @@ import com.vaadin.data.Validator.InvalidValueException; /** * <p> * Defines the interface to commit and discard changes to an object, supporting - * read-through and write-through modes. - * </p> + * buffering. * * <p> - * <i>Read-through mode</i> means that the value read from the buffered object - * is constantly up to date with the data source. <i>Write-through</i> mode - * means that all changes to the object are immediately updated to the data - * source. - * </p> + * In <i>buffered</i> mode the initial value is read from the data source and + * then buffered. Any subsequential writes or reads will be done on the buffered + * value. Calling {@link #commit()} will write the buffered value to the data + * source while calling {@link #discard()} while discard the buffered value and + * re-read the value from the data source. * * <p> - * Since these modes are independent, their combinations may result in some - * behaviour that may sound surprising. - * </p> - * - * <p> - * For example, if a <code>Buffered</code> object is in read-through mode but - * not in write-through mode, the result is an object whose value is updated - * directly from the data source only if it's not locally modified. If the value - * is locally modified, retrieving the value from the object would result in a - * value that is different than the one stored in the data source, even though - * the object is in read-through mode. - * </p> + * In <i>non-buffered</i> mode the value is always read directly from the data + * source. Any write is done directly to the data source with no buffering in + * between. Reads are also done directly from the data source. Calling + * {@link #commit()} or {@link #discard()} in this mode is efficiently a no-op. * * @author Vaadin Ltd. * @since 3.0 @@ -77,25 +68,15 @@ public interface Buffered extends Serializable { public void discard() throws SourceException; /** - * Sets the object's buffered mode to the specified status. + * Sets the buffered mode to the specified status. * <p> - * When the object is in buffered mode, an internal buffer will be used to - * store changes until {@link #commit()} is called. Calling - * {@link #discard()} will revert the internal buffer to the value of the - * data source. - * </p> + * When in buffered mode, an internal buffer will be used to store changes + * until {@link #commit()} is called. Calling {@link #discard()} will revert + * the internal buffer to the value of the data source. * <p> - * This is an easier way to use {@link #setReadThrough(boolean)} and - * {@link #setWriteThrough(boolean)} and not as error prone. Changing - * buffered mode will change both the read through and write through state - * of the object. - * </p> - * <p> - * Mixing calls to {@link #setBuffered(boolean)}/{@link #isBuffered()} and - * {@link #setReadThrough(boolean)}/{@link #isReadThrough()} or - * {@link #setWriteThrough(boolean)}/{@link #isWriteThrough()} is generally - * a bad idea. - * </p> + * When in non-buffered mode both read and write operations will be done + * directly on the data source. In this mode the {@link #commit()} and + * {@link #discard()} methods serve no purpose. * * @param buffered * true if buffered mode should be turned on, false otherwise @@ -104,10 +85,7 @@ public interface Buffered extends Serializable { public void setBuffered(boolean buffered); /** - * Checks the buffered mode of this Object. - * <p> - * This method only returns true if both read and write buffering is used. - * </p> + * Checks the buffered mode * * @return true if buffered mode is on, false otherwise * @since 7.0 diff --git a/server/src/com/vaadin/data/util/filter/Between.java b/server/src/com/vaadin/data/util/filter/Between.java index 8209f7b0a2..a76821981a 100644 --- a/server/src/com/vaadin/data/util/filter/Between.java +++ b/server/src/com/vaadin/data/util/filter/Between.java @@ -67,6 +67,10 @@ public class Between implements Filter { @Override public boolean equals(Object obj) { + if (obj == null) { + return false; + } + // Only objects of the same class can be equal if (!getClass().equals(obj.getClass())) { return false; diff --git a/server/src/com/vaadin/data/util/filter/Compare.java b/server/src/com/vaadin/data/util/filter/Compare.java index f9f19c6602..ac167673bd 100644 --- a/server/src/com/vaadin/data/util/filter/Compare.java +++ b/server/src/com/vaadin/data/util/filter/Compare.java @@ -307,6 +307,9 @@ public abstract class Compare implements Filter { @Override public boolean equals(Object obj) { + if (obj == null) { + return false; + } // Only objects of the same class can be equal if (!getClass().equals(obj.getClass())) { diff --git a/server/src/com/vaadin/data/util/filter/IsNull.java b/server/src/com/vaadin/data/util/filter/IsNull.java index 5c5bdfc0b1..6907a016a1 100644 --- a/server/src/com/vaadin/data/util/filter/IsNull.java +++ b/server/src/com/vaadin/data/util/filter/IsNull.java @@ -62,6 +62,10 @@ public final class IsNull implements Filter { @Override public boolean equals(Object obj) { + if (obj == null) { + return false; + } + // Only objects of the same class can be equal if (!getClass().equals(obj.getClass())) { return false; diff --git a/server/src/com/vaadin/data/util/filter/Like.java b/server/src/com/vaadin/data/util/filter/Like.java index 4c15564105..dc2e18363a 100644 --- a/server/src/com/vaadin/data/util/filter/Like.java +++ b/server/src/com/vaadin/data/util/filter/Like.java @@ -84,6 +84,10 @@ public class Like implements Filter { @Override public boolean equals(Object obj) { + if (obj == null) { + return false; + } + // Only objects of the same class can be equal if (!getClass().equals(obj.getClass())) { return false; diff --git a/server/src/com/vaadin/data/util/filter/SimpleStringFilter.java b/server/src/com/vaadin/data/util/filter/SimpleStringFilter.java index bc58999445..a214e69846 100644 --- a/server/src/com/vaadin/data/util/filter/SimpleStringFilter.java +++ b/server/src/com/vaadin/data/util/filter/SimpleStringFilter.java @@ -82,6 +82,9 @@ public final class SimpleStringFilter implements Filter { @Override public boolean equals(Object obj) { + if (obj == null) { + return false; + } // Only ones of the objects of the same class can be equal if (!(obj instanceof SimpleStringFilter)) { diff --git a/server/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java b/server/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java index cc04e50b3c..3ad76794de 100644 --- a/server/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java +++ b/server/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java @@ -32,8 +32,6 @@ import java.util.Set; import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.jar.Manifest; -import java.util.logging.Level; -import java.util.logging.Logger; /** * Utility class to collect widgetset related information from classpath. @@ -111,6 +109,15 @@ public class ClassPathExplorer { */ private static Map<String, URL> classpathLocations = getClasspathLocations(rawClasspathEntries); + private static boolean debug = false; + + static { + String debugProperty = System.getProperty("debug"); + if (debugProperty != null && !debugProperty.equals("")) { + debug = true; + } + } + /** * No instantiation from outside, callable methods are static. */ @@ -163,9 +170,8 @@ public class ClassPathExplorer { sb.append("\n"); } - final Logger logger = getLogger(); - logger.info(sb.toString()); - logger.info("Search took " + (end - start) + "ms"); + log(sb.toString()); + log("Search took " + (end - start) + "ms"); return new LocationInfo(widgetsets, themes); } @@ -226,8 +232,7 @@ public class ClassPathExplorer { } catch (MalformedURLException e) { // should never happen as based on an existing URL, // only changing end of file name/path part - getLogger().log(Level.SEVERE, - "Error locating the widgetset " + classname, e); + error("Error locating the widgetset " + classname, e); } } } @@ -276,7 +281,7 @@ public class ClassPathExplorer { } } } catch (IOException e) { - getLogger().log(Level.WARNING, "Error parsing jar file", e); + error("Error parsing jar file", e); } } @@ -304,7 +309,7 @@ public class ClassPathExplorer { classpath = classpath.substring(0, classpath.length() - 1); } - getLogger().log(Level.FINE, "Classpath: {0}", classpath); + debug("Classpath: " + classpath); String[] split = classpath.split(pathSep); for (int i = 0; i < split.length; i++) { @@ -338,9 +343,8 @@ public class ClassPathExplorer { include(null, file, locations); } long end = System.currentTimeMillis(); - Logger logger = getLogger(); - if (logger.isLoggable(Level.FINE)) { - logger.fine("getClassPathLocations took " + (end - start) + "ms"); + if (debug) { + debug("getClassPathLocations took " + (end - start) + "ms"); } return locations; } @@ -379,7 +383,8 @@ public class ClassPathExplorer { url = new URL("jar:" + url.toExternalForm() + "!/"); JarURLConnection conn = (JarURLConnection) url .openConnection(); - getLogger().fine(url.toString()); + debug(url.toString()); + JarFile jarFile = conn.getJarFile(); Manifest manifest = jarFile.getManifest(); if (manifest != null) { @@ -393,11 +398,13 @@ public class ClassPathExplorer { } } } catch (MalformedURLException e) { - getLogger().log(Level.FINEST, "Failed to inspect JAR file", - e); + if (debug) { + error("Failed to inspect JAR file", e); + } } catch (IOException e) { - getLogger().log(Level.FINEST, "Failed to inspect JAR file", - e); + if (debug) { + error("Failed to inspect JAR file", e); + } } return false; @@ -489,14 +496,12 @@ public class ClassPathExplorer { */ public static URL getDefaultSourceDirectory() { - final Logger logger = getLogger(); - - if (logger.isLoggable(Level.FINE)) { - logger.fine("classpathLocations values:"); + if (debug) { + debug("classpathLocations values:"); ArrayList<String> locations = new ArrayList<String>( classpathLocations.keySet()); for (String location : locations) { - logger.fine(String.valueOf(classpathLocations.get(location))); + debug(String.valueOf(classpathLocations.get(location))); } } @@ -510,11 +515,15 @@ public class ClassPathExplorer { try { return new URL("file://" + directory.getCanonicalPath()); } catch (MalformedURLException e) { - logger.log(Level.FINEST, "Ignoring exception", e); // ignore: continue to the next classpath entry + if (debug) { + e.printStackTrace(); + } } catch (IOException e) { - logger.log(Level.FINEST, "Ignoring exception", e); // ignore: continue to the next classpath entry + if (debug) { + e.printStackTrace(); + } } } } @@ -525,14 +534,24 @@ public class ClassPathExplorer { * Test method for helper tool */ public static void main(String[] args) { - getLogger().info( - "Searching for available widgetsets and stylesheets..."); + log("Searching for available widgetsets and stylesheets..."); ClassPathExplorer.getAvailableWidgetSetsAndStylesheets(); } - private static final Logger getLogger() { - return Logger.getLogger(ClassPathExplorer.class.getName()); + private static void log(String message) { + System.out.println(message); + } + + private static void error(String message, Exception e) { + System.err.println(message); + e.printStackTrace(); + } + + private static void debug(String message) { + if (debug) { + System.out.println(message); + } } } diff --git a/server/src/com/vaadin/ui/Calendar.java b/server/src/com/vaadin/ui/Calendar.java index 9ccc8ea2d9..b0999451c3 100644 --- a/server/src/com/vaadin/ui/Calendar.java +++ b/server/src/com/vaadin/ui/Calendar.java @@ -1824,7 +1824,7 @@ public class Calendar extends AbstractComponent implements try { Date start = formatter.parse(startDate); for (Action.Handler ah : actionHandlers) { - ah.handleAction(action, this, start); + ah.handleAction(action, Calendar.this, start); } } catch (ParseException e) { @@ -1842,7 +1842,7 @@ public class Calendar extends AbstractComponent implements DateConstants.ACTION_DATE_FORMAT_PATTERN); formatter.setTimeZone(getTimeZone()); for (Action.Handler ah : actionHandlers) { - ah.handleAction(action, this, events.get(eventIndex)); + ah.handleAction(action, Calendar.this, events.get(eventIndex)); } } } diff --git a/server/src/com/vaadin/ui/FormLayout.java b/server/src/com/vaadin/ui/FormLayout.java index 9d5e637068..9dc0b24cad 100644 --- a/server/src/com/vaadin/ui/FormLayout.java +++ b/server/src/com/vaadin/ui/FormLayout.java @@ -52,4 +52,23 @@ public class FormLayout extends AbstractOrderedLayout { addComponents(children); } + /** + * @deprecated This method currently has no effect as expand ratios are not + * implemented in FormLayout + */ + @Override + @Deprecated + public void setExpandRatio(Component component, float ratio) { + super.setExpandRatio(component, ratio); + } + + /** + * @deprecated This method currently has no effect as expand ratios are not + * implemented in FormLayout + */ + @Override + @Deprecated + public float getExpandRatio(Component component) { + return super.getExpandRatio(component); + } } |