Skip to content

Commit

Permalink
NPE fix in form groups
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Sep 28, 2015
1 parent d15bf9b commit 08e9c05
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
Expand Up @@ -24,6 +24,7 @@
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.CheckBox;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

Expand Down Expand Up @@ -60,7 +61,13 @@ private void initLayout(IModel<String> label, final String tooltipKey, boolean i
labelContainer.add(l);

Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
tooltipLabel.add(new AttributeAppender("data-original-title", getString(tooltipKey)));
tooltipLabel.add(new AttributeAppender("data-original-title", new AbstractReadOnlyModel<String>() {

@Override
public String getObject() {
return getString(tooltipKey);
}
}));
tooltipLabel.add(new InfoTooltipBehavior(isTooltipInModal));
tooltipLabel.add(new VisibleEnableBehaviour(){

Expand Down
Expand Up @@ -27,6 +27,7 @@
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

Expand Down Expand Up @@ -68,10 +69,13 @@ private void initLayout(IModel<List<T>> choices, IChoiceRenderer<T> renderer, IM
labelContainer.add(l);

Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
if (StringUtils.isNotBlank(tooltipKey)) {
tooltipLabel.add(new AttributeAppender("data-original-title", new AbstractReadOnlyModel<String>() {

tooltipLabel.add(new AttributeAppender("data-original-title", getString(tooltipKey)));
@Override
public String getObject() {
return getString(tooltipKey);
}
}));
tooltipLabel.add(new InfoTooltipBehavior(isTooltipInModal));
tooltipLabel.add(new VisibleEnableBehaviour() {

Expand Down
Expand Up @@ -25,6 +25,7 @@
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

Expand Down Expand Up @@ -73,11 +74,14 @@ private void initLayout(IModel<String> label, final String tooltipKey, boolean i
}
labelContainer.add(l);


Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
if (StringUtils.isNotBlank(tooltipKey)) {
tooltipLabel.add(new AttributeAppender("data-original-title", getString(tooltipKey)));
tooltipLabel.add(new AttributeAppender("data-original-title", new AbstractReadOnlyModel<String>() {

@Override
public String getObject() {
return getString(tooltipKey);
}
}));
tooltipLabel.add(new InfoTooltipBehavior(isTooltipInModal));
tooltipLabel.add(new VisibleEnableBehaviour() {

Expand Down
Expand Up @@ -26,6 +26,7 @@
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

Expand Down Expand Up @@ -64,7 +65,13 @@ private void initLayout(IModel<String> label, final String tooltipKey, boolean i
labelContainer.add(l);

Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
tooltipLabel.add(new AttributeAppender("data-original-title", getString(tooltipKey)));
tooltipLabel.add(new AttributeAppender("data-original-title", new AbstractReadOnlyModel<String>() {

@Override
public String getObject() {
return getString(tooltipKey);
}
}));
tooltipLabel.add(new InfoTooltipBehavior(isTooltipInModal));
tooltipLabel.add(new VisibleEnableBehaviour(){

Expand Down

0 comments on commit 08e9c05

Please sign in to comment.