diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Choices.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Choices.java index ad8b5936f41..29b1316816a 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Choices.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Choices.java @@ -19,8 +19,8 @@ import java.util.Iterator; import org.apache.wicket.extensions.markup.html.form.palette.Palette; -import org.apache.wicket.markup.ComponentTag; -import org.apache.wicket.util.value.IValueMap; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.OnEventHeaderItem; /** @@ -44,19 +44,17 @@ public Choices(final String id, final Palette palette) super(id, palette); } - @Override - protected void onComponentTag(final ComponentTag tag) + public void renderHead(IHeaderResponse response) { - super.onComponentTag(tag); - IValueMap attrs = tag.getAttributes(); + super.renderHead(response); String onFocus = getPalette().getChoicesOnFocusJS(); if (onFocus != null) { - attrs.put("onfocus", onFocus); + response.render(OnEventHeaderItem.forComponent(this, "focus", onFocus)); } - tag.getAttributes().put("ondblclick", getPalette().getAddOnClickJS()); + response.render(OnEventHeaderItem.forComponent(this, "dblclick", getPalette().getAddOnClickJS())); } @Override diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Selection.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Selection.java index 68561ff1e93..096ba7d15a4 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Selection.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/Selection.java @@ -19,8 +19,8 @@ import java.util.Iterator; import org.apache.wicket.extensions.markup.html.form.palette.Palette; -import org.apache.wicket.markup.ComponentTag; -import org.apache.wicket.util.value.IValueMap; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.OnEventHeaderItem; /** @@ -45,18 +45,17 @@ public Selection(final String id, final Palette palette) } @Override - protected void onComponentTag(final ComponentTag tag) + public void renderHead(IHeaderResponse response) { - super.onComponentTag(tag); - IValueMap attrs = tag.getAttributes(); + super.renderHead(response); String onFocus = getPalette().getSelectionOnFocusJS(); if (onFocus != null) { - attrs.put("onfocus", onFocus); + response.render(OnEventHeaderItem.forComponent(this, "focus", onFocus)); } - tag.getAttributes().put("ondblclick", getPalette().getRemoveOnClickJS()); + response.render(OnEventHeaderItem.forComponent(this, "dblclick", getPalette().getRemoveOnClickJS())); } @Override