[libbluray-devel] HStaticText, HStaticIcon: properly store default look

Ian Curtis git at videolan.org
Tue Apr 15 18:36:28 CEST 2014


libbluray | branch: master | Ian Curtis <i.curtis at gmail.com> | Tue Apr 15 15:27:04 2014 +0300| [1392ed8cc2c67ff01382accb8a7d8d372b607d6c] | committer: hpi1

HStaticText, HStaticIcon: properly store default look

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=1392ed8cc2c67ff01382accb8a7d8d372b607d6c
---

 src/libbluray/bdj/java/org/havi/ui/HStaticIcon.java |   17 ++++++++---------
 src/libbluray/bdj/java/org/havi/ui/HStaticText.java |   12 +++++-------
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/libbluray/bdj/java/org/havi/ui/HStaticIcon.java b/src/libbluray/bdj/java/org/havi/ui/HStaticIcon.java
index 3979230..1233e48 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HStaticIcon.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HStaticIcon.java
@@ -20,6 +20,7 @@
 package org.havi.ui;
 
 import java.awt.Image;
+import org.videolan.BDJXletContext;
 
 public class HStaticIcon extends HVisible implements HNoInputPreferred {
     public HStaticIcon()
@@ -41,25 +42,23 @@ public class HStaticIcon extends HVisible implements HNoInputPreferred {
 
     public void setLook(HLook hlook) throws HInvalidLookException
     {
-        if ((hlook != null) && !(hlook instanceof HGraphicLook)) throw new HInvalidLookException();
+        if ((hlook != null) && !(hlook instanceof HGraphicLook)) {
+            throw new HInvalidLookException();
+        }
         super.setLook(hlook);
     }
 
     public static void setDefaultLook(HGraphicLook hlook)
     {
-        //TODO double check this
-        DefaultLook = hlook;
+        BDJXletContext.setXletDefaultLook(PROPERTY_LOOK,hlook);
     }
 
     public static HGraphicLook getDefaultLook()
     {
-        //TODO and this
-        if (DefaultLook == null)
-            org.videolan.Logger.unimplemented("", "getDefaultLook");
-        return DefaultLook;
+        return (HGraphicLook) BDJXletContext.getXletDefaultLook(PROPERTY_LOOK,DEFAULT_LOOK);
     }
 
-    private static HGraphicLook DefaultLook = null;
-
+    private static final String PROPERTY_LOOK = "HStaticIcon";
+    static final Class DEFAULT_LOOK = HGraphicLook.class;
     private static final long serialVersionUID = 2015589998794748072L;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HStaticText.java b/src/libbluray/bdj/java/org/havi/ui/HStaticText.java
index 5614cef..5ef2e2b 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HStaticText.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HStaticText.java
@@ -23,6 +23,7 @@ package org.havi.ui;
 import java.awt.Color;
 import java.awt.Font;
 
+import org.videolan.BDJXletContext;
 import org.videolan.Logger;
 
 public class HStaticText extends HVisible implements HNoInputPreferred {
@@ -74,19 +75,16 @@ public class HStaticText extends HVisible implements HNoInputPreferred {
 
     public static void setDefaultLook(HTextLook hlook)
     {
-        DefaultLook = hlook;
+        BDJXletContext.setXletDefaultLook(PROPERTY_LOOK,hlook);
     }
 
     public static HTextLook getDefaultLook()
     {
-        if (DefaultLook == null)
-            DefaultLook = new HTextLook();
-        return DefaultLook;
+        return (HTextLook) BDJXletContext.getXletDefaultLook(PROPERTY_LOOK,DEFAULT_LOOK);
     }
 
-    private static HTextLook DefaultLook = null;
-
+    static final Class DEFAULT_LOOK = HGraphicLook.class;
+    private static final String PROPERTY_LOOK = HStaticText.class.getName();
     private static final Logger logger = Logger.getLogger(HStaticText.class.getName());
-
     private static final long serialVersionUID = 4352450387189482885L;
 }



More information about the libbluray-devel mailing list