Removed weird hack for refreshing table cells

This commit is contained in:
Cristian Maglie 2015-12-28 12:29:55 +01:00
parent 4725584a49
commit c1387ed316
2 changed files with 3 additions and 52 deletions

View File

@ -33,8 +33,6 @@ import static processing.app.I18n.tr;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -42,7 +40,6 @@ import java.util.stream.Collectors;
import javax.swing.JComboBox; import javax.swing.JComboBox;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.Timer;
import cc.arduino.contributions.DownloadableContributionVersionComparator; import cc.arduino.contributions.DownloadableContributionVersionComparator;
import cc.arduino.contributions.VersionComparator; import cc.arduino.contributions.VersionComparator;
@ -142,39 +139,17 @@ public class ContributedLibraryTableCellEditor extends InstallerTableCell {
return editorCell.panel; return editorCell.panel;
} }
private final Timer enabler = new Timer(100, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
enable(true);
enabler.stop();
}
});
@Override @Override
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
enable(false); editorCell.installButton.setEnabled(enabled);
if (enabled) {
enabler.start();
} else {
enabler.stop();
}
editorCell.buttonsPanel.setVisible(enabled); editorCell.buttonsPanel.setVisible(enabled);
editorCell.inactiveButtonsPanel.setVisible(!enabled); editorCell.inactiveButtonsPanel.setVisible(!enabled);
} }
public void enable(boolean enabled) {
editorCell.installButton.setEnabled(enabled);
}
public void setStatus(String status) { public void setStatus(String status) {
editorCell.statusLabel.setText(status); editorCell.statusLabel.setText(status);
} }
public void invalidate() {
editorCell.panel.invalidate();
}
protected void onRemove(ContributedLibrary selected) { protected void onRemove(ContributedLibrary selected) {
// Empty // Empty
} }

View File

@ -33,14 +33,11 @@ import static processing.app.I18n.tr;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.Timer;
import cc.arduino.contributions.DownloadableContributionVersionComparator; import cc.arduino.contributions.DownloadableContributionVersionComparator;
import cc.arduino.contributions.VersionComparator; import cc.arduino.contributions.VersionComparator;
@ -139,39 +136,18 @@ public class ContributedPlatformTableCellEditor extends InstallerTableCell {
return editorCell.panel; return editorCell.panel;
} }
private final Timer enabler = new Timer(100, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
enable(true);
enabler.stop();
}
});
@Override @Override
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
enable(false); editorCell.installButton.setEnabled(enabled);
if (enabled) { editorCell.removeButton.setEnabled(enabled);
enabler.start();
} else {
enabler.stop();
}
editorCell.buttonsPanel.setVisible(enabled); editorCell.buttonsPanel.setVisible(enabled);
editorCell.inactiveButtonsPanel.setVisible(!enabled); editorCell.inactiveButtonsPanel.setVisible(!enabled);
} }
public void enable(boolean enabled) {
editorCell.installButton.setEnabled(enabled);
editorCell.removeButton.setEnabled(enabled);
}
public void setStatus(String status) { public void setStatus(String status) {
editorCell.statusLabel.setText(status); editorCell.statusLabel.setText(status);
} }
public void invalidate() {
editorCell.panel.invalidate();
}
protected void onRemove(ContributedPlatform contributedPlatform) { protected void onRemove(ContributedPlatform contributedPlatform) {
// Empty // Empty
} }