From 20c21ac90633b05061c81aadcbbd6d7aa1b938ce Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Mon, 15 Oct 2012 15:07:20 +0300 Subject: Fixed primary stylename handling in Form #9904 Change-Id: I2cd21b386f7276be9f9dee305e086e8258094bf7 --- client/src/com/vaadin/client/ui/form/VForm.java | 27 +++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'client/src') 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,18 +62,37 @@ 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())); -- cgit v1.2.3