com.intellij.util.ui.AsyncProcessIcon Java Examples
The following examples show how to use
com.intellij.util.ui.AsyncProcessIcon.
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: ChooseLabelDialog.java From p4ic4idea with Apache License 2.0 | 6 votes |
private void createUIComponents() { searchResultsModel = new ListTableModel<>( new ColumnInfo<P4Label, String>(P4Bundle.getString("search.label.label-name")) { @Nullable @Override public String valueOf(P4Label o) { return o == null ? null : o.getName(); } }, new ColumnInfo<P4Label, String>(P4Bundle.getString("search.label.label-description")) { @Nullable @Override public String valueOf(P4Label o) { return o == null ? null : o.getDescription(); } }); mySearchResults = new JBTable(searchResultsModel); mySearchResults.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); mySearchSpinner = new AsyncProcessIcon("Searching for labels"); }
Example #2
Source File: ClientNamePartUI.java From p4ic4idea with Apache License 2.0 | 5 votes |
private void setupUI() { rootPanel = new JPanel(new BorderLayout()); clientDropdownList = new ComboBox<>(); clientDropdownList.setEditable(true); clientDropdownList.setToolTipText(P4Bundle.getString("configuration.clientname.dropdown-list.tooltip")); JLabel label = SwingUtil.createLabelFor(P4Bundle.getString("configuration.clientname"), clientDropdownList); JPanel buttonPanel = new JPanel(new FlowLayout()); errorLabel = new JLabel(ERROR); errorLabel.setVisible(false); listRefreshButton = new JButton(REFRESH); listRefreshButton.setPreferredSize(new Dimension(REFRESH.getIconWidth() + 2, REFRESH.getIconHeight() + 2)); listRefreshSpinner = new AsyncProcessIcon("Refresh Client List Progress"); listRefreshSpinner.setName("Refresh Client List Progress"); listRefreshSpinner.setVisible(false); buttonPanel.add(errorLabel); buttonPanel.add(listRefreshSpinner); buttonPanel.add(listRefreshButton); rootPanel.add(label, BorderLayout.WEST); rootPanel.add(clientDropdownList, BorderLayout.CENTER); rootPanel.add(buttonPanel, BorderLayout.EAST); }
Example #3
Source File: P4RootConfigPanel.java From p4ic4idea with Apache License 2.0 | 5 votes |
private void createUIComponents() { // custom component creation code myConfigPartStack = new ConfigPartStack(vcsRoot, configConnectionController); problemListModel = new DefaultListModel<>(); myProblemsList = new JBList<>(problemListModel); myProblemsList.setCellRenderer(new ProblemRenderer()); myCheckConnectionSpinner = new AsyncProcessIcon("Checking Connection"); }
Example #4
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 #5
Source File: ProgressStripeIcon.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static AsyncProcessIcon generateIcon(@Nonnull JComponent component) { List<Icon> result = ContainerUtil.newArrayList(); if (UIUtil.isUnderAquaBasedLookAndFeel() && !UIUtil.isUnderDarcula()) { for (int i = 0; i < 2 * JBUI.scale(GradientIcon.GRADIENT); i += JBUI.scale(TRANSLATE)) { result.add(new GradientIcon(component, i)); } } else { for (int i = 0; i < JBUI.scale(StripeIcon.WIDTH); i += JBUI.scale(TRANSLATE)) { result.add(new StripeIcon(component, i)); } result = ContainerUtil.reverse(result); } Icon passive = result.get(0); AsyncProcessIcon icon = new AsyncProcessIcon("ProgressWithStripes", result.toArray(new Icon[result.size()]), passive) { @Override public Dimension getPreferredSize() { return new Dimension(component.getWidth(), passive.getIconHeight()); } }; component.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { super.componentResized(e); icon.revalidate(); } }); return icon; }
Example #6
Source File: FastpassManagerDialog.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@Nullable @Override protected JComponent createCenterPanel() { mainPanel.setLayout(new BorderLayout()); mainPanel.setPreferredSize(JBUI.size(800, 600)); mainPanel.add(new AsyncProcessIcon(""), BorderLayout.CENTER); return mainPanel; }
Example #7
Source File: UnifiedDiffPanel.java From consulo with Apache License 2.0 | 5 votes |
public UnifiedDiffPanel(@javax.annotation.Nullable Project project, @Nonnull UnifiedContentPanel content, @Nonnull DataProvider provider, @Nonnull DiffContext context) { super(project, provider, context); myBusyIcon = new AsyncProcessIcon.Big("UnifiedDiff"); JPanel centerPanel = JBUI.Panels.simplePanel(content).addToTop(myNotificationsPanel); myContentPanel.add(centerPanel, GOOD_CONTENT); myContentPanel.add(myBusyIcon, LOADING_CONTENT); myContentPanel.add(createMessagePanel("Can not calculate diff. " + DiffTooBigException.MESSAGE), TOO_BIG_CONTENT); myContentPanel.add(createMessagePanel("Can not calculate diff. Operation canceled."), OPERATION_CANCELED_CONTENT); myContentPanel.add(createMessagePanel("Error"), ERROR_CONTENT); setCurrentCard(LOADING_CONTENT, false); }
Example #8
Source File: StatusPanel.java From consulo with Apache License 2.0 | 5 votes |
public StatusPanel() { super(new BorderLayout()); myTextLabel = new JLabel(""); myTextLabel.setVisible(false); myBusySpinner = new AsyncProcessIcon("StatusPanelSpinner"); myBusySpinner.setVisible(false); add(myTextLabel, BorderLayout.CENTER); add(myBusySpinner, BorderLayout.WEST); setBorder(IdeBorderFactory.createEmptyBorder(0, 4, 0, 4)); }
Example #9
Source File: LoadingDecorator.java From consulo with Apache License 2.0 | 5 votes |
public LoadingDecorator(JComponent content, @Nonnull Disposable parent, int startDelayMs, boolean useMinimumSize, @Nonnull AsyncProcessIcon icon) { myPane = new MyLayeredPane(useMinimumSize ? content : null); myLoadingLayer = new LoadingLayer(icon); myDelay = startDelayMs; myStartAlarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, parent); setLoadingText("Loading..."); myFadeOutAnimator = new Animator("Loading", 10, 500, false) { public void paintNow(final int frame, final int totalFrames, final int cycle) { myLoadingLayer.setAlpha(1f - ((float)frame) / ((float)totalFrames)); } @Override protected void paintCycleEnd() { myLoadingLayer.setVisible(false); myLoadingLayer.setAlpha(-1); } }; Disposer.register(parent, myFadeOutAnimator); myPane.add(content, JLayeredPane.DEFAULT_LAYER, 0); myPane.add(myLoadingLayer, JLayeredPane.DRAG_LAYER, 1); Disposer.register(parent, myLoadingLayer.myProgress); }
Example #10
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 #11
Source File: LoadingDecorator.java From consulo with Apache License 2.0 | 5 votes |
private LoadingLayer(@Nonnull AsyncProcessIcon processIcon) { setOpaque(false); setVisible(false); myProgress = processIcon; myProgress.setOpaque(false); myTextComponent = customizeLoadingLayer(this, myText, myProgress); myProgress.suspend(); }
Example #12
Source File: TextFieldWithProgress.java From consulo with Apache License 2.0 | 5 votes |
public TextFieldWithProgress(@Nonnull Project project, @Nonnull TextCompletionProvider completionProvider) { super(new BorderLayout()); setBorder(IdeBorderFactory.createEmptyBorder(3)); myProgressIcon = new AsyncProcessIcon("Loading commits"); myTextField = new TextFieldWithCompletion(project, completionProvider, "", true, true, false) { @Override public void setBackground(Color bg) { super.setBackground(bg); myProgressIcon.setBackground(bg); } @Override protected boolean processKeyBinding(KeyStroke ks, final KeyEvent e, int condition, boolean pressed) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { onOk(); return true; } return false; } }; myTextField.setBorder(IdeBorderFactory.createEmptyBorder()); myProgressIcon.setOpaque(true); myProgressIcon.setBackground(myTextField.getBackground()); add(myTextField, BorderLayout.CENTER); add(myProgressIcon, BorderLayout.EAST); hideProgress(); }
Example #13
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 #14
Source File: Neo4jBoltDataSourceDialog.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 4 votes |
private void createUIComponents() { loadingIcon = new AsyncProcessIcon("validateConnectionIcon"); }
Example #15
Source File: TableWithProgress.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected AsyncProcessIcon createBusyIcon() { return new LastRowLoadingIcon(); }
Example #16
Source File: LoadingDecorator.java From consulo with Apache License 2.0 | 4 votes |
public LoadingDecorator(JComponent content, @Nonnull Disposable parent, int startDelayMs, boolean useMinimumSize) { this(content, parent, startDelayMs, useMinimumSize, new AsyncProcessIcon.Big("Loading")); }
Example #17
Source File: FastpassStatus.java From intellij-pants-plugin with Apache License 2.0 | 4 votes |
public void setLoading(){ this.removeAll(); this.add(new AsyncProcessIcon( " ")); this.updateUI(); }
Example #18
Source File: EdtSinkProcessor.java From p4ic4idea with Apache License 2.0 | 4 votes |
public void addIcon(@NotNull final AsyncProcessIcon icon) { addStarter(() -> icon.setVisible(true)); addFinalizer(() -> icon.setVisible(false)); }
Example #19
Source File: OpenCypherGremlinDataSourceDialog.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 4 votes |
private void createUIComponents() { loadingIcon = new AsyncProcessIcon("validateConnectionIcon"); }