Author: dandre
Date: Fri Oct 11 00:10:17 2013
New Revision: 4610

Log:
* Search tooltip blueprint first then fallback to complete: allows user to 
customize blueprint used

Modified:
   trunk/AncestrisCore/core/src/ancestris/view/BpToolTip.java
   trunk/AncestrisCore/modules.views.tree/src/genj/tree/TreeView.java

Modified: trunk/AncestrisCore/core/src/ancestris/view/BpToolTip.java
==============================================================================
--- trunk/AncestrisCore/core/src/ancestris/view/BpToolTip.java  (original)
+++ trunk/AncestrisCore/core/src/ancestris/view/BpToolTip.java  Fri Oct 11 
00:10:17 2013
@@ -101,18 +101,6 @@
 
     @Override
     public void paintComponent(Graphics g) {
-
-        // set the parent to not be opaque
-        Component parent = this.getParent();
-        if (parent != null) {
-            if (parent instanceof JComponent) {
-                JComponent jparent = (JComponent) parent;
-                if (jparent.isOpaque()) {
-                    jparent.setOpaque(false);
-                }
-            }
-        }
-
         if (entity == null || renderer == null) {
             return;
         }
@@ -128,6 +116,7 @@
         g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                 RenderingHints.VALUE_ANTIALIAS_ON);
         g2.setColor(Color.WHITE);
+        g2.fill(getBounds());
         g2.fill(round);
 
 // draw the gray border
@@ -139,8 +128,8 @@
 
 // draw the blueprint
         g2.setColor(Color.BLACK);
-        g.setFont(RenderOptions.getInstance().getDefaultFont());
-        renderer.render(g, entity, new Rectangle(4, 4, getWidth() - 9, 
getHeight() - 9));
+        g2.setFont(RenderOptions.getInstance().getDefaultFont());
+        renderer.render(g2, entity, new Rectangle(4, 4, getWidth() - 9, 
getHeight() - 9));
     }
 
     /**
@@ -148,10 +137,12 @@
      */
     private Blueprint getBlueprint(String tag) {
         Blueprint result = type2blueprint.get(tag);
-        if (result == null) {
+        if (result != null && "tooltip".equals(result.getName()))
+            return result;
+        result = BlueprintManager.getInstance().getBlueprint(tag, "tooltip");
+        if (result == null)
             result = BlueprintManager.getInstance().getBlueprint(tag, 
"complete");
-            type2blueprint.put(tag, result);
-        }
+        type2blueprint.put(tag, result);
         return result;
     }
 

Modified: trunk/AncestrisCore/modules.views.tree/src/genj/tree/TreeView.java
==============================================================================
--- trunk/AncestrisCore/modules.views.tree/src/genj/tree/TreeView.java  
(original)
+++ trunk/AncestrisCore/modules.views.tree/src/genj/tree/TreeView.java  Fri Oct 
11 00:10:17 2013
@@ -920,8 +920,6 @@
 
         @Override
         public JToolTip createToolTip() {
-            tt.setEntity(getEntityAt(TreeView.this.getMousePosition()));
-            tt.setComponent(this);
             return tt;
         }
 
@@ -929,9 +927,11 @@
         @Override
         public String getToolTipText(MouseEvent event) {
             Point pos = TreeView.this.getMousePosition();
-            if (pos == null) return "";
-            Entity entity = getEntityAt(pos);
-            if (entity == null) return "";
+            Entity entity = null;
+            if (pos != null)
+                entity = getEntityAt(pos);
+            tt.setEntity(entity);
+            if (entity == null) return null;
             return entity.getId();
         }
         

---------------------------------------------------------------------
Site Web Ancestris : http://www.ancestris.org

<*> Pour vous desinscrire de cette liste, envoyez un mail a :
              [email protected]
<*> Pour obtenir de l'aide sur les commandes de la liste :
              [email protected]

Pour obtenir tous les messages lies a ce fil de discussion, cliquez sur le 
lien ci-dessous, cela ouvrira votre logiciel de messagerie. Il vous suffira 
d'envoyer le message :
              [email protected]

Reply via email to