summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/event/ListenerMethod.java49
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java28
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java5
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java12
4 files changed, 34 insertions, 60 deletions
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 <code>null</code> if the
- * cause does not exist or not known.
- *
- * @return the cause of this throwable or <code>null</code> 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);
}
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
index b54c3dd943..0083cc83c2 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
@@ -1616,14 +1616,6 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
*/
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.
@@ -1632,7 +1624,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
.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
@@ -1669,6 +1661,20 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
}
/**
+ * 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.
*
@@ -1686,10 +1692,10 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
*/
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;
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java
index 809c1a0380..9155f9932a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java
@@ -317,13 +317,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/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
index 86f2c7a2de..705bf13346 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
@@ -1234,12 +1234,16 @@ public abstract class AbstractCommunicationManager implements
try {
changeVariables(source, owner, m);
} 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 {