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;
}
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;
}
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;
}
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;
}
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);
}
Aggregations