Search in sources :

Example 36 with JBColor

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

the class SheetMessage method startAnimation.

void startAnimation(final boolean enlarge) {
    staticImage = myController.getStaticImage();
    JPanel staticPanel = new JPanel() {

        @Override
        public void paint(@NotNull Graphics g) {
            super.paint(g);
            if (staticImage != null) {
                Graphics2D g2d = (Graphics2D) g.create();
                g2d.setBackground(new JBColor(new Color(255, 255, 255, 0), new Color(110, 110, 110, 0)));
                g2d.clearRect(0, 0, myController.SHEET_NC_WIDTH, myController.SHEET_NC_HEIGHT);
                g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.95f));
                int multiplyFactor = staticImage.getWidth(null) / myController.SHEET_NC_WIDTH;
                g.drawImage(staticImage, 0, 0, myController.SHEET_NC_WIDTH, imageHeight, 0, staticImage.getHeight(null) - imageHeight * multiplyFactor, staticImage.getWidth(null), staticImage.getHeight(null), null);
            }
        }
    };
    staticPanel.setOpaque(false);
    staticPanel.setSize(myController.SHEET_NC_WIDTH, myController.SHEET_NC_HEIGHT);
    myWindow.setContentPane(staticPanel);
    Animator myAnimator = new Animator("Roll Down Sheet Animator", myController.SHEET_NC_HEIGHT, TIME_TO_SHOW_SHEET, false) {

        @Override
        public void paintNow(int frame, int totalFrames, int cycle) {
            setPositionRelativeToParent();
            float percentage = (float) frame / (float) totalFrames;
            imageHeight = enlarge ? (int) (((float) myController.SHEET_NC_HEIGHT) * percentage) : (int) (myController.SHEET_NC_HEIGHT - percentage * myController.SHEET_HEIGHT);
            myWindow.repaint();
        }

        @Override
        protected void paintCycleEnd() {
            setPositionRelativeToParent();
            if (enlarge) {
                imageHeight = myController.SHEET_NC_HEIGHT;
                staticImage = null;
                myWindow.setContentPane(myController.getPanel(myWindow));
                IJSwingUtilities.moveMousePointerOn(myWindow.getRootPane().getDefaultButton());
                myController.requestFocus();
            } else {
                if (restoreFullScreenButton) {
                    FullScreenUtilities.setWindowCanFullScreen(myParent, true);
                }
                myParent.removeComponentListener(myPositionListener);
                myController.dispose();
                myWindow.dispose();
                DialogWrapper.cleanupRootPane(myWindow.getRootPane());
            }
        }
    };
    myAnimator.resume();
}
Also used : Animator(com.intellij.util.ui.Animator) JBColor(com.intellij.ui.JBColor) JBColor(com.intellij.ui.JBColor) NotNull(org.jetbrains.annotations.NotNull)

Example 37 with JBColor

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

the class BaseLabel method updateUI.

@Override
public void updateUI() {
    setActiveFg(JBColor.foreground());
    setPassiveFg(new JBColor(Gray._75, UIUtil.getLabelDisabledForeground()));
    super.updateUI();
}
Also used : JBColor(com.intellij.ui.JBColor)

Example 38 with JBColor

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

the class IdeNotificationArea method createIconWithNotificationCount.

@NotNull
public static LayeredIcon createIconWithNotificationCount(JComponent component, NotificationType type, int size) {
    LayeredIcon icon = new LayeredIcon(2);
    icon.setIcon(getPendingNotificationsIcon(AllIcons.Ide.Notification.NoEvents, type), 0);
    if (size > 0) {
        //noinspection UseJBColor
        Color textColor = type == NotificationType.ERROR ? new JBColor(Color.white, new Color(0xF2F2F2)) : new Color(0x333333);
        icon.setIcon(new TextIcon(component, size < 10 ? String.valueOf(size) : "9+", textColor), 1);
    }
    return icon;
}
Also used : LayeredIcon(com.intellij.ui.LayeredIcon) JBColor(com.intellij.ui.JBColor) JBColor(com.intellij.ui.JBColor) NotNull(org.jetbrains.annotations.NotNull)

Example 39 with JBColor

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

the class InternalDecorator method init.

