Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve LibraryManager Dialog rendering #10254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellEditor.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
public class ContributedLibraryTableCellEditor extends InstallerTableCell {

private ContributedLibraryReleases editorValue;
private ContributedLibraryTableCellJPanel editorCell;
private ContributedLibraryTableCellJPanel editorCell = new ContributedLibraryTableCellJPanel();

@Override
public Object getCellEditorValue() {
Expand All @@ -64,8 +64,8 @@ public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected, int row,
int column) {
editorValue = (ContributedLibraryReleases) value;

editorCell = new ContributedLibraryTableCellJPanel(table, value, true);
editorCell.update(table, value, isSelected);
editorCell.installButton
.addActionListener(e -> onInstall(editorValue.getSelected(),
editorValue.getInstalled()));
Expand Down
37 changes: 22 additions & 15 deletions app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellJPanel.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,25 @@

public class ContributedLibraryTableCellJPanel extends JPanel {

final JButton moreInfoButton;
final JButton installButton;
final Component installButtonPlaceholder;
final JComboBox downgradeChooser;
final JComboBox versionToInstallChooser;
final JButton downgradeButton;
final JPanel buttonsPanel;
final JPanel inactiveButtonsPanel;
final JLabel statusLabel;
final JTextPane description;
final TitledBorder titledBorder;
protected JButton moreInfoButton;
protected JButton installButton;
protected Component installButtonPlaceholder;
protected JComboBox downgradeChooser;
protected JComboBox versionToInstallChooser;
protected JButton downgradeButton;
protected JPanel buttonsPanel;
protected JPanel inactiveButtonsPanel;
protected JLabel statusLabel;
protected JTextPane description;
protected TitledBorder titledBorder;
private final String moreInfoLbl = tr("More info");

public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
boolean isSelected) {
super();

public ContributedLibraryTableCellJPanel() {
super() ;
initComponents();
}

public void initComponents() {
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

// Actual title set below
Expand Down Expand Up @@ -119,6 +122,10 @@ public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,

add(Box.createVerticalStrut(15));

}

public void update(JTable parentTable, Object value, boolean isSelected) {

ContributedLibraryReleases releases = (ContributedLibraryReleases) value;

// FIXME: happens on macosx, don't know why
Expand Down
10 changes: 7 additions & 3 deletions app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellRenderer.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,18 @@
import javax.swing.table.TableCellRenderer;

@SuppressWarnings("serial")
public class ContributedLibraryTableCellRenderer implements TableCellRenderer {
public class ContributedLibraryTableCellRenderer extends ContributedLibraryTableCellJPanel implements TableCellRenderer {


public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected,
boolean hasFocus, int row,
int column) {
ContributedLibraryTableCellJPanel cell = new ContributedLibraryTableCellJPanel(table,
value, isSelected);

update(table, value, isSelected);

ContributedLibraryTableCellJPanel cell = this;

cell.setButtonsVisible(false);

cell.setForeground(Color.BLACK);
Expand Down