Java Code Examples for com.intellij.ui.components.panels.NonOpaquePanel#add()
The following examples show how to use
com.intellij.ui.components.panels.NonOpaquePanel#add() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueryPanel.java From nosql4idea with Apache License 2.0 | 6 votes |
void notifyOnErrorForOperator(JComponent component, Exception ex) { String message; if (ex instanceof JSONParseException) { message = StringUtils.removeStart(ex.getMessage(), "\n"); } else { message = String.format("%s: %s", ex.getClass().getSimpleName(), ex.getMessage()); } NonOpaquePanel nonOpaquePanel = new NonOpaquePanel(); JTextPane textPane = Messages.configureMessagePaneUi(new JTextPane(), message); textPane.setFont(COURIER_FONT); textPane.setBackground(MessageType.ERROR.getPopupBackground()); nonOpaquePanel.add(textPane, BorderLayout.CENTER); nonOpaquePanel.add(new JLabel(MessageType.ERROR.getDefaultIcon()), BorderLayout.WEST); JBPopupFactory.getInstance().createBalloonBuilder(nonOpaquePanel) .setFillColor(MessageType.ERROR.getPopupBackground()) .createBalloon() .show(new RelativePoint(component, new Point(0, 0)), Balloon.Position.above); }
Example 2
Source File: RedisPanel.java From nosql4idea with Apache License 2.0 | 6 votes |
protected void buildQueryToolBar() { toolBarPanel.setLayout(new BorderLayout()); filterField = new JBTextField("*"); filterField.setColumns(10); NonOpaquePanel westPanel = new NonOpaquePanel(); NonOpaquePanel filterPanel = new NonOpaquePanel(); filterPanel.add(new JLabel("Filter: "), BorderLayout.WEST); filterPanel.add(filterField, BorderLayout.CENTER); filterPanel.add(Box.createHorizontalStrut(5), BorderLayout.EAST); westPanel.add(filterPanel, BorderLayout.WEST); toolBarPanel.add(westPanel, BorderLayout.WEST); addCommonsActions(); }
Example 3
Source File: DetailsComponent.java From consulo with Apache License 2.0 | 6 votes |
public DetailsComponent(boolean detailsEnabled, boolean paintBorder) { myDetailsEnabled = detailsEnabled; myPaintBorder = paintBorder; myComponent = new JPanel(new BorderLayout()); myComponent.setOpaque(false); myContentGutter.setOpaque(false); myContentGutter.setBorder(null); myBanner = new NonOpaquePanel(new BorderLayout()); myBannerLabel = new Banner(); if (myDetailsEnabled) { myBanner.add(myBannerLabel, BorderLayout.CENTER); } myEmptyContentLabel = new JLabel("", SwingConstants.CENTER); revalidateDetailsMode(); }
Example 4
Source File: QueryPanel.java From nosql4idea with Apache License 2.0 | 5 votes |
private AggregatorPanel() { this.editor = createEditor(); setLayout(new BorderLayout()); NonOpaquePanel headPanel = new NonOpaquePanel(); JLabel operatorLabel = new JLabel("Aggregation"); headPanel.add(operatorLabel, BorderLayout.WEST); add(headPanel, BorderLayout.NORTH); add(this.editor.getComponent(), BorderLayout.CENTER); this.operatorCompletionAction = new OperatorCompletionAction(project, editor); myUpdateAlarm.setActivationComponent(this.editor.getComponent()); }
Example 5
Source File: FlatWelcomePanel.java From consulo with Apache License 2.0 | 5 votes |
private JComponent createSettingsAndDocs() { JPanel panel = new NonOpaquePanel(new BorderLayout()); NonOpaquePanel toolbar = new NonOpaquePanel(); toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.X_AXIS)); toolbar.add(createEventsLink()); toolbar.add(createActionLink("Configure", IdeActions.GROUP_WELCOME_SCREEN_CONFIGURE, AllIcons.General.GearPlain, true)); toolbar.add(createActionLink("Get Help", IdeActions.GROUP_WELCOME_SCREEN_DOC, null, false)); panel.add(toolbar, BorderLayout.EAST); panel.setBorder(JBUI.Borders.empty(0, 0, 8, 11)); return panel; }
Example 6
Source File: RunConfigurationsComboBoxAction.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public JComponent createCustomComponent(final Presentation presentation) { ComboBoxButton button = createComboBoxButton(presentation); NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout()); panel.setBorder(IdeBorderFactory.createEmptyBorder(0, 0, 0, 2)); panel.add(button.getComponent()); return panel; }
Example 7
Source File: BranchActionGroupPopup.java From consulo with Apache License 2.0 | 5 votes |
private void createTitlePanelToolbar(@Nonnull String dimensionKey) { myTitleToolbarPanel = new NonOpaquePanel(); myTitleToolbarPanel.setLayout(new BoxLayout(myTitleToolbarPanel, BoxLayout.LINE_AXIS)); myTitleToolbarPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); myRestoreSizeButton = new MyToolbarButton("Restore Size", CollapseComponent, CollapseComponentHover, e -> { WindowStateService.getInstance(myProject).putSizeFor(myProject, dimensionKey, null); myInternalSizeChanged = true; pack(true, true); }) { @Override protected boolean isButtonEnabled() { return myUserSizeChanged; } }; mySettingsButton = new MyToolbarButton("Settings", AllIcons.General.GearPlain, null, e -> { final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(BRANCH_POPUP, new DefaultActionGroup(mySettingsActions)); popupMenu.getComponent().show(mySettingsButton, 0, assertNotNull(mySettingsButton).getHeight()); }) { @Override protected boolean isButtonEnabled() { return !mySettingsActions.isEmpty(); } }; myTitleToolbarPanel.add(mySettingsButton); myTitleToolbarPanel.add(myRestoreSizeButton); getTitle().setButtonComponent(new ActiveComponent.Adapter() { @Nonnull @Override public JComponent getComponent() { return myTitleToolbarPanel; } }, JBUI.Borders.emptyRight(2)); }
Example 8
Source File: ActionMacroManager.java From consulo with Apache License 2.0 | 5 votes |
private Widget(StatusBar statusBar) { myStatusBar = statusBar; myPresentation = new WidgetPresentation() { @Override public String getTooltipText() { return "Macro is being recorded now"; } @Override public Consumer<MouseEvent> getClickConsumer() { return Widget.this; } }; new BaseButtonBehavior(myIcon) { @Override protected void execute(MouseEvent e) { showBalloon(); } }; myBalloonComponent = new NonOpaquePanel(new BorderLayout()); final AnAction stopAction = ActionManager.getInstance().getAction("StartStopMacroRecording"); final DefaultActionGroup group = new DefaultActionGroup(); group.add(stopAction); final ActionToolbar tb = ActionManager.getInstance().createActionToolbar(ActionPlaces.STATUS_BAR_PLACE, group, true); tb.setMiniMode(true); final NonOpaquePanel top = new NonOpaquePanel(new BorderLayout()); top.add(tb.getComponent(), BorderLayout.WEST); myText = new JLabel(RECORDED + "..." + TYPING_SAMPLE, SwingConstants.LEFT); final Dimension preferredSize = myText.getPreferredSize(); myText.setPreferredSize(preferredSize); myText.setText("Macro recording started..."); myLastTyping = ""; top.add(myText, BorderLayout.CENTER); myBalloonComponent.add(top, BorderLayout.CENTER); }
Example 9
Source File: PopupFactoryImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public BalloonBuilder createHtmlTextBalloonBuilder(@Nonnull final String htmlContent, @Nullable final Icon icon, Color textColor, final Color fillColor, @Nullable final HyperlinkListener listener) { JEditorPane text = IdeTooltipManager.initPane(htmlContent, new HintHint().setTextFg(textColor).setAwtTooltip(true), null); if (listener != null) { text.addHyperlinkListener(listener); } text.setEditable(false); NonOpaquePanel.setTransparent(text); text.setBorder(null); JLabel label = new JLabel(); final JPanel content = new NonOpaquePanel(new BorderLayout((int)(label.getIconTextGap() * 1.5), (int)(label.getIconTextGap() * 1.5))); final NonOpaquePanel textWrapper = new NonOpaquePanel(new GridBagLayout()); JScrollPane scrolledText = ScrollPaneFactory.createScrollPane(text, true); scrolledText.setBackground(fillColor); scrolledText.getViewport().setBackground(fillColor); textWrapper.add(scrolledText); content.add(textWrapper, BorderLayout.CENTER); if (icon != null) { final NonOpaquePanel north = new NonOpaquePanel(new BorderLayout()); north.add(new JLabel(icon), BorderLayout.NORTH); content.add(north, BorderLayout.WEST); } content.setBorder(JBUI.Borders.empty(2, 4)); final BalloonBuilder builder = createBalloonBuilder(content); builder.setFillColor(fillColor); return builder; }
Example 10
Source File: InlineProgressIndicator.java From consulo with Apache License 2.0 | 5 votes |
protected void createCompactTextAndProgress() { JPanel textAndProgress = new NonOpaquePanel(new BorderLayout()); textAndProgress.add(myText, BorderLayout.CENTER); final NonOpaquePanel progressWrapper = new NonOpaquePanel(new BorderLayout()); progressWrapper.setBorder(JBUI.Borders.empty(0, 4)); progressWrapper.add(myProgress, BorderLayout.CENTER); textAndProgress.add(progressWrapper, BorderLayout.EAST); myComponent.add(textAndProgress, BorderLayout.CENTER); }
Example 11
Source File: ProgressStripe.java From consulo with Apache License 2.0 | 5 votes |
@Override protected NonOpaquePanel customizeLoadingLayer(JPanel parent, JLabel text, AsyncProcessIcon icon) { parent.setLayout(new BorderLayout()); NonOpaquePanel result = new NonOpaquePanel(); result.setLayout(new BoxLayout(result, BoxLayout.Y_AXIS)); result.add(icon); parent.add(result, BorderLayout.NORTH); return result; }
Example 12
Source File: ActionPanel.java From consulo with Apache License 2.0 | 5 votes |
public ActionPanel(JBTabsImpl tabs, TabInfo tabInfo, Pass<MouseEvent> pass) { myTabs = tabs; ActionGroup group = tabInfo.getTabLabelActions() != null ? tabInfo.getTabLabelActions() : new DefaultActionGroup(); AnAction[] children = group.getChildren(null); final NonOpaquePanel wrapper = new NonOpaquePanel(new BorderLayout()); wrapper.add(Box.createHorizontalStrut(2), BorderLayout.WEST); NonOpaquePanel inner = new NonOpaquePanel(); inner.setLayout(new BoxLayout(inner, BoxLayout.X_AXIS)); wrapper.add(inner, BorderLayout.CENTER); for (AnAction each : children) { ActionButton eachButton = new ActionButton(myTabs, tabInfo, each, tabInfo.getTabActionPlace(), pass, tabs.getTabActionsMouseDeadzone()) { @Override protected void repaintComponent(final Component c) { TabLabel tabLabel = (TabLabel) SwingUtilities.getAncestorOfClass(TabLabel.class, c); if (tabLabel != null) { Point point = SwingUtilities.convertPoint(c, new Point(0, 0), tabLabel); Dimension d = c.getSize(); tabLabel.repaint(point.x, point.y, d.width, d.height); } else { super.repaintComponent(c); } } }; myButtons.add(eachButton); InplaceButton component = eachButton.getComponent(); inner.add(component); } add(wrapper); }
Example 13
Source File: LoadingDecorator.java From consulo with Apache License 2.0 | 5 votes |
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; }
Example 14
Source File: QueryPanel.java From nosql4idea with Apache License 2.0 | 5 votes |
private JPanel createSubOperatorPanel(String title, Editor subOperatorEditor) { JPanel selectPanel = new JPanel(); selectPanel.setLayout(new BorderLayout()); NonOpaquePanel headPanel = new NonOpaquePanel(); JLabel operatorLabel = new JLabel(title); headPanel.add(operatorLabel, BorderLayout.WEST); selectPanel.add(headPanel, BorderLayout.NORTH); selectPanel.add(subOperatorEditor.getComponent(), BorderLayout.CENTER); myUpdateAlarm.setActivationComponent(subOperatorEditor.getComponent()); return selectPanel; }
Example 15
Source File: GraphQLEditConfigAction.java From js-graphql-intellij-plugin with MIT License | 5 votes |
@Nullable @Override protected JComponent createCenterPanel() { comboBox = new ComboBox<>(new CollectionComboBoxModel<>(configDirectoryCandidates)); comboBox.setRenderer(new DefaultPsiElementCellRenderer()); comboBox.setMinimumAndPreferredWidth(450); if (comboBox.getItemCount() > 0) { comboBox.setSelectedIndex(0); } final NonOpaquePanel panel = new NonOpaquePanel(); panel.add(comboBox, BorderLayout.NORTH); return panel; }
Example 16
Source File: InlineProgressIndicator.java From consulo with Apache License 2.0 | 4 votes |
public InlineProgressIndicator(boolean compact, @Nonnull TaskInfo processInfo) { myCompact = compact; myInfo = processInfo; myProgress = new JProgressBar(SwingConstants.HORIZONTAL); UIUtil.applyStyle(UIUtil.ComponentStyle.MINI, myProgress); myComponent = new MyComponent(compact, myProcessName); myEastButtons = createEastButtons(); if (myCompact) { myComponent.setLayout(new BorderLayout(2, 0)); createCompactTextAndProgress(); myComponent.add(createButtonPanel(myEastButtons.map(b -> b.button)), BorderLayout.EAST); myComponent.setToolTipText(processInfo.getTitle() + ". " + IdeBundle.message("progress.text.clickToViewProgressWindow")); } else { myComponent.setLayout(new BorderLayout()); myProcessName.setText(processInfo.getTitle()); myComponent.add(myProcessName, BorderLayout.NORTH); myProcessName.setForeground(UIUtil.getPanelBackground().brighter().brighter()); myProcessName.setBorder(JBUI.Borders.empty(2)); final NonOpaquePanel content = new NonOpaquePanel(new BorderLayout()); content.setBorder(JBUI.Borders.empty(2, 2, 2, myInfo.isCancellable() ? 2 : 4)); myComponent.add(content, BorderLayout.CENTER); content.add(createButtonPanel(myEastButtons.map(b -> withBorder(b.button))), BorderLayout.EAST); content.add(myText, BorderLayout.NORTH); content.add(myProgress, BorderLayout.CENTER); content.add(myText2, BorderLayout.SOUTH); myComponent.setBorder(JBUI.Borders.empty(2)); } UIUtil.uiTraverser(myComponent).forEach(o -> ((JComponent)o).setOpaque(false)); if (!myCompact) { myProcessName.recomputeSize(); myText.recomputeSize(); myText2.recomputeSize(); } }
Example 17
Source File: DockManagerImpl.java From consulo with Apache License 2.0 | 4 votes |
private DockWindow(String id, Project project, DockContainer container, boolean dialog) { super(project, null, dialog); myId = id; myContainer = container; setProject(project); if (!(container instanceof DockContainer.Dialog)) { setStatusBar(WindowManager.getInstance().getStatusBar(project).createChild()); } myUiContainer = new NonOpaquePanel(new BorderLayout()); NonOpaquePanel center = new NonOpaquePanel(new BorderLayout(0, 2)); if (UIUtil.isUnderAquaLookAndFeel()) { center.setOpaque(true); center.setBackground(JBTabsImpl.MAC_AQUA_BG_COLOR); } center.add(myNorthPanel, BorderLayout.NORTH); myDockContentUiContainer = new NonOpaquePanel(new BorderLayout()); myDockContentUiContainer.add(myContainer.getContainerComponent(), BorderLayout.CENTER); center.add(myDockContentUiContainer, BorderLayout.CENTER); myUiContainer.add(center, BorderLayout.CENTER); if (myStatusBar != null) { myUiContainer.add(myStatusBar.getComponent(), BorderLayout.SOUTH); } setComponent(myUiContainer); addDisposable(container); IdeEventQueue.getInstance().addPostprocessor(this, this); myContainer.addListener(new DockContainer.Listener.Adapter() { @Override public void contentRemoved(Object key) { getReady().doWhenDone(() -> { if (myContainer.isEmpty()) { close(); } }); } }, this); UISettings.getInstance().addUISettingsListener(new UISettingsListener() { @Override public void uiSettingsChanged(UISettings source) { updateNorthPanel(); } }, this); updateNorthPanel(); }
Example 18
Source File: ParameterInfoTaskRunnerUtil.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull private static Consumer<Boolean> startProgressAndCreateStopAction(Project project, String progressTitle, AtomicReference<CancellablePromise<?>> promiseRef, Editor editor) { AtomicReference<Consumer<Boolean>> stopActionRef = new AtomicReference<>(); Consumer<Boolean> originalStopAction = (cancel) -> { stopActionRef.set(null); if (cancel) { CancellablePromise<?> promise = promiseRef.get(); if (promise != null) { promise.cancel(); } } }; if (progressTitle == null) { stopActionRef.set(originalStopAction); } else { final Disposable disposable = Disposable.newDisposable(); Disposer.register(project, disposable); JBLoadingPanel loadingPanel = new JBLoadingPanel(null, panel -> new LoadingDecorator(panel, disposable, 0, false, new AsyncProcessIcon("ShowParameterInfo")) { @Override protected NonOpaquePanel customizeLoadingLayer(JPanel parent, JLabel text, AsyncProcessIcon icon) { parent.setLayout(new FlowLayout(FlowLayout.LEFT)); final NonOpaquePanel result = new NonOpaquePanel(); result.add(icon); parent.add(result); return result; } }); loadingPanel.add(new JBLabel(EmptyIcon.ICON_18)); loadingPanel.add(new JBLabel(progressTitle)); ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(loadingPanel, null).setProject(project).setCancelCallback(() -> { Consumer<Boolean> stopAction = stopActionRef.get(); if (stopAction != null) { stopAction.accept(true); } return true; }); JBPopup popup = builder.createPopup(); Disposer.register(disposable, popup); ScheduledFuture<?> showPopupFuture = EdtScheduledExecutorService.getInstance().schedule(() -> { if (!popup.isDisposed() && !popup.isVisible() && !editor.isDisposed()) { RelativePoint popupPosition = JBPopupFactory.getInstance().guessBestPopupLocation(editor); loadingPanel.startLoading(); popup.show(popupPosition); } }, ModalityState.defaultModalityState(), DEFAULT_PROGRESS_POPUP_DELAY_MS, TimeUnit.MILLISECONDS); stopActionRef.set((cancel) -> { try { loadingPanel.stopLoading(); originalStopAction.accept(cancel); } finally { showPopupFuture.cancel(false); UIUtil.invokeLaterIfNeeded(() -> { if (popup.isVisible()) { popup.setUiVisible(false); } Disposer.dispose(disposable); }); } }); } return stopActionRef.get(); }
Example 19
Source File: LookupUi.java From consulo with Apache License 2.0 | 4 votes |
LookupUi(@Nonnull LookupImpl lookup, Advertiser advertiser, JBList list) { myLookup = lookup; myAdvertiser = advertiser; myList = list; myProcessIcon.setVisible(false); myLookup.resort(false); MenuAction menuAction = new MenuAction(); menuAction.add(new ChangeSortingAction()); menuAction.add(new DelegatedAction(ActionManager.getInstance().getAction(IdeActions.ACTION_QUICK_JAVADOC)) { @Override public void update(@Nonnull AnActionEvent e) { e.getPresentation().setVisible(!CodeInsightSettings.getInstance().AUTO_POPUP_JAVADOC_INFO); } }); menuAction.add(new DelegatedAction(ActionManager.getInstance().getAction(IdeActions.ACTION_QUICK_IMPLEMENTATIONS))); Presentation presentation = new Presentation(); presentation.setIcon(AllIcons.Actions.More); presentation.putClientProperty(ActionButton.HIDE_DROPDOWN_ICON, Boolean.TRUE); myMenuButton = new ActionButton(menuAction, presentation, ActionPlaces.EDITOR_POPUP, ActionToolbar.NAVBAR_MINIMUM_BUTTON_SIZE); AnAction hintAction = new HintAction(); myHintButton = new ActionButton(hintAction, hintAction.getTemplatePresentation(), ActionPlaces.EDITOR_POPUP, ActionToolbar.NAVBAR_MINIMUM_BUTTON_SIZE); myHintButton.setVisible(false); myBottomPanel = new NonOpaquePanel(new LookupBottomLayout()); myBottomPanel.add(myAdvertiser.getAdComponent()); myBottomPanel.add(myProcessIcon); myBottomPanel.add(myHintButton); myBottomPanel.add(myMenuButton); LookupLayeredPane layeredPane = new LookupLayeredPane(); layeredPane.mainPanel.add(myBottomPanel, BorderLayout.SOUTH); myScrollPane = ScrollPaneFactory.createScrollPane(lookup.getList(), true); myScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); UIUtil.putClientProperty(myScrollPane.getVerticalScrollBar(), JBScrollPane.IGNORE_SCROLLBAR_IN_INSETS, true); lookup.getComponent().add(layeredPane, BorderLayout.CENTER); layeredPane.mainPanel.add(myScrollPane, BorderLayout.CENTER); myModalityState = ModalityState.stateForComponent(lookup.getTopLevelEditor().getComponent()); addListeners(); Disposer.register(lookup, myProcessIcon); Disposer.register(lookup, myHintAlarm); }