Commit 58e9ffc6 authored by Matthias Möller's avatar Matthias Möller

Editing GUI for Performance-Purposes

parent 4cf21428
No preview for this file type
......@@ -21,7 +21,7 @@ public class EmotivController implements ActionListener, WindowListener, ChangeL
WebsocketServer2 emotivServer;
public EmotivController() throws UnknownHostException{
EmotivInit emo = new EmotivInit(2);
EmotivInit emo = new EmotivInit(1);
AbstractEmostateUpdatedComponent guiModel = new MentalCommandComponent(emo);
guiModel = new HardwareComponent(guiModel);
guiModel = new BatteryComponent(guiModel);
......@@ -38,7 +38,7 @@ public class EmotivController implements ActionListener, WindowListener, ChangeL
((JButton)e.getSource()).setEnabled(false);
if(buttonName == "Trainiere Normal!"){
if(buttonName == "Train Normal"){
activateActionSkills();
if(this.emotivThread.getStopped()){
Edk.INSTANCE.IEE_MentalCommandSetTrainingAction(0, EmoState.IEE_MentalCommandAction_t.MC_NEUTRAL.ToInt());
......@@ -50,7 +50,7 @@ public class EmotivController implements ActionListener, WindowListener, ChangeL
this.emotivThread.continueWorking();
}
}
else if(buttonName == "Trainiere MC1!"){
else if(buttonName == "Train MentalPush"){
activateActionSkills();
if(this.emotivThread.getStopped()){
Edk.INSTANCE.IEE_MentalCommandSetTrainingAction(0, EmoState.IEE_MentalCommandAction_t.MC_PUSH.ToInt());
......@@ -63,7 +63,7 @@ public class EmotivController implements ActionListener, WindowListener, ChangeL
}
}
else if(buttonName == "Trainiere MC2!"){
else if(buttonName == "Train MentalPull"){
activateActionSkills();
if(this.emotivThread.getStopped()){
Edk.INSTANCE.IEE_MentalCommandSetTrainingAction(0, EmoState.IEE_MentalCommandAction_t.MC_LIFT.ToInt());
......@@ -121,6 +121,7 @@ public class EmotivController implements ActionListener, WindowListener, ChangeL
new EmotivController();
}
// This function is neccessary to activate MCpull and MCPush
private void activateActionSkills() {
int shallBeActivated = 0;
shallBeActivated += EmoState.IEE_MentalCommandAction_t.MC_PULL.ToInt();
......
......@@ -49,17 +49,17 @@ public class MentalCommandEventInit {
case 0:
return "Kein Event";
case 1:
return "<html><span color='#ffa500'>training started</span></html>";
return "<html><span color='#ffa500'>Training Started</span></html>";
case 2:
return "<html><span color='green'>training succeeded</span></html>";
return "<html><span color='green'>Training Succeeded</span></html>";
case 3:
return "<html><span color='red'>training failed</span></html>";
return "<html><span color='red'>Training Failed</span></html>";
case 4:
return "<html><span color='green'>training completed</span></html>";
return "<html><span color='green'>Training Completed</span></html>";
case 5:
return "IEE_MentalCommandTrainingDataErased";
case 6:
return "<html><span color='red'>training rejectcted</span></html>";
return "<html><span color='red'>Training Rejectcted</span></html>";
case 7:
return "IEE_MentalCommandTrainingReset";
case 8:
......
......@@ -18,9 +18,9 @@ import Modell.AbstractEmotiv;
public class EmotivGUI extends JFrame implements ActionListener{
private EmotivController emotivController;
private AbstractEmotiv modell;
private SubEmotivGUI edkErrorGUI;
private SubEmotivGUI emotivMentalCommandTypeGUI;
private SubEmotivGUI emotivEventTypeGUI;
//private SubEmotivGUI edkErrorGUI;
//private SubEmotivGUI emotivMentalCommandTypeGUI;
//private SubEmotivGUI emotivEventTypeGUI;
private String edkErrorCode = "";
private float runningTime = 0; // Die RunningTime wird fr sehr viele Komponenten gebraucht!
private String emotivEventType = "";
......@@ -44,24 +44,25 @@ public class EmotivGUI extends JFrame implements ActionListener{
this.setTitle("ExplorViz BCI Plugin");
this.setVisible(true);
this.createMenuBar();
//this.createMenuBar();
this.createMenuPanel();
this.setLayout(new FlowLayout());
this.contentPanel = new JPanel(new FlowLayout(0,10,10));
this.contentPanel.setPreferredSize(new Dimension(500, 110));
this.add(contentPanel);
this.createTrainingPanel();
this.createWebsocketConnectionPanel();
this.createDefaultPanel();
this.setupDefaultPanel();
this.setSize(500, 220);
this.setResizable(false);
}
private void createDefaultPanel() {
private void setupDefaultPanel() {
JPanel defaultPanel = new JPanel();
defaultPanel.setPreferredSize(this.contentPanel.getPreferredSize());
JLabel label1 = new JLabel();
......@@ -70,8 +71,7 @@ public class EmotivGUI extends JFrame implements ActionListener{
this.contentPanel.add(defaultPanel);
}
//Layout-Funktionen
//layout-functions
private void createMenuBar() {
JMenuBar jMenuBar = new JMenuBar();
......@@ -134,9 +134,9 @@ public class EmotivGUI extends JFrame implements ActionListener{
Dimension buttonSize = new Dimension(140, 25);
JPanel jPanel2 = new JPanel();
jPanel2.setLayout(new FlowLayout(0, 0, 0));
JButton jButton = new JButton("Trainiere Normal!");
JButton jButton2 = new JButton("Trainiere MC1!");
JButton jButton3 = new JButton("Trainiere MC2!");
JButton jButton = new JButton("Train Normal");
JButton jButton2 = new JButton("Train MentalPush");
JButton jButton3 = new JButton("Train MentalPull");
jButton.setMultiClickThreshhold(40);
jButton2.setMultiClickThreshhold(40);
jButton3.setMultiClickThreshhold(40);
......@@ -247,20 +247,20 @@ public class EmotivGUI extends JFrame implements ActionListener{
}
public void updateErrorCode(){
this.runningTime = this.modell.getRunningTime();
/* this.runningTime = this.modell.getRunningTime();
String edkErrorCode = Float.toString(this.runningTime) + ": " + this.modell.edkErrorToString() + "\n";
this.edkErrorCode += edkErrorCode;
if(this.edkErrorGUI != null){
this.edkErrorGUI.addText(edkErrorCode);
}
}*/
}
public void updateEmotivEventType(){
String emotivType = Float.toString(this.runningTime) + ": " + this.modell.getEmotivEventTypeString() + "\n";
/*String emotivType = Float.toString(this.runningTime) + ": " + this.modell.getEmotivEventTypeString() + "\n";
this.emotivEventType += emotivType;
if(this.emotivEventTypeGUI != null){
this.emotivEventTypeGUI.addText(emotivType);
}
}*/
}
public void updateEmotivMentalCommandType(){
......@@ -295,28 +295,28 @@ public class EmotivGUI extends JFrame implements ActionListener{
String buttonName = ((AbstractButton)e.getSource()).getText();
if(buttonName == "EdkErrorCodes"){
if(this.edkErrorGUI == null){
/*if(this.edkErrorGUI == null){
this.edkErrorGUI = new SubEmotivGUI(this);
this.edkErrorGUI.setTitle("EdkErrors");
this.edkErrorGUI.addText(this.edkErrorCode);
}
this.edkErrorGUI.setVisible(true);
this.edkErrorGUI.setVisible(true);*/
}
else if(buttonName=="MentalCommandEventTypes"){
if(this.emotivMentalCommandTypeGUI == null){
/*if(this.emotivMentalCommandTypeGUI == null){
this.emotivMentalCommandTypeGUI = new SubEmotivGUI(this);
this.emotivMentalCommandTypeGUI.setTitle("MentalCommandType");
this.emotivMentalCommandTypeGUI.addText(this.emotivMentalCommandType);
}
this.emotivMentalCommandTypeGUI.setVisible(true);
this.emotivMentalCommandTypeGUI.setVisible(true);*/
}
else if(buttonName=="EmotivEventTypes"){
if(this.emotivEventTypeGUI == null){
/*if(this.emotivEventTypeGUI == null){
this.emotivEventTypeGUI = new SubEmotivGUI(this);
this.emotivEventTypeGUI.setTitle("EmotivEventTypes");
this.emotivEventTypeGUI.addText(this.emotivEventType);
}
this.emotivEventTypeGUI.setVisible(true);
this.emotivEventTypeGUI.setVisible(true);*/
}
else if(buttonName=="Mentalcommands"){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment