public void addVariable(YoVariable<?> variable) { if ((entryBoxArrayPanel != null) && entryBoxArrayPanel.isHoldingVariable(variable)) return; activeEntryContainer.bindToVariable(variable); variableInThisBox = variable; // label.setText(textName); String toolTip = variableInThisBox.getDescription(); if ((toolTip == null) || toolTip.equals("")) toolTip = variableInThisBox.getFullNameWithNameSpace(); this.setToolTipText(toolTip); // setTextField(); if (entryBoxArrayPanel != null) this.entryBoxArrayPanel.checkStatus(); }
@Override public void focusGained(FocusEvent evt) { activeEntryContainer.focusGained(evt); if (entryBoxArrayPanel != null) entryBoxArrayPanel.requestFocus(); else this.getParent().requestFocus(); }
public <T extends RobotControllerWithAttachRobot> SimulationConstructionSet setupSCS(T controller) throws InterruptedException { boolean showGUI = true; FallingBrickRobot robot = new FallingBrickRobot(); controller.attachRobot(robot); assertFalse(controller.getYoVariableRegistry() == null); robot.setController(controller); SimulationConstructionSetParameters parameters = SimulationConstructionSetParameters.createFromSystemProperties();; parameters.setCreateGUI(showGUI); parameters.setDataBufferSize(2000); SimulationConstructionSet scs = new SimulationConstructionSet(robot, parameters); scs.setFrameMaximized(); scs.startOnAThread(); Thread.sleep(DELAY_TIME_FOR_HUMAN_CONVENIENT_VIEWING); StandardSimulationGUI scsGUI = scs.getStandardSimulationGUI(); EntryBoxArrayPanel temp = scsGUI.getEntryBoxArrayPanel(); temp.removeAllEntryBoxes(); scsGUI.getEntryBoxArrayPanel().updateUI(); Thread.sleep(DELAY_TIME_FOR_HUMAN_CONVENIENT_VIEWING); return scs; }
public void removeVariable(YoVariable<?> variable) { if (variableInThisBox == variable) { variableInThisBox = null; activeEntryContainer.removeVariable(); } this.setToolTipText(DEFAULT_EMPTY_ENTRY_BOX_LABEL); if (entryBoxArrayPanel != null) this.entryBoxArrayPanel.checkStatus(); if (popupMenu.isVisible()) popupMenu.setVisible(false); this.updateUI(); }
Thread.sleep(DELAY_TIME_FOR_HUMAN_CONVENIENT_VIEWING); scs.setupEntryBox("badGreekVariable"); ArrayList<YoEntryBox> entryBoxes = scsGUI.getEntryBoxArrayPanel().getEntryBoxesOnThisPanel();
@Override public void actionPerformed(ActionEvent evt) { String text = jTextField.getText(); try { double val = Double.valueOf(text).doubleValue(); if (variableInThisBox != null) { variableInThisBox.setValueFromDouble(val); setTextField(); // this.updateUI(); entryBox.repaint(); for (int i = 0; i < variableChangedListeners.size(); i++) { VariableChangedListener listener = variableChangedListeners.get(i); listener.notifyOfVariableChange(variableInThisBox); } } if (entryBoxArrayPanel != null) entryBoxArrayPanel.requestFocus(); else entryBox.getParent().requestFocus(); } catch (NumberFormatException e) { setTextField(); } }