use of com.intellij.ui.border.CustomLineBorder in project intellij-community by JetBrains.
the class PluginManagerMain method init.
protected void init() {
GuiUtils.replaceJSplitPaneWithIDEASplitter(main);
HTMLEditorKit kit = new HTMLEditorKit();
StyleSheet sheet = kit.getStyleSheet();
// list-style-type: none;
sheet.addRule("ul {margin-left: 16px}");
myDescriptionTextArea.setEditorKit(kit);
myDescriptionTextArea.setEditable(false);
myDescriptionTextArea.addHyperlinkListener(new MyHyperlinkListener());
JScrollPane installedScrollPane = createTable();
myPluginHeaderPanel = new PluginHeaderPanel(this);
myHeader.setBackground(UIUtil.getTextFieldBackground());
myPluginHeaderPanel.getPanel().setBackground(UIUtil.getTextFieldBackground());
myPluginHeaderPanel.getPanel().setOpaque(true);
myHeader.add(myPluginHeaderPanel.getPanel(), BorderLayout.CENTER);
installTableActions();
myTablePanel.add(installedScrollPane, BorderLayout.CENTER);
UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, myPanelDescription);
myPanelDescription.setBorder(JBUI.Borders.emptyLeft(7));
final JPanel header = new JPanel(new BorderLayout()) {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
final Color bg = UIUtil.getTableBackground(false);
((Graphics2D) g).setPaint(new GradientPaint(0, 0, ColorUtil.shift(bg, 1.4), 0, getHeight(), ColorUtil.shift(bg, 0.9)));
g.fillRect(0, 0, getWidth(), getHeight());
}
};
header.setBorder(new CustomLineBorder(1, 1, 0, 1));
final JLabel mySortLabel = new JLabel();
mySortLabel.setForeground(UIUtil.getLabelDisabledForeground());
mySortLabel.setBorder(JBUI.Borders.empty(1, 1, 1, 5));
mySortLabel.setIcon(AllIcons.General.SplitDown);
mySortLabel.setHorizontalTextPosition(SwingConstants.LEADING);
header.add(mySortLabel, BorderLayout.EAST);
myTablePanel.add(header, BorderLayout.NORTH);
myToolbarPanel.setLayout(new BorderLayout());
myActionToolbar = ActionManager.getInstance().createActionToolbar("PluginManager", getActionGroup(true), true);
final JComponent component = myActionToolbar.getComponent();
myToolbarPanel.add(component, BorderLayout.CENTER);
myToolbarPanel.add(myFilter, BorderLayout.WEST);
new ClickListener() {
@Override
public boolean onClick(@NotNull MouseEvent event, int clickCount) {
JBPopupFactory.getInstance().createActionGroupPopup("Sort by:", createSortersGroup(), DataManager.getInstance().getDataContext(pluginTable), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true).showUnderneathOf(mySortLabel);
return true;
}
}.installOn(mySortLabel);
final TableModelListener modelListener = new TableModelListener() {
@Override
public void tableChanged(TableModelEvent e) {
String text = "Sort by:";
if (pluginsModel.isSortByStatus()) {
text += " status,";
}
if (pluginsModel.isSortByRating()) {
text += " rating,";
}
if (pluginsModel.isSortByDownloads()) {
text += " downloads,";
}
if (pluginsModel.isSortByUpdated()) {
text += " updated,";
}
text += " name";
mySortLabel.setText(text);
}
};
pluginTable.getModel().addTableModelListener(modelListener);
modelListener.tableChanged(null);
myDescriptionScrollPane.setBackground(UIUtil.getTextFieldBackground());
Border border = new BorderUIResource.LineBorderUIResource(new JBColor(Gray._220, Gray._55), 1);
myInfoPanel.setBorder(border);
}
use of com.intellij.ui.border.CustomLineBorder in project intellij-community by JetBrains.
the class EditorHeaderComponent method uiSettingsChanged.
@Override
public void uiSettingsChanged(UISettings uiSettings) {
boolean topBorderRequired = uiSettings.getEditorTabPlacement() != SwingConstants.TOP && (uiSettings.getShowNavigationBar() || uiSettings.getShowMainToolbar());
setBorder(new CustomLineBorder(JBColor.border(), topBorderRequired ? 1 : 0, 0, 1, 0));
}
use of com.intellij.ui.border.CustomLineBorder in project intellij-community by JetBrains.
the class AbstractExpandableItemsHandler method createToolTipImage.
@Nullable
private Point createToolTipImage(@NotNull KeyType key) {
UIUtil.putClientProperty(myComponent, EXPANDED_RENDERER, true);
Pair<Component, Rectangle> rendererAndBounds = getCellRendererAndBounds(key);
UIUtil.putClientProperty(myComponent, EXPANDED_RENDERER, null);
if (rendererAndBounds == null)
return null;
JComponent renderer = ObjectUtils.tryCast(rendererAndBounds.first, JComponent.class);
if (renderer == null)
return null;
if (UIUtil.isClientPropertyTrue(renderer, RENDERER_DISABLED))
return null;
if (UIUtil.isClientPropertyTrue(rendererAndBounds.getFirst(), USE_RENDERER_BOUNDS)) {
rendererAndBounds.getSecond().translate(renderer.getX(), renderer.getY());
rendererAndBounds.getSecond().setSize(renderer.getSize());
}
myKeyItemBounds = rendererAndBounds.second;
Rectangle cellBounds = myKeyItemBounds;
Rectangle visibleRect = getVisibleRect(key);
if (cellBounds.y < visibleRect.y)
return null;
int cellMaxY = cellBounds.y + cellBounds.height;
int visMaxY = visibleRect.y + visibleRect.height;
if (cellMaxY > visMaxY)
return null;
int cellMaxX = cellBounds.x + cellBounds.width;
int visMaxX = visibleRect.x + visibleRect.width;
Point location = new Point(visMaxX, cellBounds.y);
SwingUtilities.convertPointToScreen(location, myComponent);
Rectangle screen = ScreenUtil.getScreenRectangle(location);
int borderWidth = isPaintBorder() ? 1 : 0;
int width = Math.min(screen.width + screen.x - location.x - borderWidth, cellMaxX - visMaxX);
int height = cellBounds.height;
if (width <= 0 || height <= 0)
return null;
Dimension size = getImageSize(width, height);
myImage = UIUtil.createImage(myComponent, size.width, size.height, BufferedImage.TYPE_INT_RGB);
Graphics2D g = myImage.createGraphics();
g.setClip(null);
doFillBackground(height, width, g);
g.translate(cellBounds.x - visMaxX, 0);
doPaintTooltipImage(renderer, cellBounds, g, key);
CustomLineBorder border = null;
if (borderWidth > 0) {
border = new CustomLineBorder(getBorderColor(), borderWidth, 0, borderWidth, borderWidth);
Insets insets = border.getBorderInsets(myTipComponent);
location.y -= insets.top;
JBInsets.addTo(size, insets);
}
g.dispose();
myRendererPane.remove(renderer);
myTipComponent.setBorder(border);
myTipComponent.setPreferredSize(size);
return location;
}
use of com.intellij.ui.border.CustomLineBorder in project intellij-community by JetBrains.
the class DetectionExcludesConfigurable method createComponent.
@Nls
@Override
@NotNull
public JComponent createComponent() {
myEnabledDetectionCheckBox = new JCheckBox("Enable framework detection");
myEnabledDetectionCheckBox.setBorder(new EmptyBorder(10, 10, 0, 0));
final JBList excludesList = new JBList(myModel);
final ColoredListCellRenderer renderer = new ColoredListCellRenderer() {
JPanel panel = new JPanel(new BorderLayout());
{
panel.setBorder(new EmptyBorder(2, 10, 2, 0));
panel.add(this);
}
@Override
protected void customizeCellRenderer(@NotNull JList list, Object value, int index, boolean selected, boolean hasFocus) {
setIconTextGap(4);
if (value instanceof ExcludeListItem) {
((ExcludeListItem) value).renderItem(this);
setBorder(new EmptyBorder(0, 10, 0, 0));
}
}
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean selected, boolean hasFocus) {
super.getListCellRendererComponent(list, value, index, selected, hasFocus);
panel.setBackground(UIUtil.getListBackground(selected));
return panel;
}
};
renderer.setMyBorder(new EmptyBorder(0, 0, 0, 0));
excludesList.setCellRenderer(renderer);
final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(excludesList).disableUpAction().disableDownAction().setAddAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
doAddAction(button);
}
});
decorator.setPanelBorder(new CustomLineBorder(1, 0, 0, 0));
myMainPanel = new JPanel(new BorderLayout(0, 5));
myMainPanel.add(myEnabledDetectionCheckBox, BorderLayout.NORTH);
final LabeledComponent<JPanel> excludesComponent = LabeledComponent.create(decorator.createPanel(), " Exclude from detection:");
myMainPanel.add(excludesComponent);
myEnabledDetectionCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
GuiUtils.enableChildren(myEnabledDetectionCheckBox.isSelected(), excludesComponent);
}
});
myEnabledDetectionCheckBox.setSelected(true);
return myMainPanel;
}
use of com.intellij.ui.border.CustomLineBorder in project intellij-community by JetBrains.
the class CommonContentEntriesEditor method createComponentImpl.
@Override
public JPanel createComponentImpl() {
final Module module = getModule();
final Project project = module.getProject();
myContentEntryEditorListener = new MyContentEntryEditorListener();
final JPanel mainPanel = new JPanel(new BorderLayout());
addAdditionalSettingsToPanel(mainPanel);
final DefaultActionGroup group = new DefaultActionGroup();
final AddContentEntryAction action = new AddContentEntryAction();
action.registerCustomShortcutSet(KeyEvent.VK_C, InputEvent.ALT_DOWN_MASK, mainPanel);
group.add(action);
myEditorsPanel = new ScrollablePanel(new VerticalStackLayout());
myEditorsPanel.setBackground(BACKGROUND_COLOR);
JScrollPane myScrollPane = ScrollPaneFactory.createScrollPane(myEditorsPanel, true);
final ToolbarPanel toolbarPanel = new ToolbarPanel(myScrollPane, group);
int border = myWithBorders ? 1 : 0;
toolbarPanel.setBorder(new CustomLineBorder(1, 0, border, border));
final JBSplitter splitter = new OnePixelSplitter(false);
splitter.setProportion(0.6f);
splitter.setHonorComponentsMinimumSize(true);
myRootTreeEditor = createContentEntryTreeEditor(project);
final JComponent component = myRootTreeEditor.createComponent();
component.setBorder(new CustomLineBorder(1, border, border, 0));
splitter.setFirstComponent(component);
splitter.setSecondComponent(toolbarPanel);
JPanel contentPanel = new JPanel(new GridBagLayout());
final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, myRootTreeEditor.getEditingActionsGroup(), true);
contentPanel.add(new JLabel("Mark as:"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, 0, JBUI.insets(0, 10), 0, 0));
contentPanel.add(actionToolbar.getComponent(), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, JBUI.emptyInsets(), 0, 0));
contentPanel.add(splitter, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, JBUI.emptyInsets(), 0, 0));
mainPanel.add(contentPanel, BorderLayout.CENTER);
final JPanel innerPanel = createBottomControl(module);
if (innerPanel != null) {
mainPanel.add(innerPanel, BorderLayout.SOUTH);
}
final ModifiableRootModel model = getModel();
if (model != null) {
final ContentEntry[] contentEntries = model.getContentEntries();
if (contentEntries.length > 0) {
for (final ContentEntry contentEntry : contentEntries) {
addContentEntryPanel(contentEntry.getUrl());
}
selectContentEntry(contentEntries[0].getUrl());
}
}
return mainPanel;
}
Aggregations