Hiding puck detection errors from users.

This commit is contained in:
gac-S_Changer
2018-09-17 11:06:44 +02:00
parent f32260086f
commit afb1e4cac2
4 changed files with 38 additions and 16 deletions

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="76" max="32767" attributes="0"/>
<Component id="panelBottom" pref="75" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
</Group>
</Group>
@@ -334,21 +334,21 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="9" max="32767" attributes="0"/>
<EmptySpace pref="13" max="32767" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="buttonDetectCover" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="hexiposiPanel" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="9" max="32767" attributes="0"/>
<EmptySpace pref="14" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace pref="14" max="32767" attributes="0"/>
<EmptySpace pref="15" max="32767" attributes="0"/>
<Component id="hexiposiPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="9" max="32767" attributes="0"/>
<EmptySpace pref="10" max="32767" attributes="0"/>
<Component id="buttonDetectCover" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -384,12 +384,12 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="8" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="buttonDrawing" linkSize="25" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="buttonCamera" linkSize="25" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="8" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -882,7 +882,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="108" max="32767" attributes="0"/>
<Component id="panelDetail" pref="106" 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"/>
@@ -990,9 +990,9 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="devicesPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="28" max="32767" attributes="0"/>
<Component id="panelExpert" min="-2" pref="93" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="31" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -1004,7 +1004,7 @@
<Component id="panelExpert" max="32767" attributes="0"/>
<Component id="devicesPanel" pref="235" max="32767" attributes="0"/>
</Group>
<EmptySpace pref="8" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>

View File

@@ -405,6 +405,7 @@ public class MainPanel extends Panel {
panelDetection.setVisible(expert);
buttonDetectCover.setVisible(expert);
buttonConfig.setVisible(expert);
Puck.setDisplayDetectionError(expert);
if (checkExpert.isSelected() != expert) {
checkExpert.setSelected(expert);

View File

@@ -103,6 +103,16 @@ public class Puck extends DeviceBase {
return detection.toString();
}
public static boolean displayDetectionError;
public static void setDisplayDetectionError(boolean value){
displayDetectionError = value;
}
public static boolean getDisplayDetectionError(){
return displayDetectionError;
}
public double getAngle() {
return ANGLES[index];
}

View File

@@ -87,13 +87,24 @@ public class PuckGraphics {
public boolean isHighlithted() {
return puck.isSelected() || puck.isSegmentSelected();
}
Color getEmptyColor(){
return isHighlithted() ? new Color(212, 212, 212) : Color.LIGHT_GRAY;
}
Color getErrorColor(){
if (puck.getDisplayDetectionError()){
return isHighlithted() ? new Color(192, 10, 10) : new Color(192, 128, 128);
}
return getEmptyColor();
}
Color getColor() {
Color ret = Color.LIGHT_GRAY;
switch (puck.detection) {
case Empty:
//ret = isHighlithted() ? new Color(224, 224, 224) : Color.LIGHT_GRAY;
ret = isHighlithted() ? new Color(212, 212, 212) : Color.LIGHT_GRAY;
ret = getEmptyColor();
break;
case Present:
if ((puck.puckType != null) && (puck.puckType != PuckType.Unknown)){
@@ -106,15 +117,15 @@ public class PuckGraphics {
break;
case Empty:
case Error:
ret = isHighlithted() ? new Color(192, 10, 10) : new Color(192, 128, 128);
ret = getErrorColor();
break;
}
} else {
ret = isHighlithted() ? new Color(0, 140, 140) : new Color(128, 192, 192);
}
break;
case Error:
ret = isHighlithted() ? new Color(192, 10, 10) : new Color(192, 128, 128);
case Error:
ret = getErrorColor();
break;
case Offline:
ret = isHighlithted() ? new Color(250, 255, 48) : new Color(253, 194, 41);