use of com.intellij.ui.border.CustomLineBorder in project intellij-community by JetBrains.
the class ArtifactEditorImpl method createMainComponent.
public JComponent createMainComponent() {
mySourceItemsTree.initTree();
myLayoutTreeComponent.initTree();
DataManager.registerDataProvider(myMainPanel, new TypeSafeDataProviderAdapter(new MyDataProvider()));
myErrorPanelPlace.add(myValidationManager.getMainErrorPanel(), BorderLayout.CENTER);
final JBSplitter splitter = new OnePixelSplitter(false);
final JPanel leftPanel = new JPanel(new BorderLayout());
JPanel treePanel = myLayoutTreeComponent.getTreePanel();
if (UIUtil.isUnderDarcula()) {
treePanel.setBorder(new EmptyBorder(3, 0, 0, 0));
} else {
treePanel.setBorder(new LineBorder(UIUtil.getBorderColor()));
}
leftPanel.add(treePanel, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) {
CompoundBorder border = new CompoundBorder(new CustomLineBorder(0, 0, 0, 1), BorderFactory.createEmptyBorder(0, 0, 0, 0));
leftPanel.setBorder(border);
} else {
leftPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 0));
}
splitter.setFirstComponent(leftPanel);
final JPanel rightPanel = new JPanel(new BorderLayout());
final JPanel rightTopPanel = new JPanel(new BorderLayout());
final JPanel labelPanel = new JPanel();
labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.X_AXIS));
labelPanel.add(new JLabel("Available Elements "));
final HyperlinkLabel link = new HyperlinkLabel("");
link.setIcon(AllIcons.General.Help_small);
link.setUseIconAsLink(true);
link.addHyperlinkListener(new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
final JLabel label = new JLabel(ProjectBundle.message("artifact.source.items.tree.tooltip"));
label.setBorder(HintUtil.createHintBorder());
label.setBackground(HintUtil.getInformationColor());
label.setOpaque(true);
HintManager.getInstance().showHint(label, RelativePoint.getSouthWestOf(link), HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE, -1);
}
});
labelPanel.add(link);
rightTopPanel.add(labelPanel, BorderLayout.CENTER);
rightPanel.add(rightTopPanel, BorderLayout.NORTH);
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(mySourceItemsTree, true);
JPanel scrollPaneWrap = new JPanel(new BorderLayout());
scrollPaneWrap.add(scrollPane, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) {
scrollPaneWrap.setBorder(new EmptyBorder(3, 0, 0, 0));
} else {
scrollPaneWrap.setBorder(new LineBorder(UIUtil.getBorderColor()));
}
rightPanel.add(scrollPaneWrap, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) {
rightPanel.setBorder(new CompoundBorder(new CustomLineBorder(0, 1, 0, 0), BorderFactory.createEmptyBorder(0, 0, 0, 0)));
} else {
rightPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 3));
}
splitter.setSecondComponent(rightPanel);
splitter.getDivider().setBackground(UIUtil.getPanelBackground());
treePanel.setBorder(JBUI.Borders.empty());
rightPanel.setBorder(JBUI.Borders.empty());
scrollPaneWrap.setBorder(JBUI.Borders.empty());
leftPanel.setBorder(JBUI.Borders.empty());
myShowContentCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final ThreeStateCheckBox.State state = myShowContentCheckBox.getState();
if (state == ThreeStateCheckBox.State.SELECTED) {
mySubstitutionParameters.setSubstituteAll();
} else if (state == ThreeStateCheckBox.State.NOT_SELECTED) {
mySubstitutionParameters.setSubstituteNone();
}
myShowContentCheckBox.setThirdStateEnabled(false);
myLayoutTreeComponent.rebuildTree();
onShowContentSettingsChanged();
}
});
ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, createToolbarActionGroup(), true);
JComponent toolbarComponent = toolbar.getComponent();
if (UIUtil.isUnderDarcula()) {
toolbarComponent.setBorder(new CustomLineBorder(0, 0, 1, 0));
}
leftPanel.add(toolbarComponent, BorderLayout.NORTH);
toolbar.updateActionsImmediately();
rightTopPanel.setPreferredSize(new Dimension(-1, toolbarComponent.getPreferredSize().height));
myTabbedPane = new TabbedPaneWrapper(this);
myTabbedPane.addTab("Output Layout", splitter);
myPropertiesEditors.addTabs(myTabbedPane);
myEditorPanel.add(myTabbedPane.getComponent(), BorderLayout.CENTER);
final LayoutTree tree = myLayoutTreeComponent.getLayoutTree();
new ShowAddPackagingElementPopupAction(this).registerCustomShortcutSet(CommonShortcuts.getNew(), tree);
PopupHandler.installPopupHandler(tree, createPopupActionGroup(), ActionPlaces.UNKNOWN, ActionManager.getInstance());
ToolTipManager.sharedInstance().registerComponent(tree);
rebuildTries();
return getMainComponent();
}
use of com.intellij.ui.border.CustomLineBorder in project intellij-community by JetBrains.
the class LayoutTreeComponent method createPropertiesPanel.
private void createPropertiesPanel() {
myPropertiesPanel = new JPanel(new BorderLayout());
final JPanel emptyPanel = new JPanel();
emptyPanel.setMinimumSize(JBUI.emptySize());
emptyPanel.setPreferredSize(JBUI.emptySize());
myPropertiesPanelWrapper = new JPanel(new CardLayout());
myPropertiesPanel.setBorder(new CustomLineBorder(1, 0, 0, 0));
myPropertiesPanelWrapper.add(EMPTY_CARD, emptyPanel);
myPropertiesPanelWrapper.add(PROPERTIES_CARD, myPropertiesPanel);
}
use of com.intellij.ui.border.CustomLineBorder in project intellij-community by JetBrains.
the class CustomizeFeaturedPluginsStepPanel method onPluginGroupsLoaded.
private void onPluginGroupsLoaded() {
List<IdeaPluginDescriptor> pluginsFromRepository = myPluginGroups.getPluginsFromRepository();
if (pluginsFromRepository.isEmpty()) {
myInProgressLabel.setText("Cannot get featured plugins description online.");
return;
}
removeAll();
JPanel gridPanel = new JPanel(new GridLayout(0, 3));
JBScrollPane scrollPane = CustomizePluginsStepPanel.createScrollPane(gridPanel);
Map<String, String> config = myPluginGroups.getFeaturedPlugins();
for (Map.Entry<String, String> entry : config.entrySet()) {
JPanel groupPanel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
gbc.anchor = GridBagConstraints.WEST;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.weightx = 1;
String title = entry.getKey();
String s = entry.getValue();
int i = s.indexOf(':');
String topic = s.substring(0, i);
int j = s.indexOf(':', i + 1);
String description = s.substring(i + 1, j);
final String pluginId = s.substring(j + 1);
IdeaPluginDescriptor foundDescriptor = null;
for (IdeaPluginDescriptor descriptor : pluginsFromRepository) {
if (descriptor.getPluginId().getIdString().equals(pluginId) && !PluginManagerCore.isBrokenPlugin(descriptor)) {
foundDescriptor = descriptor;
break;
}
}
if (foundDescriptor == null)
continue;
final IdeaPluginDescriptor descriptor = foundDescriptor;
final boolean isVIM = PluginGroups.IDEA_VIM_PLUGIN_ID.equals(descriptor.getPluginId().getIdString());
boolean isCloud = "#Cloud".equals(topic);
if (isCloud) {
title = descriptor.getName();
description = StringUtil.defaultIfEmpty(descriptor.getDescription(), "No description available");
topic = StringUtil.defaultIfEmpty(descriptor.getCategory(), "Unknown");
}
JLabel titleLabel = new JLabel("<html><body><h2 style=\"text-align:left;\">" + title + "</h2></body></html>");
JLabel topicLabel = new JLabel("<html><body><h4 style=\"text-align:left;color:#808080;font-weight:bold;\">" + topic + "</h4></body></html>");
JLabel descriptionLabel = createHTMLLabel(description);
JLabel warningLabel = null;
if (isVIM || isCloud) {
if (isCloud) {
warningLabel = createHTMLLabel("From your JetBrains account");
warningLabel.setIcon(AllIcons.General.BalloonInformation);
} else {
warningLabel = createHTMLLabel("Recommended only if you are<br> familiar with Vim.");
warningLabel.setIcon(AllIcons.General.BalloonWarning);
}
if (!SystemInfo.isWindows)
UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, warningLabel);
}
final CardLayout wrapperLayout = new CardLayout();
final JPanel buttonWrapper = new JPanel(wrapperLayout);
final JButton installButton = new JButton(isVIM ? "Install and Enable" : "Install");
final JProgressBar progressBar = new JProgressBar(0, 100);
progressBar.setStringPainted(true);
JPanel progressPanel = new JPanel(new VerticalFlowLayout(true, false));
progressPanel.add(progressBar);
final LinkLabel cancelLink = new LinkLabel("Cancel", AllIcons.Actions.Cancel);
JPanel linkWrapper = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
linkWrapper.add(cancelLink);
progressPanel.add(linkWrapper);
final JPanel buttonPanel = new JPanel(new VerticalFlowLayout(0, 0));
buttonPanel.add(installButton);
buttonWrapper.add(buttonPanel, "button");
buttonWrapper.add(progressPanel, "progress");
wrapperLayout.show(buttonWrapper, "button");
final ProgressIndicatorEx indicator = new AbstractProgressIndicatorExBase(true) {
@Override
public void start() {
myCanceled.set(false);
super.start();
SwingUtilities.invokeLater(() -> wrapperLayout.show(buttonWrapper, "progress"));
}
@Override
public void processFinish() {
super.processFinish();
SwingUtilities.invokeLater(() -> {
wrapperLayout.show(buttonWrapper, "button");
installButton.setEnabled(false);
installButton.setText("Installed");
});
}
@Override
public void setFraction(final double fraction) {
super.setFraction(fraction);
SwingUtilities.invokeLater(() -> {
int value = (int) (100 * fraction + .5);
progressBar.setValue(value);
progressBar.setString(value + "%");
});
}
@Override
public void cancel() {
stop();
myCanceled.set(true);
super.cancel();
SwingUtilities.invokeLater(() -> {
wrapperLayout.show(buttonWrapper, "button");
progressBar.setValue(0);
progressBar.setString("0%");
});
}
};
installButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
wrapperLayout.show(buttonWrapper, "progress");
ourService.execute(new Runnable() {
@Override
public void run() {
try {
indicator.start();
IdeInitialConfigButtonUsages.addDownloadedPlugin(descriptor.getPluginId().getIdString());
PluginDownloader downloader = PluginDownloader.createDownloader(descriptor);
downloader.prepareToInstall(indicator);
downloader.install();
indicator.processFinish();
} catch (Exception ignored) {
if (!myCanceled.get()) {
onFail();
}
}
}
void onFail() {
//noinspection SSBasedInspection
SwingUtilities.invokeLater(() -> {
indicator.stop();
wrapperLayout.show(buttonWrapper, "progress");
progressBar.setString("Cannot download plugin");
});
}
});
}
});
cancelLink.setListener(new LinkListener() {
@Override
public void linkSelected(LinkLabel aSource, Object aLinkData) {
indicator.cancel();
}
}, null);
gbc.insets.left = installButton.getInsets().left / 2;
gbc.insets.right = installButton.getInsets().right / 2;
gbc.insets.bottom = -5;
groupPanel.add(titleLabel, gbc);
gbc.insets.bottom = SMALL_GAP;
groupPanel.add(topicLabel, gbc);
groupPanel.add(descriptionLabel, gbc);
gbc.weighty = 1;
groupPanel.add(Box.createVerticalGlue(), gbc);
gbc.weighty = 0;
if (warningLabel != null) {
Insets insetsBefore = gbc.insets;
gbc.insets = new Insets(0, -10, SMALL_GAP, -10);
gbc.insets.left += insetsBefore.left;
gbc.insets.right += insetsBefore.right;
JPanel warningPanel = new JPanel(new BorderLayout());
warningPanel.setBorder(new EmptyBorder(5, 10, 5, 10));
warningPanel.add(warningLabel);
groupPanel.add(warningPanel, gbc);
gbc.insets = insetsBefore;
}
gbc.insets.bottom = gbc.insets.left = gbc.insets.right = 0;
groupPanel.add(buttonWrapper, gbc);
gridPanel.add(groupPanel);
}
while (gridPanel.getComponentCount() < 4) {
gridPanel.add(Box.createVerticalBox());
}
int cursor = 0;
Component[] components = gridPanel.getComponents();
int rowCount = components.length / COLS;
for (Component component : components) {
((JComponent) component).setBorder(new CompoundBorder(new CustomLineBorder(ColorUtil.withAlpha(JBColor.foreground(), .2), 0, 0, cursor / 3 < rowCount && (!(component instanceof Box)) ? 1 : 0, cursor % COLS != COLS - 1 && (!(component instanceof Box)) ? 1 : 0) {
@Override
protected Color getColor() {
return ColorUtil.withAlpha(JBColor.foreground(), .2);
}
}, BorderFactory.createEmptyBorder(0, SMALL_GAP, 0, SMALL_GAP)));
cursor++;
}
add(scrollPane);
revalidate();
repaint();
}
use of com.intellij.ui.border.CustomLineBorder in project intellij-community by JetBrains.
the class DialogWrapper method createSouthPanel.
@NotNull
private JPanel createSouthPanel(@NotNull List<JButton> leftSideButtons, @NotNull List<JButton> rightSideButtons, boolean hasHelpToMoveToLeftSide) {
JPanel panel = new JPanel(new BorderLayout()) {
@Override
public Color getBackground() {
final Color bg = UIManager.getColor("DialogWrapper.southPanelBackground");
if (getStyle() == DialogStyle.COMPACT && bg != null) {
return bg;
}
return super.getBackground();
}
};
if (myDoNotAsk != null) {
myCheckBoxDoNotShowDialog = new JCheckBox(myDoNotAsk.getDoNotShowMessage());
myCheckBoxDoNotShowDialog.setVisible(myDoNotAsk.canBeHidden());
myCheckBoxDoNotShowDialog.setSelected(!myDoNotAsk.isToBeShown());
DialogUtil.registerMnemonic(myCheckBoxDoNotShowDialog, '&');
}
JComponent doNotAskCheckbox = createDoNotAskCheckbox();
final JPanel lrButtonsPanel = new NonOpaquePanel(new GridBagLayout());
//noinspection UseDPIAwareInsets
//don't wrap to JBInsets
final Insets insets = SystemInfo.isMacOSLeopard ? UIUtil.isUnderIntelliJLaF() ? JBUI.insets(0, 8) : JBUI.emptyInsets() : new Insets(8, 0, 0, 0);
if (rightSideButtons.size() > 0 || leftSideButtons.size() > 0) {
GridBag bag = new GridBag().setDefaultInsets(insets);
if (leftSideButtons.size() > 0) {
JPanel buttonsPanel = createButtonsPanel(leftSideButtons);
if (rightSideButtons.size() > 0) {
// leave some space between button groups
buttonsPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
}
lrButtonsPanel.add(buttonsPanel, bag.next());
}
// left strut
lrButtonsPanel.add(Box.createHorizontalGlue(), bag.next().weightx(1).fillCellHorizontally());
if (rightSideButtons.size() > 0) {
JPanel buttonsPanel = createButtonsPanel(rightSideButtons);
if (shouldAddErrorNearButtons()) {
lrButtonsPanel.add(myErrorText, bag.next());
lrButtonsPanel.add(Box.createHorizontalStrut(10), bag.next());
}
lrButtonsPanel.add(buttonsPanel, bag.next());
}
if (SwingConstants.CENTER == myButtonAlignment && doNotAskCheckbox == null) {
// right strut
lrButtonsPanel.add(Box.createHorizontalGlue(), bag.next().weightx(1).fillCellHorizontally());
}
}
JComponent helpButton = null;
if (hasHelpToMoveToLeftSide) {
helpButton = createHelpButton(insets);
}
if (helpButton != null || doNotAskCheckbox != null) {
JPanel leftPanel = new JPanel(new BorderLayout());
if (helpButton != null)
leftPanel.add(helpButton, BorderLayout.WEST);
if (doNotAskCheckbox != null) {
doNotAskCheckbox.setBorder(JBUI.Borders.emptyRight(20));
leftPanel.add(doNotAskCheckbox, BorderLayout.CENTER);
}
panel.add(leftPanel, BorderLayout.WEST);
}
panel.add(lrButtonsPanel, BorderLayout.CENTER);
if (getStyle() == DialogStyle.COMPACT) {
final Color color = UIManager.getColor("DialogWrapper.southPanelDivider");
Border line = new CustomLineBorder(color != null ? color : OnePixelDivider.BACKGROUND, 1, 0, 0, 0);
panel.setBorder(new CompoundBorder(line, JBUI.Borders.empty(8, 12)));
} else {
panel.setBorder(JBUI.Borders.emptyTop(8));
}
return panel;
}
Aggregations