Change-Id: I9fb2d2df699e6942408cb17b7857b703c0d9a16fpull/60/head
@@ -85,8 +85,7 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, | |||
*/ | |||
private boolean blurOccured = false; | |||
/** For internal use only. May be removed or replaced in the future. */ | |||
public boolean htmlContentAllowed = false; | |||
private boolean htmlContentAllowed = false; | |||
private boolean wasHtmlContentAllowed = false; | |||
private boolean wasMultiselect = false; | |||
@@ -136,7 +135,7 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, | |||
final UIDL opUidl = (UIDL) it.next(); | |||
String itemHtml = opUidl.getStringAttribute("caption"); | |||
if (!htmlContentAllowed) { | |||
if (!isHtmlContentAllowed()) { | |||
itemHtml = WidgetUtil.escapeHTML(itemHtml); | |||
} | |||
@@ -151,7 +150,7 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, | |||
// Need to recreate object if isMultiselect is changed (#10451) | |||
// OR if htmlContentAllowed changed due to Safari 5 issue | |||
if ((op == null) || (htmlContentAllowed != wasHtmlContentAllowed) | |||
if ((op == null) || (isHtmlContentAllowed() != wasHtmlContentAllowed) | |||
|| (isMultiselect() != wasMultiselect)) { | |||
// Create a new element | |||
if (isMultiselect()) { | |||
@@ -193,7 +192,7 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, | |||
} | |||
} | |||
wasHtmlContentAllowed = htmlContentAllowed; | |||
wasHtmlContentAllowed = isHtmlContentAllowed(); | |||
wasMultiselect = isMultiselect(); | |||
} | |||
@@ -308,4 +307,12 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, | |||
}); | |||
} | |||
} | |||
public boolean isHtmlContentAllowed() { | |||
return htmlContentAllowed; | |||
} | |||
public void setHtmlContentAllowed(boolean htmlContentAllowed) { | |||
this.htmlContentAllowed = htmlContentAllowed; | |||
} | |||
} |
@@ -26,7 +26,6 @@ import com.vaadin.client.UIDL; | |||
import com.vaadin.client.ui.VOptionGroup; | |||
import com.vaadin.shared.EventId; | |||
import com.vaadin.shared.ui.Connect; | |||
import com.vaadin.shared.ui.optiongroup.OptionGroupConstants; | |||
import com.vaadin.shared.ui.optiongroup.OptionGroupState; | |||
import com.vaadin.ui.OptionGroup; | |||
@@ -35,9 +34,6 @@ public class OptionGroupConnector extends OptionGroupBaseConnector { | |||
@Override | |||
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { | |||
getWidget().htmlContentAllowed = uidl | |||
.hasAttribute(OptionGroupConstants.HTML_CONTENT_ALLOWED); | |||
super.updateFromUIDL(uidl, client); | |||
getWidget().sendFocusEvents = client.hasEventListeners(this, |
@@ -44,7 +44,6 @@ public class OptionGroup extends AbstractSelect implements | |||
FieldEvents.BlurNotifier, FieldEvents.FocusNotifier { | |||
private Set<Object> disabledItemIds = new HashSet<Object>(); | |||
private boolean htmlContentAllowed = false; | |||
public OptionGroup() { | |||
super(); | |||
@@ -62,14 +61,6 @@ public class OptionGroup extends AbstractSelect implements | |||
super(caption); | |||
} | |||
@Override | |||
public void paintContent(PaintTarget target) throws PaintException { | |||
if (isHtmlContentAllowed()) { | |||
target.addAttribute(OptionGroupConstants.HTML_CONTENT_ALLOWED, true); | |||
} | |||
super.paintContent(target); | |||
} | |||
@Override | |||
protected void paintItem(PaintTarget target, Object itemId) | |||
throws PaintException { | |||
@@ -242,8 +233,7 @@ public class OptionGroup extends AbstractSelect implements | |||
* text | |||
*/ | |||
public void setHtmlContentAllowed(boolean htmlContentAllowed) { | |||
this.htmlContentAllowed = htmlContentAllowed; | |||
markAsDirty(); | |||
getState().htmlContentAllowed = htmlContentAllowed; | |||
} | |||
/** | |||
@@ -254,7 +244,7 @@ public class OptionGroup extends AbstractSelect implements | |||
* @see #setHtmlContentAllowed(boolean) | |||
*/ | |||
public boolean isHtmlContentAllowed() { | |||
return htmlContentAllowed; | |||
return getState(false).htmlContentAllowed; | |||
} | |||
@Override | |||
@@ -293,4 +283,9 @@ public class OptionGroup extends AbstractSelect implements | |||
protected OptionGroupState getState() { | |||
return (OptionGroupState) super.getState(); | |||
} | |||
@Override | |||
protected OptionGroupState getState(boolean markAsDirty) { | |||
return (OptionGroupState) super.getState(markAsDirty); | |||
} | |||
} |
@@ -18,7 +18,6 @@ package com.vaadin.shared.ui.optiongroup; | |||
import java.io.Serializable; | |||
public class OptionGroupConstants implements Serializable { | |||
public static final String HTML_CONTENT_ALLOWED = "usehtml"; | |||
public static final String ATTRIBUTE_OPTION_DISABLED = "disabled"; | |||
} |
@@ -15,6 +15,7 @@ | |||
*/ | |||
package com.vaadin.shared.ui.optiongroup; | |||
import com.vaadin.shared.annotations.DelegateToWidget; | |||
import com.vaadin.shared.ui.select.AbstractSelectState; | |||
/** | |||
@@ -26,4 +27,7 @@ public class OptionGroupState extends AbstractSelectState { | |||
{ | |||
primaryStyleName = "v-select-optiongroup"; | |||
} | |||
@DelegateToWidget | |||
public boolean htmlContentAllowed = false; | |||
} |