*/
-.v-boxlayout.v-margin-top {padding-top: 18px;}
-.v-boxlayout.v-margin-right {padding-right: 18px;}
-.v-boxlayout.v-margin-bottom {padding-bottom: 18px;}
-.v-boxlayout.v-margin-left {padding-left: 18px;}
+.v-boxlayout.v-margin-top {padding-top: 12px;}
+.v-boxlayout.v-margin-right {padding-right: 12px;}
+.v-boxlayout.v-margin-bottom {padding-bottom: 12px;}
+.v-boxlayout.v-margin-left {padding-left: 12px;}
.v-spacing {
- width: 7px;
- height: 7px;
+ width: 6px;
+ height: 6px;
}
.v-boxlayout {
vertical-align: top;
}
+/* Clear any floats inside the slot, to prevent unwanted collapsing */
+.v-slot:after {
+ content: "";
+ display: block;
+ clear: both;
+ height: 0;
+ overflow: hidden;
+}
+
.v-vertical > .v-slot,
.v-vertical > .v-expand > .v-slot {
display: block;
.v-button {
display: inline-block;
zoom: 1;
- text-align: center;
+ text-align: center !important;
text-decoration: none;
border: 2px outset #ddd;
background: #eee;
* NativeButton styles (html button element)
* -------------------------------------- */
.v-nativebutton {
- text-align: center;
+ text-align: center !important;
cursor: pointer;
white-space: nowrap;
margin: 0;
-moz-box-sizing: border-box;
box-sizing: border-box;
text-align: left;
+ display: inline-block;
}
.v-orderedlayout-margin-top,
.v-horizontallayout-margin-top,
-.v-verticallayout-margin-top {
+.v-verticallayout-margin-top,
+.v-boxlayout.v-margin-top {
padding-top: 18px;
}
.v-orderedlayout-margin-right,
.v-horizontallayout-margin-right,
-.v-verticallayout-margin-right {
+.v-verticallayout-margin-right,
+.v-boxlayout.v-margin-right {
padding-right: 18px;
}
.v-orderedlayout-margin-bottom,
.v-horizontallayout-margin-bottom,
-.v-verticallayout-margin-bottom {
+.v-verticallayout-margin-bottom,
+.v-boxlayout.v-margin-bottom {
padding-bottom: 18px;
}
.v-orderedlayout-margin-left,
.v-horizontallayout-margin-left,
-.v-verticallayout-margin-left {
+.v-verticallayout-margin-left,
+.v-boxlayout.v-margin-left {
padding-left: 18px;
}
.v-orderedlayout-spacing-on,
padding-top: 7px;
padding-left: 6px;
}
+.v-spacing {
+ height: 7px;
+ width: 6px;
+}
/* Different for historical reasons: previously was inherited directly from Base theme */
/* TODO unify these values in version 7 */
.v-gridlayout-margin-top {
.v-orderedlayout-margin-top,
.v-horizontallayout-margin-top,
.v-verticallayout-margin-top,
-.v-csslayout-margin-top {
+.v-csslayout-margin-top,
+.v-boxlayout.v-margin-top {
padding-top: 15px;
}
.v-orderedlayout-margin-right,
.v-orderedlayout-margin-bottom,
.v-horizontallayout-margin-bottom,
.v-verticallayout-margin-bottom,
-.v-csslayout-margin-bottom {
+.v-csslayout-margin-bottom,
+.v-boxlayout.v-margin-bottom {
padding-bottom: 15px;
}
.v-orderedlayout-margin-left,
padding-top: 8px;
padding-left: 8px;
}
+.v-spacing {
+ width: 8px;
+ height: 8px;
+}
.v-verticallayout-darker,
.v-horizontallayout-darker,
.v-gridlayout-darker,
if (child instanceof AbstractFieldConnector) {
required = ((AbstractFieldConnector) child).isRequired();
}
+ boolean enabled = child.getState().isEnabled();
// TODO Description is handled from somewhere else?
- slot.setCaption(caption, iconUrl, styles, error, required);
+ slot.setCaption(caption, iconUrl, styles, error, required, enabled);
slot.setRelativeWidth(child.isRelativeWidth());
slot.setRelativeHeight(child.isRelativeHeight());
getLayoutManager().addElementResizeListener(
slot.getCaptionElement(), slotCaptionResizeListener);
} else if (!needsExpand()) {
+ // TODO recheck if removing the listener here breaks anything.
+ // Should be cleaned up.
// getLayoutManager().removeElementResizeListener(
// slot.getCaptionElement(), slotCaptionResizeListener);
}
}
private boolean needsExpand() {
- return hasExpandRatio.size() > 0;
+ boolean canApplyExpand = (getWidget().vertical && !isUndefinedHeight())
+ || !isUndefinedWidth();
+ return hasExpandRatio.size() > 0 && canApplyExpand;
}
public void preLayout() {
// TODO refactor VCaption and use that instead: creates a tight coupling
// between this layout and Vaadin, but it's already coupled
public void setCaption(String captionText, String iconUrl,
- List<String> styles, String error, boolean required) {
+ List<String> styles, String error, boolean required,
+ boolean enabled) {
// TODO place for optimization: check if any of these have changed
// since last time, and only run those changes
icon = null;
}
- // Error
- if (error != null) {
- if (errorIcon == null) {
- errorIcon = DOM.createSpan();
- errorIcon.setClassName("v-errorindicator");
- }
- caption.appendChild(errorIcon);
- } else if (errorIcon != null) {
- errorIcon.removeFromParent();
- errorIcon = null;
- }
-
// Required
if (required) {
if (requiredIcon == null) {
requiredIcon = null;
}
- // Styles
+ // Error
+ if (error != null) {
+ if (errorIcon == null) {
+ errorIcon = DOM.createSpan();
+ errorIcon.setClassName("v-errorindicator");
+ }
+ caption.appendChild(errorIcon);
+ } else if (errorIcon != null) {
+ errorIcon.removeFromParent();
+ errorIcon = null;
+ }
+
if (caption != null) {
+ // Styles
caption.setClassName("v-caption");
if (styles != null) {
caption.addClassName("v-caption-" + style);
}
}
- }
- if (caption != null) {
+ if (enabled) {
+ caption.removeClassName("v-disabled");
+ } else {
+ caption.addClassName("v-disabled");
+ }
+
+ // Caption position
if (captionText != null || iconUrl != null) {
setCaptionPosition(CaptionPosition.TOP);
} else {
}
if (isExpanding) {
- if (isExpanding) {
- if (expandWrapper == null) {
- expandWrapper = DOM.createDiv();
- expandWrapper.setClassName("v-expand");
- for (; getElement().getChildCount() > 0;) {
- Node el = getElement().getChild(0);
- expandWrapper.appendChild(el);
- }
- getElement().appendChild(expandWrapper);
+ if (expandWrapper == null) {
+ expandWrapper = DOM.createDiv();
+ expandWrapper.setClassName("v-expand");
+ for (; getElement().getChildCount() > 0;) {
+ Node el = getElement().getChild(0);
+ expandWrapper.appendChild(el);
}
-
- int totalSize = 0;
- for (Widget w : getChildren()) {
- Slot slot = (Slot) w;
- if (slot.getExpandRatio() == -1) {
- if (layoutManager != null) {
- // TODO check caption position
- if (vertical) {
+ getElement().appendChild(expandWrapper);
+ }
+
+ int totalSize = 0;
+ for (Widget w : getChildren()) {
+ Slot slot = (Slot) w;
+ if (slot.getExpandRatio() == -1) {
+ if (layoutManager != null) {
+ // TODO check caption position
+ if (vertical) {
+ totalSize += layoutManager.getOuterHeight(slot
+ .getWidget().getElement())
+ - layoutManager.getMarginHeight(slot
+ .getWidget().getElement());
+ if (slot.hasCaption()) {
totalSize += layoutManager.getOuterHeight(slot
- .getWidget().getElement())
+ .getCaptionElement())
- layoutManager.getMarginHeight(slot
- .getWidget().getElement());
- if (slot.hasCaption()) {
- totalSize += layoutManager
- .getOuterHeight(slot
- .getCaptionElement())
- - layoutManager
- .getMarginHeight(slot
- .getCaptionElement());
- }
- } else {
- totalSize += layoutManager.getOuterWidth(slot
- .getWidget().getElement())
- - layoutManager.getMarginWidth(slot
- .getWidget().getElement());
+ .getCaptionElement());
}
} else {
- totalSize += vertical ? slot.getOffsetHeight()
- : slot.getOffsetWidth();
+ totalSize += layoutManager.getOuterWidth(slot
+ .getWidget().getElement())
+ - layoutManager.getMarginWidth(slot
+ .getWidget().getElement());
}
+ } else {
+ totalSize += vertical ? slot.getOffsetHeight() : slot
+ .getOffsetWidth();
}
- // TODO fails in Opera, always returns 0
- totalSize += slot.getSpacingSize(vertical);
}
-
- // When we set the margin to the first child, we don't need
- // overflow:hidden in the layout root element, since the wrapper
- // would otherwise be placed outside of the layout root element
- // and block events on elements below it.
- if (vertical) {
- expandWrapper.getStyle().setPaddingTop(totalSize, Unit.PX);
- expandWrapper.getFirstChildElement().getStyle()
- .setMarginTop(-totalSize, Unit.PX);
- } else {
- expandWrapper.getStyle().setPaddingLeft(totalSize, Unit.PX);
- expandWrapper.getFirstChildElement().getStyle()
- .setMarginLeft(-totalSize, Unit.PX);
- }
- recalculateExpands();
-
+ // TODO fails in Opera, always returns 0
+ totalSize += slot.getSpacingSize(vertical);
+ }
+
+ // When we set the margin to the first child, we don't need
+ // overflow:hidden in the layout root element, since the wrapper
+ // would otherwise be placed outside of the layout root element
+ // and block events on elements below it.
+ if (vertical) {
+ expandWrapper.getStyle().setPaddingTop(totalSize, Unit.PX);
+ expandWrapper.getFirstChildElement().getStyle()
+ .setMarginTop(-totalSize, Unit.PX);
+ } else {
+ expandWrapper.getStyle().setPaddingLeft(totalSize, Unit.PX);
+ expandWrapper.getFirstChildElement().getStyle()
+ .setMarginLeft(-totalSize, Unit.PX);
}
+
+ recalculateExpands();
}
}
public class EditTable extends Table implements Button.ClickListener {
- private Button addButton = new Button("Add new row",
- (Button.ClickListener) this);
+ private Button addButton = new Button("Add new row", this);
private String inputPrompt;
setPageLength(100);
setHeight("100%");
setSizeFull();
+ getLayout().setSizeFull();
addContainerProperty("id", Integer.class, null);
addContainerProperty("text", Component.class, null);
addContainerProperty("button", Button.class, null);
table.setSizeFull();
mainWindow.addComponent(table);
+ mainWindow.getContent().setSizeFull();
}
}
--- /dev/null
+package com.vaadin.tests.themes;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.terminal.WrappedRequest;
+import com.vaadin.tests.components.AbstractTestRoot;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.themes.LiferayTheme;
+
+@Theme("liferay")
+public class LiferayThemeTest extends AbstractTestRoot {
+
+ @Override
+ protected void setup(WrappedRequest request) {
+ Panel p = new Panel("Panel");
+ addComponent(p);
+ p.addComponent(new Label("Panel content"));
+
+ p = new Panel("Light Panel");
+ p.addStyleName(LiferayTheme.PANEL_LIGHT);
+ addComponent(p);
+ p.addComponent(new Label("Panel content"));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}