diff options
author | Marc Englund <marc@vaadin.com> | 2012-10-15 12:32:31 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-10-15 12:32:31 +0000 |
commit | f04b6cbe134d3f1f66c885cd8ad9febef300a31c (patch) | |
tree | 8eca7e4b0a37592e3a25fdd61235700ae18be7e7 /client/src | |
parent | 754cf6a33685507cc3a7d5afeb761f227df66fb8 (diff) | |
parent | 20c21ac90633b05061c81aadcbbd6d7aa1b938ce (diff) | |
download | vaadin-framework-f04b6cbe134d3f1f66c885cd8ad9febef300a31c.tar.gz vaadin-framework-f04b6cbe134d3f1f66c885cd8ad9febef300a31c.zip |
Merge "Fixed primary stylename handling in Form #9904"
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/com/vaadin/client/ui/form/VForm.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/client/src/com/vaadin/client/ui/form/VForm.java b/client/src/com/vaadin/client/ui/form/VForm.java index 9b8dd80652..eb206e75b9 100644 --- a/client/src/com/vaadin/client/ui/form/VForm.java +++ b/client/src/com/vaadin/client/ui/form/VForm.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -62,19 +62,38 @@ public class VForm extends ComplexPanel implements KeyDownHandler { setStyleName(CLASSNAME); fieldSet.appendChild(legend); legend.appendChild(caption); - desc.setClassName("v-form-description"); + fieldSet.appendChild(desc); // Adding description for initial padding // measurements, removed later if no // description is set - fieldContainer.setClassName(CLASSNAME + "-content"); + fieldSet.appendChild(fieldContainer); errorMessage.setVisible(false); - errorMessage.setStyleName(CLASSNAME + "-errormessage"); + fieldSet.appendChild(errorMessage.getElement()); fieldSet.appendChild(footerContainer); } @Override + public void setStyleName(String style) { + super.setStyleName(style); + updateStyleNames(); + } + + @Override + public void setStylePrimaryName(String style) { + super.setStylePrimaryName(style); + updateStyleNames(); + } + + protected void updateStyleNames() { + fieldContainer.setClassName(getStylePrimaryName() + "-content"); + errorMessage.setStyleName(getStylePrimaryName() + "-errormessage"); + desc.setClassName(getStylePrimaryName() + "-description"); + footerContainer.setClassName(getStylePrimaryName() + "-footer"); + } + + @Override public void onKeyDown(KeyDownEvent event) { shortcutHandler.handleKeyboardEvent(Event.as(event.getNativeEvent())); } |