summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-04-05 11:21:28 +0300
committerLeif Åstrand <leif@vaadin.com>2012-04-05 11:21:28 +0300
commit29b2858bfe174c69f5b79dcac3af7ff183aad224 (patch)
tree31f5406637adaffa3486de9dd4b4258cf4570373 /src
parent3a1d2119c59bb5d5195439d0d5b854eedd37460e (diff)
parent4404e1fb06cc9cade599f4cf5fa0620298a33a42 (diff)
downloadvaadin-framework-29b2858bfe174c69f5b79dcac3af7ff183aad224.tar.gz
vaadin-framework-29b2858bfe174c69f5b79dcac3af7ff183aad224.zip
Merge branch 'master' into layoutgraph
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ComponentConnector.java15
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java16
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/ButtonConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/CheckBoxConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/FormConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/GridLayoutConnector.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/LinkConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/NativeButtonConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/PanelConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/PopupViewConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTextField.java71
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/WindowConnector.java2
-rw-r--r--src/com/vaadin/ui/Window.java67
14 files changed, 48 insertions, 143 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ComponentConnector.java
index 48d988be76..34f3f13f03 100644
--- a/src/com/vaadin/terminal/gwt/client/ComponentConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ComponentConnector.java
@@ -104,4 +104,19 @@ public interface ComponentConnector extends ServerConnector {
public boolean hasEventListener(String eventIdentifier);
+ /**
+ * Return true if parent handles caption, false if the paintable handles the
+ * caption itself.
+ *
+ * <p>
+ * This should always return true and all components should let the parent
+ * handle the caption and use other attributes for internal texts in the
+ * component
+ * </p>
+ *
+ * @return true if caption handling is delegated to the parent, false if
+ * parent should not be allowed to render caption
+ */
+ public boolean delegateCaptionHandling();
+
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java
index 023023293d..9ea03381c4 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java
@@ -219,18 +219,14 @@ public abstract class AbstractComponentConnector extends AbstractConnector
}
}
- /**
- * Return true if parent handles caption, false if the paintable handles the
- * caption itself.
- *
+ /*
+ * (non-Javadoc)
*
- * @deprecated This should always return true and all components should let
- * the parent handle the caption and use other attributes for
- * internal texts in the component
- * @return
+ * @see
+ * com.vaadin.terminal.gwt.client.ComponentConnector#delegateCaptionHandling
+ * ()
*/
- @Deprecated
- protected boolean delegateCaptionHandling() {
+ public boolean delegateCaptionHandling() {
return true;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/ButtonConnector.java b/src/com/vaadin/terminal/gwt/client/ui/ButtonConnector.java
index b905af3d44..ddc9b59430 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/ButtonConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/ButtonConnector.java
@@ -43,7 +43,7 @@ public class ButtonConnector extends AbstractComponentConnector implements
}
@Override
- protected boolean delegateCaptionHandling() {
+ public boolean delegateCaptionHandling() {
return false;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/CheckBoxConnector.java b/src/com/vaadin/terminal/gwt/client/ui/CheckBoxConnector.java
index 2c7f43fede..5c9193f08b 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/CheckBoxConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/CheckBoxConnector.java
@@ -19,7 +19,7 @@ public class CheckBoxConnector extends AbstractFieldConnector implements
Paintable {
@Override
- protected boolean delegateCaptionHandling() {
+ public boolean delegateCaptionHandling() {
return false;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/FormConnector.java b/src/com/vaadin/terminal/gwt/client/ui/FormConnector.java
index 0ac6f0cb69..8e05522eb5 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/FormConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/FormConnector.java
@@ -49,7 +49,7 @@ public class FormConnector extends AbstractComponentContainerConnector
}
@Override
- protected boolean delegateCaptionHandling() {
+ public boolean delegateCaptionHandling() {
return false;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/GridLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/GridLayoutConnector.java
index b3bcc3e58d..1aad705109 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/GridLayoutConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/GridLayoutConnector.java
@@ -168,7 +168,9 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector
needCaptionUpdate = false;
for (ComponentConnector child : getChildren()) {
- updateCaption(child);
+ if (child.delegateCaptionHandling()) {
+ updateCaption(child);
+ }
}
}
getLayoutManager().setNeedsUpdate(this);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/LinkConnector.java b/src/com/vaadin/terminal/gwt/client/ui/LinkConnector.java
index 12fbefa80c..715e902b24 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/LinkConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/LinkConnector.java
@@ -17,7 +17,7 @@ public class LinkConnector extends AbstractComponentConnector implements
Paintable {
@Override
- protected boolean delegateCaptionHandling() {
+ public boolean delegateCaptionHandling() {
return false;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/NativeButtonConnector.java b/src/com/vaadin/terminal/gwt/client/ui/NativeButtonConnector.java
index 991a184e57..bf1299ed27 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/NativeButtonConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/NativeButtonConnector.java
@@ -27,7 +27,7 @@ public class NativeButtonConnector extends AbstractComponentConnector implements
}
@Override
- protected boolean delegateCaptionHandling() {
+ public boolean delegateCaptionHandling() {
return false;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/PanelConnector.java b/src/com/vaadin/terminal/gwt/client/ui/PanelConnector.java
index 65a8f8d5b5..11888f69aa 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/PanelConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/PanelConnector.java
@@ -88,7 +88,7 @@ public class PanelConnector extends AbstractComponentContainerConnector
}
@Override
- protected boolean delegateCaptionHandling() {
+ public boolean delegateCaptionHandling() {
return false;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/PopupViewConnector.java b/src/com/vaadin/terminal/gwt/client/ui/PopupViewConnector.java
index 5da77c7e56..a409b3e5a5 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/PopupViewConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/PopupViewConnector.java
@@ -20,7 +20,7 @@ public class PopupViewConnector extends AbstractComponentContainerConnector
private boolean centerAfterLayout = false;
@Override
- protected boolean delegateCaptionHandling() {
+ public boolean delegateCaptionHandling() {
return false;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java
index 42b6bbaf50..54e6043f1b 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/UnknownComponentConnector.java
@@ -15,7 +15,7 @@ public class UnknownComponentConnector extends AbstractComponentConnector
implements Paintable {
@Override
- protected boolean delegateCaptionHandling() {
+ public boolean delegateCaptionHandling() {
return false;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTextField.java b/src/com/vaadin/terminal/gwt/client/ui/VTextField.java
index cb7c53f216..5936a96565 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VTextField.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTextField.java
@@ -60,8 +60,6 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler,
private boolean valueBeforeEditIsSynced = true;
protected boolean immediate = false;
- private int extraHorizontalPixels = -1;
- private int extraVerticalPixels = -1;
private int maxLength = -1;
private static final String CLASSNAME_PROMPT = "prompt";
@@ -411,75 +409,6 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler,
} catch (e) {}
}-*/;
- /**
- * @return space used by components paddings and borders
- */
- private int getExtraHorizontalPixels() {
- if (extraHorizontalPixels < 0) {
- detectExtraSizes();
- }
- return extraHorizontalPixels;
- }
-
- /**
- * @return space used by components paddings and borders
- */
- private int getExtraVerticalPixels() {
- if (extraVerticalPixels < 0) {
- detectExtraSizes();
- }
- return extraVerticalPixels;
- }
-
- /**
- * Detects space used by components paddings and borders. Used when
- * relational size are used.
- */
- private void detectExtraSizes() {
- Element clone = Util.cloneNode(getElement(), false);
- DOM.setElementAttribute(clone, "id", "");
- DOM.setStyleAttribute(clone, "visibility", "hidden");
- DOM.setStyleAttribute(clone, "position", "absolute");
- // due FF3 bug set size to 10px and later subtract it from extra pixels
- DOM.setStyleAttribute(clone, "width", "10px");
- DOM.setStyleAttribute(clone, "height", "10px");
- DOM.appendChild(DOM.getParent(getElement()), clone);
- extraHorizontalPixels = DOM.getElementPropertyInt(clone, "offsetWidth") - 10;
- extraVerticalPixels = DOM.getElementPropertyInt(clone, "offsetHeight") - 10;
-
- DOM.removeChild(DOM.getParent(getElement()), clone);
- }
-
- @Override
- public void setHeight(String height) {
- if (height.endsWith("px")) {
- int h = Integer.parseInt(height.substring(0, height.length() - 2));
- h -= getExtraVerticalPixels();
- if (h < 0) {
- h = 0;
- }
-
- super.setHeight(h + "px");
- } else {
- super.setHeight(height);
- }
- }
-
- @Override
- public void setWidth(String width) {
- if (width.endsWith("px")) {
- int w = Integer.parseInt(width.substring(0, width.length() - 2));
- w -= getExtraHorizontalPixels();
- if (w < 0) {
- w = 0;
- }
-
- super.setWidth(w + "px");
- } else {
- super.setWidth(width);
- }
- }
-
// Here for backward compatibility; to be moved to TextArea
public void setWordwrap(boolean enabled) {
if (enabled == wordwrap) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/WindowConnector.java b/src/com/vaadin/terminal/gwt/client/ui/WindowConnector.java
index 7c80a37a84..9129940594 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/WindowConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/WindowConnector.java
@@ -113,7 +113,7 @@ public class WindowConnector extends AbstractComponentContainerConnector
private WindowServerRPC rpc;
@Override
- protected boolean delegateCaptionHandling() {
+ public boolean delegateCaptionHandling() {
return false;
};
diff --git a/src/com/vaadin/ui/Window.java b/src/com/vaadin/ui/Window.java
index 83be696d54..b025e923df 100644
--- a/src/com/vaadin/ui/Window.java
+++ b/src/com/vaadin/ui/Window.java
@@ -23,7 +23,6 @@ import com.vaadin.event.ShortcutListener;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.gwt.client.MouseEventDetails;
-import com.vaadin.terminal.gwt.client.ui.WindowConnector;
import com.vaadin.terminal.gwt.client.ui.WindowConnector.WindowServerRPC;
import com.vaadin.terminal.gwt.client.ui.WindowConnector.WindowState;
@@ -75,39 +74,6 @@ import com.vaadin.terminal.gwt.client.ui.WindowConnector.WindowState;
@SuppressWarnings("serial")
public class Window extends Panel implements FocusNotifier, BlurNotifier {
- /**
- * <b>Sub window only</b>. Top offset in pixels for the sub window (relative
- * to the parent application window) or -1 if unspecified.
- */
- private int positionY = -1;
-
- /**
- * <b>Sub window only</b>. Left offset in pixels for the sub window
- * (relative to the parent application window) or -1 if unspecified.
- */
- private int positionX = -1;
-
- /**
- * <b>Sub window only</b>. Modality flag for sub window.
- */
- private boolean modal = false;
-
- /**
- * <b>Sub window only</b>. Controls if the end user can resize the window.
- */
- private boolean resizable = true;
-
- /**
- * <b>Sub window only</b>. Controls if the end user can move the window by
- * dragging.
- */
- private boolean draggable = true;
-
- /**
- * Should resize recalculate layouts lazily (as opposed to immediately)
- */
- private boolean resizeLazy = false;
-
private WindowServerRPC rpc = new WindowServerRPC() {
public void click(MouseEventDetails mouseDetails) {
@@ -178,9 +144,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
// Contents of the window panel is painted
super.paintContent(target);
-
- // Window closing
- target.addVariable(this, "close", false);
}
/*
@@ -282,7 +245,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
* @since 4.0.0
*/
public int getPositionX() {
- return positionX;
+ return getState().getPositionX();
}
/**
@@ -310,7 +273,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
* @since 6.3.4
*/
private void setPositionX(int positionX, boolean repaintRequired) {
- this.positionX = positionX;
+ getState().setPositionX(positionX);
getState().setCentered(false);
if (repaintRequired) {
requestRepaint();
@@ -327,7 +290,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
* @since 4.0.0
*/
public int getPositionY() {
- return positionY;
+ return getState().getPositionY();
}
/**
@@ -357,7 +320,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
* @since 6.3.4
*/
private void setPositionY(int positionY, boolean repaintRequired) {
- this.positionY = positionY;
+ getState().setPositionY(positionY);
getState().setCentered(false);
if (repaintRequired) {
requestRepaint();
@@ -577,11 +540,11 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
* Sets sub-window modal, so that widgets behind it cannot be accessed.
* <b>Note:</b> affects sub-windows only.
*
- * @param modality
+ * @param modal
* true if modality is to be turned on
*/
- public void setModal(boolean modality) {
- modal = modality;
+ public void setModal(boolean modal) {
+ getState().setModal(modal);
center();
requestRepaint();
}
@@ -590,7 +553,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
* @return true if this window is modal.
*/
public boolean isModal() {
- return modal;
+ return getState().isModal();
}
/**
@@ -599,8 +562,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
* @param resizable
* true if resizability is to be turned on
*/
- public void setResizable(boolean resizeability) {
- resizable = resizeability;
+ public void setResizable(boolean resizable) {
+ getState().setResizable(resizable);
requestRepaint();
}
@@ -609,7 +572,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
* @return true if window is resizable by the end-user, otherwise false.
*/
public boolean isResizable() {
- return resizable;
+ return getState().isResizable();
}
/**
@@ -618,7 +581,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
* sizes are recalculated immediately.
*/
public boolean isResizeLazy() {
- return resizeLazy;
+ return getState().isResizeLazy();
}
/**
@@ -634,7 +597,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
* calculate immediately.
*/
public void setResizeLazy(boolean resizeLazy) {
- this.resizeLazy = resizeLazy;
+ getState().setResizeLazy(resizeLazy);
requestRepaint();
}
@@ -695,7 +658,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
* true if the sub window can be dragged by the user
*/
public boolean isDraggable() {
- return draggable;
+ return getState().isDraggable();
}
/**
@@ -708,7 +671,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier {
* true if the sub window can be dragged by the user
*/
public void setDraggable(boolean draggable) {
- this.draggable = draggable;
+ getState().setDraggable(draggable);
requestRepaint();
}