Skip to content
Snippets Groups Projects
Commit a6b30a40 authored by tobias's avatar tobias
Browse files

Removed anomation toggle in modern cart layout

parent 77494db6
No related branches found
No related tags found
No related merge requests found
......@@ -30,12 +30,6 @@
<Button fx:id="playColorButton" focusTraversable="false" mnemonicParsing="false" onAction="#playColorButtonHandler" prefWidth="150.0" />
</children>
</VBox>
<VBox maxWidth="1.7976931348623157E308" prefWidth="150.0" spacing="14.0" HBox.hgrow="ALWAYS">
<children>
<Label alignment="BOTTOM_LEFT" layoutX="243.0" layoutY="8.0" prefHeight="60.0" prefWidth="150.0" text="%layout.label.animation" wrapText="true" VBox.vgrow="ALWAYS" />
<CheckBox fx:id="warnAnimationCheckBox" mnemonicParsing="false" text="%layout.label.warnAnimation" />
</children>
</VBox>
</children>
</HBox>
<Button fx:id="resetButton" mnemonicParsing="false" onAction="#resetButtonHandler" text="%layout.button.reset">
......
......@@ -210,7 +210,7 @@ public class ClassicCartLayout extends Layout implements CartLayout {
}
@Override
public void handleWarning(IPadViewController controller, Warning warning) {
public void handleWarning(IPadViewController controller, Warning warning, GlobalLayout layout) {
final IPadView view = controller.getParent();
try {
......
......@@ -25,8 +25,6 @@ public class ModernLayoutCart extends Layout implements CartLayout, LayoutColorA
private ModernColor backgroundColor = ModernColor.GRAY1;
private ModernColor playColor = ModernColor.RED3;
private boolean isWarnAnimation = true;
public ModernColor getBackgroundColor() {
return backgroundColor;
}
......@@ -43,19 +41,9 @@ public class ModernLayoutCart extends Layout implements CartLayout, LayoutColorA
this.playColor = playColor;
}
public boolean isWarnAnimation() {
return isWarnAnimation;
}
public void setWarnAnimation(boolean isWarnAnimation) {
this.isWarnAnimation = isWarnAnimation;
}
public void reset() {
backgroundColor = ModernColor.GRAY1;
playColor = ModernColor.RED1;
isWarnAnimation = true;
}
@Override
......@@ -77,28 +65,18 @@ public class ModernLayoutCart extends Layout implements CartLayout, LayoutColorA
e.printStackTrace();
}
}
Element animationElement = rootElement.element("Animation");
if (animationElement != null) {
Element warnAnimationElement = animationElement.element("Warn");
if (warnAnimationElement != null) {
isWarnAnimation = Boolean.valueOf(warnAnimationElement.getStringValue());
}
}
}
@Override
public void save(Element rootElement) {
rootElement.addElement("BackgroundColor").addText(backgroundColor.name());
rootElement.addElement("PlayColor").addText(playColor.name());
Element animationElement = rootElement.addElement("Animation");
animationElement.addElement("Warn").addText(String.valueOf(isWarnAnimation));
}
// Warn Handler -> Animation oder Blinken
@Override
public void handleWarning(IPadViewController controller, Warning warning) {
if (isWarnAnimation) {
public void handleWarning(IPadViewController controller, Warning warning, GlobalLayout layout) {
if (layout instanceof ModernLayoutGlobal && ((ModernLayoutGlobal) layout).isWarnAnimation()) {
warnAnimation(controller, warning);
} else {
ModernLayoutAnimator.warnFlash(controller);
......@@ -204,7 +182,6 @@ public class ModernLayoutCart extends Layout implements CartLayout, LayoutColorA
ModernLayoutGlobal modernLayoutGlobal = (ModernLayoutGlobal) globalLayout;
backgroundColor = modernLayoutGlobal.getBackgroundColor();
playColor = modernLayoutGlobal.getPlayColor();
isWarnAnimation = modernLayoutGlobal.isWarnAnimation();
}
}
}
......@@ -88,7 +88,7 @@ public class PadPositionListener implements ChangeListener<Duration>, Runnable {
Warning warning = pad.getWarning();
if (pad.isCustomLayout()) {
pad.getLayout().handleWarning(controller, warning);
pad.getLayout().handleWarning(controller, warning, Profile.currentProfile().currentLayout());
} else {
Profile.currentProfile().currentLayout().handleWarning(controller, warning);
}
......
......@@ -42,16 +42,10 @@ public class ModernLayoutCartViewController extends CartLayoutViewController {
private void setLayout() {
backgroundColorButton.setStyle(getLinearGradientCss(cartLayout.getBackgroundColor()));
playColorButton.setStyle(getLinearGradientCss(cartLayout.getPlayColor()));
warnAnimationCheckBox.setSelected(cartLayout.isWarnAnimation());
}
@Override
public void init() {
warnAnimationCheckBox.selectedProperty().addListener((a, b, c) ->
{
cartLayout.setWarnAnimation(c);
});
}
@FXML
......
......@@ -25,7 +25,7 @@ public interface CartLayout {
* @param controller
* @param warning
*/
public abstract void handleWarning(IPadViewController controller, Warning warning);
public abstract void handleWarning(IPadViewController controller, Warning warning, GlobalLayout animate);
public default void stopWarning(IPadViewController controller) {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment