jhall-2.0_05

16:37:53.619 INFO  jd.cli.Main - Decompiling jhall-2.0_05.jar
package javax.help;

import com.sun.java.help.impl.LangElement;
import com.sun.java.help.impl.Parser;
import com.sun.java.help.impl.ParserEvent;
import com.sun.java.help.impl.ParserListener;
import com.sun.java.help.impl.Tag;
import com.sun.java.help.impl.TagProperties;
import java.io.IOException;
import java.io.PrintStream;
import java.io.Reader;
import java.util.Hashtable;
import java.util.Locale;
import java.util.Stack;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.MutableTreeNode;

class IndexView$IndexParser
  implements ParserListener
{
  private HelpSet currentParseHS;
  private Stack nodeStack;
  private Stack itemStack;
  private Stack tagStack;
  private Locale defaultLocale;
  private Locale lastLocale;
  private boolean startedindex;
  private TreeItemFactory factory;
  
  IndexView$IndexParser(TreeItemFactory paramTreeItemFactory)
  {
    factory = paramTreeItemFactory;
  }
  
  synchronized DefaultMutableTreeNode parse(Reader paramReader, HelpSet paramHelpSet, Locale paramLocale)
    throws IOException
  {
    nodeStack = new Stack();
    itemStack = new Stack();
    tagStack = new Stack();
    if (paramLocale == null) {
      defaultLocale = Locale.getDefault();
    } else {
      defaultLocale = paramLocale;
    }
    lastLocale = defaultLocale;
    
    DefaultMutableTreeNode localDefaultMutableTreeNode = new DefaultMutableTreeNode();
    nodeStack.push(localDefaultMutableTreeNode);
    
    currentParseHS = paramHelpSet;
    
    Parser localParser = new Parser(paramReader);
    localParser.addParserListener(this);
    localParser.parse();
    return localDefaultMutableTreeNode;
  }
  
  public void tagFound(ParserEvent paramParserEvent)
  {
    Locale localLocale = null;
    Tag localTag = paramParserEvent.getTag();
    TagProperties localTagProperties = atts;
    Object localObject1;
    if (localTagProperties != null)
    {
      localObject1 = localTagProperties.getProperty("xml:lang");
      localLocale = HelpUtilities.localeFromLang((String)localObject1);
    }
    if (localLocale == null) {
      localLocale = lastLocale;
    }
    if (name.equals("indexitem"))
    {
      if (!startedindex) {
        factory.reportMessage(HelpUtilities.getText("index.invalidIndexFormat"), false);
      }
      if ((isEnd) && (!isEmpty))
      {
        nodeStack.pop();
        itemStack.pop();
        removeTag(localTag);
        return;
      }
      localObject1 = null;
      try
      {
        Hashtable localHashtable = null;
        if (localTagProperties != null) {
          localHashtable = localTagProperties.getHashtable();
        }
        localObject1 = factory.createItem("indexitem", localHashtable, currentParseHS, localLocale);
      }
      catch (Exception localException)
      {
        if (IndexView.access$000())
        {
          localObject3 = null;
          if (localTagProperties != null) {
            localObject3 = localTagProperties.getProperty("target");
          }
          System.err.println("Failure in IndexItem Creation; ");
          System.err.println("  id: " + (String)localObject3);
          System.err.println("  hs: " + currentParseHS);
        }
        localObject1 = factory.createItem();
      }
      if (!itemStack.empty())
      {
        localObject2 = (IndexItem)itemStack.peek();
        if ((((TreeItem)localObject1).getExpansionType() == -1) && (localObject2 != null) && (((IndexItem)localObject2).getExpansionType() != -1)) {
          ((TreeItem)localObject1).setExpansionType(((IndexItem)localObject2).getExpansionType());
        }
      }
      Object localObject2 = new DefaultMutableTreeNode(localObject1);
      Object localObject3 = (DefaultMutableTreeNode)nodeStack.peek();
      
      ((DefaultMutableTreeNode)localObject3).add((MutableTreeNode)localObject2);
      if (!isEmpty)
      {
        itemStack.push(localObject1);
        nodeStack.push(localObject2);
        addTag(localTag, localLocale);
      }
    }
    else if (name.equals("index"))
    {
      if (!isEnd)
      {
        if (localTagProperties != null)
        {
          localObject1 = localTagProperties.getProperty("version");
          if ((localObject1 != null) && (((String)localObject1).compareTo("1.0") != 0) && (((String)localObject1).compareTo("2.0") != 0)) {
            factory.reportMessage(HelpUtilities.getText("index.unknownVersion", (String)localObject1), false);
          }
        }
        if (startedindex) {
          factory.reportMessage(HelpUtilities.getText("index.invalidIndexFormat"), false);
        }
        startedindex = true;
        addTag(localTag, localLocale);
      }
      else
      {
        if (startedindex) {
          startedindex = false;
        }
        removeTag(localTag);
      }
      return;
    }
  }
  
  public void piFound(ParserEvent paramParserEvent) {}
  
  public void doctypeFound(ParserEvent paramParserEvent)
  {
    factory.processDOCTYPE(paramParserEvent.getRoot(), paramParserEvent.getPublicId(), paramParserEvent.getSystemId());
  }
  
  public void textFound(ParserEvent paramParserEvent)
  {
    if (tagStack.empty()) {
      return;
    }
    LangElement localLangElement = (LangElement)tagStack.peek();
    Tag localTag = localLangElement.getTag();
    if (name.equals("indexitem"))
    {
      IndexItem localIndexItem = (IndexItem)itemStack.peek();
      String str = localIndexItem.getName();
      if (str == null) {
        localIndexItem.setName(paramParserEvent.getText().trim());
      } else {
        localIndexItem.setName(str.concat(paramParserEvent.getText()).trim());
      }
    }
  }
  
  public void commentFound(ParserEvent paramParserEvent) {}
  
  public void errorFound(ParserEvent paramParserEvent)
  {
    factory.reportMessage(paramParserEvent.getText(), false);
  }
  
  protected void addTag(Tag paramTag, Locale paramLocale)
  {
    LangElement localLangElement = new LangElement(paramTag, paramLocale);
    tagStack.push(localLangElement);
    if (lastLocale == null)
    {
      lastLocale = paramLocale;
      return;
    }
    if (paramLocale == null)
    {
      lastLocale = paramLocale;
      return;
    }
    if (!lastLocale.equals(paramLocale)) {
      lastLocale = paramLocale;
    }
  }
  
  protected void removeTag(Tag paramTag)
  {
    String str = name;
    Locale localLocale = null;
    while (!tagStack.empty())
    {
      LangElement localLangElement = (LangElement)tagStack.pop();
      if (!getTagname.equals(str)) {
        if (tagStack.empty())
        {
          localLocale = defaultLocale;
        }
        else
        {
          localLangElement = (LangElement)tagStack.peek();
          localLocale = localLangElement.getLocale();
        }
      }
    }
    if (lastLocale == null)
    {
      lastLocale = localLocale;
      return;
    }
    if (localLocale == null)
    {
      lastLocale = localLocale;
      return;
    }
    if (!lastLocale.equals(localLocale)) {
      lastLocale = localLocale;
    }
  }
}

