private void createUIComponents() { myRootPanel = new TransparentPanel(0.5f) { @Override public boolean isVisible() { UISettings ui = UISettings.getInstance(); return ui.PRESENTATION_MODE || !ui.SHOW_STATUS_BAR && Registry.is("ide.show.progress.without.status.bar"); } }; IconButton iconButton = new IconButton(myProgress.getInfo().getCancelTooltipText(), AllIcons.Process.Stop, AllIcons.Process.StopHovered); myCancelButton = new InplaceButton(iconButton, new ActionListener() { public void actionPerformed(@NotNull ActionEvent e) { myProgress.cancelRequest(); } }).setFillBg(false); }
private ProgressButton createCancelButton() { InplaceButton cancelButton = new InplaceButton( new IconButton(myInfo.getCancelTooltipText(), myCompact ? AllIcons.Process.StopSmall : AllIcons.Process.Stop, myCompact ? AllIcons.Process.StopSmallHovered : AllIcons.Process.StopHovered), new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { cancelRequest(); } }).setFillBg(false); cancelButton.setVisible(myInfo.isCancellable()); return new ProgressButton(cancelButton, () -> cancelButton.setPainting(!isStopping())); }
public InplaceButton(String tooltip, final Icon icon, final ActionListener listener) { this(new IconButton(tooltip, icon, icon), listener, null); }
public InplaceButton(String tooltip, final Icon icon, final ActionListener listener, final Pass<MouseEvent> me) { this(new IconButton(tooltip, icon, icon), listener, me); }
public InplaceButton(IconButton source, final ActionListener listener) { this(source, listener, null); }
public InplaceButton(IconButton source, final ActionListener listener, final Pass<MouseEvent> me) { this(source, listener, me, TimedDeadzone.DEFAULT); }
public void setIcons(IconButton source) { setIcons(source.getRegular(), source.getInactive(), source.getHovered()); }
public InlineProgressIndicator(boolean compact, @NotNull TaskInfo processInfo) { myCompact = compact; myInfo = processInfo; myCancelButton = new InplaceButton(new IconButton(processInfo.getCancelTooltipText(), AllIcons.Process.Stop, AllIcons.Process.StopHovered) { }, new ActionListener() { public void actionPerformed(final ActionEvent e) { cancelRequest(); } }).setFillBg(true); myCancelButton.setVisible(myInfo.isCancellable()); myCancelButton.setOpaque(false); myCancelButton.setToolTipText(processInfo.getCancelTooltipText()); myCancelButton.setFillBg(false); myProgress = new JProgressBar(SwingConstants.HORIZONTAL); myProgress.putClientProperty("JComponent.sizeVariant", "mini"); myComponent = new MyComponent(compact, myProcessName); if (myCompact) { myComponent.setOpaque(false); myComponent.setLayout(new BorderLayout(2, 0)); final JPanel textAndProgress = new JPanel(new BorderLayout()); textAndProgress.setOpaque(false); textAndProgress.add(myText, BorderLayout.CENTER); final NonOpaquePanel progressWrapper = new NonOpaquePanel(new GridBagLayout()); progressWrapper.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); final GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; c.insets = new Insets(SystemInfo.isMacOSLion ? 1 : 0, 0, 1, myInfo.isCancellable() ? 0 : 4); c.fill = GridBagConstraints.HORIZONTAL; progressWrapper.add(myProgress, c); textAndProgress.add(progressWrapper, BorderLayout.EAST); myComponent.add(textAndProgress, BorderLayout.CENTER); myComponent.add(myCancelButton, 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(new EmptyBorder(2, 2, 2, 2)); final NonOpaquePanel content = new NonOpaquePanel(new BorderLayout()); content.setBorder(new EmptyBorder(2, 2, 2, myInfo.isCancellable() ? 2 : 4)); myComponent.add(content, BorderLayout.CENTER); final Wrapper cancelWrapper = new Wrapper(myCancelButton); cancelWrapper.setOpaque(false); cancelWrapper.setBorder(new EmptyBorder(0, 3, 0, 2)); content.add(cancelWrapper, BorderLayout.EAST); content.add(myText, BorderLayout.NORTH); content.add(myProgress, BorderLayout.CENTER); content.add(myText2, BorderLayout.SOUTH); myComponent.setBorder(new EmptyBorder(2, 2, 2, 2)); } if (!myCompact) { myProcessName.recomputeSize(); myText.recomputeSize(); myText2.recomputeSize(); } }
public InlineProgressIndicator(boolean compact, TaskInfo processInfo) { myCompact = compact; myInfo = processInfo; myCancelButton = new InplaceButton(new IconButton(processInfo.getCancelTooltipText(), AllIcons.Process.Stop, AllIcons.Process.StopHovered) { }, new ActionListener() { public void actionPerformed(final ActionEvent e) { cancelRequest(); } }).setFillBg(true); myCancelButton.setVisible(myInfo.isCancellable()); myCancelButton.setOpaque(false); myCancelButton.setToolTipText(processInfo.getCancelTooltipText()); myCancelButton.setFillBg(false); myProgress = new MyProgressBar(JProgressBar.HORIZONTAL, compact); myComponent = new MyComponent(compact, myProcessName); if (myCompact) { myComponent.setOpaque(false); myComponent.setLayout(new BorderLayout(2, 0)); final JPanel textAndProgress = new JPanel(new BorderLayout()); textAndProgress.setOpaque(false); textAndProgress.add(myText, BorderLayout.CENTER); final NonOpaquePanel progressWrapper = new NonOpaquePanel(new GridBagLayout()); progressWrapper.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); final GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; c.insets = new Insets(SystemInfo.isMacOSLion ? 1 : 0, 0, 1, myInfo.isCancellable() ? 0 : 4); c.fill = GridBagConstraints.HORIZONTAL; progressWrapper.add(myProgress, c); textAndProgress.add(progressWrapper, BorderLayout.EAST); myComponent.add(textAndProgress, BorderLayout.CENTER); myComponent.add(myCancelButton, BorderLayout.EAST); myComponent.setToolTipText(processInfo.getTitle() + ". " + IdeBundle.message("progress.text.clickToViewProgressWindow")); myProgress.setActive(false); } else { myComponent.setLayout(new BorderLayout()); myProcessName.setText(processInfo.getTitle()); myComponent.add(myProcessName, BorderLayout.NORTH); myProcessName.setForeground(UIUtil.getPanelBackground().brighter().brighter()); myProcessName.setBorder(new EmptyBorder(2, 2, 2, 2)); myProcessName.setDecorate(false); final NonOpaquePanel content = new NonOpaquePanel(new BorderLayout()); content.setBorder(new EmptyBorder(2, 2, 2, myInfo.isCancellable() ? 2 : 4)); myComponent.add(content, BorderLayout.CENTER); final Wrapper cancelWrapper = new Wrapper(myCancelButton); cancelWrapper.setOpaque(false); cancelWrapper.setBorder(new EmptyBorder(0, 3, 0, 2)); content.add(cancelWrapper, BorderLayout.EAST); content.add(myText, BorderLayout.NORTH); content.add(myProgress, BorderLayout.CENTER); content.add(myText2, BorderLayout.SOUTH); myText.setDecorate(false); myText2.setDecorate(false); myComponent.setBorder(new EmptyBorder(2, 2, 2, 2)); myProgress.setActive(false); } if (!myCompact) { myProcessName.recomputeSize(); myText.recomputeSize(); myText2.recomputeSize(); } }