Search in sources :

Example 1 with NonOpaquePanel

use of com.intellij.ui.components.panels.NonOpaquePanel in project intellij-community by JetBrains.

the class NavigationItemListCellRenderer method getListCellRendererComponent.

@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    removeAll();
    final boolean hasRightRenderer = UISettings.getInstance().getShowIconInQuickNavigation();
    final ModuleRendererFactory factory = ModuleRendererFactory.findInstance(value);
    final LeftRenderer left = new LeftRenderer(!hasRightRenderer || !factory.rendersLocationString(), MatcherHolder.getAssociatedMatcher(list));
    final Component leftCellRendererComponent = left.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    final Color listBg = leftCellRendererComponent.getBackground();
    add(leftCellRendererComponent, BorderLayout.WEST);
    setBackground(isSelected ? UIUtil.getListSelectionBackground() : listBg);
    if (hasRightRenderer) {
        final DefaultListCellRenderer moduleRenderer = factory.getModuleRenderer();
        final Component rightCellRendererComponent = moduleRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        ((JComponent) rightCellRendererComponent).setOpaque(false);
        rightCellRendererComponent.setBackground(listBg);
        add(rightCellRendererComponent, BorderLayout.EAST);
        final JPanel spacer = new NonOpaquePanel();
        final Dimension size = rightCellRendererComponent.getSize();
        spacer.setSize(new Dimension((int) (size.width * 0.015 + leftCellRendererComponent.getSize().width * 0.015), size.height));
        spacer.setBackground(isSelected ? UIUtil.getListSelectionBackground() : listBg);
        add(spacer, BorderLayout.CENTER);
    }
    return this;
}
Also used : NonOpaquePanel(com.intellij.ui.components.panels.NonOpaquePanel) JBColor(com.intellij.ui.JBColor)

Example 2 with NonOpaquePanel

use of com.intellij.ui.components.panels.NonOpaquePanel in project intellij-community by JetBrains.

the class LoadingDecorator method customizeLoadingLayer.

protected NonOpaquePanel customizeLoadingLayer(JPanel parent, JLabel text, AsyncProcessIcon icon) {
    parent.setLayout(new GridBagLayout());
    final Font font = text.getFont();
    text.setFont(font.deriveFont(font.getStyle(), font.getSize() + 8));
    //text.setForeground(Color.black);
    final int gap = new JLabel().getIconTextGap();
    final NonOpaquePanel result = new NonOpaquePanel(new FlowLayout(FlowLayout.CENTER, gap * 3, 0));
    result.add(icon);
    result.add(text);
    parent.add(result);
    return result;
}
Also used : NonOpaquePanel(com.intellij.ui.components.panels.NonOpaquePanel)

Example 3 with NonOpaquePanel

use of com.intellij.ui.components.panels.NonOpaquePanel in project intellij-community by JetBrains.

the class RunConfigurationsComboBoxAction method createCustomComponent.

@Override
public JComponent createCustomComponent(final Presentation presentation) {
    ComboBoxButton button = createComboBoxButton(presentation);
    button.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
    NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout());
    panel.setBorder(IdeBorderFactory.createEmptyBorder(0, 0, 0, 2));
    panel.add(button);
    return panel;
}
Also used : NonOpaquePanel(com.intellij.ui.components.panels.NonOpaquePanel)

Example 4 with NonOpaquePanel

use of com.intellij.ui.components.panels.NonOpaquePanel in project intellij-community by JetBrains.

the class RunnerContentUi method getGridFor.

@Nullable
private GridImpl getGridFor(@NotNull Content content, boolean createIfMissing) {
    GridImpl grid = (GridImpl) findGridFor(content);
    if (grid != null || !createIfMissing)
        return grid;
    grid = new GridImpl(this, mySessionName);
    if (myCurrentOver != null || myOriginal != null) {
        Integer forcedDropIndex = content.getUserData(RunnerLayout.DROP_INDEX);
        final int index = myTabs.getDropInfoIndex() + (myOriginal != null ? myOriginal.getTabOffsetFor(this) : 0);
        final int dropIndex = forcedDropIndex != null ? forcedDropIndex : index;
        if (forcedDropIndex == null) {
            moveFollowingTabs(dropIndex);
        }
        final int defaultIndex = content.getUserData(RunnerLayout.DEFAULT_INDEX);
        final TabImpl tab = myLayoutSettings.getOrCreateTab(forcedDropIndex != null ? forcedDropIndex : -1);
        tab.setDefaultIndex(defaultIndex);
        tab.setIndex(dropIndex);
        getStateFor(content).assignTab(tab);
        content.putUserData(RunnerLayout.DROP_INDEX, null);
        content.putUserData(RunnerLayout.DEFAULT_INDEX, null);
    }
    TabInfo tab = new TabInfo(grid).setObject(getStateFor(content).getTab()).setText("Tab");
    Wrapper left = new Wrapper();
    myCommonActionsPlaceholder.put(grid, left);
    Wrapper minimizedToolbar = new Wrapper();
    myMinimizedButtonsPlaceholder.put(grid, minimizedToolbar);
    final Wrapper searchComponent = new Wrapper();
    if (content.getSearchComponent() != null) {
        searchComponent.setContent(content.getSearchComponent());
    }
    TwoSideComponent right = new TwoSideComponent(searchComponent, minimizedToolbar);
    NonOpaquePanel sideComponent = new TwoSideComponent(left, right);
    tab.setSideComponent(sideComponent);
    tab.setTabLabelActions((ActionGroup) myActionManager.getAction(VIEW_TOOLBAR), TAB_TOOLBAR_PLACE);
    myTabs.addTab(tab);
    myTabs.sortTabs(myTabsComparator);
    return grid;
}
Also used : Wrapper(com.intellij.ui.components.panels.Wrapper) NonOpaquePanel(com.intellij.ui.components.panels.NonOpaquePanel) TabInfo(com.intellij.ui.tabs.TabInfo) RelativePoint(com.intellij.ui.awt.RelativePoint) Nullable(org.jetbrains.annotations.Nullable)

