mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-17 14:55:09 -05:00
Remove "validate children, yet avoid flickering of the mouse cursor" workaround because it causes a 600-800ms startup delay
This commit is contained in:
parent
52e96f4890
commit
7d02dcb88e
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
package net.filebot.util.ui;
|
package net.filebot.util.ui;
|
||||||
|
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
@ -19,7 +18,6 @@ import javax.swing.border.CompoundBorder;
|
|||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
import javax.swing.border.LineBorder;
|
import javax.swing.border.LineBorder;
|
||||||
|
|
||||||
|
|
||||||
public abstract class AbstractFancyListCellRenderer extends JPanel implements ListCellRenderer {
|
public abstract class AbstractFancyListCellRenderer extends JPanel implements ListCellRenderer {
|
||||||
|
|
||||||
private Color gradientBeginColor;
|
private Color gradientBeginColor;
|
||||||
@ -38,22 +36,18 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
private static final Insets DEFAULT_PADDING = new Insets(7, 7, 7, 7);
|
private static final Insets DEFAULT_PADDING = new Insets(7, 7, 7, 7);
|
||||||
private static final Insets DEFAULT_MARGIN = new Insets(1, 1, 0, 1);
|
private static final Insets DEFAULT_MARGIN = new Insets(1, 1, 0, 1);
|
||||||
|
|
||||||
|
|
||||||
public AbstractFancyListCellRenderer() {
|
public AbstractFancyListCellRenderer() {
|
||||||
this(DEFAULT_PADDING, DEFAULT_MARGIN, null);
|
this(DEFAULT_PADDING, DEFAULT_MARGIN, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AbstractFancyListCellRenderer(Insets padding) {
|
public AbstractFancyListCellRenderer(Insets padding) {
|
||||||
this(padding, DEFAULT_MARGIN, null);
|
this(padding, DEFAULT_MARGIN, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AbstractFancyListCellRenderer(Insets padding, Insets margin) {
|
public AbstractFancyListCellRenderer(Insets padding, Insets margin) {
|
||||||
this(padding, margin, null);
|
this(padding, margin, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AbstractFancyListCellRenderer(Insets padding, Insets margin, Color borderColor) {
|
public AbstractFancyListCellRenderer(Insets padding, Insets margin, Color borderColor) {
|
||||||
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
||||||
|
|
||||||
@ -76,7 +70,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void paintBorder(Graphics g) {
|
protected void paintBorder(Graphics g) {
|
||||||
if (borderPainted) {
|
if (borderPainted) {
|
||||||
@ -84,7 +77,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void paintComponent(Graphics g) {
|
protected void paintComponent(Graphics g) {
|
||||||
Graphics2D g2d = (Graphics2D) g;
|
Graphics2D g2d = (Graphics2D) g;
|
||||||
@ -108,7 +100,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
super.paintComponent(g);
|
super.paintComponent(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||||
configureListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
configureListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||||
@ -117,7 +108,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void configureListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
protected void configureListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||||
setGradientPainted(isSelected);
|
setGradientPainted(isSelected);
|
||||||
setBorderPainted(isSelected);
|
setBorderPainted(isSelected);
|
||||||
@ -143,77 +133,55 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setGradientColors(Color gradientBeginColor, Color gradientEndColor) {
|
public void setGradientColors(Color gradientBeginColor, Color gradientEndColor) {
|
||||||
this.gradientBeginColor = gradientBeginColor;
|
this.gradientBeginColor = gradientBeginColor;
|
||||||
this.gradientEndColor = gradientEndColor;
|
this.gradientEndColor = gradientEndColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Color getGradientBeginColor() {
|
public Color getGradientBeginColor() {
|
||||||
return gradientBeginColor;
|
return gradientBeginColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Color getGradientEndColor() {
|
public Color getGradientEndColor() {
|
||||||
return gradientEndColor;
|
return gradientEndColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setHighlightColor(Color highlightColor) {
|
public void setHighlightColor(Color highlightColor) {
|
||||||
this.highlightColor = highlightColor;
|
this.highlightColor = highlightColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setGradientStyle(GradientStyle gradientStyle) {
|
public void setGradientStyle(GradientStyle gradientStyle) {
|
||||||
this.gradientStyle = gradientStyle;
|
this.gradientStyle = gradientStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setHighlightingEnabled(boolean highlightingEnabled) {
|
public void setHighlightingEnabled(boolean highlightingEnabled) {
|
||||||
this.highlightingEnabled = highlightingEnabled;
|
this.highlightingEnabled = highlightingEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setBorderPainted(boolean borderPainted) {
|
public void setBorderPainted(boolean borderPainted) {
|
||||||
this.borderPainted = borderPainted;
|
this.borderPainted = borderPainted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setGradientPainted(boolean gradientPainted) {
|
public void setGradientPainted(boolean gradientPainted) {
|
||||||
this.gradientPainted = gradientPainted;
|
this.gradientPainted = gradientPainted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Color getHighlightColor() {
|
public Color getHighlightColor() {
|
||||||
return highlightColor;
|
return highlightColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isBorderPainted() {
|
public boolean isBorderPainted() {
|
||||||
return borderPainted;
|
return borderPainted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public GradientStyle getGradientStyle() {
|
public GradientStyle getGradientStyle() {
|
||||||
return gradientStyle;
|
return gradientStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isHighlightingEnabled() {
|
public boolean isHighlightingEnabled() {
|
||||||
return highlightingEnabled;
|
return highlightingEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate() {
|
|
||||||
// validate children, yet avoid flickering of the mouse cursor
|
|
||||||
synchronized (getTreeLock()) {
|
|
||||||
validateTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden for performance reasons.
|
* Overridden for performance reasons.
|
||||||
*/
|
*/
|
||||||
@ -221,7 +189,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
public void repaint() {
|
public void repaint() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden for performance reasons.
|
* Overridden for performance reasons.
|
||||||
*/
|
*/
|
||||||
@ -229,7 +196,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
public void repaint(long tm, int x, int y, int width, int height) {
|
public void repaint(long tm, int x, int y, int width, int height) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden for performance reasons.
|
* Overridden for performance reasons.
|
||||||
*/
|
*/
|
||||||
@ -237,7 +203,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
public void repaint(Rectangle r) {
|
public void repaint(Rectangle r) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden for performance reasons.
|
* Overridden for performance reasons.
|
||||||
*/
|
*/
|
||||||
@ -245,7 +210,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
|
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden for performance reasons.
|
* Overridden for performance reasons.
|
||||||
*/
|
*/
|
||||||
@ -253,7 +217,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
public void firePropertyChange(String propertyName, byte oldValue, byte newValue) {
|
public void firePropertyChange(String propertyName, byte oldValue, byte newValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden for performance reasons.
|
* Overridden for performance reasons.
|
||||||
*/
|
*/
|
||||||
@ -261,7 +224,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
public void firePropertyChange(String propertyName, char oldValue, char newValue) {
|
public void firePropertyChange(String propertyName, char oldValue, char newValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden for performance reasons.
|
* Overridden for performance reasons.
|
||||||
*/
|
*/
|
||||||
@ -269,7 +231,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
public void firePropertyChange(String propertyName, short oldValue, short newValue) {
|
public void firePropertyChange(String propertyName, short oldValue, short newValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden for performance reasons.
|
* Overridden for performance reasons.
|
||||||
*/
|
*/
|
||||||
@ -277,7 +238,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
public void firePropertyChange(String propertyName, int oldValue, int newValue) {
|
public void firePropertyChange(String propertyName, int oldValue, int newValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden for performance reasons.
|
* Overridden for performance reasons.
|
||||||
*/
|
*/
|
||||||
@ -285,7 +245,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
public void firePropertyChange(String propertyName, long oldValue, long newValue) {
|
public void firePropertyChange(String propertyName, long oldValue, long newValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden for performance reasons.
|
* Overridden for performance reasons.
|
||||||
*/
|
*/
|
||||||
@ -293,7 +252,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
public void firePropertyChange(String propertyName, float oldValue, float newValue) {
|
public void firePropertyChange(String propertyName, float oldValue, float newValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden for performance reasons.
|
* Overridden for performance reasons.
|
||||||
*/
|
*/
|
||||||
@ -301,7 +259,6 @@ public abstract class AbstractFancyListCellRenderer extends JPanel implements Li
|
|||||||
public void firePropertyChange(String propertyName, double oldValue, double newValue) {
|
public void firePropertyChange(String propertyName, double oldValue, double newValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden for performance reasons.
|
* Overridden for performance reasons.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user