@Override public Border getBorder() { //avoid moving lines if (myState == State.EXPANDING || myState == State.COLLAPSING) { return new EmptyBorder(0,0,0,0); } //fix for Darcula double border if (myState == State.TEMPORARY_EXPANDED && UIUtil.isUnderDarcula()) { return new CustomLineBorder(Gray._75, 0, 0, 1, 0); } //save 1px for mouse handler if (myState == State.COLLAPSED) { return new EmptyBorder(0, 0, 1, 0); } return UISettings.getInstance().SHOW_MAIN_TOOLBAR || UISettings.getInstance().SHOW_NAVIGATION_BAR ? super.getBorder() : null; }
@Override public Border getBorder() { //avoid moving lines if (myState == State.EXPANDING || myState == State.COLLAPSING) { return new EmptyBorder(0,0,0,0); } //fix for Darcula double border if (myState == State.TEMPORARY_EXPANDED && UIUtil.isUnderDarcula()) { return new CustomLineBorder(Gray._75, 0, 0, 1, 0); } //save 1px for mouse handler if (myState == State.COLLAPSED) { return new EmptyBorder(0, 0, 1, 0); } return super.getBorder(); }
public void recalculateWidth() { myLeftWidth = 16; ListModel model = myList.getModel(); myTitle.setIcon(EmptyIcon.ICON_16); myTitle.setFont(getTitleFont()); int index = 0; while (index < model.getSize()) { Object el = model.getElementAt(index); Object prev = index == 0 ? null : model.getElementAt(index - 1); String title = getTitle(index, el, prev); if (title != null) { myTitle.setText(title); myLeftWidth = Math.max(myLeftWidth, myTitle.getPreferredSize().width); } index++; } myLeftWidth += 10; myTitle.setForeground(Gray._122); myTitle.setAlignmentY(BOTTOM_ALIGNMENT); myLeftPanel.setBorder(new CompoundBorder(new CustomLineBorder(Gray._206, 0,0,0,1), new EmptyBorder(0,0,0,5))); }
@RequiredDispatchThread public BaseWelcomeScreenPanel(@Nonnull Disposable parentDisposable, @Nullable E param) { super(new BorderLayout()); myParam = param; myLeftComponent = createLeftComponent(parentDisposable, param); JPanel leftPanel = new JPanel(new BorderLayout()); leftPanel.setBackground(WelcomeScreenConstants.getProjectsBackground()); leftPanel.setBorder(new CustomLineBorder(WelcomeScreenConstants.getSeparatorColor(), JBUI.insetsRight(1))); leftPanel.setPreferredSize(JBUI.size(300, 460)); leftPanel.add(myLeftComponent, BorderLayout.CENTER); add(leftPanel, BorderLayout.WEST); JComponent rightComponent = createRightComponent(param); add(rightComponent, BorderLayout.CENTER); }
@Override protected void init() { super.init(); myEnableCheckBox = new JCheckBox(ApplicationBundle.message("checkbox.enable.javadoc.formatting")); myEnableCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { update(); } }); myPanel.setBorder(new CustomLineBorder(OnePixelDivider.BACKGROUND, 1, 0, 0, 0)); myJavaDocPanel.add(BorderLayout.CENTER, myPanel); myJavaDocPanel.add(myEnableCheckBox, BorderLayout.NORTH); }
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); }
public ToolbarDecorator setToolbarPosition(ActionToolbarPosition position) { myToolbarPosition = position; myActionsPanelBorder = new CustomLineBorder(myToolbarPosition == ActionToolbarPosition.BOTTOM ? 1 : 0, myToolbarPosition == ActionToolbarPosition.RIGHT ? 1 : 0, myToolbarPosition == ActionToolbarPosition.TOP ? 1 : 0, myToolbarPosition == ActionToolbarPosition.LEFT ? 1 : 0); return this; }
private JComponent createRecentProjects() { JPanel panel = new JPanel(new BorderLayout()); panel.add(new NewRecentProjectPanel(this), BorderLayout.CENTER); panel.setBackground(getProjectsBackground()); panel.setBorder(new CustomLineBorder(getSeparatorColor(), JBUI.insetsRight(1))); return panel; }
@Nullable @Override protected JComponent createSouthPanel() { final JComponent panel = super.createSouthPanel(); CustomLineBorder line = new CustomLineBorder(new JBColor(Gray._153.withAlpha(128), Gray._100.withAlpha(128)), 1, 0, 0, 0); panel.setBorder(new CompoundBorder(line, new EmptyBorder(8, 12, 8, 12))); return panel; }
public FramesPanel(Project project, DebuggerStateManager stateManager) { super(project, stateManager); myStateManager = stateManager; setLayout(new BorderLayout()); myThreadsCombo = new ComboBoxWithWidePopup(); myThreadsCombo.setRenderer(new DebuggerComboBoxRenderer(myThreadsCombo.getRenderer())); myThreadsListener = new ThreadsListener(); myThreadsCombo.addItemListener(myThreadsListener); myFramesList = new FramesList(project); myFramesListener = new FramesListener(); myFramesList.addListSelectionListener(myFramesListener); myFramesList.addMouseListener(new MouseAdapter() { public void mousePressed(final MouseEvent e) { int index = myFramesList.locationToIndex(e.getPoint()); if (index >= 0 && myFramesList.isSelectedIndex(index)) { processListValue(myFramesList.getModel().getElementAt(index)); } } }); registerThreadsPopupMenu(myFramesList); setBorder(null); final ActionToolbar toolbar = createToolbar(); Wrapper threads = new Wrapper(); CustomLineBorder border = new CustomLineBorder(CaptionPanel.CNT_ACTIVE_BORDER_COLOR, 0, 0, 1, 0); threads.setBorder(border); threads.add(toolbar.getComponent(), BorderLayout.EAST); threads.add(myThreadsCombo, BorderLayout.CENTER); add(threads, BorderLayout.NORTH); add(ScrollPaneFactory.createScrollPane(myFramesList), BorderLayout.CENTER); }
private void createPropertiesPanel() { myPropertiesPanel = new JPanel(new BorderLayout()); final JPanel emptyPanel = new JPanel(); emptyPanel.setMinimumSize(new Dimension(0, 0)); emptyPanel.setPreferredSize(new Dimension(0, 0)); myPropertiesPanelWrapper = new JPanel(new CardLayout()); myPropertiesPanel.setBorder(new CustomLineBorder(UIUtil.getBorderColor(), 1, 0, 0, 0)); myPropertiesPanelWrapper.add(EMPTY_CARD, emptyPanel); myPropertiesPanelWrapper.add(PROPERTIES_CARD, myPropertiesPanel); }
private static JComponent createEditorSettings() { final LabeledButtonsPanel panel = new LabeledButtonsPanel("Editor"); panel.addButton(new PreferenceButton("Editor", AllIcons.Preferences.Editor)); panel.addButton(new PreferenceButton("Code Style", AllIcons.Preferences.CodeStyle)); panel.setBackground(Gray._229); panel.setBorder(new CustomLineBorder(Gray._223, 0, 0, 1, 0)); return panel; }
private static JComponent createProjectSettings() { final LabeledButtonsPanel panel = new LabeledButtonsPanel("Project"); panel.addButton(new PreferenceButton("Compiler", AllIcons.Preferences.Compiler)); panel.addButton(new PreferenceButton("Version Control", AllIcons.Preferences.VersionControl)); panel.addButton(new PreferenceButton("File Colors", AllIcons.Preferences.FileColors)); panel.addButton(new PreferenceButton("Scopes", AllIcons.Preferences.Editor)); panel.setBackground(Gray._236); panel.setBorder(new CustomLineBorder(Gray._223, 0, 0, 1, 0)); return panel; }
private static JComponent createApplicationSettings() { final LabeledButtonsPanel panel = new LabeledButtonsPanel("IDE"); panel.addButton(new PreferenceButton("Appearance", AllIcons.Preferences.Appearance)); panel.addButton(new PreferenceButton("General", AllIcons.Preferences.General)); panel.addButton(new PreferenceButton("Keymap", AllIcons.Preferences.Keymap)); panel.addButton(new PreferenceButton("File Types", AllIcons.Preferences.FileTypes)); panel.setBackground(Gray._229); panel.setBorder(new CustomLineBorder(Gray._223, 0, 0, 1, 0)); return panel; }
private static JComponent createOtherSettings() { final LabeledButtonsPanel panel = new LabeledButtonsPanel("Other"); panel.addButton(new PreferenceButton("Plugins", AllIcons.Preferences.Plugins)); panel.addButton(new PreferenceButton("Updates", AllIcons.Preferences.Updates)); panel.setBackground(Gray._236); panel.setBorder(new CustomLineBorder(Gray._223, 0, 0, 1, 0)); return panel; }
public ToolbarPanel(JComponent contentComponent, ActionGroup actions) { super(new GridBagLayout()); setBorder(new CustomLineBorder(1, 0, 0, 0)); if (contentComponent.getBorder() != null) { contentComponent.setBorder(BorderFactory.createEmptyBorder()); } final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actions, true); add(actionToolbar.getComponent(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); add(contentComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); }
@Nullable @Override protected JComponent createSouthPanel() { JComponent southPanel = super.createSouthPanel(); if (southPanel != null) { southPanel.add(new JBLabel("Following nodes will be downloaded & installed"), BorderLayout.WEST); southPanel.setBorder(JBUI.Borders.empty(ourDefaultBorderInsets)); BorderLayoutPanel borderLayoutPanel = JBUI.Panels.simplePanel(southPanel); borderLayoutPanel.setBorder(new CustomLineBorder(JBUI.scale(1), 0, 0, 0)); return borderLayoutPanel; } return null; }
@Nullable @Override protected JComponent createSouthPanel() { JComponent southPanel = super.createSouthPanel(); if(southPanel != null) { southPanel.setBorder(JBUI.Borders.empty(ourDefaultBorderInsets)); BorderLayoutPanel borderLayoutPanel = JBUI.Panels.simplePanel(southPanel); borderLayoutPanel.setBorder(new CustomLineBorder(JBUI.scale(1), 0, 0, 0)); return borderLayoutPanel; } return null; }
@Nullable private static Color getBorderColor(@Nonnull Border value) { if (value instanceof LineBorder) { return ((LineBorder)value).getLineColor(); } else if (value instanceof CustomLineBorder) { try { return (Color)ReflectionUtil.findField(CustomLineBorder.class, Color.class, "myColor").get(value); } catch (Exception ignore) { } } return null; }
public StripeTabPanel() { super(new BorderLayout()); myTabPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false)); myTabPanel.setBorder(new CustomLineBorder(0, 0, 0, JBUI.scale(1))); add(myTabPanel, BorderLayout.WEST); myContentPanel = new JPanel(new CardLayout()); add(myContentPanel, BorderLayout.CENTER); }
public ToolbarDecorator setLineBorder(int top, int left, int bottom, int right) { return setToolbarBorder(new CustomLineBorder(top, left, bottom, right)); }
public DiffPanelImpl(final Window owner, @NotNull Project project, boolean enableToolbar, boolean horizontal, int diffDividerPolygonsOffset, DiffTool parentTool) { myProject = project; myIsHorizontal = horizontal; myParentTool = parentTool; myOptions = new DiffPanelOptions(this); myPanel = new DiffPanelOuterComponent(TextDiffType.DIFF_TYPES, null); myPanel.disableToolbar(!enableToolbar); if (enableToolbar) myPanel.resetToolbar(); myOwnerWindow = owner; myIsSyncScroll = true; final boolean v = !horizontal; myLeftSide = new DiffSideView(this, new CustomLineBorder(1, 0, v ? 0 : 1, v ? 0 : 1)); myRightSide = new DiffSideView(this, new CustomLineBorder(v ? 0 : 1, v ? 0 : 1, 1, 0)); myLeftSide.becomeMaster(); myDiffUpdater = new Rediffers(this); myDiffDividerPolygonsOffset = diffDividerPolygonsOffset; myData = createDiffPanelState(this); if (horizontal) { mySplitter = new DiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent(), new DiffDividerPaint(this, FragmentSide.SIDE1, diffDividerPolygonsOffset), myData); } else { mySplitter = new HorizontalDiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent()); } myPanel.insertDiffComponent(mySplitter.getComponent(), new MyScrollingPanel()); myDataProvider = new MyGenericDataProvider(this); myPanel.setDataProvider(myDataProvider); ComparisonPolicy comparisonPolicy = getComparisonPolicy(); if (comparisonPolicy != DiffManagerImpl.getInstanceEx().getComparisonPolicy()) { setComparisonPolicy(comparisonPolicy); } HighlightMode highlightMode = getHighlightMode(); if (highlightMode != DiffManagerImpl.getInstanceEx().getHighlightMode()) { setHighlightMode(highlightMode); } myVisibleAreaListener = new VisibleAreaListener() { @Override public void visibleAreaChanged(VisibleAreaEvent e) { Editor editor1 = getEditor1(); if (editor1 != null) { editor1.getComponent().repaint(); } Editor editor2 = getEditor2(); if (editor2 != null) { editor2.getComponent().repaint(); } } }; registerActions(); }
public EditorHeaderComponent() { super(new BorderLayout(0, 0)); boolean topBorderRequired = !SystemInfo.isMac && UISettings.getInstance().EDITOR_TAB_PLACEMENT != SwingConstants.TOP && !(UISettings.getInstance().SHOW_MAIN_TOOLBAR && UISettings.getInstance().SHOW_NAVIGATION_BAR); setBorder(new CustomLineBorder(JBColor.border(), topBorderRequired ? 1 : 0, 0, 1, 0)); }
protected void init() { GuiUtils.replaceJSplitPaneWithIDEASplitter(main); HTMLEditorKit kit = new HTMLEditorKit(); StyleSheet sheet = kit.getStyleSheet(); sheet.addRule("ul {margin-left: 16px}"); // list-style-type: none; 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); }
public static Border customLine(Color color, int top, int left, int bottom, int right) { return new CustomLineBorder(color, insets(top, left, bottom, right)); }
@Override public JPanel createComponentImpl() { final Module module = getModule(); final Project project = module.getProject(); myContentEntryEditorListener = new MyContentEntryEditorListener(); final JPanel mainPanel = new JPanel(new BorderLayout()); if (!Registry.is("ide.new.project.settings")) { mainPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); } addAdditionalSettingsToPanel(mainPanel); final JPanel entriesPanel = new JPanel(new BorderLayout()); 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, Registry.is("ide.new.project.settings")); final ToolbarPanel toolbarPanel = new ToolbarPanel(myScrollPane, group); if (Registry.is("ide.new.project.settings")) { toolbarPanel.setBorder(new CustomLineBorder(1,0,0,0)); } entriesPanel.add(toolbarPanel, BorderLayout.CENTER); final JBSplitter splitter = Registry.is("ide.new.project.settings") ? new OnePixelSplitter(false) : new JBSplitter(false); splitter.setProportion(0.6f); splitter.setHonorComponentsMinimumSize(true); myRootTreeEditor = createContentEntryTreeEditor(project); final JComponent component = myRootTreeEditor.createComponent(); if (Registry.is("ide.new.project.settings")) { component.setBorder(new CustomLineBorder(1,0,0,0)); } splitter.setFirstComponent(component); splitter.setSecondComponent(entriesPanel); JPanel contentPanel = new JPanel(new GridBagLayout()); if (!Registry.is("ide.new.project.settings")) { contentPanel.setBorder(BorderFactory.createEtchedBorder()); } 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, new Insets(0, 10, 0, 10), 0, 0)); contentPanel.add(actionToolbar.getComponent(), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); contentPanel.add(splitter, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 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; }
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component cmp; PsiElement file; myLocationString = null; String pattern = "*" + myPopupField.getText(); Matcher matcher = NameUtil.buildMatcher(pattern, 0, true, true); if (isMoreItem(index)) { cmp = More.get(isSelected); } else if (value instanceof VirtualFile && myProject != null && ((((VirtualFile)value).isDirectory() && (file = PsiManager.getInstance(myProject).findDirectory((VirtualFile)value)) != null ) || (file = PsiManager.getInstance(myProject).findFile((VirtualFile)value)) != null)) { myFileRenderer.setPatternMatcher(matcher); cmp = myFileRenderer.getListCellRendererComponent(list, file, index, isSelected, cellHasFocus); } else if (value instanceof PsiElement) { myFileRenderer.setPatternMatcher(matcher); cmp = myFileRenderer.getListCellRendererComponent(list, value, index, isSelected, isSelected); } else if (value instanceof GotoActionModel.ActionWrapper) { cmp = myActionsRenderer.getListCellRendererComponent(list, new GotoActionModel.MatchedValue(((GotoActionModel.ActionWrapper)value), pattern), index, isSelected, isSelected); } else { cmp = super.getListCellRendererComponent(list, value, index, isSelected, isSelected); final JPanel p = new JPanel(new BorderLayout()); p.setBackground(UIUtil.getListBackground(isSelected)); p.add(cmp, BorderLayout.CENTER); cmp = p; } if (myLocationString != null || value instanceof BooleanOptionDescription) { final JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(UIUtil.getListBackground(isSelected)); panel.add(cmp, BorderLayout.CENTER); final Component rightComponent; if (value instanceof BooleanOptionDescription) { final OnOffButton button = new OnOffButton(); button.setSelected(((BooleanOptionDescription)value).isOptionEnabled()); rightComponent = button; } else { rightComponent = myLocation.getListCellRendererComponent(list, value, index, isSelected, isSelected); } panel.add(rightComponent, BorderLayout.EAST); cmp = panel; } Color bg = cmp.getBackground(); if (bg == null) { cmp.setBackground(UIUtil.getListBackground(isSelected)); bg = cmp.getBackground(); } myMainPanel.setBorder(new CustomLineBorder(bg, 0, 0, 2, 0)); String title = getModel().titleIndex.getTitle(index); myMainPanel.removeAll(); if (title != null) { myTitle.setText(title); myMainPanel.add(createTitle(" " + title), BorderLayout.NORTH); } myMainPanel.add(cmp, BorderLayout.CENTER); if (cmp instanceof Accessible) { myMainPanel.setAccessible((Accessible)cmp); } final int width = myMainPanel.getPreferredSize().width; if (width > myPopupActualWidth) { myPopupActualWidth = width; //schedulePopupUpdate(); } return myMainPanel; }
public DiffPanelImpl(final Window owner, Project project, boolean enableToolbar, boolean horizontal, int diffDividerPolygonsOffset, DiffTool parentTool) { myProject = project; myIsHorizontal = horizontal; myParentTool = parentTool; myOptions = new DiffPanelOptions(this); myPanel = new DiffPanelOuterComponent(TextDiffType.DIFF_TYPES, null); myPanel.disableToolbar(!enableToolbar); if (enableToolbar) myPanel.resetToolbar(); myOwnerWindow = owner; myIsSyncScroll = true; final boolean v = !horizontal; myLeftSide = new DiffSideView(this, new CustomLineBorder(UIUtil.getBorderColor(), 1, 0, v ? 0 : 1, v ? 0 : 1)); myRightSide = new DiffSideView(this, new CustomLineBorder(UIUtil.getBorderColor(), v ? 0 : 1, v ? 0 : 1, 1, 0)); myLeftSide.becomeMaster(); myDiffUpdater = new Rediffers(this); myData = createDiffPanelState(this); if (horizontal) { mySplitter = new DiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent(), new DiffDividerPaint(this, FragmentSide.SIDE1, diffDividerPolygonsOffset), myData); } else { mySplitter = new HorizontalDiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent()); } myPanel.insertDiffComponent(mySplitter.getComponent(), new MyScrollingPanel()); myDataProvider = new MyGenericDataProvider(this); myPanel.setDataProvider(myDataProvider); final ComparisonPolicy comparisonPolicy = getComparisonPolicy(); final ComparisonPolicy defaultComparisonPolicy = DiffManagerImpl.getInstanceEx().getComparisonPolicy(); if (defaultComparisonPolicy != null && comparisonPolicy != defaultComparisonPolicy) { setComparisonPolicy(defaultComparisonPolicy); } myVisibleAreaListener = new VisibleAreaListener() { @Override public void visibleAreaChanged(VisibleAreaEvent e) { Editor editor1 = getEditor1(); if (editor1 != null) { editor1.getComponent().repaint(); } Editor editor2 = getEditor2(); if (editor2 != null) { editor2.getComponent().repaint(); } } }; registerActions(); }
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { CheckBoxList checkBoxList = (CheckBoxList)list; EarlyAccessProgramDescriptor earlyAccessProgramDescriptor = (EarlyAccessProgramDescriptor)checkBoxList.getItemAt(index); JCheckBox checkbox = (JCheckBox)value; checkbox.setEnabled(list.isEnabled()); checkbox.setFocusPainted(false); checkbox.setBorderPainted(true); if (earlyAccessProgramDescriptor == null) { return checkbox; } else { checkbox.setEnabled(earlyAccessProgramDescriptor.isAvailable()); JPanel panel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, true, true)) { @Override public Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); return new Dimension(Math.min(size.width, 200), size.height); } }; panel.setEnabled(earlyAccessProgramDescriptor.isAvailable()); JPanel topPanel = new JPanel(new BorderLayout()); topPanel.add(checkbox, BorderLayout.WEST); if (earlyAccessProgramDescriptor.isRestartRequired()) { JBLabel comp = new JBLabel("Restart required"); comp.setForeground(JBColor.GRAY); topPanel.add(comp, BorderLayout.EAST); } panel.add(topPanel); panel.setBorder(new CustomLineBorder(0, 0, 1, 0)); String description = StringUtil.notNullizeIfEmpty(earlyAccessProgramDescriptor.getDescription(), "Description is not available"); JTextPane textPane = new JTextPane(); textPane.setText(description); textPane.setEditable(false); if (!earlyAccessProgramDescriptor.isAvailable()) { textPane.setForeground(JBColor.GRAY); } panel.add(textPane); return panel; } }
public DiffPanelImpl(final Window owner, @Nonnull Project project, boolean enableToolbar, boolean horizontal, int diffDividerPolygonsOffset, DiffTool parentTool) { myProject = project; myIsHorizontal = horizontal; myParentTool = parentTool; myOptions = new DiffPanelOptions(this); myPanel = new DiffPanelOuterComponent(TextDiffType.DIFF_TYPES, null); myPanel.disableToolbar(!enableToolbar); if (enableToolbar) myPanel.resetToolbar(); myOwnerWindow = owner; myIsSyncScroll = true; final boolean v = !horizontal; myLeftSide = new DiffSideView(this, new CustomLineBorder(1, 0, v ? 0 : 1, v ? 0 : 1)); myRightSide = new DiffSideView(this, new CustomLineBorder(v ? 0 : 1, v ? 0 : 1, 1, 0)); myLeftSide.becomeMaster(); myDiffUpdater = new Rediffers(this); myDiffDividerPolygonsOffset = diffDividerPolygonsOffset; myData = createDiffPanelState(this); if (horizontal) { mySplitter = new DiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent(), new DiffDividerPaint(this, FragmentSide.SIDE1, diffDividerPolygonsOffset), myData); } else { mySplitter = new HorizontalDiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent()); } myPanel.insertDiffComponent(mySplitter.getComponent(), new MyScrollingPanel()); myDataProvider = new MyGenericDataProvider(this); myPanel.setDataProvider(myDataProvider); final ComparisonPolicy comparisonPolicy = getComparisonPolicy(); final ComparisonPolicy defaultComparisonPolicy = DiffManagerImpl.getInstanceEx().getComparisonPolicy(); final HighlightMode highlightMode = getHighlightMode(); final HighlightMode defaultHighlightMode = DiffManagerImpl.getInstanceEx().getHighlightMode(); if (defaultComparisonPolicy != null && comparisonPolicy != defaultComparisonPolicy) { setComparisonPolicy(defaultComparisonPolicy); } if (defaultHighlightMode != null && highlightMode != defaultHighlightMode) { setHighlightMode(defaultHighlightMode); } myVisibleAreaListener = new VisibleAreaListener() { @Override public void visibleAreaChanged(VisibleAreaEvent e) { Editor editor1 = getEditor1(); if (editor1 != null) { editor1.getComponent().repaint(); } Editor editor2 = getEditor2(); if (editor2 != null) { editor2.getComponent().repaint(); } } }; registerActions(); }
protected void init() { GuiUtils.replaceJSplitPaneWithIDEASplitter(main); myDescriptionTextArea.setEditorKit(UIUtil.getHTMLEditorKit()); myDescriptionTextArea.setEditable(false); myDescriptionTextArea.addHyperlinkListener(new MyHyperlinkListener()); JScrollPane installedScrollPane = createTable(); myPluginHeaderPanel = new PluginHeaderPanel(this, getPluginTable()); 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.empty(0, 7, 0, 0)); 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(JBUI.scale(1), JBUI.scale(1), 0, JBUI.scale(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(@Nonnull MouseEvent event, int clickCount) { JBPopupFactory.getInstance().createActionGroupPopup("Sort by:", createSortersGroup(), DataManager.getInstance().getDataContext(myPluginTable), 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 (myPluginsModel.isSortByStatus()) { text += " status,"; } if (myPluginsModel.isSortByRating()) { text += " rating,"; } if (myPluginsModel.isSortByDownloads()) { text += " downloads,"; } if (myPluginsModel.isSortByUpdated()) { text += " updated,"; } text += " name"; mySortLabel.setText(text); } }; myPluginTable.getModel().addTableModelListener(modelListener); modelListener.tableChanged(null); Border border = new BorderUIResource.LineBorderUIResource(new JBColor(Gray._220, Gray._55), JBUI.scale(1)); myInfoPanel.setBorder(border); }