Puck Loading Dialog
This commit is contained in:
@@ -13,6 +13,7 @@ import ch.psi.pshell.imaging.Source;
|
||||
import ch.psi.pshell.scripting.ViewPreference;
|
||||
import ch.psi.pshell.ui.App;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.pshell.ui.StatusBar;
|
||||
import ch.psi.utils.Chrono;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
@@ -24,12 +25,10 @@ import java.awt.Dimension;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.Window;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JComponent;
|
||||
@@ -51,6 +50,7 @@ public class MainPanel extends Panel {
|
||||
Boolean manualMode;
|
||||
Boolean roomTemperature;
|
||||
public final String PUCK_LOADING_STATUS = "Puck loading";
|
||||
StatusBar statusBar;
|
||||
|
||||
public enum BasePlateLayout {
|
||||
normal,
|
||||
@@ -128,7 +128,7 @@ public class MainPanel extends Panel {
|
||||
showException(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,6 +139,11 @@ public class MainPanel extends Panel {
|
||||
}
|
||||
basePlatePanel.setSelectionMode(SelectionMode.Pucks);
|
||||
basePlatePanel.setDevice(Controller.getInstance().basePlate);
|
||||
|
||||
try{
|
||||
statusBar = (StatusBar) SwingUtils.getComponentsByType(getTopLevel(), StatusBar.class)[0];
|
||||
} catch (Exception ex){
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -228,7 +233,7 @@ public class MainPanel extends Panel {
|
||||
public void onStateChange(State state, State former) {
|
||||
Controller.getInstance().onStateChange(state, former);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onTimer() {
|
||||
try {
|
||||
@@ -273,17 +278,23 @@ public class MainPanel extends Panel {
|
||||
String status;
|
||||
|
||||
void setStatus(String status) {
|
||||
if (!status.equals(this.status)) {
|
||||
String current = current = (statusBar==null) ? this.status : statusBar.getStatusLabel().getText();
|
||||
if (!status.equals(current)) {
|
||||
getContext().setPreference(ViewPreference.STATUS, status);
|
||||
this.status = status;
|
||||
}
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
volatile boolean refreshing;
|
||||
void refresh() {
|
||||
if (!SwingUtilities.isEventDispatchThread()) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
refresh();
|
||||
});
|
||||
if (!refreshing){
|
||||
refreshing = true;
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
refreshing = false;
|
||||
refresh();
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
repaint();
|
||||
|
||||
Reference in New Issue
Block a user