/* Location:
 * Qualified Name:     javax.help.IndexView.IndexParser
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package javax.help;

import javax.accessibility.AccessibleRole;
import javax.swing.JComponent.AccessibleJComponent;

public class JHelpContentViewer$AccessibleJHelpContentViewer
  extends JComponent.AccessibleJComponent
{
  protected JHelpContentViewer$AccessibleJHelpContentViewer(JHelpContentViewer paramJHelpContentViewer)
  {
    super(paramJHelpContentViewer);
  }
  
  public AccessibleRole getAccessibleRole()
  {
    return AccessibleRole.PANEL;
  }
}

/* Location:
 * Qualified Name:     javax.help.JHelpContentViewer.AccessibleJHelpContentViewer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package javax.help;

import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.AWTEvent;
import java.awt.ActiveEvent;
import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.MenuComponent;
import java.awt.MenuItem;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.io.PrintStream;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Map;
import java.util.Vector;
import java.util.WeakHashMap;
import javax.swing.CellRendererPane;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JRootPane;
import javax.swing.JTable;
import javax.swing.JTree;
import javax.swing.ListCellRenderer;
import javax.swing.ListModel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;

public class CSH
{
  private static Map comps;
  private static Map parents;
  private static Vector managers = new Vector();
  private static final boolean debug = false;
  
  public static void addManager(Manager paramManager)
  {
    managers.add(paramManager);
  }
  
  public static void addManager(int paramInt, Manager paramManager)
  {
    managers.add(paramInt, paramManager);
  }
  
  public static boolean removeManager(Manager paramManager)
  {
    return managers.remove(paramManager);
  }
  
  public static void removeManager(int paramInt)
  {
    managers.remove(paramInt);
  }
  
  public static void removeAllManagers()
  {
    managers.clear();
  }
  
  public static Manager getManager(int paramInt)
  {
    return (Manager)managers.get(paramInt);
  }
  
  public static Manager[] getManagers()
  {
    return (Manager[])managers.toArray(new Manager[0]);
  }
  
  public static int getManagerCount()
  {
    return managers.size();
  }
  
  private static void _setHelpIDString(Object paramObject, String paramString)
  {
    if ((paramObject instanceof JComponent))
    {
      ((JComponent)paramObject).putClientProperty("HelpID", paramString);
    }
    else if (((paramObject instanceof Component)) || ((paramObject instanceof MenuItem)))
    {
      if (comps == null) {
        comps = new WeakHashMap(5);
      }
      Hashtable localHashtable = (Hashtable)comps.get(paramObject);
      if (localHashtable != null)
      {
        if (paramString != null)
        {
          localHashtable.put("HelpID", paramString);
        }
        else
        {
          localHashtable.remove("HelpID");
          if (localHashtable.isEmpty()) {
            comps.remove(paramObject);
          }
        }
      }
      else if (paramString != null)
      {
        localHashtable = new Hashtable(2);
        localHashtable.put("HelpID", paramString);
        comps.put(paramObject, localHashtable);
      }
    }
    else
    {
      throw new IllegalArgumentException("Invalid Component");
    }
  }
  
  private static String _getHelpIDString(Object paramObject)
  {
    String str = null;
    if (paramObject != null) {
      if ((paramObject instanceof JComponent)) {
        str = (String)((JComponent)paramObject).getClientProperty("HelpID");
      } else if (((paramObject instanceof Component)) || ((paramObject instanceof MenuItem)))
      {
        if (comps != null)
        {
          Hashtable localHashtable = (Hashtable)comps.get(paramObject);
          if (localHashtable != null) {
            str = (String)localHashtable.get("HelpID");
          }
        }
      }
      else {
        throw new IllegalArgumentException("Invalid Component");
      }
    }
    return str;
  }
  
  private static String _getHelpIDString(Object paramObject, AWTEvent paramAWTEvent)
  {
    String str = null;
    if (paramObject != null)
    {
      Manager[] arrayOfManager = getManagers();
      for (int i = 0; i < arrayOfManager.length; i++)
      {
        str = arrayOfManager[i].getHelpIDString(paramObject, paramAWTEvent);
        if (str != null) {
          return str;
        }
      }
    }
    return null;
  }
  
  private static Object getParent(Object paramObject)
  {
    if (paramObject == null) {
      return null;
    }
    Object localObject = null;
    if ((paramObject instanceof MenuComponent)) {
      localObject = ((MenuComponent)paramObject).getParent();
    } else if ((paramObject instanceof JPopupMenu)) {
      localObject = ((JPopupMenu)paramObject).getInvoker();
    } else if ((paramObject instanceof Component)) {
      localObject = ((Component)paramObject).getParent();
    } else {
      throw new IllegalArgumentException("Invalid Component");
    }
    if ((localObject == null) && (parents != null)) {
      localObject = parents.get(paramObject);
    }
    return localObject;
  }
  
  public static void setHelpIDString(Component paramComponent, String paramString)
  {
    _setHelpIDString(paramComponent, paramString);
  }
  
  public static void setHelpIDString(MenuItem paramMenuItem, String paramString)
  {
    _setHelpIDString(paramMenuItem, paramString);
  }
  
  public static String getHelpIDString(Object paramObject, AWTEvent paramAWTEvent)
  {
    if (paramObject == null) {
      return null;
    }
    String str = _getHelpIDString(paramObject, paramAWTEvent);
    if (str == null) {
      str = _getHelpIDString(paramObject);
    }
    if (str == null) {
      str = getHelpIDString(getParent(paramObject), paramAWTEvent);
    }
    return str;
  }
  
  public static String getHelpIDString(Component paramComponent)
  {
    return getHelpIDString(paramComponent, null);
  }
  
  public static String getHelpIDString(MenuItem paramMenuItem)
  {
    return getHelpIDString(paramMenuItem, null);
  }
  
  private static void _setHelpSet(Object paramObject, HelpSet paramHelpSet)
  {
    if ((paramObject instanceof JComponent))
    {
      ((JComponent)paramObject).putClientProperty("HelpSet", paramHelpSet);
    }
    else if (((paramObject instanceof Component)) || ((paramObject instanceof MenuItem)))
    {
      if (comps == null) {
        comps = new WeakHashMap(5);
      }
      Hashtable localHashtable = (Hashtable)comps.get(paramObject);
      if (localHashtable != null)
      {
        if (paramHelpSet != null)
        {
          localHashtable.put("HelpSet", paramHelpSet);
        }
        else
        {
          localHashtable.remove("HelpSet");
          if (localHashtable.isEmpty()) {
            comps.remove(paramObject);
          }
        }
      }
      else if (paramHelpSet != null)
      {
        localHashtable = new Hashtable(2);
        localHashtable.put("HelpSet", paramHelpSet);
        comps.put(paramObject, localHashtable);
      }
    }
    else
    {
      throw new IllegalArgumentException("Invalid Component");
    }
  }
  
  private static HelpSet _getHelpSet(Object paramObject)
  {
    HelpSet localHelpSet = null;
    if (paramObject != null) {
      if ((paramObject instanceof JComponent)) {
        localHelpSet = (HelpSet)((JComponent)paramObject).getClientProperty("HelpSet");
      } else if (((paramObject instanceof Component)) || ((paramObject instanceof MenuItem)))
      {
        if (comps != null)
        {
          Hashtable localHashtable = (Hashtable)comps.get(paramObject);
          if (localHashtable != null) {
            localHelpSet = (HelpSet)localHashtable.get("HelpSet");
          }
        }
      }
      else {
        throw new IllegalArgumentException("Invalid Component");
      }
    }
    return localHelpSet;
  }
  
  private static HelpSet _getHelpSet(Object paramObject, AWTEvent paramAWTEvent)
  {
    HelpSet localHelpSet = null;
    if (paramObject != null)
    {
      Manager[] arrayOfManager = getManagers();
      for (int i = 0; i < arrayOfManager.length; i++)
      {
        localHelpSet = arrayOfManager[i].getHelpSet(paramObject, paramAWTEvent);
        if (localHelpSet != null) {
          return localHelpSet;
        }
      }
    }
    return localHelpSet;
  }
  
  public static void setHelpSet(Component paramComponent, HelpSet paramHelpSet)
  {
    _setHelpSet(paramComponent, paramHelpSet);
  }
  
  public static void setHelpSet(MenuItem paramMenuItem, HelpSet paramHelpSet)
  {
    _setHelpSet(paramMenuItem, paramHelpSet);
  }
  
  public static HelpSet getHelpSet(Object paramObject, AWTEvent paramAWTEvent)
  {
    if (paramObject == null) {
      return null;
    }
    String str = _getHelpIDString(paramObject, paramAWTEvent);
    if (str == null) {
      str = _getHelpIDString(paramObject);
    }
    if (str != null)
    {
      HelpSet localHelpSet = _getHelpSet(paramObject, paramAWTEvent);
      if (localHelpSet == null) {
        localHelpSet = _getHelpSet(paramObject);
      }
      return localHelpSet;
    }
    return getHelpSet(getParent(paramObject), paramAWTEvent);
  }
  
  public static HelpSet getHelpSet(Component paramComponent)
  {
    return getHelpSet(paramComponent, null);
  }
  
  public static HelpSet getHelpSet(MenuItem paramMenuItem)
  {
    return getHelpSet(paramMenuItem, null);
  }
  
  public static Object trackCSEvents()
  {
    MouseEvent localMouseEvent = getMouseEvent();
    if (localMouseEvent != null) {
      return getDeepestObjectAt(localMouseEvent.getSource(), localMouseEvent.getX(), localMouseEvent.getY());
    }
    return null;
  }
  
  private static void displayHelp(HelpBroker paramHelpBroker, HelpSet paramHelpSet, String paramString1, String paramString2, Object paramObject1, Object paramObject2, AWTEvent paramAWTEvent)
  {
    Presentation localPresentation = null;
    Object localObject3;
    if (paramHelpBroker != null)
    {
      if ((paramHelpBroker instanceof DefaultHelpBroker)) {
        ((DefaultHelpBroker)paramHelpBroker).setActivationObject(paramObject2);
      }
    }
    else
    {
      localObject3 = new Class[] { HelpSet.class, String.class };
      
      Object[] arrayOfObject = { paramHelpSet, paramString2 };
      try
      {
        localObject1 = paramHelpSet.getLoader();
        if (localObject1 == null) {
          localObject2 = Class.forName(paramString1);
        } else {
          localObject2 = ((ClassLoader)localObject1).loadClass(paramString1);
        }
        Method localMethod = ((Class)localObject2).getMethod("getPresentation", (Class[])localObject3);
        localPresentation = (Presentation)localMethod.invoke(null, arrayOfObject);
      }
      catch (Exception localException2)
      {
        throw new RuntimeException("error invoking presentation");
      }
      if (localPresentation == null) {
        return;
      }
      if ((localPresentation instanceof WindowPresentation)) {
        ((WindowPresentation)localPresentation).setActivationObject(paramObject2);
      }
      if (((localPresentation instanceof Popup)) && ((paramObject1 instanceof Component))) {
        ((Popup)localPresentation).setInvoker((Component)paramObject1);
      }
    }
    Object localObject1 = null;
    Object localObject2 = null;
    localObject1 = getHelpIDString(paramObject1, paramAWTEvent);
    localObject2 = getHelpSet(paramObject1, paramAWTEvent);
    if (localObject2 == null) {
      if (paramHelpBroker != null) {
        localObject2 = paramHelpBroker.getHelpSet();
      } else {
        localObject2 = paramHelpSet;
      }
    }
    try
    {
      localObject3 = Map.ID.create((String)localObject1, (HelpSet)localObject2);
      if (localObject3 == null) {
        localObject3 = ((HelpSet)localObject2).getHomeID();
      }
      if (paramHelpBroker != null)
      {
        paramHelpBroker.setCurrentID((Map.ID)localObject3);
        paramHelpBroker.setDisplayed(true);
      }
      else
      {
        localPresentation.setCurrentID((Map.ID)localObject3);
        localPresentation.setDisplayed(true);
      }
    }
    catch (Exception localException1)
    {
      localException1.printStackTrace();
    }
  }
  
  private static MouseEvent getMouseEvent()
  {
    try
    {
      if (EventQueue.isDispatchThread())
      {
        EventQueue localEventQueue = null;
        try
        {
          localEventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
        }
        catch (Exception localException)
        {
          debug(localException);
        }
        if (localEventQueue == null) {
          return null;
        }
        int i = -1;
        for (;;)
        {
          i++;
          AWTEvent localAWTEvent = localEventQueue.getNextEvent();
          Object localObject1 = localAWTEvent.getSource();
          if ((localAWTEvent instanceof ActiveEvent))
          {
            ((ActiveEvent)localAWTEvent).dispatch();
          }
          else if ((localObject1 instanceof Component))
          {
            Object localObject2;
            if ((localAWTEvent instanceof KeyEvent))
            {
              localObject2 = (KeyEvent)localAWTEvent;
              if ((((KeyEvent)localObject2).getKeyCode() == 3) || (((KeyEvent)localObject2).getKeyCode() == 27))
              {
                ((KeyEvent)localObject2).consume();
                return null;
              }
              ((KeyEvent)localObject2).consume();
            }
            else if ((localAWTEvent instanceof MouseEvent))
            {
              localObject2 = (MouseEvent)localAWTEvent;
              int j = ((MouseEvent)localObject2).getID();
              if (((j == 500) || (j == 501) || (j == 502)) && (SwingUtilities.isLeftMouseButton((MouseEvent)localObject2)))
              {
                if ((j == 500) && 
                  (i == 0))
                {
                  dispatchEvent(localAWTEvent);
                }
                else
                {
                  ((MouseEvent)localObject2).consume();
                  return (MouseEvent)localObject2;
                }
              }
              else {
                ((MouseEvent)localObject2).consume();
              }
            }
            else
            {
              dispatchEvent(localAWTEvent);
            }
          }
          else if ((localObject1 instanceof MenuComponent))
          {
            if ((localAWTEvent instanceof InputEvent)) {
              ((InputEvent)localAWTEvent).consume();
            }
          }
          else
          {
            System.err.println("unable to dispatch event: " + localAWTEvent);
          }
        }
      }
    }
    catch (InterruptedException localInterruptedException)
    {
      debug(localInterruptedException);
    }
    debug("Fall Through code");
    return null;
  }
  
  private static void dispatchEvent(AWTEvent paramAWTEvent)
  {
    Object localObject = paramAWTEvent.getSource();
    if ((paramAWTEvent instanceof ActiveEvent)) {
      ((ActiveEvent)paramAWTEvent).dispatch();
    } else if ((localObject instanceof Component)) {
      ((Component)localObject).dispatchEvent(paramAWTEvent);
    } else if ((localObject instanceof MenuComponent)) {
      ((MenuComponent)localObject).dispatchEvent(paramAWTEvent);
    } else {
      System.err.println("unable to dispatch event: " + paramAWTEvent);
    }
  }
  
  private static Object getDeepestObjectAt(Object paramObject, int paramInt1, int paramInt2)
  {
    if ((paramObject instanceof Container))
    {
      Container localContainer = (Container)paramObject;
      
      Component localComponent = findComponentAt(localContainer, localContainer.getWidth(), localContainer.getHeight(), paramInt1, paramInt2);
      if ((localComponent != null) && (localComponent != localContainer))
      {
        if ((localComponent instanceof JRootPane))
        {
          JLayeredPane localJLayeredPane = ((JRootPane)localComponent).getLayeredPane();
          Rectangle localRectangle = localJLayeredPane.getBounds();
          localComponent = (Component)getDeepestObjectAt(localJLayeredPane, paramInt1 - x, paramInt2 - y);
        }
        if (localComponent != null) {
          return localComponent;
        }
      }
    }
    return paramObject;
  }
  
  private static Component findComponentAt(Container paramContainer, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    synchronized (paramContainer.getTreeLock())
    {
      if ((paramInt3 < 0) || (paramInt3 >= paramInt1) || (paramInt4 < 0) || (paramInt4 >= paramInt2) || (!paramContainer.isVisible()) || (!paramContainer.isEnabled())) {
        return null;
      }
      Component[] arrayOfComponent = paramContainer.getComponents();
      int i = paramContainer.getComponentCount();
      Object localObject1;
      Rectangle localRectangle;
      Component localComponent;
      for (int j = 0; j < i; j++)
      {
        localObject1 = arrayOfComponent[j];
        localRectangle = null;
        if ((localObject1 instanceof CellRendererPane))
        {
          localComponent = getComponentAt((CellRendererPane)localObject1, paramInt3, paramInt4);
          if (localComponent != null)
          {
            localRectangle = getRectangleAt((CellRendererPane)localObject1, paramInt3, paramInt4);
            localObject1 = localComponent;
          }
        }
        if ((localObject1 != null) && (!((Component)localObject1).isLightweight()))
        {
          if ((localRectangle == null) || (width == 0) || (height == 0)) {
            localRectangle = ((Component)localObject1).getBounds();
          }
          if ((localObject1 instanceof Container)) {
            localObject1 = findComponentAt((Container)localObject1, width, height, paramInt3 - x, paramInt4 - y);
          } else {
            localObject1 = ((Component)localObject1).getComponentAt(paramInt3 - x, paramInt4 - y);
          }
          if ((localObject1 != null) && (((Component)localObject1).isVisible()) && (((Component)localObject1).isEnabled())) {
            return (Component)localObject1;
          }
        }
      }
      for (j = 0; j < i; j++)
      {
        localObject1 = arrayOfComponent[j];
        localRectangle = null;
        if ((localObject1 instanceof CellRendererPane))
        {
          localComponent = getComponentAt((CellRendererPane)localObject1, paramInt3, paramInt4);
          if (localComponent != null)
          {
            localRectangle = getRectangleAt((CellRendererPane)localObject1, paramInt3, paramInt4);
            localObject1 = localComponent;
          }
        }
        if ((localObject1 != null) && (((Component)localObject1).isLightweight()))
        {
          if ((localRectangle == null) || (width == 0) || (height == 0)) {
            localRectangle = ((Component)localObject1).getBounds();
          }
          if ((localObject1 instanceof Container)) {
            localObject1 = findComponentAt((Container)localObject1, width, height, paramInt3 - x, paramInt4 - y);
          } else {
            localObject1 = ((Component)localObject1).getComponentAt(paramInt3 - x, paramInt4 - y);
          }
          if ((localObject1 != null) && (((Component)localObject1).isVisible()) && (((Component)localObject1).isEnabled())) {
            return (Component)localObject1;
          }
        }
      }
      return paramContainer;
    }
  }
  
  private static Rectangle getRectangleAt(CellRendererPane paramCellRendererPane, int paramInt1, int paramInt2)
  {
    Rectangle localRectangle = null;
    Container localContainer = paramCellRendererPane.getParent();
    if ((localContainer instanceof JTable)) {
      localRectangle = getRectangleAt((JTable)localContainer, paramInt1, paramInt2);
    } else if ((localContainer instanceof JTableHeader)) {
      localRectangle = getRectangleAt((JTableHeader)localContainer, paramInt1, paramInt2);
    } else if ((localContainer instanceof JTree)) {
      localRectangle = getRectangleAt((JTree)localContainer, paramInt1, paramInt2);
    } else if ((localContainer instanceof JList)) {
      localRectangle = getRectangleAt((JList)localContainer, paramInt1, paramInt2);
    }
    return localRectangle;
  }
  
  private static Component getComponentAt(CellRendererPane paramCellRendererPane, int paramInt1, int paramInt2)
  {
    Component localComponent = null;
    Container localContainer = paramCellRendererPane.getParent();
    if ((localContainer instanceof JTable)) {
      localComponent = getComponentAt((JTable)localContainer, paramInt1, paramInt2);
    } else if ((localContainer instanceof JTableHeader)) {
      localComponent = getComponentAt((JTableHeader)localContainer, paramInt1, paramInt2);
    } else if ((localContainer instanceof JTree)) {
      localComponent = getComponentAt((JTree)localContainer, paramInt1, paramInt2);
    } else if ((localContainer instanceof JList)) {
      localComponent = getComponentAt((JList)localContainer, paramInt1, paramInt2);
    }
    if (localComponent != null)
    {
      if (parents == null) {
        parents = new WeakHashMap(4)
        {
          public Object put(Object paramAnonymousObject1, Object paramAnonymousObject2)
          {
            return super.put(paramAnonymousObject1, new WeakReference(paramAnonymousObject2));
          }
          
          public Object get(Object paramAnonymousObject)
          {
            WeakReference localWeakReference = (WeakReference)super.get(paramAnonymousObject);
            if (localWeakReference != null) {
              return localWeakReference.get();
            }
            return null;
          }
        };
      }
      parents.put(localComponent, paramCellRendererPane);
    }
    return localComponent;
  }
  
  private static Rectangle getRectangleAt(JTableHeader paramJTableHeader, int paramInt1, int paramInt2)
  {
    Rectangle localRectangle = null;
    try
    {
      int i = paramJTableHeader.columnAtPoint(new Point(paramInt1, paramInt2));
      localRectangle = paramJTableHeader.getHeaderRect(i);
    }
    catch (Exception localException) {}
    return localRectangle;
  }
  
  private static Component getComponentAt(JTableHeader paramJTableHeader, int paramInt1, int paramInt2)
  {
    try
    {
      if ((!paramJTableHeader.contains(paramInt1, paramInt2)) || (!paramJTableHeader.isVisible()) || (!paramJTableHeader.isEnabled())) {
        return null;
      }
      TableColumnModel localTableColumnModel = paramJTableHeader.getColumnModel();
      int i = localTableColumnModel.getColumnIndexAtX(paramInt1);
      TableColumn localTableColumn = localTableColumnModel.getColumn(i);
      
      TableCellRenderer localTableCellRenderer = localTableColumn.getHeaderRenderer();
      if (localTableCellRenderer == null) {
        localTableCellRenderer = paramJTableHeader.getDefaultRenderer();
      }
      return localTableCellRenderer.getTableCellRendererComponent(paramJTableHeader.getTable(), localTableColumn.getHeaderValue(), false, false, -1, i);
    }
    catch (Exception localException) {}
    return null;
  }
  
  private static Rectangle getRectangleAt(JTable paramJTable, int paramInt1, int paramInt2)
  {
    Rectangle localRectangle = null;
    try
    {
      Point localPoint = new Point(paramInt1, paramInt2);
      int i = paramJTable.rowAtPoint(localPoint);
      int j = paramJTable.columnAtPoint(localPoint);
      localRectangle = paramJTable.getCellRect(i, j, true);
    }
    catch (Exception localException) {}
    return localRectangle;
  }
  
  private static Component getComponentAt(JTable paramJTable, int paramInt1, int paramInt2)
  {
    try
    {
      if ((!paramJTable.contains(paramInt1, paramInt2)) || (!paramJTable.isVisible()) || (!paramJTable.isEnabled())) {
        return null;
      }
      Point localPoint = new Point(paramInt1, paramInt2);
      int i = paramJTable.rowAtPoint(localPoint);
      int j = paramJTable.columnAtPoint(localPoint);
      if ((paramJTable.isEditing()) && (paramJTable.getEditingRow() == i) && (paramJTable.getEditingColumn() == j)) {
        return null;
      }
      TableCellRenderer localTableCellRenderer = paramJTable.getCellRenderer(i, j);
      return paramJTable.prepareRenderer(localTableCellRenderer, i, j);
    }
    catch (Exception localException) {}
    return null;
  }
  
  private static Rectangle getRectangleAt(JTree paramJTree, int paramInt1, int paramInt2)
  {
    Rectangle localRectangle = null;
    try
    {
      TreePath localTreePath = paramJTree.getPathForLocation(paramInt1, paramInt2);
      localRectangle = paramJTree.getPathBounds(localTreePath);
    }
    catch (Exception localException) {}
    return localRectangle;
  }
  
  private static Component getComponentAt(JTree paramJTree, int paramInt1, int paramInt2)
  {
    try
    {
      TreePath localTreePath = paramJTree.getPathForLocation(paramInt1, paramInt2);
      if ((paramJTree.isEditing()) && (paramJTree.getSelectionPath() == localTreePath)) {
        return null;
      }
      int i = paramJTree.getRowForPath(localTreePath);
      Object localObject = localTreePath.getLastPathComponent();
      boolean bool1 = paramJTree.isRowSelected(i);
      boolean bool2 = paramJTree.isExpanded(localTreePath);
      boolean bool3 = paramJTree.getModel().isLeaf(localObject);
      boolean bool4 = (paramJTree.hasFocus()) && (paramJTree.getLeadSelectionRow() == i);
      
      return paramJTree.getCellRenderer().getTreeCellRendererComponent(paramJTree, localObject, bool1, bool2, bool3, i, bool4);
    }
    catch (Exception localException) {}
    return null;
  }
  
  private static Rectangle getRectangleAt(JList paramJList, int paramInt1, int paramInt2)
  {
    Rectangle localRectangle = null;
    try
    {
      int i = paramJList.locationToIndex(new Point(paramInt1, paramInt2));
      localRectangle = paramJList.getCellBounds(i, i);
    }
    catch (Exception localException) {}
    return localRectangle;
  }
  
  private static Component getComponentAt(JList paramJList, int paramInt1, int paramInt2)
  {
    try
    {
      int i = paramJList.locationToIndex(new Point(paramInt1, paramInt2));
      Object localObject = paramJList.getModel().getElementAt(i);
      boolean bool1 = paramJList.isSelectedIndex(i);
      boolean bool2 = (paramJList.hasFocus()) && (paramJList.getLeadSelectionIndex() == i);
      
      return paramJList.getCellRenderer().getListCellRendererComponent(paramJList, localObject, i, bool1, bool2);
    }
    catch (Exception localException) {}
    return null;
  }
  
  public static class DisplayHelpFromFocus
    implements ActionListener
  {
    private HelpBroker hb = null;
    private HelpSet hs = null;
    private String presentation = null;
    private String presentationName = null;
    
    public DisplayHelpFromFocus(HelpBroker paramHelpBroker)
    {
      if (paramHelpBroker == null) {
        throw new NullPointerException("hb");
      }
      hb = paramHelpBroker;
    }
    
    public DisplayHelpFromFocus(HelpSet paramHelpSet, String paramString1, String paramString2)
    {
      if (paramHelpSet == null) {
        throw new NullPointerException("hs");
      }
      try
      {
        ClassLoader localClassLoader = paramHelpSet.getLoader();
        Class localClass;
        if (localClassLoader == null) {
          localClass = Class.forName(paramString1);
        } else {
          localClass = localClassLoader.loadClass(paramString1);
        }
      }
      catch (Exception localException)
      {
        throw new IllegalArgumentException(paramString1 + "presentation  invalid");
      }
      presentation = paramString1;
      presentationName = paramString2;
      hs = paramHelpSet;
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      Component localComponent1 = (Component)paramActionEvent.getSource();
      if ((hb instanceof DefaultHelpBroker)) {
        ((DefaultHelpBroker)hb).setActivationObject(localComponent1);
      }
      Component localComponent2 = CSH.findFocusOwner(localComponent1);
      
      CSH.debug("focusOwner:" + localComponent2);
      if (localComponent2 == null) {
        localComponent2 = localComponent1;
      }
      CSH.displayHelp(hb, hs, presentation, presentationName, localComponent2, localComponent2, paramActionEvent);
    }
  }
  
  private static JPopupMenu getRootPopupMenu(JPopupMenu paramJPopupMenu)
  {
    while ((paramJPopupMenu != null) && ((paramJPopupMenu.getInvoker() instanceof JMenu)) && ((paramJPopupMenu.getInvoker().getParent() instanceof JPopupMenu))) {
      paramJPopupMenu = (JPopupMenu)paramJPopupMenu.getInvoker().getParent();
    }
    return paramJPopupMenu;
  }
  
  private static Component findFocusOwner(JPopupMenu paramJPopupMenu)
  {
    if (paramJPopupMenu == null) {
      return null;
    }
    synchronized (paramJPopupMenu.getTreeLock())
    {
      if (!paramJPopupMenu.isVisible()) {
        return null;
      }
      Object localObject1 = null;
      int i = 0;
      for (int j = paramJPopupMenu.getComponentCount(); i < j; i++)
      {
        Component localComponent = paramJPopupMenu.getComponent(i);
        if (localComponent.hasFocus())
        {
          localObject1 = localComponent;
          break;
        }
        if (((localComponent instanceof JMenu)) && (((JMenu)localComponent).isPopupMenuVisible())) {
          localObject1 = localComponent;
        }
        if (((localComponent instanceof JMenuItem)) && (((JMenuItem)localComponent).isArmed())) {
          localObject1 = localComponent;
        }
      }
      if ((localObject1 instanceof JMenu)) {
        localObject1 = findFocusOwner(((JMenu)localObject1).getPopupMenu());
      }
      if (localObject1 != null) {
        return (Component)localObject1;
      }
    }
    return paramJPopupMenu;
  }
  
  private static Component findFocusOwner(Component paramComponent)
  {
    synchronized (paramComponent.getTreeLock())
    {
      if ((paramComponent instanceof JPopupMenu)) {
        return findFocusOwner(getRootPopupMenu((JPopupMenu)paramComponent));
      }
      if (paramComponent.hasFocus()) {
        return paramComponent;
      }
      if ((paramComponent instanceof Container))
      {
        int i = 0;
        for (int j = ((Container)paramComponent).getComponentCount(); i < j; i++)
        {
          Component localComponent = findFocusOwner(((Container)paramComponent).getComponent(i));
          if (localComponent != null) {
            return localComponent;
          }
        }
      }
      return null;
    }
  }
  
  private static void debug(Object paramObject) {}
  
  public static class DisplayHelpAfterTracking
    implements ActionListener
  {
    private HelpBroker hb = null;
    private HelpSet hs = null;
    private String presentation = null;
    private String presentationName = null;
    private Hashtable cursors;
    
    public DisplayHelpAfterTracking(HelpBroker paramHelpBroker)
    {
      if (paramHelpBroker == null) {
        throw new NullPointerException("hb");
      }
      hb = paramHelpBroker;
    }
    
    public DisplayHelpAfterTracking(HelpSet paramHelpSet, String paramString1, String paramString2)
    {
      if (paramHelpSet == null) {
        throw new NullPointerException("hs");
      }
      try
      {
        ClassLoader localClassLoader = paramHelpSet.getLoader();
        Class localClass;
        if (localClassLoader == null) {
          localClass = Class.forName(paramString1);
        } else {
          localClass = localClassLoader.loadClass(paramString1);
        }
      }
      catch (Exception localException)
      {
        throw new IllegalArgumentException(paramString1 + "presentation  invalid");
      }
      presentation = paramString1;
      presentationName = paramString2;
      hs = paramHelpSet;
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      SwingHelpUtilities.installUIDefaults();
  
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd