/** * @see org.newdawn.slick.tools.peditor.InputPanelListener#valueUpdated(org.newdawn.slick.tools.peditor.ValuePanel) */ public void valueUpdated(ValuePanel source) { if (emitter == null) { return; } Value value = (Value) controlToData.get(source); if (value != null) { if( value instanceof SimpleValue) ((SimpleValue)value).setValue( source.getValue()); else if( value instanceof RandomValue ) ((RandomValue)value).setValue( source.getValue()); } else { throw new RuntimeException("No data set specified for the GUI source"); } }
/** * Link a emitter configurable value to a value panel * * @param value The configurable value from the emitter * @param panel The component to link against */ private void link(Value value, ValuePanel panel) { controlToData.put(panel, value); if( value instanceof SimpleValue ) panel.setValue((int) ((SimpleValue)value).getValue( 0 )); else if( value instanceof RandomValue ) panel.setValue((int) ((RandomValue)value).getValue()); }
/** * Link a emitter configurable value to a named component * * @param value The configurable value from the emitter * @param name The name of the component to link to */ protected void link(Value value, String name) { link(value, (ValuePanel) named.get(name)); }