protected void removeWidget(WidgetWrapper wrapper) { if (wrapper.widget() == view) { view = null; } remove(wrapper); org.nlogo.log.Logger.logWidgetRemoved( wrapper.widget().classDisplayName(), wrapper.widget().displayName()); }
@Override protected void removeWidget(WidgetWrapper wrapper) { remove(wrapper); // if the compile that is associated with this removal (assuming there is one) fails // the observer variables and constraints might not get reallocated in which case // if we try to add a different widget with the same name we get a constraint violation // from the old constraint. yuck. ev 11/27/07 new org.nlogo.window.Events.RemoveConstraintEvent(wrapper.widget().displayName()).raise(this); org.nlogo.log.Logger.logWidgetRemoved( wrapper.widget().classDisplayName(), wrapper.widget().displayName()); }
public void stateChanged(javax.swing.event.ChangeEvent e) { int value = speedSlider.getValue(); // adjust the speed reported to the workspace // so there isn't a big gap between the snap area // and outside the snap area. ev 2/22/07 if (value < -10) { value += 10; } else if (value > 10) { value -= 10; } else { value = 0; } workspace.speedSliderPosition(value / 2); if (org.nlogo.api.Version.isLoggingEnabled()) { org.nlogo.log.Logger.logSpeedSlider(value); } enableLabels(value); workspace.updateManager().nudgeSleeper(); }
protected WidgetWrapper addWidget( Widget widget, int x, int y, boolean select, boolean loadingWidget) { java.awt.Dimension size = widget.getSize(); WidgetWrapper wrapper = new WidgetWrapper(widget, this); wrapper.setVisible(false); // we need to add the wrapper before we can call wrapper.getPreferredSize(), because // that method looks at its parent and sees if it's an InterfacePanel // and zooms accordingly - ST 6/16/02 add(wrapper, DEFAULT_LAYER); moveToFront(wrapper); if (select || !loadingWidget) { wrapper.setSize(wrapper.getPreferredSize()); } else { wrapper.setSize(size); // //wrapper.getPreferredSize()); } if (workspace.snapOn() && !loadingWidget) { int gridX = (x / GRID_SNAP) * GRID_SNAP; int gridY = (y / GRID_SNAP) * GRID_SNAP; wrapper.setLocation(gridX, gridY); } else { wrapper.setLocation(x, y); } wrapper.validate(); wrapper.setVisible(true); zoomer.zoomWidget(wrapper, true, loadingWidget, 1.0, zoomer.zoomFactor()); if (select) { newWidget = wrapper; newWidget.originalBounds = newWidget.getBounds(); newWidget.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.CROSSHAIR_CURSOR)); } org.nlogo.log.Logger.logAddWidget(widget.classDisplayName(), widget.displayName()); return wrapper; }