private void init(boolean dumbAware) {
    enableEvents(AWTEvent.COMPONENT_EVENT_MASK);
    final JPanel contentPane = new JPanel(new BorderLayout());
    contentPane.add(myHeader, BorderLayout.NORTH);
    JPanel innerPanel = new JPanel(new BorderLayout());
    JComponent toolWindowComponent = myToolWindow.getComponent();
    if (!dumbAware) {
        toolWindowComponent = DumbService.getInstance(myProject).wrapGently(toolWindowComponent, myProject);
    }
    innerPanel.add(toolWindowComponent, BorderLayout.CENTER);
    final NonOpaquePanel inner = new NonOpaquePanel(innerPanel);
    contentPane.add(inner, BorderLayout.CENTER);
    add(contentPane, BorderLayout.CENTER);
    if (SystemInfo.isMac) {
        setBackground(new JBColor(Gray._200, Gray._90));
    }
    // Add listeners
    registerKeyboardAction(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            ToolWindowManager.getInstance(myProject).activateEditorComponent();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
}
Also used : NonOpaquePanel(com.intellij.ui.components.panels.NonOpaquePanel) JBColor(com.intellij.ui.JBColor)

Example 40 with JBColor

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

the class PluginsTableRenderer method getTableCellRendererComponent.

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    if (myPluginDescriptor != null) {
        Couple<Color> colors = UIUtil.getCellColors(table, isSelected, row, column);
        Color fg = colors.getFirst();
        final Color background = colors.getSecond();
        Color grayedFg = isSelected ? fg : new JBColor(Gray._130, Gray._120);
        myPanel.setBackground(background);
        myName.setForeground(fg);
        myCategory.setForeground(grayedFg);
        myStatus.setForeground(grayedFg);
        myLastUpdated.setForeground(grayedFg);
        myDownloads.setForeground(grayedFg);
        myName.clear();
        myName.setOpaque(false);
        myCategory.clear();
        myCategory.setOpaque(false);
        String pluginName = myPluginDescriptor.getName() + "  ";
        Object query = table.getClientProperty(SpeedSearchSupply.SEARCH_QUERY_KEY);
        SimpleTextAttributes attr = new SimpleTextAttributes(UIUtil.getListBackground(isSelected), UIUtil.getListForeground(isSelected), JBColor.RED, SimpleTextAttributes.STYLE_PLAIN);
        Matcher matcher = NameUtil.buildMatcher("*" + query, NameUtil.MatchingCaseSensitivity.NONE);
        if (query instanceof String) {
            SpeedSearchUtil.appendColoredFragmentForMatcher(pluginName, myName, attr, matcher, UIUtil.getTableBackground(isSelected), true);
        } else {
            myName.append(pluginName);
        }
        String category = myPluginDescriptor.getCategory() == null ? null : StringUtil.toUpperCase(myPluginDescriptor.getCategory());
        if (category != null) {
            if (query instanceof String) {
                SpeedSearchUtil.appendColoredFragmentForMatcher(category, myCategory, attr, matcher, UIUtil.getTableBackground(isSelected), true);
            } else {
                myCategory.append(category);
            }
        } else if (!myPluginsView) {
            myCategory.append(AvailablePluginsManagerMain.N_A);
        }
        myStatus.setIcon(AllIcons.Nodes.Plugin);
        if (myPluginDescriptor.isBundled()) {
            myCategory.append(" [Bundled]");
            myStatus.setIcon(AllIcons.Nodes.PluginJB);
        }
        String vendor = myPluginDescriptor.getVendor();
        if (vendor != null && StringUtil.containsIgnoreCase(vendor, "jetbrains")) {
            myStatus.setIcon(AllIcons.Nodes.PluginJB);
        }
        String downloads = myPluginDescriptor.getDownloads();
        if (downloads != null && myPluginDescriptor instanceof PluginNode) {
            if (downloads.length() > 3) {
                downloads = new DecimalFormat("#,###").format(Integer.parseInt(downloads));
            }
            myDownloads.setText(downloads);
            myRating.setRate(((PluginNode) myPluginDescriptor).getRating());
            myLastUpdated.setText(DateFormatUtil.formatBetweenDates(((PluginNode) myPluginDescriptor).getDate(), System.currentTimeMillis()));
        }
        // plugin state-dependent rendering
        PluginId pluginId = myPluginDescriptor.getPluginId();
        IdeaPluginDescriptor installed = PluginManager.getPlugin(pluginId);
        if (installed != null && ((IdeaPluginDescriptorImpl) installed).isDeleted()) {
            // existing plugin uninstalled (both views)
            myStatus.setIcon(AllIcons.Nodes.PluginRestart);
            if (!isSelected)
                myName.setForeground(FileStatus.DELETED.getColor());
            myPanel.setToolTipText(IdeBundle.message("plugin.manager.uninstalled.tooltip"));
        } else if (ourState.wasInstalled(pluginId)) {
            // new plugin installed (both views)
            myStatus.setIcon(AllIcons.Nodes.PluginRestart);
            if (!isSelected)
                myName.setForeground(FileStatus.ADDED.getColor());
            myPanel.setToolTipText(IdeBundle.message("plugin.manager.installed.tooltip"));
        } else if (ourState.wasUpdated(pluginId)) {
            // existing plugin updated (both views)
            myStatus.setIcon(AllIcons.Nodes.PluginRestart);
            if (!isSelected)
                myName.setForeground(FileStatus.ADDED.getColor());
            myPanel.setToolTipText(IdeBundle.message("plugin.manager.updated.tooltip"));
        } else if (ourState.hasNewerVersion(pluginId)) {
            // existing plugin has a newer version (both views)
            myStatus.setIcon(AllIcons.Nodes.Pluginobsolete);
            if (!isSelected)
                myName.setForeground(FileStatus.MODIFIED.getColor());
            if (!myPluginsView && installed != null) {
                myPanel.setToolTipText(IdeBundle.message("plugin.manager.new.version.tooltip", installed.getVersion()));
            } else {
                myPanel.setToolTipText(IdeBundle.message("plugin.manager.update.available.tooltip"));
            }
        } else if (isIncompatible(myPluginDescriptor, table.getModel())) {
            // a plugin is incompatible with current installation (both views)
            if (!isSelected)
                myName.setForeground(JBColor.RED);
            myPanel.setToolTipText(whyIncompatible(myPluginDescriptor, table.getModel()));
        } else if (!myPluginDescriptor.isEnabled() && myPluginsView) {
            // a plugin is disabled (plugins view only)
            myStatus.setIcon(IconLoader.getDisabledIcon(myStatus.getIcon()));
        }
    }
    return myPanel;
}
Also used : Matcher(com.intellij.util.text.Matcher) JBColor(com.intellij.ui.JBColor) SimpleTextAttributes(com.intellij.ui.SimpleTextAttributes) DecimalFormat(java.text.DecimalFormat) JBColor(com.intellij.ui.JBColor) PluginId(com.intellij.openapi.extensions.PluginId)

