summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Englund <marc@vaadin.com>2012-10-11 13:10:58 +0000
committerVaadin Code Review <review@vaadin.com>2012-10-11 13:10:58 +0000
commite722952c0e571945f1afee9f150c946caaf17f8f (patch)
tree708d2d277209242888051a47caba709d2a2af805
parentf6339220790b932f4488171fd492658f63e80fcd (diff)
parentce11d139f6ef2a71c689897c922a6d9987ee4416 (diff)
downloadvaadin-framework-e722952c0e571945f1afee9f150c946caaf17f8f.tar.gz
vaadin-framework-e722952c0e571945f1afee9f150c946caaf17f8f.zip
Merge "Fixed primary stylename handling in AbsoluteLayout as well as moved layout specific functionality into the layout from the connector #9899"
-rw-r--r--client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java171
-rw-r--r--client/src/com/vaadin/client/ui/absolutelayout/VAbsoluteLayout.java388
-rw-r--r--uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutPrimaryStylename.html67
-rw-r--r--uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutPrimaryStylename.java45
4 files changed, 549 insertions, 122 deletions
diff --git a/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java b/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java
index 599f52dc2a..0877b563a0 100644
--- a/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java
+++ b/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java
@@ -15,13 +15,7 @@
*/
package com.vaadin.client.ui.absolutelayout;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.google.gwt.dom.client.Style;
-import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.ComponentConnector;
import com.vaadin.client.ConnectorHierarchyChangeEvent;
import com.vaadin.client.DirectionalManagedLayout;
@@ -31,13 +25,16 @@ import com.vaadin.client.communication.RpcProxy;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractComponentContainerConnector;
import com.vaadin.client.ui.LayoutClickEventHandler;
-import com.vaadin.client.ui.absolutelayout.VAbsoluteLayout.AbsoluteWrapper;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.LayoutClickRpc;
import com.vaadin.shared.ui.absolutelayout.AbsoluteLayoutServerRpc;
import com.vaadin.shared.ui.absolutelayout.AbsoluteLayoutState;
import com.vaadin.ui.AbsoluteLayout;
+/**
+ * Connects the server side {@link AbsoluteLayout} with the client side
+ * counterpart {@link VAbsoluteLayout}
+ */
@Connect(AbsoluteLayout.class)
public class AbsoluteLayoutConnector extends
AbstractComponentContainerConnector implements DirectionalManagedLayout {
@@ -54,13 +51,15 @@ public class AbsoluteLayoutConnector extends
protected LayoutClickRpc getLayoutClickRPC() {
return rpc;
};
-
};
private AbsoluteLayoutServerRpc rpc;
- private Map<String, AbsoluteWrapper> connectorIdToComponentWrapper = new HashMap<String, AbsoluteWrapper>();
-
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.client.ui.AbstractComponentConnector#init()
+ */
@Override
protected void init() {
super.init();
@@ -82,41 +81,58 @@ public class AbsoluteLayoutConnector extends
element);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.client.ComponentContainerConnector#updateCaption(com.vaadin
+ * .client.ComponentConnector)
+ */
@Override
public void updateCaption(ComponentConnector component) {
VAbsoluteLayout absoluteLayoutWidget = getWidget();
- AbsoluteWrapper componentWrapper = getWrapper(component);
-
boolean captionIsNeeded = VCaption.isNeeded(component.getState());
- VCaption caption = componentWrapper.getCaption();
-
+ VCaption caption = absoluteLayoutWidget.getWidgetCaption(component
+ .getWidget());
if (captionIsNeeded) {
if (caption == null) {
caption = new VCaption(component, getConnection());
- absoluteLayoutWidget.add(caption);
- componentWrapper.setCaption(caption);
- }
- caption.updateCaption();
- componentWrapper.updateCaptionPosition();
- } else {
- if (caption != null) {
- caption.removeFromParent();
}
+ absoluteLayoutWidget.setWidgetCaption(component.getWidget(),
+ caption);
+ } else if (caption != null) {
+ absoluteLayoutWidget.setWidgetCaption(component.getWidget(), null);
}
-
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.client.ui.AbstractComponentConnector#getWidget()
+ */
@Override
public VAbsoluteLayout getWidget() {
return (VAbsoluteLayout) super.getWidget();
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.client.ui.AbstractComponentConnector#getState()
+ */
@Override
public AbsoluteLayoutState getState() {
return (AbsoluteLayoutState) super.getState();
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.client.ui.AbstractComponentConnector#onStateChanged(com.vaadin
+ * .client.communication.StateChangeEvent)
+ */
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
super.onStateChanged(stateChangeEvent);
@@ -125,106 +141,63 @@ public class AbsoluteLayoutConnector extends
// TODO Margin handling
for (ComponentConnector child : getChildComponents()) {
- getWrapper(child).setPosition(
+ getWidget().setWidgetPosition(
+ child.getWidget(),
getState().connectorToCssPosition.get(child
.getConnectorId()));
}
};
- private AbsoluteWrapper getWrapper(ComponentConnector child) {
- String childId = child.getConnectorId();
- AbsoluteWrapper wrapper = connectorIdToComponentWrapper.get(childId);
- if (wrapper != null) {
- return wrapper;
- }
-
- wrapper = new AbsoluteWrapper(child.getWidget());
- connectorIdToComponentWrapper.put(childId, wrapper);
- getWidget().add(wrapper);
- return wrapper;
-
- }
-
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.client.ui.AbstractComponentContainerConnector#
+ * onConnectorHierarchyChange
+ * (com.vaadin.client.ConnectorHierarchyChangeEvent)
+ */
@Override
public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
-
for (ComponentConnector child : getChildComponents()) {
- getWrapper(child);
+ if (!getWidget().contains(child.getWidget())) {
+ getWidget().add(child.getWidget());
+ }
}
-
for (ComponentConnector oldChild : event.getOldChildren()) {
if (oldChild.getParent() != this) {
- String connectorId = oldChild.getConnectorId();
- AbsoluteWrapper absoluteWrapper = connectorIdToComponentWrapper
- .remove(connectorId);
- absoluteWrapper.destroy();
+ getWidget().remove(oldChild.getWidget());
}
}
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.client.DirectionalManagedLayout#layoutVertically()
+ */
@Override
public void layoutVertically() {
- VAbsoluteLayout layout = getWidget();
- for (ComponentConnector paintable : getChildComponents()) {
- Widget widget = paintable.getWidget();
- AbsoluteWrapper wrapper = (AbsoluteWrapper) widget.getParent();
- Style wrapperStyle = wrapper.getElement().getStyle();
-
- if (paintable.isRelativeHeight()) {
- int h;
- if (wrapper.top != null && wrapper.bottom != null) {
- h = wrapper.getOffsetHeight();
- } else if (wrapper.bottom != null) {
- // top not defined, available space 0... bottom of
- // wrapper
- h = wrapper.getElement().getOffsetTop()
- + wrapper.getOffsetHeight();
- } else {
- // top defined or both undefined, available space ==
- // canvas - top
- h = layout.canvas.getOffsetHeight()
- - wrapper.getElement().getOffsetTop();
- }
- wrapperStyle.setHeight(h, Unit.PX);
- getLayoutManager().reportHeightAssignedToRelative(paintable, h);
- } else {
- wrapperStyle.clearHeight();
+ getWidget().layoutVertically();
+ for (ComponentConnector connector : getChildComponents()) {
+ if (connector.isRelativeHeight()) {
+ getLayoutManager().reportHeightAssignedToRelative(connector,
+ getWidget().getWidgetSlotHeight(connector.getWidget()));
}
-
- wrapper.updateCaptionPosition();
}
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.client.DirectionalManagedLayout#layoutHorizontally()
+ */
@Override
public void layoutHorizontally() {
- VAbsoluteLayout layout = getWidget();
- for (ComponentConnector paintable : getChildComponents()) {
- AbsoluteWrapper wrapper = getWrapper(paintable);
- Style wrapperStyle = wrapper.getElement().getStyle();
-
- if (paintable.isRelativeWidth()) {
- int w;
- if (wrapper.left != null && wrapper.right != null) {
- w = wrapper.getOffsetWidth();
- } else if (wrapper.right != null) {
- // left == null
- // available width == right edge == offsetleft + width
- w = wrapper.getOffsetWidth()
- + wrapper.getElement().getOffsetLeft();
- } else {
- // left != null && right == null || left == null &&
- // right == null
- // available width == canvas width - offset left
- w = layout.canvas.getOffsetWidth()
- - wrapper.getElement().getOffsetLeft();
- }
- wrapperStyle.setWidth(w, Unit.PX);
- getLayoutManager().reportWidthAssignedToRelative(paintable, w);
- } else {
- wrapperStyle.clearWidth();
+ getWidget().layoutHorizontally();
+ for (ComponentConnector connector : getChildComponents()) {
+ if (connector.isRelativeWidth()) {
+ getLayoutManager().reportWidthAssignedToRelative(connector,
+ getWidget().getWidgetSlotWidth(connector.getWidget()));
}
-
- wrapper.updateCaptionPosition();
}
}
}
diff --git a/client/src/com/vaadin/client/ui/absolutelayout/VAbsoluteLayout.java b/client/src/com/vaadin/client/ui/absolutelayout/VAbsoluteLayout.java
index 1f5b58bef3..6c58933dd3 100644
--- a/client/src/com/vaadin/client/ui/absolutelayout/VAbsoluteLayout.java
+++ b/client/src/com/vaadin/client/ui/absolutelayout/VAbsoluteLayout.java
@@ -18,12 +18,12 @@ package com.vaadin.client.ui.absolutelayout;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.StyleConstants;
import com.vaadin.client.VCaption;
@@ -39,52 +39,386 @@ public class VAbsoluteLayout extends ComplexPanel {
protected final Element canvas = DOM.createDiv();
- private Object previousStyleName;
-
- protected ApplicationConnection client;
-
+ /**
+ * Default constructor
+ */
public VAbsoluteLayout() {
setElement(Document.get().createDivElement());
- setStyleName(CLASSNAME);
- addStyleName(StyleConstants.UI_LAYOUT);
marginElement = Document.get().createDivElement();
canvas.getStyle().setProperty("position", "relative");
canvas.getStyle().setProperty("overflow", "hidden");
marginElement.appendChild(canvas);
getElement().appendChild(marginElement);
-
- canvas.setClassName(CLASSNAME + "-canvas");
- canvas.setClassName(CLASSNAME + "-margin");
+ setStyleName(CLASSNAME);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.google.gwt.user.client.ui.Panel#add(com.google.gwt.user.client.ui
+ * .Widget)
+ */
@Override
public void add(Widget child) {
- super.add(child, canvas);
+ AbsoluteWrapper wrapper = new AbsoluteWrapper(child);
+ wrapper.setStyleName(getStylePrimaryName() + "-wrapper");
+ super.add(wrapper, canvas);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.google.gwt.user.client.ui.ComplexPanel#remove(com.google.gwt.user
+ * .client.ui.Widget)
+ */
+ @Override
+ public boolean remove(Widget w) {
+ AbsoluteWrapper wrapper = getChildWrapper(w);
+ if (wrapper != null) {
+ wrapper.destroy();
+ return super.remove(wrapper);
+ }
+ return false;
+ }
+
+ /**
+ * Does this layout contain a widget
+ *
+ * @param widget
+ * The widget to check
+ * @return Returns true if the widget is in this layout, false if not
+ */
+ public boolean contains(Widget widget) {
+ return getChildWrapper(widget) != null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.google.gwt.user.client.ui.ComplexPanel#getWidget(int)
+ */
+ @Override
+ public Widget getWidget(int index) {
+ for (int i = 0, j = 0; i < super.getWidgetCount(); i++) {
+ Widget w = getWidget(i);
+ if (w instanceof AbsoluteWrapper) {
+ if (j == index) {
+ return w;
+ } else {
+ j++;
+ }
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.google.gwt.user.client.ui.ComplexPanel#getWidgetCount()
+ */
+ @Override
+ public int getWidgetCount() {
+ int counter = 0;
+ for (int i = 0; i < super.getWidgetCount(); i++) {
+ if (getWidget(i) instanceof AbsoluteWrapper) {
+ counter++;
+ }
+ }
+ return counter;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.google.gwt.user.client.ui.ComplexPanel#getWidgetIndex(com.google.
+ * gwt.user.client.ui.Widget)
+ */
+ @Override
+ public int getWidgetIndex(Widget child) {
+ for (int i = 0, j = 0; i < super.getWidgetCount(); i++) {
+ Widget w = getWidget(i);
+ if (w instanceof AbsoluteWrapper) {
+ if (child == w) {
+ return j;
+ } else {
+ j++;
+ }
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Sets a caption for a contained widget
+ *
+ * @param child
+ * The child widget to set the caption for
+ * @param caption
+ * The caption of the widget
+ */
+ public void setWidgetCaption(Widget child, VCaption caption) {
+ AbsoluteWrapper wrapper = getChildWrapper(child);
+ if (wrapper != null) {
+ if (caption != null) {
+ if (!getChildren().contains(caption)) {
+ add(caption);
+ }
+ wrapper.setCaption(caption);
+ caption.updateCaption();
+ wrapper.updateCaptionPosition();
+ } else if (wrapper.getCaption() != null) {
+ wrapper.setCaption(null);
+ }
+ }
+ }
+
+ /**
+ * Set the position of the widget in the layout. The position is a CSS
+ * property string using properties such as top,left,right,top
+ *
+ * @param child
+ * The child widget to set the position for
+ * @param position
+ * The position string
+ */
+ public void setWidgetPosition(Widget child, String position) {
+ AbsoluteWrapper wrapper = getChildWrapper(child);
+ if (wrapper != null) {
+ wrapper.setPosition(position);
+ }
+ }
+
+ /**
+ * Get the caption for a widget
+ *
+ * @param child
+ * The child widget to get the caption of
+ */
+ public VCaption getWidgetCaption(Widget child) {
+ AbsoluteWrapper wrapper = getChildWrapper(child);
+ if (wrapper != null) {
+ return wrapper.getCaption();
+ }
+ return null;
+ }
+
+ /**
+ * Get the pixel width of an slot in the layout
+ *
+ * @param child
+ * The widget in the layout.
+ * @return Returns the size in pixels, or 0 if child is not in the layout
+ */
+ public int getWidgetSlotWidth(Widget child) {
+ AbsoluteWrapper wrapper = getChildWrapper(child);
+ if (wrapper != null) {
+ return wrapper.getOffsetWidth();
+ }
+ return 0;
+ }
+
+ /**
+ * Get the pixel height of an slot in the layout
+ *
+ * @param child
+ * The widget in the layout
+ * @return Returns the size in pixels, or 0 if the child is not in the
+ * layout
+ */
+ public int getWidgetSlotHeight(Widget child) {
+ AbsoluteWrapper wrapper = getChildWrapper(child);
+ if (wrapper != null) {
+ return wrapper.getOffsetHeight();
+ }
+ return 0;
+ }
+
+ /**
+ * Get the wrapper for a widget
+ *
+ * @param child
+ * The child to get the wrapper for
+ * @return
+ */
+ protected AbsoluteWrapper getChildWrapper(Widget child) {
+ for (Widget w : getChildren()) {
+ AbsoluteWrapper wrapper = (AbsoluteWrapper) w;
+ if (wrapper.getWidget() == child) {
+ return wrapper;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.google.gwt.user.client.ui.UIObject#setStylePrimaryName(java.lang.
+ * String)
+ */
+ @Override
+ public void setStylePrimaryName(String style) {
+ updateStylenames(style);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.google.gwt.user.client.ui.UIObject#setStyleName(java.lang.String)
+ */
+ @Override
+ public void setStyleName(String style) {
+ super.setStyleName(style);
+ updateStylenames(style);
+ addStyleName(StyleConstants.UI_LAYOUT);
+ }
+
+ /**
+ * Updates all style names contained in the layout
+ *
+ * @param primaryStyleName
+ * The style name to use as primary
+ */
+ protected void updateStylenames(String primaryStyleName) {
+ super.setStylePrimaryName(primaryStyleName);
+ canvas.setClassName(getStylePrimaryName() + "-canvas");
+ canvas.setClassName(getStylePrimaryName() + "-margin");
+ for (Widget w : getChildren()) {
+ if (w instanceof AbsoluteWrapper) {
+ AbsoluteWrapper wrapper = (AbsoluteWrapper) w;
+ wrapper.setStyleName(getStylePrimaryName() + "-wrapper");
+ }
+ }
}
- public static class AbsoluteWrapper extends SimplePanel {
+ /**
+ * Performs a vertical layout of the layout. Should be called when a widget
+ * is added or removed
+ */
+ public void layoutVertically() {
+ for (Widget widget : getChildren()) {
+ if (widget instanceof AbsoluteWrapper) {
+ AbsoluteWrapper wrapper = (AbsoluteWrapper) widget;
+ Style wrapperStyle = wrapper.getElement().getStyle();
+ Style widgetStyle = wrapper.getWidget().getElement().getStyle();
+ if (widgetStyle.getHeight() != null
+ && widgetStyle.getHeight().endsWith("%")) {
+ int h;
+ if (wrapper.top != null && wrapper.bottom != null) {
+ h = wrapper.getOffsetHeight();
+ } else if (wrapper.bottom != null) {
+ // top not defined, available space 0... bottom of
+ // wrapper
+ h = wrapper.getElement().getOffsetTop()
+ + wrapper.getOffsetHeight();
+ } else {
+ // top defined or both undefined, available space ==
+ // canvas - top
+ h = canvas.getOffsetHeight()
+ - wrapper.getElement().getOffsetTop();
+ }
+ wrapperStyle.setHeight(h, Unit.PX);
+ } else {
+ wrapperStyle.clearHeight();
+ }
+
+ wrapper.updateCaptionPosition();
+ }
+ }
+ }
+
+ /**
+ * Performs an horizontal layout. Should be called when a widget is add or
+ * removed
+ */
+ public void layoutHorizontally() {
+ for (Widget widget : getChildren()) {
+ if (widget instanceof AbsoluteWrapper) {
+ AbsoluteWrapper wrapper = (AbsoluteWrapper) widget;
+ Style wrapperStyle = wrapper.getElement().getStyle();
+ Style widgetStyle = wrapper.getWidget().getElement().getStyle();
+
+ if (widgetStyle.getWidth() != null
+ && widgetStyle.getWidth().endsWith("%")) {
+ int w;
+ if (wrapper.left != null && wrapper.right != null) {
+ w = wrapper.getOffsetWidth();
+ } else if (wrapper.right != null) {
+ // left == null
+ // available width == right edge == offsetleft + width
+ w = wrapper.getOffsetWidth()
+ + wrapper.getElement().getOffsetLeft();
+ } else {
+ // left != null && right == null || left == null &&
+ // right == null
+ // available width == canvas width - offset left
+ w = canvas.getOffsetWidth()
+ - wrapper.getElement().getOffsetLeft();
+ }
+ wrapperStyle.setWidth(w, Unit.PX);
+ } else {
+ wrapperStyle.clearWidth();
+ }
+
+ wrapper.updateCaptionPosition();
+ }
+ }
+ }
+
+ /**
+ * Internal wrapper for wrapping widgets in the Absolute layout
+ */
+ protected class AbsoluteWrapper extends SimplePanel {
private String css;
- String left;
- String top;
- String right;
- String bottom;
+ private String left;
+ private String top;
+ private String right;
+ private String bottom;
private String zIndex;
private VCaption caption;
+ /**
+ * Constructor
+ *
+ * @param child
+ * The child to wrap
+ */
public AbsoluteWrapper(Widget child) {
setWidget(child);
- setStyleName(CLASSNAME + "-wrapper");
}
+ /**
+ * Get the caption of the wrapper
+ */
public VCaption getCaption() {
return caption;
}
+ /**
+ * Set the caption for the wrapper
+ *
+ * @param caption
+ * The caption for the wrapper
+ */
public void setCaption(VCaption caption) {
- this.caption = caption;
+ if (caption != null) {
+ this.caption = caption;
+ } else if (this.caption != null) {
+ this.caption.removeFromParent();
+ this.caption = caption;
+ }
}
+ /**
+ * Removes the wrapper caption and itself from the layout
+ */
public void destroy() {
if (caption != null) {
caption.removeFromParent();
@@ -92,9 +426,15 @@ public class VAbsoluteLayout extends ComplexPanel {
removeFromParent();
}
- public void setPosition(String stringAttribute) {
- if (css == null || !css.equals(stringAttribute)) {
- css = stringAttribute;
+ /**
+ * Set the position for the wrapper in the layout
+ *
+ * @param position
+ * The position string
+ */
+ public void setPosition(String position) {
+ if (css == null || !css.equals(position)) {
+ css = position;
top = right = bottom = left = zIndex = null;
if (!css.equals("")) {
String[] properties = css.split(";");
@@ -134,7 +474,10 @@ public class VAbsoluteLayout extends ComplexPanel {
updateCaptionPosition();
}
- void updateCaptionPosition() {
+ /**
+ * Updates the caption position by using element offset left and top
+ */
+ private void updateCaptionPosition() {
if (caption != null) {
Style style = caption.getElement().getStyle();
style.setProperty("position", "absolute");
@@ -144,5 +487,4 @@ public class VAbsoluteLayout extends ComplexPanel {
}
}
}
-
}
diff --git a/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutPrimaryStylename.html b/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutPrimaryStylename.html
new file mode 100644
index 0000000000..fccbb29b8b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutPrimaryStylename.html
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.absolutelayout.AbsoluteLayoutPrimaryStylename?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertNotCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutPrimaryStylename::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VAbsoluteLayout[0]/</td>
+ <td>v-absolute-layout</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutPrimaryStylename::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VAbsoluteLayout[0]/</td>
+ <td>my-absolute-layout</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutPrimaryStylename::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VAbsoluteLayout[0]/domChild[0]/domChild[0]</td>
+ <td>my-absolute-layout-margin</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutPrimaryStylename::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VAbsoluteLayout[0]/VAbsoluteLayout$AbsoluteWrapper[0]/</td>
+ <td>my-absolute-layout-wrapper</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutPrimaryStylename::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertNotCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutPrimaryStylename::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VAbsoluteLayout[0]/</td>
+ <td>my-absolute-layout</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutPrimaryStylename::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VAbsoluteLayout[0]/</td>
+ <td>my-second-absolute-layout</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutPrimaryStylename::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VAbsoluteLayout[0]/domChild[0]/domChild[0]</td>
+ <td>my-second-absolute-layout-margin</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsabsolutelayoutAbsoluteLayoutPrimaryStylename::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VAbsoluteLayout[0]/VAbsoluteLayout$AbsoluteWrapper[0]/</td>
+ <td>my-second-absolute-layout-wrapper</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutPrimaryStylename.java b/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutPrimaryStylename.java
new file mode 100644
index 0000000000..b75d5931b5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutPrimaryStylename.java
@@ -0,0 +1,45 @@
+package com.vaadin.tests.components.absolutelayout;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbsoluteLayout;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.NativeButton;
+
+public class AbsoluteLayoutPrimaryStylename extends TestBase {
+
+ @Override
+ protected void setup() {
+ final AbsoluteLayout layout = new AbsoluteLayout();
+ layout.setWidth("100px");
+ layout.setWidth("200px");
+ layout.setPrimaryStyleName("my-absolute-layout");
+
+ Component comp1 = new NativeButton("Child 1");
+ comp1.setWidth("100%");
+ comp1.setHeight("50px");
+ layout.addComponent(comp1);
+
+ addComponent(layout);
+
+ addComponent(new Button("Change primary stylename",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ layout.setPrimaryStyleName("my-second-absolute-layout");
+ }
+ }));
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Absolutelayout should handle setting primary stylename both initially and dynamically";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 9899;
+ }
+
+}
on value='backport/50129/stable30'>backport/50129/stable30 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/apps/theming/tests/ImageManagerTest.php
blob: 501ec0e14325f593d460559c733038c340baa056 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323