From cc4914f4969141fcdc92f636ccb67b84c99f32f7 Mon Sep 17 00:00:00 2001 From: Automerge Date: Tue, 14 Feb 2012 14:06:37 +0000 Subject: [merge from 6.7] #5833 and #7013 combo box width fix and tests svn changeset:23000/svn branch:6.8 --- .../terminal/gwt/client/ui/VFilterSelect.java | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java index e261286cb7..5cf02532b1 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java @@ -1842,14 +1842,6 @@ public class VFilterSelect extends Composite implements Paintable, Field, */ int tbWidth = Util.getRequiredWidth(tb); - if (popupWidth < 0) { - /* - * Only use the first page popup width so the textbox will not - * get resized whenever the popup is resized. - */ - popupWidth = Util.getRequiredWidth(popupOpener); - } - /* * Note: iconWidth is here calculated as a negative pixel value so * you should consider this in further calculations. @@ -1858,7 +1850,7 @@ public class VFilterSelect extends Composite implements Paintable, Field, .measureMarginLeft(tb.getElement()) - Util.measureMarginLeft(selectedItemIcon.getElement()) : 0; - int w = tbWidth + popupWidth + iconWidth; + int w = tbWidth + getPopUpOpenerWidth() + iconWidth; /* * When the select has a undefined with we need to check that we are @@ -1894,6 +1886,20 @@ public class VFilterSelect extends Composite implements Paintable, Field, } } + /** + * Only use the first page popup width so the textbox will not get resized + * whenever the popup is resized. This also resolves issue where toggling + * combo box between read only and normal state makes it grow larger. + * + * @return Width of popup opener + */ + private int getPopUpOpenerWidth() { + if (popupWidth < 0) { + popupWidth = Util.getRequiredWidth(popupOpener); + } + return popupWidth; + } + /** * Get the width of the select in pixels where the text area and icon has * been included. @@ -1921,10 +1927,10 @@ public class VFilterSelect extends Composite implements Paintable, Field, */ private void setTextboxWidth(int componentWidth) { int padding = getTextboxPadding(); - int popupOpenerWidth = Util.getRequiredWidth(popupOpener); int iconWidth = selectedItemIcon.isAttached() ? Util .getRequiredWidth(selectedItemIcon) : 0; - int textboxWidth = componentWidth - padding - popupOpenerWidth + + int textboxWidth = componentWidth - padding - getPopUpOpenerWidth() - iconWidth; if (textboxWidth < 0) { textboxWidth = 0; -- cgit v1.2.3 From b495b8f7f4d4cf1ea1731b45d1cf6e35bdd86779 Mon Sep 17 00:00:00 2001 From: Automerge Date: Tue, 14 Feb 2012 22:08:42 +0000 Subject: [merge from 6.7] #8392 Improved error message for exceptions that take place in listener code svn changeset:23006/svn branch:6.8 --- src/com/vaadin/event/ListenerMethod.java | 49 ++++---------------------------- 1 file changed, 5 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/event/ListenerMethod.java b/src/com/vaadin/event/ListenerMethod.java index c11f3b1424..1f1305fa69 100644 --- a/src/com/vaadin/event/ListenerMethod.java +++ b/src/com/vaadin/event/ListenerMethod.java @@ -517,8 +517,10 @@ public class ListenerMethod implements EventListener, Serializable { } catch (final java.lang.reflect.InvocationTargetException e) { // An exception was thrown by the invocation target. Throw it // forwards. - throw new MethodException("Invocation of method " + method - + " failed.", e.getTargetException()); + throw new MethodException("Invocation of method " + + method.getName() + " in " + + target.getClass().getName() + " failed.", + e.getTargetException()); } } } @@ -617,49 +619,8 @@ public class ListenerMethod implements EventListener, Serializable { public class MethodException extends RuntimeException implements Serializable { - private final Throwable cause; - - private String message; - private MethodException(String message, Throwable cause) { - super(message); - this.cause = cause; - } - - /** - * Retrieves the cause of this throwable or null if the - * cause does not exist or not known. - * - * @return the cause of this throwable or null if the cause - * is nonexistent or unknown. - * @see java.lang.Throwable#getCause() - */ - @Override - public Throwable getCause() { - return cause; - } - - /** - * Returns the error message string of this throwable object. - * - * @return the error message. - * @see java.lang.Throwable#getMessage() - */ - @Override - public String getMessage() { - return message; - } - - /** - * @see java.lang.Throwable#toString() - */ - @Override - public String toString() { - String msg = super.toString(); - if (cause != null) { - msg += "\nCause: " + cause.toString(); - } - return msg; + super(message, cause); } } -- cgit v1.2.3 From 5b2e12623424e3603a5983895d122ba333db5b18 Mon Sep 17 00:00:00 2001 From: Automerge Date: Wed, 15 Feb 2012 02:18:42 +0000 Subject: [merge from 6.7] #8373 Handler DragAndDropService changeVariables error by finding the drop target and using that for error reporting svn changeset:23013/svn branch:6.8 --- .../terminal/gwt/server/AbstractCommunicationManager.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index e96f2d2b56..4454287ae9 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -1396,12 +1396,16 @@ public abstract class AbstractCommunicationManager implements } } } catch (Exception e) { + Component errorComponent = null; if (owner instanceof Component) { - handleChangeVariablesError(app, (Component) owner, e, m); - } else { - // TODO DragDropService error handling - throw new RuntimeException(e); + errorComponent = (Component) owner; + } else if (owner instanceof DragAndDropService) { + if (m.get("dhowner") instanceof Component) { + errorComponent = (Component) m.get("dhowner"); + } } + + handleChangeVariablesError(app, errorComponent, e, m); } } else { -- cgit v1.2.3 From aa13b3432bab77bb2dfca0db9b437b222517813f Mon Sep 17 00:00:00 2001 From: Automerge Date: Wed, 15 Feb 2012 02:18:50 +0000 Subject: [merge from 6.7] #8114 - Fixed TabSheet rendering of first tab when another tab is selected svn changeset:23014/svn branch:6.8 --- .../vaadin/terminal/gwt/client/ui/VTabsheet.java | 7 ++- .../tabsheet/TabSheetSelectionStyles.html | 67 ++++++++++++++++++++++ 2 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetSelectionStyles.html (limited to 'src') diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java index d30d999d16..39b3779682 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java @@ -52,7 +52,7 @@ public class VTabsheet extends VTabsheetBase { /** * Representation of a single "tab" shown in the TabBar - * + * */ private static class Tab extends SimplePanel { private static final String TD_CLASSNAME = CLASSNAME + "-tabitemcell"; @@ -341,13 +341,16 @@ public class VTabsheet extends VTabsheetBase { } public Tab addTab() { + // Must check this before insert as insert updates the tab count + boolean firstTab = (getTabCount() == 0); + Tab t = new Tab(this); // Logical attach int spacerIndex = getTabCount(); insert(t, tr, spacerIndex, true); - if (getTabCount() == 0) { + if (firstTab) { // Set the "first" style t.setStyleNames(false, true); } diff --git a/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetSelectionStyles.html b/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetSelectionStyles.html new file mode 100644 index 0000000000..e046cfacb4 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/tabsheet/TabSheetSelectionStyles.html @@ -0,0 +1,67 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/TabSheetIndexOperations?restartApplication
screenCapturetab1-selected
mouseClickvaadin=runTabSheetIndexOperations::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]21,8
screenCapturetab2-selected
open/run/TabSheetIndexOperations
screenCapturetab2-selected
mouseClickvaadin=runTabSheetIndexOperations::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]14,5
screenCapturetab1-selected
open/run/TabSheetIndexOperations
screenCapturetab1-selected
+ + -- cgit v1.2.3