com-sun-tools-visualvm-uisupport

16:34:05.884 INFO  jd.cli.Main - Decompiling com-sun-tools-visualvm-uisupport.jar
package com.sun.tools.visualvm.uisupport;

import javax.swing.text.BadLocationException;
import javax.swing.text.JTextComponent;
import javax.swing.text.NavigationFilter;
import javax.swing.text.NavigationFilter.FilterBypass;
import javax.swing.text.Position.Bias;

class HTMLLabel$1
  extends NavigationFilter
{
  HTMLLabel$1(HTMLLabel paramHTMLLabel) {}
  
  public void moveDot(NavigationFilter.FilterBypass fb, int dot, Position.Bias bias)
  {
    super.moveDot(fb, 0, bias);
  }
  
  public void setDot(NavigationFilter.FilterBypass fb, int dot, Position.Bias bias)
  {
    super.setDot(fb, 0, bias);
  }
  
  public int getNextVisualPositionFrom(JTextComponent text, int pos, Position.Bias bias, int direction, Position.Bias[] biasRet)
    throws BadLocationException
  {
    return 0;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.HTMLLabel.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Font;
import java.net.URL;
import javax.swing.JEditorPane;
import javax.swing.UIManager;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkEvent.EventType;
import javax.swing.event.HyperlinkListener;
import javax.swing.text.BadLocationException;
import javax.swing.text.JTextComponent;
import javax.swing.text.NavigationFilter;
import javax.swing.text.NavigationFilter.FilterBypass;
import javax.swing.text.Position.Bias;
import javax.swing.text.html.HTMLEditorKit;

public class HTMLLabel
  extends JEditorPane
  implements HyperlinkListener
{
  public HTMLLabel()
  {
    setEditorKit(new HTMLEditorKit());
    setEditable(false);
    setOpaque(false);
    setNavigationFilter(new NavigationFilter()
    {
      public void moveDot(NavigationFilter.FilterBypass fb, int dot, Position.Bias bias)
      {
        super.moveDot(fb, 0, bias);
      }
      
      public void setDot(NavigationFilter.FilterBypass fb, int dot, Position.Bias bias)
      {
        super.setDot(fb, 0, bias);
      }
      
      public int getNextVisualPositionFrom(JTextComponent text, int pos, Position.Bias bias, int direction, Position.Bias[] biasRet)
        throws BadLocationException
      {
        return 0;
      }
    });
    setFont(UIManager.getFont("Label.font"));
    addHyperlinkListener(this);
  }
  
  public HTMLLabel(String text)
  {
    this();
    setText(text);
  }
  
  public void setText(String value)
  {
    Font font = getFont();
    Color textColor = getForeground();
    
    value = value.replaceAll("\\n\\r|\\r\\n|\\n|\\r", "<br>");
    value = value.replace("<code>", "<code style=\"font-size: " + font.getSize() + "pt;\">");
    
    String colorText = "rgb(" + textColor.getRed() + "," + textColor.getGreen() + "," + textColor.getBlue() + ")";
    super.setText("<html><body text=\"" + colorText + "\" style=\"font-size: " + font.getSize() + "pt; font-family: " + font.getName() + ";\">" + value + "</body></html>");
  }
  
  public void hyperlinkUpdate(HyperlinkEvent e)
  {
    if (!isEnabled()) {
      return;
    }
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
      showURL(e.getURL());
    } else if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) {
      setCursor(Cursor.getPredefinedCursor(12));
    } else if (e.getEventType() == HyperlinkEvent.EventType.EXITED) {
      setCursor(Cursor.getDefaultCursor());
    }
  }
  
  protected void showURL(URL url) {}
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.HTMLLabel
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;

class HTMLTextArea$1
  implements HierarchyListener
{
  HTMLTextArea$1(HTMLTextArea paramHTMLTextArea) {}
  
  public void hierarchyChanged(HierarchyEvent e)
  {
    if (((e.getChangeFlags() & 0x4) != 0L) && 
      (this$0.isShowing()) && (HTMLTextArea.access$100(this$0) != null)) {
      this$0.setText(HTMLTextArea.access$100(this$0));
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.HTMLTextArea.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class HTMLTextArea$2
  implements ActionListener
{
  HTMLTextArea$2(HTMLTextArea paramHTMLTextArea) {}
  
  public void actionPerformed(ActionEvent e)
  {
    if (e.getSource() == HTMLTextArea.access$200(this$0)) {
      this$0.cut();
    } else if (e.getSource() == HTMLTextArea.access$300(this$0)) {
      this$0.copy();
    } else if (e.getSource() == HTMLTextArea.access$400(this$0)) {
      this$0.paste();
    } else if (e.getSource() == HTMLTextArea.access$500(this$0)) {
      this$0.deleteSelection();
    } else if (e.getSource() == HTMLTextArea.access$600(this$0)) {
      this$0.selectAll();
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.HTMLTextArea.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.io.IOException;
import java.io.Writer;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Element;
import javax.swing.text.StyleConstants;
import javax.swing.text.html.HTML.Tag;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLWriter;

class HTMLTextArea$ExtendedHTMLWriter
  extends HTMLWriter
{
  public HTMLTextArea$ExtendedHTMLWriter(Writer w, HTMLDocument doc, int pos, int len)
  {
    super(w, doc, pos, len);
    setLineLength(Integer.MAX_VALUE);
  }
  
  protected boolean isSupportedBreakFlowTag(AttributeSet attr)
  {
    Object o = attr.getAttribute(StyleConstants.NameAttribute);
    if ((o instanceof HTML.Tag))
    {
      HTML.Tag tag = (HTML.Tag)o;
      if ((tag == HTML.Tag.HTML) || (tag == HTML.Tag.HEAD) || (tag == HTML.Tag.BODY) || (tag == HTML.Tag.HR)) {
        return false;
      }
      return tag.breaksFlow();
    }
    return false;
  }
  
  protected void emptyTag(Element elem)
    throws BadLocationException, IOException
  {
    if (isSupportedBreakFlowTag(elem.getAttributes())) {
      writeLineSeparator();
    }
    if (matchNameAttribute(elem.getAttributes(), HTML.Tag.CONTENT)) {
      text(elem);
    }
  }
  
  protected void endTag(Element elem)
    throws IOException
  {
    if (isSupportedBreakFlowTag(elem.getAttributes())) {
      writeLineSeparator();
    }
  }
  
  protected void startTag(Element elem)
    throws IOException, BadLocationException
  {}
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.HTMLTextArea.ExtendedHTMLWriter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.io.StringWriter;
import javax.swing.JComponent;
import javax.swing.TransferHandler;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.html.HTMLDocument;

class HTMLTextArea$HTMLTextAreaTransferHandler
  extends TransferHandler
{
  private HTMLTextArea$HTMLTextAreaTransferHandler(HTMLTextArea paramHTMLTextArea) {}
  
  public void exportToClipboard(JComponent comp, Clipboard clip, int action)
  {
    try
    {
      int selStart = this$0.getSelectionStart();
      int selLength = this$0.getSelectionEnd() - selStart;
      
      StringWriter plainTextWriter = new StringWriter();
      try
      {
        new HTMLTextArea.ExtendedHTMLWriter(plainTextWriter, (HTMLDocument)this$0.getDocument(), selStart, selLength).write();
      }
      catch (Exception e) {}
      String plainText = HTMLTextArea.NcrToUnicode.decode(plainTextWriter.toString());
      clip.setContents(new StringSelection(plainText), null);
      if (action == 2) {
        this$0.getDocument().remove(selStart, selLength);
      }
    }
    catch (BadLocationException ble) {}
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.HTMLTextArea.HTMLTextAreaTransferHandler
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.util.Hashtable;
import java.util.Map;

class HTMLTextArea$NcrToUnicode
{
  private static Map entities;
  
  public static String decode(String str)
  {
    StringBuffer ostr = new StringBuffer();
    int i1 = 0;
    int i2 = 0;
    while (i2 < str.length())
    {
      i1 = str.indexOf("&", i2);
      if (i1 == -1)
      {
        ostr.append(str.substring(i2, str.length()));
        
        break;
      }
      ostr.append(str.substring(i2, i1));
      i2 = str.indexOf(";", i1);
      if (i2 == -1)
      {
        ostr.append(str.substring(i1, str.length()));
        
        break;
      }
      String tok = str.substring(i1 + 1, i2);
      if (tok.charAt(0) == '#')
      {
        if (tok.equals("#160"))
        {
          ostr.append((String)getEntities().get("nbsp"));
        }
        else
        {
          tok = tok.substring(1);
          try
          {
            int radix = 10;
            if (tok.trim().charAt(0) == 'x')
            {
              radix = 16;
              tok = tok.substring(1, tok.length());
            }
            ostr.append((char)Integer.parseInt(tok, radix));
          }
          catch (NumberFormatException exp)
          {
            ostr.append('?');
          }
        }
      }
      else
      {
        tok = (String)getEntities().get(tok);
        if (tok != null) {
          ostr.append(tok);
        } else {
          ostr.append('?');
        }
      }
      i2++;
    }
    return ostr.toString();
  }
  
  private static synchronized Map getEntities()
  {
    if (entities == null)
    {
      entities = new Hashtable();
      
      entities.put("quot", "\"");
      
      entities.put("amp", "&");
      
      entities.put("lt", "<");
      
      entities.put("gt", ">");
      
      entities.put("nbsp", " ");
      
      entities.put("iexcl", "�");
      
      entities.put("cent", "�");
      
      entities.put("pound", "�");
      
      entities.put("curren", "�");
      
      entities.put("yen", "�");
      
      entities.put("brvbar", "�");
      
      entities.put("sect", "�");
      
      entities.put("uml", "�");
      
      entities.put("copy", "�");
      
      entities.put("ordf", "�");
      
      entities.put("laquo", "�");
      
      entities.put("not", "�");
      
      entities.put("shy", "�");
      
      entities.put("reg", "�");
      
      entities.put("macr", "�");
      
      entities.put("deg", "�");
      
      entities.put("plusmn", "�");
      
      entities.put("sup2", "�");
      
      entities.put("sup3", "�");
      
      entities.put("acute", "�");
      
      entities.put("micro", "�");
      
      entities.put("para", "�");
      
      entities.put("middot", "�");
      
      entities.put("cedil", "�");
      
      entities.put("sup1", "�");
      
      entities.put("ordm", "�");
      
      entities.put("raquo", "�");
      
      entities.put("frac14", "�");
      
      entities.put("frac12", "�");
      
      entities.put("frac34", "�");
      
      entities.put("iquest", "�");
      
      entities.put("Agrave", "�");
      
      entities.put("Aacute", "�");
      
      entities.put("Acirc", "�");
      
      entities.put("Atilde", "�");
      
      entities.put("Auml", "�");
      
      entities.put("Aring", "�");
      
      entities.put("AElig", "�");
      
      entities.put("Ccedil", "�");
      
      entities.put("Egrave", "�");
      
      entities.put("Eacute", "�");
      
      entities.put("Ecirc", "�");
      
      entities.put("Euml", "�");
      
      entities.put("Igrave", "�");
      
      entities.put("Iacute", "�");
      
      entities.put("Icirc", "�");
      
      entities.put("Iuml", "�");
      
      entities.put("ETH", "�");
      
      entities.put("Ntilde", "�");
      
      entities.put("Ograve", "�");
      
      entities.put("Oacute", "�");
      
      entities.put("Ocirc", "�");
      
      entities.put("Otilde", "�");
      
      entities.put("Ouml", "�");
      
      entities.put("times", "�");
      
      entities.put("Oslash", "�");
      
      entities.put("Ugrave", "�");
      
      entities.put("Uacute", "�");
      
      entities.put("Ucirc", "�");
      
      entities.put("Uuml", "�");
      
      entities.put("Yacute", "�");
      
      entities.put("THORN", "�");
      
      entities.put("szlig", "�");
      
      entities.put("agrave", "�");
      
      entities.put("aacute", "�");
      
      entities.put("acirc", "�");
      
      entities.put("atilde", "�");
      
      entities.put("auml", "�");
      
      entities.put("aring", "�");
      
      entities.put("aelig", "�");
      
      entities.put("ccedil", "�");
      
      entities.put("egrave", "�");
      
      entities.put("eacute", "�");
      
      entities.put("ecirc", "�");
      
      entities.put("euml", "�");
      
      entities.put("igrave", "�");
      
      entities.put("iacute", "�");
      
      entities.put("icirc", "�");
      
      entities.put("iuml", "�");
      
      entities.put("eth", "�");
      
      entities.put("ntilde", "�");
      
      entities.put("ograve", "�");
      
      entities.put("oacute", "�");
      
      entities.put("ocirc", "�");
      
      entities.put("otilde", "�");
      
      entities.put("ouml", "�");
      
      entities.put("divide", "�");
      
      entities.put("oslash", "�");
      
      entities.put("ugrave", "�");
      
      entities.put("uacute", "�");
      
      entities.put("ucirc", "�");
      
      entities.put("uuml", "�");
      
      entities.put("yacute", "�");
      
      entities.put("thorn", "�");
      
      entities.put("yuml", "�");
    }
    return entities;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.HTMLTextArea.NcrToUnicode
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.net.URL;
import java.util.Hashtable;
import java.util.Map;
import java.util.ResourceBundle;
import javax.swing.JComponent;
import javax.swing.JEditorPane;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.TransferHandler;
import javax.swing.UIManager;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkEvent.EventType;
import javax.swing.event.HyperlinkListener;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.EditorKit;
import javax.swing.text.Element;
import javax.swing.text.StyleConstants;
import javax.swing.text.html.HTML.Tag;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.HTMLWriter;
import org.netbeans.lib.profiler.ui.UIUtils;

public class HTMLTextArea
  extends JEditorPane
  implements HyperlinkListener, MouseListener
{
  private static class ExtendedHTMLWriter
    extends HTMLWriter
  {
    public ExtendedHTMLWriter(Writer w, HTMLDocument doc, int pos, int len)
    {
      super(doc, pos, len);
      setLineLength(Integer.MAX_VALUE);
    }
    
    protected boolean isSupportedBreakFlowTag(AttributeSet attr)
    {
      Object o = attr.getAttribute(StyleConstants.NameAttribute);
      if ((o instanceof HTML.Tag))
      {
        HTML.Tag tag = (HTML.Tag)o;
        if ((tag == HTML.Tag.HTML) || (tag == HTML.Tag.HEAD) || (tag == HTML.Tag.BODY) || (tag == HTML.Tag.HR)) {
          return false;
        }
        return tag.breaksFlow();
      }
      return false;
    }
    
    protected void emptyTag(Element elem)
      throws BadLocationException, IOException
    {
      if (isSupportedBreakFlowTag(elem.getAttributes())) {
        writeLineSeparator();
      }
      if (matchNameAttribute(elem.getAttributes(), HTML.Tag.CONTENT)) {
        text(elem);
      }
    }
    
    protected void endTag(Element elem)
      throws IOException
    {
      if (isSupportedBreakFlowTag(elem.getAttributes())) {
        writeLineSeparator();
      }
    }
    
    protected void startTag(Element elem)
      throws IOException, BadLocationException
    {}
  }
  
  private class HTMLTextAreaTransferHandler
    extends TransferHandler
  {
    private HTMLTextAreaTransferHandler() {}
    
    public void exportToClipboard(JComponent comp, Clipboard clip, int action)
    {
      try
      {
        int selStart = getSelectionStart();
        int selLength = getSelectionEnd() - selStart;
        
        StringWriter plainTextWriter = new StringWriter();
        try
        {
          new HTMLTextArea.ExtendedHTMLWriter(plainTextWriter, (HTMLDocument)getDocument(), selStart, selLength).write();
        }
        catch (Exception e) {}
        String plainText = HTMLTextArea.NcrToUnicode.decode(plainTextWriter.toString());
        clip.setContents(new StringSelection(plainText), null);
        if (action == 2) {
          getDocument().remove(selStart, selLength);
        }
      }
      catch (BadLocationException ble) {}
    }
  }
  
  private static class NcrToUnicode
  {
    private static Map entities;
    
    public static String decode(String str)
    {
      StringBuffer ostr = new StringBuffer();
      int i1 = 0;
      int i2 = 0;
      while (i2 < str.length())
      {
        i1 = str.indexOf("&", i2);
        if (i1 == -1)
        {
          ostr.append(str.substring(i2, str.length()));
          
          break;
        }
        ostr.append(str.substring(i2, i1));
        i2 = str.indexOf(";", i1);
        if (i2 == -1)
        {
          ostr.append(str.substring(i1, str.length()));
          
          break;
        }
        String tok = str.substring(i1 + 1, i2);
        if (tok.charAt(0) == '#')
        {
          if (tok.equals("#160"))
          {
            ostr.append((String)getEntities().get("nbsp"));
          }
          else
          {
            tok = tok.substring(1);
            try
            {
              int radix = 10;
              if (tok.trim().charAt(0) == 'x')
              {
                radix = 16;
                tok = tok.substring(1, tok.length());
              }
              ostr.append((char)Integer.parseInt(tok, radix));
            }
            catch (NumberFormatException exp)
            {
              ostr.append('?');
            }
          }
        }
        else
        {
          tok = (String)getEntities().get(tok);
          if (tok != null) {
            ostr.append(tok);
          } else {
            ostr.append('?');
          }
        }
        i2++;
      }
      return ostr.toString();
    }
    
    private static synchronized Map getEntities()
    {
      if (entities == null)
      {
        entities = new Hashtable();
        
        entities.put("quot", "\"");
        
        entities.put("amp", "&");
        
        entities.put("lt", "<");
        
        entities.put("gt", ">");
        
        entities.put("nbsp", " ");
        
        entities.put("iexcl", "�");
        
        entities.put("cent", "�");
        
        entities.put("pound", "�");
        
        entities.put("curren", "�");
        
        entities.put("yen", "�");
        
        entities.put("brvbar", "�");
        
        entities.put("sect", "�");
        
        entities.put("uml", "�");
        
        entities.put("copy", "�");
        
        entities.put("ordf", "�");
        
        entities.put("laquo", "�");
        
        entities.put("not", "�");
        
        entities.put("shy", "�");
        
        entities.put("reg", "�");
        
        entities.put("macr", "�");
        
        entities.put("deg", "�");
        
        entities.put("plusmn", "�");
        
        entities.put("sup2", "�");
        
        entities.put("sup3", "�");
        
        entities.put("acute", "�");
        
        entities.put("micro", "�");
        
        entities.put("para", "�");
        
        entities.put("middot", "�");
        
        entities.put("cedil", "�");
        
        entities.put("sup1", "�");
        
        entities.put("ordm", "�");
        
        entities.put("raquo", "�");
        
        entities.put("frac14", "�");
        
        entities.put("frac12", "�");
        
        entities.put("frac34", "�");
        
        entities.put("iquest", "�");
        
        entities.put("Agrave", "�");
        
        entities.put("Aacute", "�");
        
        entities.put("Acirc", "�");
        
        entities.put("Atilde", "�");
        
        entities.put("Auml", "�");
        
        entities.put("Aring", "�");
        
        entities.put("AElig", "�");
        
        entities.put("Ccedil", "�");
        
        entities.put("Egrave", "�");
        
        entities.put("Eacute", "�");
        
        entities.put("Ecirc", "�");
        
        entities.put("Euml", "�");
        
        entities.put("Igrave", "�");
        
        entities.put("Iacute", "�");
        
        entities.put("Icirc", "�");
        
        entities.put("Iuml", "�");
        
        entities.put("ETH", "�");
        
        entities.put("Ntilde", "�");
        
        entities.put("Ograve", "�");
        
        entities.put("Oacute", "�");
        
        entities.put("Ocirc", "�");
        
        entities.put("Otilde", "�");
        
        entities.put("Ouml", "�");
        
        entities.put("times", "�");
        
        entities.put("Oslash", "�");
        
        entities.put("Ugrave", "�");
        
        entities.put("Uacute", "�");
        
        entities.put("Ucirc", "�");
        
        entities.put("Uuml", "�");
        
        entities.put("Yacute", "�");
        
        entities.put("THORN", "�");
        
        entities.put("szlig", "�");
        
        entities.put("agrave", "�");
        
        entities.put("aacute", "�");
        
        entities.put("acirc", "�");
        
        entities.put("atilde", "�");
        
        entities.put("auml", "�");
        
        entities.put("aring", "�");
        
        entities.put("aelig", "�");
        
        entities.put("ccedil", "�");
        
        entities.put("egrave", "�");
        
        entities.put("eacute", "�");
        
        entities.put("ecirc", "�");
        
        entities.put("euml", "�");
        
        entities.put("igrave", "�");
        
        entities.put("iacute", "�");
        
        entities.put("icirc", "�");
        
        entities.put("iuml", "�");
        
        entities.put("eth", "�");
        
        entities.put("ntilde", "�");
        
        entities.put("ograve", "�");
        
        entities.put("oacute", "�");
        
        entities.put("ocirc", "�");
        
        entities.put("otilde", "�");
        
        entities.put("ouml", "�");
        
        entities.put("divide", "�");
        
        entities.put("oslash", "�");
        
        entities.put("ugrave", "�");
        
        entities.put("uacute", "�");
        
        entities.put("ucirc", "�");
        
        entities.put("uuml", "�");
        
        entities.put("yacute", "�");
        
        entities.put("thorn", "�");
        
        entities.put("yuml", "�");
      }
      return entities;
    }
  }
  
  private static final ResourceBundle messages = ResourceBundle.getBundle("org.netbeans.lib.profiler.ui.components.Bundle");
  private static final String CUT_STRING = messages.getString("HTMLTextArea_CutString");
  private static final String COPY_STRING = messages.getString("HTMLTextArea_CopyString");
  private static final String PASTE_STRING = messages.getString("HTMLTextArea_PasteString");
  private static final String DELETE_STRING = messages.getString("HTMLTextArea_DeleteString");
  private static final String SELECT_ALL_STRING = messages.getString("HTMLTextArea_SelectAllString");
  private ActionListener popupListener;
  private JMenuItem itemCopy;
  private JMenuItem itemCut;
  private JMenuItem itemDelete;
  private JMenuItem itemPaste;
  private JMenuItem itemSelectAll;
  private JPopupMenu popupMenu;
  private boolean showPopup = true;
  private String pendingText;
  private String currentText;
  private boolean forceSetText;
  
  public HTMLTextArea()
  {
    setEditorKit(new HTMLEditorKit());
    setEditable(false);
    setOpaque(true);
    setAutoscrolls(true);
    addHyperlinkListener(this);
    setTransferHandler(new HTMLTextAreaTransferHandler(null));
    setFont(UIManager.getFont("Label.font"));
    setBackground(UIUtils.getProfilerResultsBackground());
    addMouseListener(this);
    
    addHierarchyListener(new HierarchyListener()
    {
      public void hierarchyChanged(HierarchyEvent e)
      {
        if (((e.getChangeFlags() & 0x4) != 0L) && 
          (isShowing()) && (pendingText != null)) {
          setText(pendingText);
        }
      }
    });
  }
  
  public HTMLTextArea(String text)
  {
    this();
    setText(text);
  }
  
  public void setForeground(Color color)
  {
    Color foreground = getForeground();
    if ((foreground != null) && (foreground.equals(color))) {
      return;
    }
    super.setForeground(color);
    forceSetText = true;
    setText(getText());
  }
  
  public void setShowPopup(boolean showPopup)
  {
    this.showPopup = showPopup;
  }
  
  public boolean getShowPopup()
  {
    return showPopup;
  }
  
  public void setText(String value)
  {
    if (value == null) {
      return;
    }
    if ((!isShowing()) && (!forceSetText))
    {
      pendingText = value;
    }
    else
    {
      if ((!forceSetText) && (value.equals(currentText))) {
        return;
      }
      currentText = value;
      pendingText = null;
      
      Font font = getFont();
      Color textColor = getForeground();
      value = value.replaceAll("\\n\\r|\\r\\n|\\n|\\r", "<br>");
      value = value.replace("<code>", "<code style=\"font-size: " + font.getSize() + "pt;\">");
      
      String colorText = "rgb(" + textColor.getRed() + "," + textColor.getGreen() + "," + textColor.getBlue() + ")";
      String newText = "<html><body text=\"" + colorText + "\" style=\"font-size: " + font.getSize() + "pt; font-family: " + font.getName() + ";\">" + value + "</body></html>";
      
      setDocument(getEditorKit().createDefaultDocument());
      super.setText(newText);
    }
    forceSetText = false;
  }
  
  public String getText()
  {
    return pendingText != null ? pendingText : currentText;
  }
  
  public Dimension getMinimumSize()
  {
    if (pendingText != null)
    {
      forceSetText = true;
      setText(pendingText);
    }
    return super.getMinimumSize();
  }
  
  public Dimension getPreferredSize()
  {
    if (pendingText != null)
    {
      forceSetText = true;
      setText(pendingText);
    }
    return super.getPreferredSize();
  }
  
  public Dimension getMaximumSize()
  {
    if (pendingText != null)
    {
      forceSetText = true;
      setText(pendingText);
    }
    return super.getMaximumSize();
  }
  
  public void deleteSelection()
  {
    try
    {
      getDocument().remove(getSelectionStart(), getSelectionEnd() - getSelectionStart());
    }
    catch (Exception ex) {}
  }
  
  public void hyperlinkUpdate(HyperlinkEvent e)
  {
    if (!isEnabled()) {
      return;
    }
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
      showURL(e.getURL());
    } else if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) {
      setCursor(Cursor.getPredefinedCursor(12));
    } else if (e.getEventType() == HyperlinkEvent.EventType.EXITED) {
      setCursor(Cursor.getDefaultCursor());
    }
  }
  
  public void mouseClicked(MouseEvent e)
  {
    if ((e.getModifiers() == 4) && 
      (isEnabled()) && (isFocusable()) && (showPopup))
    {
      JPopupMenu popup = getPopupMenu();
      if (popup != null)
      {
        updatePopupMenu();
        if (!hasFocus()) {
          requestFocus();
        }
        popup.show(this, e.getX(), e.getY());
      }
    }
  }
  
  public void mouseEntered(MouseEvent e) {}
  
  public void mouseExited(MouseEvent e) {}
  
  public void mousePressed(MouseEvent e) {}
  
  public void mouseReleased(MouseEvent e) {}
  
  public void paste()
  {
    try
    {
      replaceSelection(Toolkit.getDefaultToolkit().getSystemClipboard().getContents(this).getTransferData(DataFlavor.stringFlavor).toString());
    }
    catch (Exception ex) {}
  }
  
  protected JPopupMenu getPopupMenu()
  {
    if (popupMenu == null) {
      popupMenu = createPopupMenu();
    }
    return popupMenu;
  }
  
  protected JPopupMenu createPopupMenu()
  {
    JPopupMenu popup = new JPopupMenu();
    
    popupListener = createPopupListener();
    
    itemCut = new JMenuItem(CUT_STRING);
    itemCopy = new JMenuItem(COPY_STRING);
    itemPaste = new JMenuItem(PASTE_STRING);
    itemDelete = new JMenuItem(DELETE_STRING);
    itemSelectAll = new JMenuItem(SELECT_ALL_STRING);
    
    itemCut.addActionListener(popupListener);
    itemCopy.addActionListener(popupListener);
    itemPaste.addActionListener(popupListener);
    itemDelete.addActionListener(popupListener);
    itemSelectAll.addActionListener(popupListener);
    
    popup.add(itemCut);
    popup.add(itemCopy);
    popup.add(itemPaste);
    popup.add(itemDelete);
    popup.addSeparator();
    popup.add(itemSelectAll);
    
    return popup;
  }
  
  protected void showURL(URL url) {}
  
  protected void updatePopupMenu()
  {
    itemCut.setEnabled((isEditable()) && (getSelectedText() != null));
    
    itemCopy.setEnabled(getSelectedText() != null);
    try
    {
      Transferable clipboardContent = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(this);
      itemPaste.setEnabled((isEditable()) && (clipboardContent != null) && (clipboardContent.isDataFlavorSupported(DataFlavor.stringFlavor)));
    }
    catch (Exception e)
    {
      itemPaste.setEnabled(false);
    }
    if (isEditable())
    {
      itemDelete.setVisible(true);
      itemDelete.setEnabled(getSelectedText() != null);
    }
    else
    {
      itemDelete.setVisible(false);
    }
  }
  
  private ActionListener createPopupListener()
  {
    new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        if (e.getSource() == itemCut) {
          cut();
        } else if (e.getSource() == itemCopy) {
          copy();
        } else if (e.getSource() == itemPaste) {
          paste();
        } else if (e.getSource() == itemDelete) {
          deleteSelection();
        } else if (e.getSource() == itemSelectAll) {
          selectAll();
        }
      }
    };
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.HTMLTextArea
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager;
import javax.swing.Box.Filler;

public final class HorizontalLayout
  implements LayoutManager
{
  private final boolean proportionalHeight;
  private final int hGap;
  
  public HorizontalLayout(boolean proportionalHeight)
  {
    this(proportionalHeight, 0);
  }
  
  public HorizontalLayout(boolean proportionalHeight, int hGap)
  {
    this.proportionalHeight = proportionalHeight;
    this.hGap = hGap;
  }
  
  public void layoutContainer(Container parent)
  {
    Insets insets = parent.getInsets();
    int posX = left;
    int posY = top;
    int height = parent.getHeight() - top - bottom;
    for (Component comp : parent.getComponents()) {
      if (comp.isVisible())
      {
        Dimension pref = comp.getPreferredSize();
        if (proportionalHeight)
        {
          int h = Math.min(height, height);
          int o = (height - h) / 2;
          comp.setBounds(posX, posY + o, width, h);
        }
        else
        {
          comp.setBounds(posX, posY, width, height);
        }
        posX += hGap;
        posX += width;
      }
    }
  }
  
  public Dimension minimumLayoutSize(Container parent)
  {
    Insets insets = parent.getInsets();
    Dimension d = new Dimension(left + right, top + bottom);
    
    int maxHeight = 0;
    int visibleCount = 0;
    for (Component comp : parent.getComponents()) {
      if ((comp.isVisible()) && (!(comp instanceof Box.Filler)))
      {
        Dimension size = comp.getPreferredSize();
        maxHeight = Math.max(maxHeight, height);
        width += width;
        visibleCount++;
      }
    }
    width += (visibleCount - 1) * hGap;
    height += maxHeight;
    
    return d;
  }
  
  public Dimension preferredLayoutSize(Container parent)
  {
    Insets insets = parent.getInsets();
    Dimension d = new Dimension(left + right, top + bottom);
    
    int maxHeight = 0;
    int visibleCount = 0;
    for (Component comp : parent.getComponents()) {
      if (comp.isVisible())
      {
        Dimension size = comp.getPreferredSize();
        maxHeight = Math.max(maxHeight, height);
        width += width;
        visibleCount++;
      }
    }
    width += (visibleCount - 1) * hGap;
    height += maxHeight;
    
    return d;
  }
  
  public void addLayoutComponent(String name, Component comp) {}
  
  public void removeLayoutComponent(Component comp) {}
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.HorizontalLayout
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

class JExtendedSpinner$1
  extends KeyAdapter
{
  JExtendedSpinner$1(JExtendedSpinner paramJExtendedSpinner) {}
  
  public void keyPressed(KeyEvent e)
  {
    if (e.getKeyCode() == 27) {
      JExtendedSpinner.access$000(this$0, e);
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.JExtendedSpinner.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

class JExtendedSpinner$2
  extends KeyAdapter
{
  JExtendedSpinner$2(JExtendedSpinner paramJExtendedSpinner) {}
  
  public void keyPressed(KeyEvent e)
  {
    if (e.getKeyCode() == 27) {
      JExtendedSpinner.access$100(this$0, e);
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.JExtendedSpinner.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.awt.Font;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.accessibility.AccessibleContext;
import javax.swing.JFormattedTextField;
import javax.swing.JSpinner;
import javax.swing.JSpinner.DefaultEditor;
import javax.swing.SpinnerModel;
import javax.swing.UIManager;

public class JExtendedSpinner
  extends JSpinner
{
  public JExtendedSpinner()
  {
    ((JSpinner.DefaultEditor)getEditor()).getTextField().setFont(UIManager.getFont("Label.font"));
    ((JSpinner.DefaultEditor)getEditor()).getTextField().addKeyListener(new KeyAdapter()
    {
      public void keyPressed(KeyEvent e)
      {
        if (e.getKeyCode() == 27) {
          processKeyEvent(e);
        }
      }
    });
  }
  
  public JExtendedSpinner(SpinnerModel model)
  {
    super(model);
    ((JSpinner.DefaultEditor)getEditor()).getTextField().setFont(UIManager.getFont("Label.font"));
    ((JSpinner.DefaultEditor)getEditor()).getTextField().addKeyListener(new KeyAdapter()
    {
      public void keyPressed(KeyEvent e)
      {
        if (e.getKeyCode() == 27) {
          processKeyEvent(e);
        }
      }
    });
  }
  
  public void setModel(SpinnerModel model)
  {
    Font font = ((JSpinner.DefaultEditor)getEditor()).getTextField().getFont();
    String accessibleName = ((JSpinner.DefaultEditor)getEditor()).getTextField().getAccessibleContext().getAccessibleName();
    String accessibleDescription = ((JSpinner.DefaultEditor)getEditor()).getTextField().getAccessibleContext().getAccessibleDescription();
    
    super.setModel(model);
    ((JSpinner.DefaultEditor)getEditor()).getTextField().setFont(font);
    ((JSpinner.DefaultEditor)getEditor()).getTextField().getAccessibleContext().setAccessibleName(accessibleName);
    ((JSpinner.DefaultEditor)getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(accessibleDescription);
  }
  
  public void fixAccessibility()
  {
    if (getAccessibleContext() != null)
    {
      ((JSpinner.DefaultEditor)getEditor()).getTextField().getAccessibleContext().setAccessibleName(getAccessibleContext().getAccessibleName());
      
      ((JSpinner.DefaultEditor)getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(getAccessibleContext().getAccessibleDescription());
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.JExtendedSpinner
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.awt.Component;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
import javax.swing.AbstractButton;

class TransparentToolBar$1
  implements HierarchyListener
{
  TransparentToolBar$1(TransparentToolBar paramTransparentToolBar) {}
  
  public void hierarchyChanged(HierarchyEvent e)
  {
    if (((e.getChangeFlags() & 0x4) != 0L) && 
      (this$0.isShowing()))
    {
      this$0.removeHierarchyListener(this);
      for (Component c : this$0.getComponents()) {
        if ((c instanceof AbstractButton)) {
          TransparentToolBar.ItemListener.access$200(TransparentToolBar.access$100(this$0), (AbstractButton)c);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.TransparentToolBar.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.Box.Filler;

class TransparentToolBar$2
  extends Box.Filler
{
  TransparentToolBar$2(TransparentToolBar paramTransparentToolBar, Dimension x0, Dimension x1, Dimension x2, boolean paramBoolean)
  {
    super(x0, x1, x2);
  }
  
  public Dimension getPreferredSize()
  {
    if (val$customFiller)
    {
      int currentWidth = this$0.getSize().width;
      int minimumWidth = this$0.getMinimumSize().width;
      int extraWidth = currentWidth - minimumWidth;
      return new Dimension(Math.max(extraWidth, 0), 0);
    }
    return super.getPreferredSize();
  }
  
  protected void paintComponent(Graphics g) {}
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.uisupport.TransparentToolBar.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.uisupport;

import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.AbstractButton;
import javax.swing.event.
1 2

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-2019. Infinite Loop Ltd