From 4084f46404e3ffe7c4ce17cd573dce7fa34f30cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anian=20B=C3=BChler?= <anian.buehler@reutlingen-university.de> Date: Wed, 10 Nov 2021 13:33:13 +0100 Subject: [PATCH] added psn setInteval to BlockLabel --- .../java/edu/mit/blocks/codeblockutil/LabelWidget.java | 3 ++- src/main/java/edu/mit/blocks/renderable/BlockLabel.java | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/mit/blocks/codeblockutil/LabelWidget.java b/src/main/java/edu/mit/blocks/codeblockutil/LabelWidget.java index ba2d67c..08340ee 100644 --- a/src/main/java/edu/mit/blocks/codeblockutil/LabelWidget.java +++ b/src/main/java/edu/mit/blocks/codeblockutil/LabelWidget.java @@ -472,7 +472,8 @@ public abstract class LabelWidget extends JComponent { * either perform some action that should be triggered by * that key or */ - protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { + @SuppressWarnings("deprecation") + protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { if (isNumber) { if (e.getKeyChar() == '-' && canProcessNegativeSign()) { return super.processKeyBinding(ks, e, condition, pressed); diff --git a/src/main/java/edu/mit/blocks/renderable/BlockLabel.java b/src/main/java/edu/mit/blocks/renderable/BlockLabel.java index f1ecbd5..70eae13 100644 --- a/src/main/java/edu/mit/blocks/renderable/BlockLabel.java +++ b/src/main/java/edu/mit/blocks/renderable/BlockLabel.java @@ -300,6 +300,8 @@ public class BlockLabel implements MouseListener, MouseMotionListener, KeyListen text = text + " handleNetwork"; } else if(workspace.getEnv().getBlock(blockID).getGenusName().toUpperCase().contains("DATA_TO_SEND")){ text = text + " isDataToSend"; + } else if(workspace.getEnv().getBlock(blockID).getGenusName().toUpperCase().contains("SET_INTERVAL")){ + text = text + " setInterval"; } else if(workspace.getEnv().getBlock(blockID).getGenusName().toUpperCase().contains("PUBLISH_ONCHANGE")){ text = text + " publishOnChange"; } else if(workspace.getEnv().getBlock(blockID).getGenusName().toUpperCase().contains("PUBLISH")){ @@ -311,7 +313,10 @@ public class BlockLabel implements MouseListener, MouseMotionListener, KeyListen } workspace.getEnv().getBlock(blockID).setBlockLabel(text); - } else { + }else if(workspace.getEnv().getBlock(blockID).getGenusName().toUpperCase().startsWith("CONSTANT")){ + workspace.getEnv().getBlock(blockID).setBlockLabel(text.toUpperCase()); + }else { + workspace.getEnv().getBlock(blockID).setBlockLabel(text); } } -- GitLab