From 84f0ec29775df74b40cf13fb4f5875aa651640f1 Mon Sep 17 00:00:00 2001 From: Jani Laakso Date: Sun, 4 Feb 2007 13:38:27 +0000 Subject: [PATCH] Got rid of few NPEs svn changeset:445/svn branch:toolkit --- .../toolkit/demo/features/FeatureBrowser.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/com/itmill/toolkit/demo/features/FeatureBrowser.java b/src/com/itmill/toolkit/demo/features/FeatureBrowser.java index a14ede780f..2652c975a4 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureBrowser.java +++ b/src/com/itmill/toolkit/demo/features/FeatureBrowser.java @@ -44,7 +44,7 @@ public class FeatureBrowser extends CustomComponent implements private Feature currentFeature = null; private OrderedLayout layout; - + private Button propertiesSelect; private OrderedLayout right; @@ -169,7 +169,7 @@ public class FeatureBrowser extends CustomComponent implements right = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL); layout.addComponent(right); - propertiesSelect = new Button("Show properties",this); + propertiesSelect = new Button("Show properties", this); propertiesSelect.setSwitchMode(true); right.addComponent(propertiesSelect); properties = currentFeature.getPropertyPanel(); @@ -212,11 +212,13 @@ public class FeatureBrowser extends CustomComponent implements if (feature != null) { layout.replaceComponent(currentFeature, feature); currentFeature = feature; - right.replaceComponent(properties, feature - .getPropertyPanel()); properties = feature.getPropertyPanel(); - properties.setVisible(((Boolean)propertiesSelect.getValue()).booleanValue()); - + if (properties != null) { + right.replaceComponent(properties, feature + .getPropertyPanel()); + properties.setVisible(((Boolean) propertiesSelect + .getValue()).booleanValue()); + } getWindow() .setCaption( "IT Mill Toolkit Features / " @@ -230,6 +232,7 @@ public class FeatureBrowser extends CustomComponent implements } public void buttonClick(ClickEvent event) { - properties.setVisible(((Boolean)propertiesSelect.getValue()).booleanValue()); + properties.setVisible(((Boolean) propertiesSelect.getValue()) + .booleanValue()); } } -- 2.39.5