Aggregations

JBColor (com.intellij.ui.JBColor)51 GraphicsConfig (com.intellij.openapi.ui.GraphicsConfig)8 NotNull (org.jetbrains.annotations.NotNull)8 SimpleTextAttributes (com.intellij.ui.SimpleTextAttributes)4 Rectangle2D (java.awt.geom.Rectangle2D)4 UIUtil (com.intellij.util.ui.UIUtil)3 Project (com.intellij.openapi.project.Project)2 BalloonLayout (com.intellij.ui.BalloonLayout)2 BalloonLayoutData (com.intellij.ui.BalloonLayoutData)2 StudyStatus (com.jetbrains.edu.learning.courseFormat.StudyStatus)2 RoundRectangle2D (java.awt.geom.RoundRectangle2D)2 BasicArrowButton (javax.swing.plaf.basic.BasicArrowButton)2 Nullable (org.jetbrains.annotations.Nullable)2 ItemResourceValue (com.android.ide.common.rendering.api.ItemResourceValue)1 ResourceValue (com.android.ide.common.rendering.api.ResourceValue)1 LegendComponent (com.android.tools.adtui.LegendComponent)1 LegendRenderData (com.android.tools.adtui.LegendRenderData)1 TimelineComponent (com.android.tools.adtui.TimelineComponent)1 ConfiguredThemeEditorStyle (com.android.tools.idea.editors.theme.datamodels.ConfiguredThemeEditorStyle)1 MergedManifest (com.android.tools.idea.model.MergedManifest)1