This commit is contained in:
102
src/main/java/ch/psi/mxsc/MainPanel.java
Normal file
102
src/main/java/ch/psi/mxsc/MainPanel.java
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
|
||||
*/
|
||||
|
||||
package ch.psi.mxsc;
|
||||
|
||||
import ch.psi.pshell.device.GenericDevice;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class MainPanel extends Panel {
|
||||
BasePlate basePlate;
|
||||
/** Creates new form Panel */
|
||||
static MainPanel instance;
|
||||
|
||||
public static MainPanel getInstance(){
|
||||
return instance;
|
||||
}
|
||||
public MainPanel() {
|
||||
initComponents();
|
||||
instance = this;
|
||||
basePlate = new BasePlate();
|
||||
SwingUtils.setEnumCombo(comboMode, BasePlatePanel.Mode.class);
|
||||
comboMode.setSelectedItem(basePlatePanel.getMode());
|
||||
this.setPersistedComponents(new Component[]{comboMode});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onInitialize(int runCount) {
|
||||
basePlatePanel.setDevice(basePlate);
|
||||
//basePlatePanel.setShowSamples(true);
|
||||
//puckPanel.setDevice(basePlate.getPucks()[0]);
|
||||
GenericDevice former = getDevice("BasePlate");
|
||||
if (former!=null){
|
||||
removeDevice(former);
|
||||
}
|
||||
addDevice(basePlate);
|
||||
}
|
||||
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
basePlatePanel = new ch.psi.mxsc.BasePlatePanel();
|
||||
comboMode = new javax.swing.JComboBox<>();
|
||||
|
||||
comboMode.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
comboMode.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
comboModeActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout basePlatePanelLayout = new javax.swing.GroupLayout(basePlatePanel);
|
||||
basePlatePanel.setLayout(basePlatePanelLayout);
|
||||
basePlatePanelLayout.setHorizontalGroup(
|
||||
basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, basePlatePanelLayout.createSequentialGroup()
|
||||
.addGap(0, 386, Short.MAX_VALUE)
|
||||
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
basePlatePanelLayout.setVerticalGroup(
|
||||
basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(basePlatePanelLayout.createSequentialGroup()
|
||||
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 280, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(basePlatePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(basePlatePanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void comboModeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboModeActionPerformed
|
||||
basePlatePanel.setMode((BasePlatePanel.Mode) comboMode.getSelectedItem());
|
||||
}//GEN-LAST:event_comboModeActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private ch.psi.mxsc.BasePlatePanel basePlatePanel;
|
||||
private javax.swing.JComboBox<String> comboMode;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user