Example 5 with NonOpaquePanel

use of com.intellij.ui.components.panels.NonOpaquePanel in project intellij-community by JetBrains.

the class NotificationsManagerImpl method createMergeAction.

private static void createMergeAction(@NotNull final BalloonLayoutData layoutData, @NotNull JPanel panel) {
    StringBuilder title = new StringBuilder().append(layoutData.mergeData.count).append(" more");
    String shortTitle = NotificationParentGroup.getShortTitle(layoutData.groupId);
    if (shortTitle != null) {
        title.append(" from ").append(shortTitle);
    }
    LinkLabel<BalloonLayoutData> action = new LinkLabel<BalloonLayoutData>(title.toString(), null, new LinkListener<BalloonLayoutData>() {

        @Override
        public void linkSelected(LinkLabel aSource, BalloonLayoutData layoutData) {
            EventLog.showNotification(layoutData.project, layoutData.groupId, layoutData.getMergeIds());
        }
    }, layoutData) {

        @Override
        protected boolean isInClickableArea(Point pt) {
            return true;
        }

        @Override
        protected Color getTextColor() {
            return new JBColor(0x666666, 0x8C8C8C);
        }
    };
    action.setFont(FontUtil.minusOne(action.getFont()));
    action.setHorizontalAlignment(SwingConstants.CENTER);
    action.setPaintUnderline(false);
    AbstractLayoutManager layout = new AbstractLayoutManager() {

        @Override
        public Dimension preferredLayoutSize(Container parent) {
            return new Dimension(parent.getWidth(), JBUI.scale(20) + 2);
        }

        @Override
        public void layoutContainer(Container parent) {
            parent.getComponent(0).setBounds(2, 1, parent.getWidth() - 4, JBUI.scale(20));
        }
    };
    JPanel mergePanel = new NonOpaquePanel(layout) {

        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.setColor(new JBColor(0xE3E3E3, 0x3A3C3D));
            ((Graphics2D) g).fill(new Rectangle2D.Double(1.5, 1, getWidth() - 2.5, getHeight() - 2));
            g.setColor(new JBColor(0xDBDBDB, 0x353738));
            if (SystemInfo.isMac) {
                ((Graphics2D) g).draw(new Rectangle2D.Double(2, 0, getWidth() - 3.5, 0.5));
            } else if (SystemInfo.isWindows) {
                ((Graphics2D) g).draw(new Rectangle2D.Double(1.5, 0, getWidth() - 3, 0.5));
            } else {
                ((Graphics2D) g).draw(new Rectangle2D.Double(1.5, 0, getWidth() - 2.5, 0.5));
            }
        }
    };
    mergePanel.add(action);
    panel.add(BorderLayout.SOUTH, mergePanel);
}
Also used : AbstractLayoutManager(com.intellij.util.ui.AbstractLayoutManager) Rectangle2D(java.awt.geom.Rectangle2D) NonOpaquePanel(com.intellij.ui.components.panels.NonOpaquePanel) LinkLabel(com.intellij.ui.components.labels.LinkLabel)

Aggregations

NonOpaquePanel (com.intellij.ui.components.panels.NonOpaquePanel)20 NotNull (org.jetbrains.annotations.NotNull)5 RelativePoint (com.intellij.ui.awt.RelativePoint)4 EmptyBorder (javax.swing.border.EmptyBorder)4 Project (com.intellij.openapi.project.Project)3 JBColor (com.intellij.ui.JBColor)3 LinkLabel (com.intellij.ui.components.labels.LinkLabel)3 HintHint (com.intellij.ui.HintHint)2 TabInfo (com.intellij.ui.tabs.TabInfo)2 VmStatsTreeTableModel (com.android.tools.idea.editors.vmtrace.treemodel.VmStatsTreeTableModel)1 Executor (com.intellij.execution.Executor)1 KillableProcess (com.intellij.execution.KillableProcess)1 ExecutionManagerImpl (com.intellij.execution.impl.ExecutionManagerImpl)1 ProcessHandler (com.intellij.execution.process.ProcessHandler)1 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)1 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)1 ActionToolbar (com.intellij.openapi.actionSystem.ActionToolbar)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 Document (com.intellij.openapi.editor.Document)1 Editor (com.intellij.openapi.editor.Editor)1