Skip to content

Commit c1387ed

Browse files
committed
Removed weird hack for refreshing table cells
1 parent 4725584 commit c1387ed

File tree

2 files changed

+3
-52
lines changed

2 files changed

+3
-52
lines changed

app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellEditor.java

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,13 @@
3333

3434
import java.awt.Color;
3535
import java.awt.Component;
36-
import java.awt.event.ActionEvent;
37-
import java.awt.event.ActionListener;
3836
import java.util.Collections;
3937
import java.util.LinkedList;
4038
import java.util.List;
4139
import java.util.stream.Collectors;
4240

4341
import javax.swing.JComboBox;
4442
import javax.swing.JTable;
45-
import javax.swing.Timer;
4643

4744
import cc.arduino.contributions.DownloadableContributionVersionComparator;
4845
import cc.arduino.contributions.VersionComparator;
@@ -142,39 +139,17 @@ public Component getTableCellEditorComponent(JTable table, Object value,
142139
return editorCell.panel;
143140
}
144141

145-
private final Timer enabler = new Timer(100, new ActionListener() {
146-
@Override
147-
public void actionPerformed(ActionEvent e) {
148-
enable(true);
149-
enabler.stop();
150-
}
151-
});
152-
153142
@Override
154143
public void setEnabled(boolean enabled) {
155-
enable(false);
156-
if (enabled) {
157-
enabler.start();
158-
} else {
159-
enabler.stop();
160-
}
144+
editorCell.installButton.setEnabled(enabled);
161145
editorCell.buttonsPanel.setVisible(enabled);
162146
editorCell.inactiveButtonsPanel.setVisible(!enabled);
163147
}
164148

165-
public void enable(boolean enabled) {
166-
editorCell.installButton.setEnabled(enabled);
167-
}
168-
169149
public void setStatus(String status) {
170150
editorCell.statusLabel.setText(status);
171151
}
172152

173-
public void invalidate() {
174-
editorCell.panel.invalidate();
175-
}
176-
177-
178153
protected void onRemove(ContributedLibrary selected) {
179154
// Empty
180155
}

app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellEditor.java

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,11 @@
3333

3434
import java.awt.Color;
3535
import java.awt.Component;
36-
import java.awt.event.ActionEvent;
37-
import java.awt.event.ActionListener;
3836
import java.util.Collections;
3937
import java.util.LinkedList;
4038
import java.util.stream.Collectors;
4139

4240
import javax.swing.JTable;
43-
import javax.swing.Timer;
4441

4542
import cc.arduino.contributions.DownloadableContributionVersionComparator;
4643
import cc.arduino.contributions.VersionComparator;
@@ -139,39 +136,18 @@ public Component getTableCellEditorComponent(JTable table, Object value,
139136
return editorCell.panel;
140137
}
141138

142-
private final Timer enabler = new Timer(100, new ActionListener() {
143-
@Override
144-
public void actionPerformed(ActionEvent e) {
145-
enable(true);
146-
enabler.stop();
147-
}
148-
});
149-
150139
@Override
151140
public void setEnabled(boolean enabled) {
152-
enable(false);
153-
if (enabled) {
154-
enabler.start();
155-
} else {
156-
enabler.stop();
157-
}
158-
editorCell.buttonsPanel.setVisible(enabled);
159-
editorCell.inactiveButtonsPanel.setVisible(!enabled);
160-
}
161-
162-
public void enable(boolean enabled) {
163141
editorCell.installButton.setEnabled(enabled);
164142
editorCell.removeButton.setEnabled(enabled);
143+
editorCell.buttonsPanel.setVisible(enabled);
144+
editorCell.inactiveButtonsPanel.setVisible(!enabled);
165145
}
166146

167147
public void setStatus(String status) {
168148
editorCell.statusLabel.setText(status);
169149
}
170150

171-
public void invalidate() {
172-
editorCell.panel.invalidate();
173-
}
174-
175151
protected void onRemove(ContributedPlatform contributedPlatform) {
176152
// Empty
177153
}

0 commit comments

Comments
 (0)