Search in sources :

Example 16 with AsyncProcessIcon

use of com.intellij.util.ui.AsyncProcessIcon in project intellij-community by JetBrains.

the class ProgressStripeIcon method generateIcon.

@NotNull
public static AsyncProcessIcon generateIcon(@NotNull JComponent component) {
    List<Icon> result = ContainerUtil.newArrayList();
    if (UIUtil.isUnderAquaBasedLookAndFeel() && !UIUtil.isUnderDarcula()) {
        for (int i = 0; i < 2 * JBUI.scale(GradientIcon.GRADIENT); i += JBUI.scale(TRANSLATE)) {
            result.add(new GradientIcon(component, i));
        }
    } else {
        for (int i = 0; i < JBUI.scale(StripeIcon.WIDTH); i += JBUI.scale(TRANSLATE)) {
            result.add(new StripeIcon(component, i));
        }
        result = ContainerUtil.reverse(result);
    }
    Icon passive = result.get(0);
    AsyncProcessIcon icon = new AsyncProcessIcon("ProgressWithStripes", result.toArray(new Icon[result.size()]), passive) {

        @Override
        public Dimension getPreferredSize() {
            return new Dimension(component.getWidth(), passive.getIconHeight());
        }
    };
    component.addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            super.componentResized(e);
            icon.revalidate();
        }
    });
    return icon;
}
Also used : AsyncProcessIcon(com.intellij.util.ui.AsyncProcessIcon) AsyncProcessIcon(com.intellij.util.ui.AsyncProcessIcon) ComponentEvent(java.awt.event.ComponentEvent) ComponentAdapter(java.awt.event.ComponentAdapter) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

AsyncProcessIcon (com.intellij.util.ui.AsyncProcessIcon)16 NotNull (org.jetbrains.annotations.NotNull)3 AllIcons (com.intellij.icons.AllIcons)2 Disposer (com.intellij.openapi.util.Disposer)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 com.intellij.ui (com.intellij.ui)2 TreeTableView (com.intellij.ui.dualView.TreeTableView)2 ListTreeTableModelOnColumns (com.intellij.ui.treeStructure.treetable.ListTreeTableModelOnColumns)2 TreeColumnInfo (com.intellij.ui.treeStructure.treetable.TreeColumnInfo)2 ColumnInfo (com.intellij.util.ui.ColumnInfo)2 List (java.util.List)2 javax.swing (javax.swing)2 Nullable (org.jetbrains.annotations.Nullable)2 SdkConstants (com.android.SdkConstants)1 ColumnTreeBuilder (com.android.tools.adtui.common.ColumnTreeBuilder)1 EdtExecutor (com.android.tools.idea.ddms.EdtExecutor)1 FutureCallback (com.google.common.util.concurrent.FutureCallback)1 Futures (com.google.common.util.concurrent.Futures)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 TargetElementUtil (com.intellij.codeInsight.TargetElementUtil)1