org-netbeans-lib-profiler-ui

16:39:43.966 INFO  jd.cli.Main - Decompiling org-netbeans-lib-profiler-ui.jar
package org.netbeans.lib.profiler.ui;

import java.awt.image.BufferedImage;

public abstract interface LiveResultsPanel
{
  public abstract int getSortingColumn();
  
  public abstract boolean getSortingOrder();
  
  public abstract BufferedImage getViewImage(boolean paramBoolean);
  
  public abstract String getViewName();
  
  public abstract boolean fitsVisibleArea();
  
  public abstract void handleRemove();
  
  public abstract void handleShutdown();
  
  public abstract boolean hasView();
  
  public abstract void reset();
  
  public abstract boolean supports(int paramInt);
  
  public abstract void updateLiveResults();
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.LiveResultsPanel
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JButton;
import javax.swing.JPopupMenu;

class ResultsPanel$1
  extends KeyAdapter
{
  ResultsPanel$1(ResultsPanel paramResultsPanel, JPopupMenu paramJPopupMenu, JButton paramJButton) {}
  
  public void keyPressed(KeyEvent paramKeyEvent)
  {
    if (paramKeyEvent.getKeyCode() == 32) {
      ResultsPanel.access$000(this$0, val$headerPopup, val$cornerButton);
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.ResultsPanel.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ButtonModel;
import javax.swing.JButton;
import javax.swing.JPopupMenu;

class ResultsPanel$2
  extends MouseAdapter
{
  ResultsPanel$2(ResultsPanel paramResultsPanel, JPopupMenu paramJPopupMenu, JButton paramJButton) {}
  
  public void mousePressed(MouseEvent paramMouseEvent)
  {
    if (val$headerPopup.isVisible())
    {
      ResultsPanel.access$102(this$0, true);
      val$cornerButton.getModel().setArmed(false);
    }
    else
    {
      ResultsPanel.access$102(this$0, false);
      if (paramMouseEvent.getModifiers() == 4) {
        ResultsPanel.access$000(this$0, val$headerPopup, val$cornerButton);
      }
    }
  }
  
  public void mouseClicked(MouseEvent paramMouseEvent)
  {
    if ((paramMouseEvent.getModifiers() == 16) && (!ResultsPanel.access$100(this$0))) {
      ResultsPanel.access$000(this$0, val$headerPopup, val$cornerButton);
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.ResultsPanel.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import javax.swing.JScrollBar;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

class ResultsPanel$3
  implements ChangeListener
{
  ResultsPanel$3(ResultsPanel paramResultsPanel, JScrollBar paramJScrollBar) {}
  
  public void stateChanged(ChangeEvent paramChangeEvent)
  {
    val$vScrollbar.setEnabled((this$0.isEnabled()) && (val$vScrollbar.getVisibleAmount() < val$vScrollbar.getMaximum()));
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.ResultsPanel.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.text.NumberFormat;
import java.util.ResourceBundle;
import javax.swing.BoundedRangeModel;
import javax.swing.ButtonModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

public abstract class ResultsPanel
  extends JPanel
{
  private static final ResourceBundle messages = ResourceBundle.getBundle("org.netbeans.lib.profiler.ui.Bundle");
  private static final String CORNER_BUTTON_TOOLTIP = messages.getString("ResultsPanel_CornerButtonToolTip");
  protected NumberFormat intFormat;
  protected NumberFormat percentFormat;
  private boolean internalCornerButtonClick = false;
  
  public ResultsPanel()
  {
    setLayout(new BorderLayout());
    
    intFormat = NumberFormat.getIntegerInstance();
    intFormat.setGroupingUsed(true);
    
    percentFormat = NumberFormat.getPercentInstance();
    percentFormat.setMaximumFractionDigits(1);
    percentFormat.setMinimumFractionDigits(0);
  }
  
  public abstract void prepareResults();
  
  protected JButton createHeaderPopupCornerButton(final JPopupMenu paramJPopupMenu)
  {
    final JButton localJButton = new JButton(new ImageIcon(getClass().getResource("/org/netbeans/lib/profiler/ui/resources/hideColumn.png")));
    
    localJButton.setToolTipText(CORNER_BUTTON_TOOLTIP);
    localJButton.setDefaultCapable(false);
    if (UIUtils.isWindowsClassicLookAndFeel()) {
      localJButton.setMargin(new Insets(0, 0, 2, 2));
    } else if (UIUtils.isWindowsXPLookAndFeel()) {
      localJButton.setMargin(new Insets(0, 0, 0, 1));
    } else if (UIUtils.isMetalLookAndFeel()) {
      localJButton.setMargin(new Insets(0, 0, 2, 1));
    }
    localJButton.addKeyListener(new KeyAdapter()
    {
      public void keyPressed(KeyEvent paramAnonymousKeyEvent)
      {
        if (paramAnonymousKeyEvent.getKeyCode() == 32) {
          ResultsPanel.this.showColumnSelectionPopup(paramJPopupMenu, localJButton);
        }
      }
    });
    localJButton.addMouseListener(new MouseAdapter()
    {
      public void mousePressed(MouseEvent paramAnonymousMouseEvent)
      {
        if (paramJPopupMenu.isVisible())
        {
          internalCornerButtonClick = true;
          localJButton.getModel().setArmed(false);
        }
        else
        {
          internalCornerButtonClick = false;
          if (paramAnonymousMouseEvent.getModifiers() == 4) {
            ResultsPanel.this.showColumnSelectionPopup(paramJPopupMenu, localJButton);
          }
        }
      }
      
      public void mouseClicked(MouseEvent paramAnonymousMouseEvent)
      {
        if ((paramAnonymousMouseEvent.getModifiers() == 16) && (!internalCornerButtonClick)) {
          ResultsPanel.this.showColumnSelectionPopup(paramJPopupMenu, localJButton);
        }
      }
    });
    return localJButton;
  }
  
  protected JScrollPane createScrollPane()
  {
    JScrollPane localJScrollPane = new JScrollPane();
    add(localJScrollPane, "Center");
    
    return localJScrollPane;
  }
  
  protected JScrollPane createScrollPaneVerticalScrollBarAlways()
  {
    JScrollPane localJScrollPane = createScrollPane();
    localJScrollPane.setVerticalScrollBarPolicy(22);
    localJScrollPane.setHorizontalScrollBarPolicy(31);
    
    final JScrollBar localJScrollBar = localJScrollPane.getVerticalScrollBar();
    localJScrollBar.getModel().addChangeListener(new ChangeListener()
    {
      public void stateChanged(ChangeEvent paramAnonymousChangeEvent)
      {
        localJScrollBar.setEnabled((isEnabled()) && (localJScrollBar.getVisibleAmount() < localJScrollBar.getMaximum()));
      }
    });
    return localJScrollPane;
  }
  
  protected abstract void initColumnSelectorItems();
  
  private void showColumnSelectionPopup(JPopupMenu paramJPopupMenu, JButton paramJButton)
  {
    initColumnSelectorItems();
    paramJPopupMenu.show(paramJButton, paramJButton.getWidth() - getPreferredSizewidth, paramJButton.getHeight());
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.ResultsPanel
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

final class StringDecorator$1
  implements StringDecorator
{
  public String decorate(String paramString)
  {
    return paramString;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.StringDecorator.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

public abstract interface StringDecorator
{
  public static final StringDecorator DEFAULT = new StringDecorator()
  {
    public String decorate(String paramAnonymousString)
    {
      return paramAnonymousString;
    }
  };
  
  public abstract String decorate(String paramString);
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.StringDecorator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

class SwingWorker$1
  implements Runnable
{
  SwingWorker$1(SwingWorker paramSwingWorker) {}
  
  public void run()
  {
    synchronized (SwingWorker.access$000(this$0))
    {
      try
      {
        if (SwingWorker.access$100(this$0)) {
          SwingWorker.access$000(this$0).wait(this$0.getWarmup());
        }
        if (SwingWorker.access$100(this$0)) {
          this$0.nonResponding();
        }
      }
      catch (InterruptedException localInterruptedException)
      {
        localInterruptedException.printStackTrace();
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.SwingWorker.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

class SwingWorker$2$1
  implements Runnable
{
  SwingWorker$2$1(SwingWorker.2 param2) {}
  
  public void run()
  {
    this$1.this$0.done();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.SwingWorker.2.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import java.util.concurrent.ExecutorService;

class SwingWorker$2
  implements Runnable
{
  SwingWorker$2(SwingWorker paramSwingWorker) {}
  
  public void run()
  {
    synchronized (SwingWorker.access$000(this$0))
    {
      SwingWorker.access$102(this$0, true);
    }
    SwingWorker.access$300().submit(SwingWorker.access$200(this$0));
    try
    {
      this$0.doInBackground();
    }
    finally
    {
      synchronized (SwingWorker.access$000(this$0))
      {
        SwingWorker.access$102(this$0, false);
        SwingWorker.access$000(this$0).notify();
      }
      if (SwingWorker.access$400(this$0)) {
        SwingWorker.access$500(new Runnable()
        {
          public void run()
          {
            this$0.done();
          }
        });
      } else {
        this$0.done();
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.SwingWorker.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import java.util.concurrent.Executors;

final class SwingWorker$3
  implements Runnable
{
  public void run()
  {
    SwingWorker.access$302(Executors.newCachedThreadPool());
    SwingWorker.access$602(Executors.newCachedThreadPool());
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.SwingWorker.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.swing.SwingUtilities;

public abstract class SwingWorker
{
  private static ExecutorService warmupService;
  private static ExecutorService taskService;
  private final Object warmupLock = new Object();
  private boolean useEQ;
  private boolean workerRunning;
  private Runnable warmupTimer = new Runnable()
  {
    public void run()
    {
      synchronized (warmupLock)
      {
        try
        {
          if (workerRunning) {
            warmupLock.wait(getWarmup());
          }
          if (workerRunning) {
            nonResponding();
          }
        }
        catch (InterruptedException localInterruptedException)
        {
          localInterruptedException.printStackTrace();
        }
      }
    }
  };
  
  public SwingWorker(boolean paramBoolean)
  {
    sinit();
    useEQ = paramBoolean;
  }
  
  public SwingWorker()
  {
    this(true);
  }
  
  public void execute()
  {
    postRunnable(new Runnable()
    {
      public void run()
      {
        synchronized (warmupLock)
        {
          workerRunning = true;
        }
        SwingWorker.warmupService.submit(warmupTimer);
        try
        {
          doInBackground();
        }
        finally
        {
          synchronized (warmupLock)
          {
            workerRunning = false;
            warmupLock.notify();
          }
          if (useEQ) {
            SwingWorker.runInEventDispatchThread(new Runnable()
            {
              public void run()
              {
                done();
              }
            });
          } else {
            done();
          }
        }
      }
    });
  }
  
  protected int getWarmup()
  {
    return 500;
  }
  
  protected abstract void doInBackground();
  
  protected void done() {}
  
  protected void nonResponding() {}
  
  protected void postRunnable(Runnable paramRunnable)
  {
    taskService.submit(paramRunnable);
  }
  
  static synchronized void sinit()
  {
    if (warmupService == null) {
      UIUtils.runInEventDispatchThreadAndWait(new Runnable()
      {
        public void run()
        {
          SwingWorker.access$302(Executors.newCachedThreadPool());
          SwingWorker.access$602(Executors.newCachedThreadPool());
        }
      });
    }
  }
  
  private static void runInEventDispatchThread(Runnable paramRunnable)
  {
    if (SwingUtilities.isEventDispatchThread()) {
      paramRunnable.run();
    } else {
      SwingUtilities.invokeLater(paramRunnable);
    }
  }
  
  private static void runInEventDispatchThreadAndWait(Runnable paramRunnable)
  {
    if (SwingUtilities.isEventDispatchThread()) {
      paramRunnable.run();
    } else {
      try
      {
        SwingUtilities.invokeAndWait(paramRunnable);
      }
      catch (InterruptedException localInterruptedException)
      {
        Thread.currentThread().interrupt();
      }
      catch (InvocationTargetException localInvocationTargetException) {}
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.SwingWorker
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import java.awt.Color;

public abstract interface UIConstants
{
  public static final Color TABLE_VERTICAL_GRID_COLOR = new Color(214, 223, 247);
  public static final boolean SHOW_TABLE_HORIZONTAL_GRID = false;
  public static final boolean SHOW_TABLE_VERTICAL_GRID = true;
  public static final Color TABLE_SELECTION_BACKGROUND_COLOR = new Color(193, 210, 238);
  public static final Color TABLE_SELECTION_FOREGROUND_COLOR = Color.BLACK;
  public static final int TABLE_ROW_MARGIN = 0;
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.UIConstants
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

final class UIUtils$1
  extends ComponentAdapter
{
  UIUtils$1(Component paramComponent) {}
  
  public void componentResized(ComponentEvent paramComponentEvent)
  {
    Dimension localDimension1 = val$top.getSize();
    Dimension localDimension2 = val$top.getMinimumSize();
    if ((width < width) || (height < height)) {
      val$top.setSize(Math.max(width, width), Math.max(height, height));
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.UIUtils.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import com.sun.java.swing.plaf.windows.WindowsButtonUI;
import java.awt.Graphics;
import java.awt.Rectangle;
import javax.swing.AbstractButton;
import javax.swing.plaf.basic.BasicButtonListener;
import javax.swing.plaf.basic.BasicGraphicsUtils;

final class UIUtils$2
  extends WindowsButtonUI
{
  UIUtils$2(int paramInt1, int paramInt2, int paramInt3, int paramInt4) {}
  
  protected BasicButtonListener createButtonListener(AbstractButton paramAbstractButton)
  {
    return new BasicButtonListener(paramAbstractButton);
  }
  
  protected void paintFocus(Graphics paramGraphics, AbstractButton paramAbstractButton, Rectangle paramRectangle1, Rectangle paramRectangle2, Rectangle paramRectangle3)
  {
    int i = paramAbstractButton.getWidth();
    int j = paramAbstractButton.getHeight();
    paramGraphics.setColor(getFocusColor());
    BasicGraphicsUtils.drawDashedRect(paramGraphics, val$dashedRectGapX_Local, val$dashedRectGapY_Local, i - val$dashedRectGapWidth_Local, j - val$dashedRectGapHeight_Local);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.UIUtils.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import com.sun.java.swing.plaf.windows.WindowsToggleButtonUI;
import java.awt.Graphics;
import java.awt.Rectangle;
import javax.swing.AbstractButton;
import javax.swing.plaf.basic.BasicButtonListener;
import javax.swing.plaf.basic.BasicGraphicsUtils;

final class UIUtils$3
  extends WindowsToggleButtonUI
{
  UIUtils$3(int paramInt1, int paramInt2, int paramInt3, int paramInt4) {}
  
  protected BasicButtonListener createButtonListener(AbstractButton paramAbstractButton)
  {
    return new BasicButtonListener(paramAbstractButton);
  }
  
  protected void paintFocus(Graphics paramGraphics, AbstractButton paramAbstractButton, Rectangle paramRectangle1, Rectangle paramRectangle2, Rectangle paramRectangle3)
  {
    int i = paramAbstractButton.getWidth();
    int j = paramAbstractButton.getHeight();
    paramGraphics.setColor(getFocusColor());
    BasicGraphicsUtils.drawDashedRect(paramGraphics, val$dashedRectGapX_Local, val$dashedRectGapY_Local, i - val$dashedRectGapWidth_Local, j - val$dashedRectGapHeight_Local);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.UIUtils.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import javax.swing.JTree;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeExpansionListener;
import javax.swing.tree.TreePath;

final class UIUtils$4
  implements TreeExpansionListener
{
  boolean internalChange = false;
  
  UIUtils$4(JTree paramJTree, int paramInt, boolean paramBoolean) {}
  
  public void treeCollapsed(TreeExpansionEvent paramTreeExpansionEvent) {}
  
  public void treeExpanded(TreeExpansionEvent paramTreeExpansionEvent)
  {
    if ((internalChange) || (Boolean.TRUE.equals(val$tree.getClientProperty("expansion_transaction")))) {
      return;
    }
    TreePath localTreePath = paramTreeExpansionEvent.getPath();
    JTree localJTree = (JTree)paramTreeExpansionEvent.getSource();
    internalChange = true;
    UIUtils.autoExpand(localJTree, localTreePath, 50, val$maxChildToExpand, val$dontExpandToLeafs);
    internalChange = false;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.UIUtils.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import java.awt.Component;
import java.awt.image.BufferedImage;
import javax.swing.JTable;
import javax.swing.JViewport;

final class UIUtils$5
  implements Runnable
{
  UIUtils$5(Component paramComponent, BufferedImage[] paramArrayOfBufferedImage) {}
  
  public void run()
  {
    if (((val$component instanceof JTable)) || (((val$component instanceof JViewport)) && ((((JViewport)val$component).getView() instanceof JTable)))) {
      val$result[0] = UIUtils.access$000(val$component);
    } else {
      val$result[0] = UIUtils.access$100(val$component);
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.UIUtils.5
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import java.awt.Graphics;
import javax.swing.table.JTableHeader;

final class UIUtils$6
  implements Runnable
{
  UIUtils$6(JTableHeader paramJTableHeader, Graphics paramGraphics) {}
  
  public void run()
  {
    val$tableHeader.printAll(val$tableScreenshotGraphics);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.UIUtils.6
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import java.awt.Component;
import java.awt.Graphics;

final class UIUtils$7
  implements Runnable
{
  UIUtils$7(Component paramComponent, Graphics paramGraphics) {}
  
  public void run()
  {
    val$printSrc.printAll(val$tableScreenshotGraphics);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.ui.UIUtils.7
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.ui;

import com.sun.java.swing.plaf.windows.WindowsButtonUI;
import com.sun.java.swing.plaf.windows.WindowsToggleButtonUI;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.image.BufferedImage;
import java.awt.image.PixelGrabber;
import java.lang.reflect.InvocationTargetException;
import java.util.logging.Logger;
import javax.swing.AbstractButton;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTree;
import javax.swing.JViewport;
import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeExpansionListener;
import javax.swing.plaf.basic.BasicButtonListener;
import javax.swing.plaf.basic.BasicGraphicsUtils;
import javax.swing.table.JTableHeader;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;

public final class UIUtils
{
  public static final String PROP_EXPANSION_TRANSACTION = "expansion_transaction";
  private static final Logger LOGGER = Logger.getLogger(UIUtils.class.getName());
  public static final float ALTERNATE_ROW_DARKER_FACTOR = 0.96F;
  private static final int MAX_TREE_AUTOEXPAND_LINES = 50;
  private static boolean toolTipValuesInitialized = false;
  private static Color unfocusedSelBg;
  private static Color unfocusedSelFg;
  private static Color profilerResultsBackground;
  
  public static boolean isAquaLookAndFeel()
  {
    return UIManager.getLookAndFeel().getID().equals("Aqua");
  }
  
  public static Color getDarker(Color paramColor)
  {
    if (paramColor.equals(Color.WHITE)) {
      return new Color(244, 244, 244);
    }
    return getSafeColor((int)(paramColor.getRed() * 0.96F), (int)(paramColor.getGreen() * 0.96F), (int)(paramColor.getBlue() * 0.96F));
  }
  
  public static Color getDarkerLine(Color paramColor, float paramFloat)
  {
    return getSafeColor((int)(paramColor.getRed() * paramFloat), (int)(paramColor.getGreen() * paramFloat), (int)(paramColor.getBlue() * paramFloat));
  }
  
  public static int getDefaultRowHeight()
  {
    return JLabel"X"getPreferredSizeheight + 2;
  }
  
  public static boolean isGTKLookAndFeel()
  {
    return UIManager.getLookAndFeel().getID().equals("GTK");
  }
  
  public static boolean isNimbusLookAndFeel()
  {
    return UIManager.getLookAndFeel().getID().equals("Nimbus");
  }
  
  public static boolean isNimbusGTKTheme()
  {
    return (isGTKLookAndFeel()) && ("nimbus".equals(Toolkit.getDefaultToolkit().getDesktopProperty("gnome.Net/ThemeName")));
  }
  
  public static boolean isNimbus()
  {
    return (isNimbusLookAndFeel()) || (isNimbusGTKTheme());
  }
  
  public static boolean isMetalLookAndFeel()
  {
    return UIManager.getLookAndFeel().getID().equals("Metal");
  }
  
  public static int getNextSubTabIndex(JTabbedPane paramJTabbedPane, int paramInt)
  {
    int i = paramInt;
    for (int j = 0; j < paramJTabbedPane.getComponentCount(); j++)
    {
      i++;
      if (i == paramJTabbedPane.getComponentCount()) {
        i = 0;
      }
      if (paramJTabbedPane.isEnabledAt(i)) {
        break;
      }
    }
    return i;
  }
  
  public static Window getParentWindow(Component paramComponent)
  {
    while ((paramComponent != null) && (!(paramComponent instanceof Window))) {
      paramComponent = paramComponent.getParent();
    }
    return (Window)paramComponent;
  }
  
  public static int getPreviousSubTabIndex(JTabbedPane paramJTabbedPane, int paramInt)
  {
    int i = paramInt;
    for (int j = 0; j < paramJTabbedPane.getComponentCount(); j++)
    {
      i--;
      if (i < 0) {
        i = paramJTabbedPane.getComponentCount() - 1;
      }
      if (paramJTabbedPane.isEnabledAt(i)) {
        break;
      }
    }
    return i;
  }
  
  public static Color getSafeColor(int paramInt1, int paramInt2, int paramInt3)
  {
    paramInt1 = Math.max(paramInt1, 0);
    paramInt1 = Math.min(paramInt1, 255);
    paramInt2 = Math.max(paramInt2, 0);
    paramInt2 = Math.min(paramInt2, 255);
    paramInt3 = Math.max(paramInt3, 0);
    paramInt3 = Math.min(paramInt3, 255);
    
    return new Color(paramInt1, paramInt2, paramInt3);
  }
  
  public static Color getUnfocusedSelectionBackground()
  {
    if (unfocusedSelBg == null)
    {
      unfocusedSelBg = UIManager.getColor("nb.explorer.unfocusedSelBg");
      if (unfocusedSelBg == null)
      {
        unfocusedSelBg = UIManager.getColor("controlShadow");
        if (unfocusedSelBg == null) {
          unfocusedSelBg = Color.lightGray;
        }
        if (!Color.WHITE.equals(unfocusedSelBg.brighter())) {
          unfocusedSelBg = unfocusedSelBg.brighter();
        }
      }
    }
    return unfocusedSelBg;
  }
  
  public static Color getUnfocusedSelectionForeground()
  {
    if (unfocusedSelFg == null)
    {
      unfocusedSelFg = UIManager.getColor("nb.explorer.unfocusedSelFg");
      if (unfocusedSelFg == null)
      {
        unfocusedSelFg = UIManager.getColor("textText");
        if (unfocusedSelFg == null) {
          unfocusedSelFg = Color.BLACK;
        }
      }
    }
    return unfocusedSelFg;
  }
  
  private static Color getGTKProfilerResultsBackground()
  {
    int[] arrayOfInt = new int[1];
    arrayOfInt[0] = -1;
    
    JTextArea localJTextArea = new JTextArea();
    localJTextArea.setSize(new Dimension(10, 10));
    localJTextArea.doLayout();
    
    BufferedImage localBufferedImage = new BufferedImage(getSizewidth, getSizeheight, 1);
    localJTextArea.printAll(localBufferedImage.getGraphics());
    
    PixelGrabber localPixelGrabber = new PixelGrabber(localBufferedImage, 5, 5, 1, 1, arrayOfInt, 0, 1);
    try
    {
      localPixelGrabber.grabPixels();
      if (arrayOfInt[0] == -1) {
        return Color.WHITE;
      }
    }
    catch (InterruptedException localInterruptedException)
    {
      return getNonGTKProfilerResultsBackground();
    }
    return arrayOfInt[0] != -1 ? new Color(arrayOfInt[0]) : getNonGTKProfilerResultsBackground();
  }
  
  private static Color getNonGTKProfilerResultsBackground()
  {
    return UIManager.getColor("Table.background");
  }
  
  public static Color getProfilerResultsBackground()
  {
    if (profilerResultsBackground == null)
    {
      if ((isGTKLookAndFeel()) || (isNimbusLookAndFeel())) {
        profilerResultsBackground = getGTKProfilerResultsBackground();
      } else {
        profilerResultsBackground = getNonGTKProfilerResultsBackground();
      }
      if (profilerResultsBackground == null) {
        profilerResultsBackground = Color.WHITE;
      }
    }
    return profilerResultsBackground;
  }
  
  public static boolean isWindowsClassicLookAndFeel()
  {
    if (!isWindowsLookAndFeel()) {
      return false;
    }
    return !isWindowsXPLookAndFeel();
  }
  
  public static boolean isWindowsLookAndFeel()
  {
    return UIManager.getLookAndFeel().getID().equals("Windows");
  }
  
  public static boolean isWindowsXPLookAndFeel()
  {
    if (!isWindowsLookAndFeel()) {
      return false;
    }
    boolean bool = Boolean.TRUE.equals(Toolkit.getDefaultToolkit().getDesktopProperty("win.xpstyle.themeActive"));
    
    int i = System.getProperty("swing.noxp") != null ? 1 : 0;
    
    return (bool) && (i == 0);
  }
  
  public static void autoExpand(JTree paramJTree, TreePath paramTreePath, int paramInt1, int paramInt2, boolean paramBoolean)
  {
    TreeModel localTreeModel = paramJTree.getModel();
    Object localObject = paramTreePath.getLastPathComponent();
    TreePath localTreePath = paramTreePath;
    
    int i = 0;
    while ((i++ < paramInt1) && (!localTreeModel.isLeaf(localObject)) && (localTreeModel.getChildCount(localObject) > 0) && (localTreeModel.getChildCount(localObject) <= paramInt2)) {
      for (int j = 0; j < localTreeModel.getChildCount(localObject); j++)
      {
        localObject = paramJTree.getModel().getChild(localObject, j);
        if (!localTreeModel.isLeaf(localObject))
        {
          if ((paramBoolean) && (hasOnlyLeafs(paramJTree, localObject))) {
            break;
          }
          localTreePath = localTreePath.pathByAddingChild(localObject);
          
          break;
        }
      }
    }
    paramJTree.expandPath(localTreePath);
  }
  
  public static void autoExpandRoot(JTree paramJTree)
  {
    autoExpandRoot(paramJTree, 1);
  }
  
  public static void autoExpandRoot(JTree paramJTree, int paramInt)
  {
    Object localObject = paramJTree.getModel().getRoot();
    if (localObject == null) {
      return;
    }
    TreePath localTreePath = new TreePath(localObject);
    autoExpand(paramJTree, localTreePath, 50, paramInt, false);
  }
  
  public static long[] copyArray(long[] paramArrayOfLong)
  {
    if (paramArrayOfLong == null) {
      return null;
    }
    if (paramArrayOfLong.length == 0) {
      return new long[0];
    }
    long[] arrayOfLong = new long[paramArrayOfLong.length];
    System.arraycopy(paramArrayOfLong, 0, arrayOfLong, 0, paramArrayOfLong.length);
    
    return arrayOfLong;
  }
  
  public static int[] copyArray(int[] paramArrayOfInt)
  {
    if (paramArrayOfInt == null) {
      return null;
    }
    if (paramArrayOfInt.length == 0) {
      return new int[0];
    }
    int[] arrayOfInt = new int[paramArrayOfInt.length];
    System.arraycopy(paramArrayOfInt, 0, arrayOfInt, 0, paramArrayOfInt.length);
    
    return arrayOfInt;
  }
  
  public static float[] copyArray(float[] paramArrayOfFloat)
  {
    if (paramArrayOfFloat == null) {
      return null;
    }
    if (paramArrayOfFloat.length == 0) {
      return new float[0];
    }
    float[] arrayOfFloat = new float[paramArrayOfFloat.length];
    System.arraycopy(paramArrayOfFloat, 0, arrayOfFloat, 0, paramArrayOfFloat.length);
    
    return arrayOfFloat;
  }
  
  public static BufferedImage createScreenshot(Component paramComponent)
  {
    if ((paramComponent instanceof JScrollPane))
    {
      JScrollPane localJScrollPane = (JScrollPane)paramComponent;
      
      return createComponentScreenshot(localJScrollPane.getViewport());
    }
    return createComponentScreenshot(paramComponent);
  }
  
  public static void ensureMinimumSize(Component paramComponent)
  {
    paramComponent = getParentWindow(paramComponent);
    if (paramComponent != null)
    {
      Component localComponent = paramComponent;
      localComponent.addComponentListener(new ComponentAdapter()
      {
        public void componentResized(ComponentEvent paramAnonymousComponentEvent)
        {
          Dimension localDimension1 = val$top.getSize();
          Dimension localDimension2 = val$top.getMinimumSize();
          if ((width < width) || (height < height)) {
            val$top.setSize(Math.max(width, width), Math.max(height, height));
          }
        }
      });
    }
  }
  
  public static void fixButtonUI(AbstractButton paramAbstractButton)
  {
    try
    {
      int i = ((Integer)UIManager.get("Button.dashedRectGapX")).intValue();
      final int j = ((Integer)UIManager.get("Button.dashedRectGapY")).intValue();
      final int k = ((Integer)UIManager.get("Button.dashedRectGapWidth")).intValue();
      final int m = ((Integer)UIManager.get("Button.dashedRectGapHeight")).intValue();
      if ((paramAbstractButton.getUI() instanceof WindowsButtonUI)) {
        paramAbstractButton.setUI(new WindowsButtonUI()
        {
          protected BasicButtonListener createButtonListener(AbstractButton paramAnonymousAbstractButton)
          {
            return new BasicButtonListener(paramAnonymousAbstractButton);
          }
          
          protected void paintFocus(Graphics paramAnonymousGraphics, AbstractButton paramAnonymousAbstractButton, Rectangle paramAnonymousRectangle1, Rectangle paramAnonymousRectangle2, Rectangle paramAnonymousRectangle3)
          {
            int i = paramAnonymousAbstractButton.getWidth();
            int j = paramAnonymousAbstractButton.getHeight();
            paramAnonymousGraphics.setColor(getFocusColor());
            BasicGraphicsUtils.drawDashedRect(paramAnonymousGraphics, val$dashedRectGapX_Local, j, i - k, j - m);
          }
        });
      } else if ((paramAbstractButton.getUI() instanceof WindowsToggleButtonUI)) {
        paramAbstractButton.setUI(new WindowsToggleButtonUI()
        {
          protected BasicButtonListener createButtonListener(AbstractButton paramAnonymousAbstractButton)
          {
            return new BasicButtonListener(paramAnonymousAbstractButton);
          }
          
          protected void paintFocus(Graphics paramAnonymousGraphics, AbstractButton paramAnonymousAbstractButton, Rectangle paramAnonymousRectangle1, Rectangle paramAnonymousRectangle2, Rectangle paramAnonymousRectangle3)
          {
            int i = paramAnonymousAbstractButton.getWidth();
            int j = paramAnonymousAbstractButton.getHeight();
            paramAnonymousGraphics.setColor(getFocusColor());
            BasicGraphicsUtils.drawDashedRect(paramAnonymousGraphics, val$dashedRectGapX_Local, j, i - k, j - m);
          }
        });
      }
    }
    catch (Throwable localThrowable) {}
  }
  
  public static boolean hasOnlyLeafs(JTree paramJTree, Object paramObject)
  {
    TreeModel localTreeModel = paramJTree.getModel();
    for (int i = 0; i < localTreeModel.getChildCount(paramObject); i++) {
      if (!localTreeModel.isLeaf(localTreeModel.getChild(paramObject, i))) {
        return false;
      }
    }
    return true;
  }
  
  public static void makeTreeAutoExpandable(JTree paramJTree)
  {
    makeTreeAutoExpandable(paramJTree, 1, false);
  }
  
  public static void makeTreeAutoExpandable(JTree paramJTree, boolean paramBoolean)
  {
    makeTreeAutoExpandable(paramJTree, 1, paramBoolean);
  }
  
  public static void makeTreeAutoExpandable(JTree paramJTree, int paramInt)
  {
    makeTreeAutoExpandable(paramJTree, paramInt, false);
  }
  
  public static void makeTreeAutoExpandable(JTree paramJTree, final int paramInt, final boolean paramBoolean)
  {
    paramJTree.addTreeExpansionListener(new TreeExpansionListener()
    {
      boolean internalChange = false;
      
      public void treeCollapsed(TreeExpansionEvent paramAnonymousTreeExpansionEvent) {}
      
      public void treeExpanded(TreeExpansionEvent paramAnonymousTreeExpansionEvent)
      {
        if ((internalChange) || (Boolean.TRUE.equals(val$tree.getClientProperty("expansion_transaction")))) {
          return;
        }
        TreePath localTreePath = paramAnonymousTreeExpansionEvent.getPath();
        JTree localJTree = (JTree)paramAnonymousTreeExpansionEvent.getSource();
        internalChange = true;
        UIUtils.autoExpand(localJTree, localTreePath, 50, paramInt, paramBoolean);
        internalChange = false;
      }
    });
  }
  
  public static void runInEventDispatchThread(Runnable paramRunnable)
  {
    if (SwingUtilities.isEventDispatchThread()) {
      paramRunnable.run();
    } else {
      SwingUtilities.invokeLater(paramRunnable);
    }
  }
  
  public static void runInEventDispatchThreadAndWait(Runnable paramRunnable)
  {
    if (SwingUtilities.isEventDispatchThread()) {
      paramRunnable.run();
    } else {
      try
      {
        SwingUtilities.invokeAndWait(paramRunnable);
      }
      catch (InvocationTargetException localInvocationTargetException)
      {
        LOGGER.severe(localInvocationTargetException.getMessage());
      }
      catch (InterruptedException localInterruptedException)
      {
        LOGGER.severe(localInterruptedException.getMessage());
      }
    }
  }
  
  private static BufferedImage createComponentScreenshot(Component paramComponent)
  {
    final BufferedImage[] arrayOfBufferedImage = new BufferedImage[1];
    
    Runnable local5 = new Runnable()
    {
      public void run()
      {
        if (((val$component instanceof JTable)) || (((val$component instanceof JViewport)) && ((((JViewport)val$component).getView() instanceof JTable)))) {
          arrayOfBufferedImage[0] = UIUtils.createTableScreenshot(val$component);
        } else {
          arrayOfBufferedImage[0] = UIUtils.createGeneralComponentScreenshot(val$component);
        }
      }
    };
    try
    {
      if (SwingUtilities.isEventDispatchThread()) {
        local5.run();
      } else {
        SwingUtilities.invokeAndWait(local5);
      }
    }
    catch (Exception localException)
    {
      return null;
    }
    return arrayOfBufferedImage[0];
  }
  
  private static BufferedImage createGeneralComponentScreenshot(Component paramComponent)
  {
    Object localObject1;
    Dimension localDimension;
    if ((paramComponent instanceof JViewport))
    {
      localObject2 = (JViewport)paramComponent;
      localObject3 = ((JViewport)localObject2).getView();
      if (getSizeheight > getSizeheight)
      {
        localObject1 = paramComponent;
        localDimension = paramComponent.getSize();
      }
      else
      {
        localObject1 = localObject3;
        localDimension = ((Component)localObject3).getSize();
      }
    }
    else
    {
      localObject1 = paramComponent;
      localDimension = paramComponent.getSize();
    }
    Object localObject2 = new BufferedImage(width, height, 1);
    Object localObject3 = ((BufferedImage)localObject2).getGraphics();
    ((Component)localObject1).printAll((Graphics)localObject3);
    
    return (BufferedImage)localObject2;
  }
  
  private static BufferedImage createTableScreenshot(Component paramComponent)
  {
    JTable localJTable;
    Object localObject1;
    Dimension localDimension1;
    if ((paramComponent instanceof JTable))
    {
      localJTable = (JTable)paramComponent;
      if ((localJTable.getTableHeader() == null) || (!localJTable.getTableHeader().isVisible())) {
        return createGeneralComponentScreenshot(paramComponent);
      }
      localObject1 = localJTable;
      localDimension1 = localJTable.getSize();
    }
    else if (((paramComponent instanceof JViewport)) && ((((JViewport)paramComponent).getView() instanceof JTable)))
    {
      localObject2 = (JViewport)paramComponent;
      localJTable = (JTable)((JViewport)localObject2).getView();
      if ((localJTable.getTableHeader() == null) || (!localJTable.getTableHeader().isVisible())) {
        return createGeneralComponentScreenshot(paramComponent);
      }
      if (getSizeheight > getSizeheight)
      {
        localObject1 = localObject2;
        localDimension1 = ((JViewport)localObject2).getSize();
      }
      else
      {
        localObject1 = localJTable;
        localDimension1 = localJTable.getSize();
      }
    }
    else
    {
      throw new IllegalArgumentException("Component can only be JTable or JViewport holding JTable");
    }
    Object localObject2 = localJTable.getTableHeader();
    Dimension localDimension2 = ((JTableHeader)localObject2).getSize();
    
    BufferedIma
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 34

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