forked from External/mage
[refactoring][minor] Replaced all tabs with four spaces.
This commit is contained in:
parent
e646e4768d
commit
239a4fb100
2891 changed files with 79411 additions and 79411 deletions
|
|
@ -7,49 +7,49 @@ import java.util.Map;
|
|||
|
||||
|
||||
public class DelayedViewerThread extends Thread {
|
||||
private static DelayedViewerThread fInstance = new DelayedViewerThread();
|
||||
private static DelayedViewerThread fInstance = new DelayedViewerThread();
|
||||
|
||||
public static DelayedViewerThread getInstance() {
|
||||
return fInstance;
|
||||
}
|
||||
public static DelayedViewerThread getInstance() {
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
private final Map<Component, Long> delayedViewers;
|
||||
private final Map<Component, Long> delayedViewers;
|
||||
|
||||
protected DelayedViewerThread() {
|
||||
delayedViewers = new HashMap<Component, Long>();
|
||||
start();
|
||||
}
|
||||
protected DelayedViewerThread() {
|
||||
delayedViewers = new HashMap<Component, Long>();
|
||||
start();
|
||||
}
|
||||
|
||||
public synchronized void show(Component component, long delay) {
|
||||
delayedViewers.put(component, System.currentTimeMillis() + delay);
|
||||
notify();
|
||||
}
|
||||
public synchronized void show(Component component, long delay) {
|
||||
delayedViewers.put(component, System.currentTimeMillis() + delay);
|
||||
notify();
|
||||
}
|
||||
|
||||
public synchronized void hide(Component component) {
|
||||
delayedViewers.remove(component);
|
||||
component.setVisible(false);
|
||||
}
|
||||
public synchronized void hide(Component component) {
|
||||
delayedViewers.remove(component);
|
||||
component.setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void run() {
|
||||
while (true) {
|
||||
try {
|
||||
if (delayedViewers.isEmpty()) {
|
||||
wait();
|
||||
}
|
||||
final long time = System.currentTimeMillis();
|
||||
for (Iterator<Component> it = delayedViewers.keySet().iterator(); it.hasNext();) {
|
||||
Component component = it.next();
|
||||
final long delayedTime = delayedViewers.get(component);
|
||||
if (delayedTime <= time) {
|
||||
component.setVisible(true);
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
wait(100);
|
||||
} catch (final InterruptedException ex) {
|
||||
System.out.println("Interrupted : " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public synchronized void run() {
|
||||
while (true) {
|
||||
try {
|
||||
if (delayedViewers.isEmpty()) {
|
||||
wait();
|
||||
}
|
||||
final long time = System.currentTimeMillis();
|
||||
for (Iterator<Component> it = delayedViewers.keySet().iterator(); it.hasNext();) {
|
||||
Component component = it.next();
|
||||
final long delayedTime = delayedViewers.get(component);
|
||||
if (delayedTime <= time) {
|
||||
component.setVisible(true);
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
wait(100);
|
||||
} catch (final InterruptedException ex) {
|
||||
System.out.println("Interrupted : " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue