Java Code Examples for com.badlogic.gdx.scenes.scene2d.utils.ChangeListener#ChangeEvent

The following examples show how to use com.badlogic.gdx.scenes.scene2d.utils.ChangeListener#ChangeEvent . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SeekBar.java    From gdx-texture-packer-gui with Apache License 2.0 6 votes vote down vote up
/**
 * Called by {@link SeekBarModel}. Notifies when underlying model value has changed and text field and slider must update.
 * Typically there is no need to call this method manually.
 * @param fireEvent if true then {@link ChangeListener.ChangeEvent} will be fired
 */
public void notifyValueChanged (boolean updateTextField, boolean updateSlider, boolean fireEvent) {
    if (updateTextField) {
        VisValidatableTextField textField = getTextField();
        int cursor = textField.getCursorPosition();
        textField.setCursorPosition(0);
        this.setListenTextChangeEvents(false);
        textField.setText(model.prepareTextValue());
        this.setListenTextChangeEvents(true);
        textField.setCursorPosition(cursor);
    }

    if (updateSlider) {
        VisSlider slider = getSlider();
        this.setListenSliderChangeEvents(false);
        slider.setValue(model.prepareSliderValue());
        this.setListenSliderChangeEvents(true);
    }

    if (fireEvent) {
        ChangeListener.ChangeEvent changeEvent = Pools.obtain(ChangeListener.ChangeEvent.class);
        fire(changeEvent);
        Pools.free(changeEvent);
    }
}
 
Example 2
Source File: RootTable.java    From skin-composer with MIT License 5 votes vote down vote up
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
    main.getDialogFactory().showDialogColorPicker((Color) previewProperties.get("bgcolor"), new DialogColorPicker.ColorListener() {
        @Override
        public void selected(Color color) {
            if (color != null) {
                browseField.getTextButton().setText((int) (color.r * 255) + "," + (int) (color.g * 255) + "," + (int) (color.b * 255) + "," + (int) (color.a * 255));
                previewProperties.put("bgcolor", color);
                main.getProjectData().setPreviewBgColor(color);
                refreshPreview();
            }
        }
    });
}
 
Example 3
Source File: ParticleActor.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@Override public void draw(Batch batch, float parentAlpha) {
    effect.setPosition(getX(), getY());
    Color c = getColor();
    batch.setColor(c.r, c.g, c.b, c.a * parentAlpha);
    effect.draw(batch, Gdx.graphics.getDeltaTime());
    if (effect.isComplete()) {
        ChangeListener.ChangeEvent event = Pools.obtain(ChangeListener.ChangeEvent.class);
        fire(event);
        Pools.free(event);
    }
}
 
Example 4
Source File: Spinner.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
/**
 * Called by {@link SpinnerModel}. Notifies when underlying model value has changed and spinner text field must updated.
 * Typically there is no need to call this method manually.
 * @param fireEvent if true then {@link ChangeListener.ChangeEvent} will be fired
 */
public void notifyValueChanged (boolean fireEvent) {
	VisValidatableTextField textField = getTextField();
	int cursor = textField.getCursorPosition();
	textField.setCursorPosition(0);
	textField.setText(model.getText());
	textField.setCursorPosition(cursor);

	if (fireEvent) {
		ChangeListener.ChangeEvent changeEvent = Pools.obtain(ChangeListener.ChangeEvent.class);
		fire(changeEvent);
		Pools.free(changeEvent);
	}
}
 
Example 5
Source File: DialogFreeTypeFont.java    From skin-composer with MIT License 4 votes vote down vote up
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
    previewText = ((TextField) actor).getText();
}
 
Example 6
Source File: DialogBitmapFont.java    From skin-composer with MIT License 4 votes vote down vote up
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
    previewText = ((TextField) actor).getText();
}
 
Example 7
Source File: RootTable.java    From skin-composer with MIT License 4 votes vote down vote up
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
    fire(new CustomPropertyEvent(null, null, CustomPropertyEnum.NEW));
}
 
Example 8
Source File: RootTable.java    From skin-composer with MIT License 4 votes vote down vote up
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
    fire(new StylePropertyEvent(styleProp, styleActor));
}
 
Example 9
Source File: RootTable.java    From skin-composer with MIT License 4 votes vote down vote up
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
    fire(new CustomPropertyEvent(styleProp, styleActor, CustomPropertyEnum.CHANGE_VALUE));
}
 
Example 10
Source File: DirectionActor.java    From riiablo with Apache License 2.0 4 votes vote down vote up
void update() {
  ChangeListener.ChangeEvent event = new ChangeListener.ChangeEvent();
  event.setListenerActor(this);
  fire(event);
}
 
Example 11
Source File: MenuItem.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
void fireChangeEvent () {
	ChangeListener.ChangeEvent changeEvent = Pools.obtain(ChangeListener.ChangeEvent.class);
	fire(changeEvent);
	Pools.free(changeEvent);
}