private void createUIComponents() { UpdaterTreeNode.Renderer renderer = new SummaryTreeNode.Renderer(); myPlatformLoadingIcon = new AsyncProcessIcon("Loading..."); myPlatformSummaryRootNode = new RootNode(); myPlatformDetailsRootNode = new RootNode(); ColumnInfo[] platformSummaryColumns = new ColumnInfo[]{new DownloadStatusColumnInfo(), new TreeColumnInfo("Name"), new ApiLevelColumnInfo(), new RevisionColumnInfo(), new StatusColumnInfo()}; myPlatformSummaryTable = new TreeTableView(new ListTreeTableModelOnColumns(myPlatformSummaryRootNode, platformSummaryColumns)); SdkUpdaterConfigPanel.setTreeTableProperties(myPlatformSummaryTable, renderer); MouseListener modificationListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { refreshModified(); } }; myPlatformSummaryTable.addMouseListener(modificationListener); ColumnInfo[] platformDetailColumns = new ColumnInfo[]{new DownloadStatusColumnInfo(), new TreeColumnInfo("Name"), new ApiLevelColumnInfo(), new RevisionColumnInfo(), new StatusColumnInfo()}; myPlatformDetailTable = new TreeTableView(new ListTreeTableModelOnColumns(myPlatformDetailsRootNode, platformDetailColumns)); SdkUpdaterConfigPanel.setTreeTableProperties(myPlatformDetailTable, renderer); myPlatformDetailTable.addMouseListener(modificationListener); }
/** The "small" icon mode isn't just for the icon size; it's for the layout position too; see {@link #doLayout} */ private void setSmallIcon(boolean small) { if (small != mySmall) { if (myProgressVisible && getComponentCount() != 0) { AsyncProcessIcon oldIcon = getProgressIcon(); oldIcon.suspend(); } mySmall = true; removeAll(); AsyncProcessIcon icon = getProgressIcon(); add(icon, BorderLayout.CENTER); if (myProgressVisible) { icon.setVisible(true); icon.resume(); } } }
@Override public void doLayout() { super.doLayout(); if (!myProgressVisible) { return; } // Place the progress icon in the center if there's no rendering, and in the // upper right corner if there's a rendering. The reason for this is that the icon color // will depend on whether we're in a light or dark IDE theme, and depending on the rendering // in the layout it will be invisible. For example, in Darcula the icon is white, and if the // layout is rendering a white screen, the progress is invisible. AsyncProcessIcon icon = getProgressIcon(); Dimension size = icon.getPreferredSize(); if (mySmall) { icon.setBounds(getWidth() - size.width - 1, 1, size.width, size.height); } else { icon.setBounds(getWidth() / 2 - size.width / 2, getHeight() / 2 - size.height / 2, size.width, size.height); } }
public void reset() { myModel.removeAll(); myModel.add(MavenRepositoryServicesManager.getInstance().getUrls()); myIndicesTable.setModel(new MyTableModel(myManager.getIndices())); myIndicesTable.getColumnModel().getColumn(0).setPreferredWidth(400); myIndicesTable.getColumnModel().getColumn(1).setPreferredWidth(50); myIndicesTable.getColumnModel().getColumn(2).setPreferredWidth(50); myIndicesTable.getColumnModel().getColumn(3).setPreferredWidth(20); myUpdatingIcon = new AsyncProcessIcon(IndicesBundle.message("maven.indices.updating")); myUpdatingIcon.resume(); myTimerListener = new ActionListener() { public void actionPerformed(ActionEvent e) { myIndicesTable.repaint(); } }; myRepaintTimer = UIUtil.createNamedTimer("Maven repaint",AsyncProcessIcon.CYCLE_LENGTH / AsyncProcessIcon.COUNT, myTimerListener); myRepaintTimer.start(); }
private void createProgressPanel() { myProgressIcon = new AsyncProcessIcon("Designer progress"); myProgressMessage = new JLabel(); JPanel progressBlock = new JPanel(); progressBlock.add(myProgressIcon); progressBlock.add(myProgressMessage); progressBlock.setBorder(IdeBorderFactory.createRoundedBorder()); myProgressPanel = new JPanel(new GridBagLayout()); myProgressPanel.add(progressBlock, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0) ); myProgressPanel.setOpaque(false); }
@Override protected JComponent createContent() { if (myPanel != null) return myPanel; myPanel = new JPanel(new BorderLayout()); myPanel.add(new AsyncProcessIcon("Async Popup Step"), BorderLayout.WEST); myPanel.add(new JBLabel("Loading..."), BorderLayout.CENTER); myPanel.setBorder(new EmptyBorder(UIUtil.getListCellPadding())); myPanel.setBackground(UIUtil.getListSelectionBackground()); myPanel.registerKeyboardAction(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { goBack(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), JComponent.WHEN_FOCUSED); return myPanel; }
public UnifiedDiffPanel(@Nullable Project project, @NotNull UnifiedContentPanel content, @NotNull DataProvider provider, @NotNull 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); }
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)); }
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; }
private void createUIComponents() { mySourcesLoadingIcon = new AsyncProcessIcon("Loading..."); mySourcesTableModel = new SourcesTableModel(); myUpdateSitesTable = new TableView<SourcesTableModel.Row>(mySourcesTableModel); ToolbarDecorator userDefinedDecorator = ToolbarDecorator.createDecorator(myUpdateSitesTable); mySourcesPanel = addExtraActions(userDefinedDecorator).createPanel(); }
private void createUIComponents() { myToolsLoadingIcon = new AsyncProcessIcon("Loading..."); myToolsSummaryRootNode = new RootNode(); myToolsDetailsRootNode = new RootNode(); UpdaterTreeNode.Renderer renderer = new SummaryTreeNode.Renderer(); ColumnInfo[] toolsSummaryColumns = new ColumnInfo[]{new DownloadStatusColumnInfo(), new TreeColumnInfo("Name"), new VersionColumnInfo(), new StatusColumnInfo()}; myToolsSummaryTable = new TreeTableView(new ListTreeTableModelOnColumns(myToolsSummaryRootNode, toolsSummaryColumns)); SdkUpdaterConfigPanel.setTreeTableProperties(myToolsSummaryTable, renderer); ColumnInfo[] toolsDetailColumns = new ColumnInfo[]{new DownloadStatusColumnInfo(), new TreeColumnInfo("Name"), new VersionColumnInfo(), new StatusColumnInfo()}; myToolsDetailTable = new TreeTableView(new ListTreeTableModelOnColumns(myToolsDetailsRootNode, toolsDetailColumns)); SdkUpdaterConfigPanel.setTreeTableProperties(myToolsDetailTable, renderer); MouseListener modificationListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { refreshModified(); } }; myToolsDetailTable.addMouseListener(modificationListener); myToolsSummaryTable.addMouseListener(modificationListener); }
private void createUIComponents() { myNdkCheckProcessIcon = new AsyncProcessIcon("NDK check progress"); createSdkLocationTextField(); createJdkLocationTextField(); createNdkLocationTextField(); createNdkDownloadLink(); createNdkResetLink(); }
public void showProgressIcon() { if (!myProgressVisible) { setSmallIcon(myRenderResult != null && myRenderResult.getImage() != null); myProgressVisible = true; setVisible(true); AsyncProcessIcon icon = getProgressIcon(); if (getComponentCount() == 0) { // First time: haven't added icon yet? add(getProgressIcon(), BorderLayout.CENTER); } else { icon.setVisible(true); } icon.resume(); } }
public void hideProgressIcon() { if (myProgressVisible) { myProgressVisible = false; setVisible(false); AsyncProcessIcon icon = getProgressIcon(); icon.setVisible(false); icon.suspend(); } }
private static JComponent createDownloadingMessage() { JPanel downloadPanel = new JPanel(new FlowLayout()); AsyncProcessIcon refreshIcon = new AsyncProcessIcon("loading"); JLabel refreshingLabel = new JLabel("Looking for SDK..."); refreshingLabel.setForeground(JBColor.GRAY); downloadPanel.add(refreshIcon); downloadPanel.add(refreshingLabel); return downloadPanel; }
private void createUIComponents() { myVersionLabel = new JBLabel(); myDefaultLabelColor = myVersionLabel.getForeground(); myVersionPanel = new JPanel(new JBCardLayout()); JPanel gettingVersionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); AsyncProcessIcon gettingVersionIcon = new AsyncProcessIcon(SquirrelBundle.message("getting.squirrel.sdk.version")); gettingVersionPanel.add(gettingVersionIcon); gettingVersionPanel.add(new JLabel(SquirrelBundle.message("getting"))); myVersionPanel.add(gettingVersionPanel, VERSION_GETTING); myVersionPanel.add(myVersionLabel, VERSION_RESULT); setVersion(null); }
private void updateBusy() { if (myBusy) { if (myBusyIcon == null) { myBusyIcon = new AsyncProcessIcon(toString()).setUseMask(false); myBusyIcon.setOpaque(false); myBusyIcon.setPaintPassiveIcon(false); add(myBusyIcon); } } if (myBusyIcon != null) { if (myBusy) { myBusyIcon.resume(); } else { myBusyIcon.suspend(); //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { public void run() { if (myBusyIcon != null) { repaint(); } } }); } if (myBusyIcon != null) { myBusyIcon.updateLocation(this); } } }
private void createProgressPanel() { myProgressIcon = new AsyncProcessIcon("Designer progress"); myProgressMessage = new JLabel(); JPanel progressBlock = new JPanel(); progressBlock.add(myProgressIcon); progressBlock.add(myProgressMessage); progressBlock.setBorder(IdeBorderFactory.createRoundedBorder()); myProgressPanel = new JPanel(new GridBagLayout()); myProgressPanel.add(progressBlock, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); myProgressPanel.setOpaque(false); }
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); }
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); }
private LoadingLayer(@Nonnull AsyncProcessIcon processIcon) { setOpaque(false); setVisible(false); myProgress = processIcon; myProgress.setOpaque(false); myTextComponent = customizeLoadingLayer(this, myText, myProgress); myProgress.suspend(); }
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(); }
@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; }
@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; }
public TextFieldWithProgress(@NotNull Project project, @NotNull Collection<String> variants) { super(new BorderLayout()); setBorder(IdeBorderFactory.createEmptyBorder(3)); myProgressIcon = new AsyncProcessIcon("Loading commits"); myTextField = new TextFieldWithAutoCompletion<String>(project, new TextFieldWithAutoCompletion.StringsCompletionProvider(variants, null), false, null) { @Override public void setBackground(Color bg) { super.setBackground(bg); myProgressIcon.setBackground(bg); } @Override protected EditorEx createEditor() { // spell check is not needed EditorEx editor = super.createEditor(); EditorCustomization customization = SpellCheckingEditorCustomizationProvider.getInstance().getDisabledCustomization(); if (customization != null) { customization.customize(editor); } return editor; } @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(); }
private void createUIComponents() { myProgressIcon = new AsyncProcessIcon("Progress"); }
@NotNull private AsyncProcessIcon getProgressIcon() { return getProgressIcon(mySmall); }
private void createUIComponents() { myValidationProgress = new AsyncProcessIcon("validation"); myValidationProgress.setVisible(false); }
private void updateBusy() { if (myBusy) { if (myBusyIcon == null) { myBusyIcon = new AsyncProcessIcon(toString()).setUseMask(false); myBusyIcon.setOpaque(false); myBusyIcon.setPaintPassiveIcon(false); add(myBusyIcon); myBusyIcon.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (!UIUtil.isActionClick(e)) return; AbstractTreeBuilder builder = AbstractTreeBuilder.getBuilderFor(Tree.this); if (builder != null) { builder.cancelUpdate(); } } }); } } if (myBusyIcon != null) { if (myBusy) { if (hasFocus()) { myBusyIcon.resume(); myBusyIcon.setToolTipText("Update is in progress. Click to cancel"); } } else { myBusyIcon.suspend(); myBusyIcon.setToolTipText(null); //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { public void run() { if (myBusyIcon != null) { repaint(); } } }); } updateBusyIconLocation(); } }
private void createUIComponents() { myAsyncProcessIcon = new AsyncProcessIcon("Loading available branches"); }