Bigger font sizes and clearing mounted sample if puck is removed.

This commit is contained in:
gac-S_Changer
2019-06-06 11:14:29 +02:00
parent 075e76fc4e
commit 1969d8253e
5 changed files with 172 additions and 108 deletions

View File

@@ -8,7 +8,7 @@ import ch.psi.pshell.core.Context;
import ch.psi.pshell.core.DevicePool;
import ch.psi.pshell.core.DevicePoolListener;
import ch.psi.pshell.core.JsonSerializer;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.DeviceAdapter;
import ch.psi.pshell.device.DeviceListener;
import ch.psi.pshell.device.GenericDevice;
@@ -64,14 +64,14 @@ public class Controller {
static void createInstance(Panel mainFrame) {
instance = new Controller(mainFrame);
}
enum PuckMountMode{
enum PuckMountMode {
Direct,
Dialog
}
final PuckMountMode puckMountMode = App.hasArgument("direct") ? PuckMountMode.Direct : PuckMountMode.Dialog;
enum PuckSensorAccess {
RaspberryPi,
Esera;
@@ -127,7 +127,7 @@ public class Controller {
basePlate.addListener(basePlateListener);
roomTemperatureBasePlate = new RoomTemperatureBasePlate();
}
final DeviceListener basePlateListener = new DeviceAdapter() {
@@ -226,6 +226,17 @@ public class Controller {
refreshSamplesTable();
}
public Sample getMountedSample() throws Exception{
currentMountedSample = (String) Context.getInstance().evalLineBackground("get_setting('mounted_sample_position')");
Sample sample = basePlate.getSampleByName(currentMountedSample);
return sample;
}
public void resetMountedSample() throws Exception{
Context.getInstance().evalLineBackground("set_setting('mounted_sample_position', None)");
}
public void onStateChange(State state, State former) {
if (state == State.Initializing) {
@@ -233,9 +244,8 @@ public class Controller {
} else if (state == State.Ready) {
refreshSamplesTable();
try {
currentMountedSample = (String) Context.getInstance().evalLineBackground("get_setting('mounted_sample_position')");
Sample sample = basePlate.getSampleByName(currentMountedSample);
if ((sample == null) && (roomTemperatureBasePlate!=null)){
Sample sample = getMountedSample();
if ((sample == null) && (roomTemperatureBasePlate != null)) {
sample = roomTemperatureBasePlate.getSampleByName(currentMountedSample);
roomTemperatureBasePlate.resetLoadedSample();
}
@@ -263,7 +273,7 @@ public class Controller {
refreshSamplesTable();
} catch (Exception ex) {
Logger.getLogger(Controller.class.getName()).log(Level.WARNING, null, ex);
}
}
}
final DeviceListener hexiposiListener = new DeviceAdapter() {
@@ -397,7 +407,7 @@ public class Controller {
return null;
}
}
public boolean isSelectedPuck(Puck puck) {
return ("" + puck.getSegment()).equalsIgnoreCase(getHexiposiPosition());
}
@@ -419,7 +429,7 @@ public class Controller {
return null;
}
}
public Boolean isRoomTemp() {
try {
return getMainFrame().eval("is_room_temp()", true).equals(true);
@@ -474,25 +484,24 @@ public class Controller {
} catch (Exception ex) {
return null;
}
}
}
public Boolean isBeamlineStatusEnabled() {
try {
return getMainFrame().eval("is_beamline_status_enabled()", true).equals(true);
} catch (Exception ex) {
return null;
}
}
}
public Boolean isImagingEnabled() {
try {
return getMainFrame().eval("is_imaging_enabled()", true).equals(true);
} catch (Exception ex) {
return null;
}
}
}
public void imageDetectPucks() throws Context.ContextStateException {
imageDetectPucks(null, null, null);
}
@@ -670,24 +679,24 @@ public class Controller {
Device reader = getPuckBarcodeReader();
if (reader != null) {
final String name = reader.getName();
BiFunction errorHandler =(BiFunction) (ret, ex) -> {
BiFunction errorHandler = (BiFunction) (ret, ex) -> {
if (ex != null) {
if (puckReaderOk){
Logger.getLogger(Controller.class.getName()).warning("Communication failure: " + name);
if (puckReaderOk) {
Logger.getLogger(Controller.class.getName()).warning("Communication failure: " + name);
}
puckLoading = null;
puckLoading = null;
puckReaderOk = false;
} else {
if (!puckReaderOk){
Logger.getLogger(Controller.class.getName()).warning("Communication resumed: " + name);
if (!puckReaderOk) {
Logger.getLogger(Controller.class.getName()).warning("Communication resumed: " + name);
}
puckReaderOk = true;
}
return ret;
};
};
try {
if (puckLoading) {
getMainFrame().evalAsync(name + ".enable(); " + name + ".polling = 100" , true).handle(errorHandler);
getMainFrame().evalAsync(name + ".enable(); " + name + ".polling = 100", true).handle(errorHandler);
currentDetection = basePlate.getDetection();
} else if (getState().isInitialized()) {
getMainFrame().evalAsync(name + ".polling = 0; " + name + ".disable()", true).handle(errorHandler);
@@ -708,14 +717,14 @@ public class Controller {
return puckLoading;
}
void playSound(String name){
try{
void playSound(String name) {
try {
Audio.playFile(new File(Context.getInstance().getSetup().expandPath("{home}/sounds/" + name + ".wav")), false);
} catch (Exception ex){
} catch (Exception ex) {
Logger.getLogger(Controller.class.getName()).log(Level.FINE, null, ex);
}
}
public void onPuckBarcode(String datamatrix) {
if (isPuckLoading()) {
playSound("scanned");
@@ -738,7 +747,7 @@ public class Controller {
if (isSelectedPuck(puck)) {
boolean detectedPuckInserted = (currentDetection[i] != Puck.Detection.Present) && (detection[i] == Puck.Detection.Present);
boolean detectedPuckRemoved = (currentDetection[i] != Puck.Detection.Empty) && (detection[i] == Puck.Detection.Empty);
if (detectedPuckInserted) {
if (detectedPuckInserted) {
onPuckInserted(puck);
} else if (detectedPuckRemoved) {
@@ -751,18 +760,18 @@ public class Controller {
currentDetection = detection;
}
}
public void onPuckInserted(Puck puck){
public void onPuckInserted(Puck puck) {
playSound("mounted");
String datamatrix = getMainFrame().getPuckDatamatrix();
onPuckScanned(null);
onPuckMounted(puck, datamatrix);
onPuckMounted(puck, datamatrix);
}
public void onPuckRemoved(Puck puck){
public void onPuckRemoved(Puck puck) {
playSound("unmounted");
onPuckUnmounted(puck);
}
onPuckUnmounted(puck);
}
void linkPuckDatamatrix(Puck puck, String datamatrix, boolean showMessage) {
// if ( ((puck.getId()==null) && (datamatrix!=null)) ||
@@ -866,70 +875,81 @@ public class Controller {
}
}
void showDialogPuckLoading (){
if ((dialogPuckLoading!=null) && (dialogPuckLoading.isVisible())){
void showDialogPuckLoading() {
if ((dialogPuckLoading != null) && (dialogPuckLoading.isVisible())) {
return;
}
dialogPuckLoading = new PuckLoadingDialog(mainFrame.getTopLevel(), false);
dialogPuckLoading.setLocationRelativeTo(mainFrame);
dialogPuckLoading.setLocationRelativeTo(mainFrame);
dialogPuckLoading.setVisible(true);
}
void hideDialogPuckLoading (){
if (dialogPuckLoading!=null){
void hideDialogPuckLoading() {
if (dialogPuckLoading != null) {
dialogPuckLoading.setVisible(false);
dialogPuckLoading.dispose();
dialogPuckLoading = null;
}
}
void onPuckLoadingModeChange(boolean puckLoadMode) {
if (puckMountMode == PuckMountMode.Dialog){
if (puckLoadMode){
if (puckMountMode == PuckMountMode.Dialog) {
if (puckLoadMode) {
showDialogPuckLoading();
} else {
hideDialogPuckLoading ();
hideDialogPuckLoading();
}
}
}
void onPuckScanned(String datamatrix){
void onPuckScanned(String datamatrix) {
if (isPuckLoading()) {
getMainFrame().setPuckDatamatrix(datamatrix);
if (puckMountMode == PuckMountMode.Dialog){
if (puckMountMode == PuckMountMode.Dialog) {
showDialogPuckLoading();
dialogPuckLoading.onPuckScanned(datamatrix);
}
} else{
} else {
getMainFrame().setPuckDatamatrix(null);
}
}
void onPuckMounted(Puck puck, String datamatrix){
void onPuckMounted(Puck puck, String datamatrix) {
if (isPuckLoading()) {
if (puckMountMode == PuckMountMode.Dialog){
if (puckMountMode == PuckMountMode.Dialog) {
showDialogPuckLoading();
dialogPuckLoading.onPuckMounted(puck, datamatrix);
} else {
} else {
if (!datamatrix.isEmpty()) {
linkPuckDatamatrix(puck, datamatrix, true);
} else {
askPuckDatamatrix(puck);
}
}
}
}
}
void onPuckUnmounted(Puck puck){
void onPuckUnmounted(Puck puck) {
if (isPuckLoading()) {
if (puckMountMode == PuckMountMode.Dialog){
try{
Sample sample = getMountedSample();
if ((sample!=null) && (sample.getPuck() == puck)){
resetMountedSample();
sample.setLoaded(false);
SwingUtilities.invokeLater(()->{;
getMainFrame().refresh();
});
}
} catch (Exception ex) {
Logger.getLogger(Controller.class.getName()).log(Level.WARNING, null, ex);
}
if (puckMountMode == PuckMountMode.Dialog) {
showDialogPuckLoading();
dialogPuckLoading.onPuckUnmounted(puck);
} else {
linkPuckDatamatrix(puck, null, true);
linkPuckDatamatrix(puck, null, true);
}
}
}
}
}

View File

@@ -31,7 +31,7 @@
<Group type="102" alignment="1" attributes="0">
<Component id="panelTop" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="panelBottom" pref="75" max="32767" attributes="0"/>
<Component id="panelBottom" pref="74" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
</Group>
</Group>
@@ -896,7 +896,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="panelDetail" pref="106" max="32767" attributes="0"/>
<Component id="panelDetail" pref="107" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="panelDevices" min="-2" pref="280" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
@@ -1170,7 +1170,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="jScrollPane1" alignment="1" max="32767" attributes="0"/>
<Component id="panelTableSamples" alignment="1" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
@@ -1179,14 +1179,14 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="50" max="32767" attributes="0"/>
<Component id="panelTableSamples" pref="50" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Container class="javax.swing.JScrollPane" name="panelTableSamples">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
@@ -1221,7 +1221,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="jScrollPane3" alignment="1" pref="328" max="32767" attributes="0"/>
<Component id="panelTablePucks" alignment="1" pref="328" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
@@ -1230,14 +1230,14 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="jScrollPane3" pref="0" max="32767" attributes="0"/>
<Component id="panelTablePucks" pref="0" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane3">
<Container class="javax.swing.JScrollPane" name="panelTablePucks">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>

View File

@@ -65,6 +65,8 @@ public class MainPanel extends Panel {
basePlatePanel.setMode(BasePlatePanel.Mode.single);
setExpertMode(false);
setDefaultDetail();
panelTablePucks.getVerticalScrollBar().setPreferredSize(new Dimension(20, 0));
panelTableSamples.getVerticalScrollBar().setPreferredSize(new Dimension(20, 0));
int row = 0;
for (String segment : new String[]{"A", "B", "C", "D", "E", "F"}) {
@@ -728,10 +730,10 @@ public class MainPanel extends Panel {
buttonConfig = new javax.swing.JButton();
panelBottom = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
panelTableSamples = new javax.swing.JScrollPane();
tableSamples = new javax.swing.JTable();
jPanel4 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
panelTablePucks = new javax.swing.JScrollPane();
tablePucks = new javax.swing.JTable();
setPreferredSize(new java.awt.Dimension(1030, 530));
@@ -1449,7 +1451,7 @@ public class MainPanel extends Panel {
}
));
tableSamples.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
jScrollPane1.setViewportView(tableSamples);
panelTableSamples.setViewportView(tableSamples);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
@@ -1457,14 +1459,14 @@ public class MainPanel extends Panel {
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(jScrollPane1)
.addComponent(panelTableSamples)
.addGap(0, 0, 0))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
.addComponent(panelTableSamples, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
@@ -1523,7 +1525,7 @@ public class MainPanel extends Panel {
}
});
tablePucks.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
jScrollPane3.setViewportView(tablePucks);
panelTablePucks.setViewportView(tablePucks);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
@@ -1531,14 +1533,14 @@ public class MainPanel extends Panel {
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
.addComponent(panelTablePucks, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(panelTablePucks, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
@@ -1775,8 +1777,6 @@ public class MainPanel extends Panel {
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JLabel labelManualMode;
private javax.swing.JLabel labelRoomTemperature;
private ch.psi.pshell.swing.Led led5;
@@ -1809,6 +1809,8 @@ public class MainPanel extends Panel {
private javax.swing.JPanel panelRight;
private javax.swing.JPanel panelStatus;
private javax.swing.JPanel panelSystemStatus;
private javax.swing.JScrollPane panelTablePucks;
private javax.swing.JScrollPane panelTableSamples;
private javax.swing.JPanel panelTop;
private javax.swing.JPanel panelViewType;
private javax.swing.JProgressBar progressLN2;

View File

@@ -32,11 +32,13 @@
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="labelSuggestion" max="32767" attributes="0"/>
<Component id="jScrollPane1" pref="484" max="32767" attributes="0"/>
<Component id="panelTable" pref="484" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="textScannedDatamatrix" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonClearDatamatrix" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel2" linkSize="1" min="-2" max="-2" attributes="0"/>
@@ -55,9 +57,12 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="labelSuggestion" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textScannedDatamatrix" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textScannedDatamatrix" linkSize="2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="buttonClearDatamatrix" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
@@ -65,7 +70,7 @@
<Component id="textDetectedPuck" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="249" max="32767" attributes="0"/>
<Component id="panelTable" pref="235" max="32767" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="buttonSet" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
@@ -81,14 +86,14 @@
<Font name="Lucida Grande" size="18" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Scanned Dartamatrix:"/>
<Property name="text" type="java.lang.String" value="Scanned Datamatrix:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textScannedDatamatrix">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="24" style="0"/>
<Font name="Lucida Grande" size="30" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
@@ -96,7 +101,7 @@
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Container class="javax.swing.JScrollPane" name="panelTable">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
@@ -106,11 +111,11 @@
<Component class="javax.swing.JTable" name="table">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="28" style="0"/>
<Font name="Lucida Grande" size="30" style="0"/>
</Property>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="2" rowCount="0">
<Column editable="false" title="Datamatrix" type="java.lang.String"/>
<Column editable="false" title="Datamatrix / Puck Id" type="java.lang.String"/>
<Column editable="false" title="Puck Position" type="java.lang.String"/>
</Table>
</Property>
@@ -179,7 +184,7 @@
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="24" style="0"/>
<Font name="Lucida Grande" size="30" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
@@ -187,5 +192,16 @@
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="buttonClearDatamatrix">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Clear"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonClearDatamatrixActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@@ -4,6 +4,7 @@ import ch.psi.pshell.core.Context;
import ch.psi.pshell.swing.DataPanel;
import ch.psi.utils.swing.MainFrame;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Dimension;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
@@ -26,7 +27,7 @@ public class PuckLoadingDialog extends JDialog {
* Creates new form PuckLoadingDialog
*/
public PuckLoadingDialog(java.awt.Frame parent, boolean modal) {
super(parent, "Puck Loading", modal);
super(parent, "Puck Loading", modal);
initComponents();
this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
this.setName("PuckLoadingDialog");
@@ -34,7 +35,8 @@ public class PuckLoadingDialog extends JDialog {
setStatusLabel(null,-1);
setSugestionLabel(null,-1);
model = (DefaultTableModel) table.getModel();
table.getTableHeader().setFont(table.getTableHeader().getFont().deriveFont(20.0f));
table.getTableHeader().setFont(table.getTableHeader().getFont().deriveFont(22.0f));
panelTable.getVerticalScrollBar().setPreferredSize(new Dimension(30, 0));
}
@Override
@@ -214,31 +216,32 @@ public class PuckLoadingDialog extends JDialog {
jLabel1 = new javax.swing.JLabel();
textScannedDatamatrix = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
panelTable = new javax.swing.JScrollPane();
table = new javax.swing.JTable();
buttonSet = new javax.swing.JButton();
labelSuggestion = new javax.swing.JLabel();
labelStatus = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
textDetectedPuck = new javax.swing.JTextField();
buttonClearDatamatrix = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("Scanned Dartamatrix:");
jLabel1.setText("Scanned Datamatrix:");
textScannedDatamatrix.setEditable(false);
textScannedDatamatrix.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
textScannedDatamatrix.setFont(new java.awt.Font("Lucida Grande", 0, 30)); // NOI18N
textScannedDatamatrix.setHorizontalAlignment(javax.swing.JTextField.CENTER);
table.setFont(new java.awt.Font("Lucida Grande", 0, 28)); // NOI18N
table.setFont(new java.awt.Font("Lucida Grande", 0, 30)); // NOI18N
table.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Datamatrix", "Puck Position"
"Datamatrix / Puck Id", "Puck Position"
}
) {
Class[] types = new Class [] {
@@ -260,7 +263,7 @@ public class PuckLoadingDialog extends JDialog {
table.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
table.getTableHeader().setResizingAllowed(false);
table.getTableHeader().setReorderingAllowed(false);
jScrollPane1.setViewportView(table);
panelTable.setViewportView(table);
buttonSet.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
buttonSet.setText("Set");
@@ -285,9 +288,17 @@ public class PuckLoadingDialog extends JDialog {
jLabel2.setText("Detected Puck:");
textDetectedPuck.setEditable(false);
textDetectedPuck.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
textDetectedPuck.setFont(new java.awt.Font("Lucida Grande", 0, 30)); // NOI18N
textDetectedPuck.setHorizontalAlignment(javax.swing.JTextField.CENTER);
buttonClearDatamatrix.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
buttonClearDatamatrix.setText("Clear");
buttonClearDatamatrix.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonClearDatamatrixActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
@@ -300,11 +311,13 @@ public class PuckLoadingDialog extends JDialog {
.addComponent(buttonSet, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(labelSuggestion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 484, Short.MAX_VALUE)
.addComponent(panelTable, javax.swing.GroupLayout.DEFAULT_SIZE, 484, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(textScannedDatamatrix))
.addComponent(textScannedDatamatrix)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonClearDatamatrix))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
@@ -321,21 +334,25 @@ public class PuckLoadingDialog extends JDialog {
.addContainerGap()
.addComponent(labelSuggestion)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(textScannedDatamatrix, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(textScannedDatamatrix, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(buttonClearDatamatrix))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(textDetectedPuck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE)
.addComponent(panelTable, javax.swing.GroupLayout.DEFAULT_SIZE, 235, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonSet)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(labelStatus))
);
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {buttonClearDatamatrix, textScannedDatamatrix});
pack();
}// </editor-fold>//GEN-END:initComponents
@@ -351,6 +368,14 @@ public class PuckLoadingDialog extends JDialog {
}
}//GEN-LAST:event_buttonSetActionPerformed
private void buttonClearDatamatrixActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonClearDatamatrixActionPerformed
try {
Controller.getInstance().onPuckScanned(null);
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonClearDatamatrixActionPerformed
/**
* @param args the command line arguments
*/
@@ -394,12 +419,13 @@ public class PuckLoadingDialog extends JDialog {
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonClearDatamatrix;
javax.swing.JButton buttonSet;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel labelStatus;
private javax.swing.JLabel labelSuggestion;
private javax.swing.JScrollPane panelTable;
javax.swing.JTable table;
javax.swing.JTextField textDetectedPuck;
javax.swing.JTextField textScannedDatamatrix;