javauis/lcdui_qt/src/javax/microedition/lcdui/Item.java
changeset 79 2f468c1958d0
parent 61 bf7ee68962da
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Item.java	Fri Sep 17 08:28:21 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Item.java	Mon Oct 04 00:10:53 2010 +0300
@@ -170,7 +170,7 @@
     private ItemControlStateChangeListener controlListener;
 
     private Command defaultCommand;
-	private WeakReference wParent;
+    private Screen iParent = null;
 
     private int layout;
     private int lockedPrefWidth = -1;
@@ -188,14 +188,14 @@
      */
     void setParent(Screen parent)
     {
-    	if(parent != null)
-    	{
-    		wParent = new WeakReference(parent);
-    	}
-		else
-		{
-			clearParent();
-		}
+        if(parent != null)
+        {
+            iParent = parent;
+        }
+        else
+        {
+            clearParent();
+        }
     }
 
     /**
@@ -205,14 +205,14 @@
      */
     Screen getParent()
     {
-    	if(wParent != null)
-    	{
-    		return (Screen)wParent.get();
-    	}
-		else
-		{
-			return null;
-		}
+        if(iParent != null)
+        {
+            return iParent;
+        }
+        else
+        {
+            return null;
+        }
     }
 
     /**
@@ -221,11 +221,10 @@
      */
     void clearParent()
     {
-    	if(wParent != null)
-    	{
-    		wParent.clear();
-			wParent = null;
-    	}
+        if(iParent != null)
+        {
+            iParent = null;
+        }
     }
 
     /**
@@ -241,10 +240,10 @@
             throw new IllegalStateException(
                 MsgRepository.ITEM_EXCEPTION_OWNED_BY_ALERT);
         }
-    	if((newLabel == null) && (label == null))
-		{
-			return;
-		}
+        if((newLabel == null) && (label == null))
+        {
+            return;
+        }
         label = newLabel;
         updateParent(UPDATE_LABEL | UPDATE_SIZE_CHANGED);
     }
@@ -570,7 +569,7 @@
                 MsgRepository.ITEM_EXCEPTION_NOT_OWNED_BY_FORM);
         }
         // Notify item state listener
-        ((Form) getParent()).notifyItemStateChanged(this);
+        ((Form) iParent).notifyItemStateChanged(this);
     }
 
     /**
@@ -630,7 +629,7 @@
      */
     boolean isContainedInAlert()
     {
-        return ((wParent != null) && (getParent() instanceof Alert));
+        return ((iParent != null) && (iParent instanceof Alert));
     }
 
     /**
@@ -638,7 +637,7 @@
      */
     boolean isContainedInForm()
     {
-        return ((wParent != null) && (getParent() instanceof Form));
+        return ((iParent != null) && (iParent instanceof Form));
     }
 
     /**
@@ -672,7 +671,7 @@
         }
         if(isContainedInForm())
         {
-        	((Form) getParent()).updateItemState(this, updateReason, param);
+        	((Form) iParent).updateItemState(this, updateReason, param);
         }
     }