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. These examples are extracted from open source projects. 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 Project: cocos-ui-libgdx   Source File: ProgressBar.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Sets the progress bar position, rounded to the nearest step size and clamped to the minumum and maximim values.
 * {@link #clamp(float)} can be overidden to allow values outside of the progress bars min/max range.
 *
 * @return false if the value was not changed because the progress bar already had the value or it was canceled by a listener.
 */
public boolean setValue(float value) {
    value = snap(clamp(Math.round(value / stepSize) * stepSize));
    float oldValue = this.value;
    if (value == oldValue) {
        return false;
    }
    float oldVisualValue = getVisualValue();
    this.value = value;
    ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);
    boolean cancelled = fire(changeEvent);
    if (cancelled) {
        this.value = oldValue;
    } else if (animateDuration > 0) {
        animateFromValue = oldVisualValue;
        animateTime = animateDuration;
    }
    Pools.free(changeEvent);
    return !cancelled;
}
 
Example 2
private void createKeyStore() {
	// keytool -genkey -v -keystore my-release-key.keystore -alias alias_name
	// -keyalg RSA -keysize 2048 -validity 10000

	String[] args = { "-genkey", "-noprompt", "-v", "-keystore", getKeyStorePath(), "-alias", getKeyAlias(),
			"-keyalg", "RSA", "-keysize", "2048", "-validity", "10000", "-storepass", getKeyStorePassword(),
			"-dname", "CN=bladeengine.com", "-keypass", getKeyAliasPassword() };

	try {
		Process p = RunProccess.runJavaHomeBin("keytool", Arrays.asList(args));
		p.waitFor();

		if (p.exitValue() == 0) {
			if (listener != null)
				listener.changed(new ChangeEvent(), this);
		} else {
			Message.showMsgDialog(getStage(), "Error", "Error generating key");
			cancel();
		}
	} catch (Exception e) {
		Message.showMsgDialog(getStage(), "Error", e.getMessage());
		cancel();
	}

}
 
Example 3
/**
 * Override to append all animations if selected.
 */
@Override
protected void ok() {
	@SuppressWarnings("unchecked")
	FilteredSelectBox<String> cb = (FilteredSelectBox<String>) id.getField();

	if (e == null && cb.getSelectedIndex() == 0) {
		AnimationRenderer renderer = (AnimationRenderer) parent.getRenderer();

		for (int i = 1; i < cb.getItems().size; i++) {
			cb.setSelectedIndex(i);

			if (renderer.getAnimations().get(id.getText()) != null)
				continue;

			inputsToModel(true);
			// doc.setId(e, cb.getItems().get(i));

			if (listener != null)
				listener.changed(new ChangeEvent(), this);
		}

	} else {
		super.ok();
	}
}
 
Example 4
@Override
protected void ok() {

	final Stage stage = getStage();

	Message.showMsg(stage, "Creating resolution...", true);

	Timer.schedule(new Task() {
		@Override
		public void run() {
			createResolution();

			String msg = scaleImages();

			if (listener != null)
				listener.changed(new ChangeEvent(), CreateResolutionDialog.this);

			Message.hideMsg();

			if (msg != null)
				Message.showMsgDialog(stage, "Error creating resolution", msg);
		}
	}, 1);
}
 
Example 5
Source Project: vis-ui   Source File: VisTextField.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @param oldText May be null.
 * @return True if the text was changed.
 */
boolean changeText (String oldText, String newText) {
	if (ignoreEqualsTextChange && newText.equals(oldText)) return false;
	text = newText;
	beforeChangeEventFired();
	ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);
	boolean cancelled = fire(changeEvent);
	text = cancelled ? oldText : newText;
	Pools.free(changeEvent);
	return !cancelled;
}
 
Example 6
Source Project: vis-ui   Source File: VerticalChannelBar.java    License: Apache License 2.0 5 votes vote down vote up
private void updateValueFromTouch (float y) {
	int newValue = (int) (y / BasicColorPicker.PALETTE_SIZE * maxValue / sizes.scaleFactor);
	setValue(newValue);

	ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);
	fire(changeEvent);
	Pools.free(changeEvent);
}
 
Example 7
Source Project: vis-ui   Source File: Palette.java    License: Apache License 2.0 5 votes vote down vote up
private void updateValueFromTouch (float touchX, float touchY) {
	int newV = (int) (touchX / BasicColorPicker.PALETTE_SIZE * maxValue / sizes.scaleFactor);
	int newS = (int) (touchY / BasicColorPicker.PALETTE_SIZE * maxValue / sizes.scaleFactor);

	setValue(newS, newV);

	ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);
	fire(changeEvent);
	Pools.free(changeEvent);
}
 
Example 8
Source Project: vis-ui   Source File: ChannelBar.java    License: Apache License 2.0 5 votes vote down vote up
private void updateValueFromTouch (float x) {
	int newValue = (int) (x / BasicColorPicker.BAR_WIDTH * maxValue / sizes.scaleFactor);
	setValue(newValue);

	ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);
	fire(changeEvent);
	Pools.free(changeEvent);
}
 
Example 9
@Override
protected void ok() {
	if (previousId == null) {
		create();
	} else {
		newId = inputId.getText();
		renameChapter();
	}
	
	if(listener != null)
		listener.changed(new ChangeEvent(), this);
}
 
Example 10
@Override
protected void ok() {
	try{
		inputsToModel(e==null);
	} catch (Exception e1) {
		Message.showMsg(getStage(), "Error getting fields " + e1.getMessage(), 4);
		EditorLogger.printStackTrace(e1);
	}

	if (listener != null)
		listener.changed(new ChangeEvent(), this);
}
 
Example 11
Source Project: gdx-ai   Source File: TabbedPane.java    License: Apache License 2.0 5 votes vote down vote up
/** Sends a ChangeEvent, with this TabbedPane as the target, to each registered listener. This method is called each time there
 * is a change to the selected index. */
protected void fireStateChanged () {
	ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);
	changeEvent.setBubbles(false);
	fire(changeEvent);
	Pools.free(changeEvent);
}
 
Example 12
Source Project: riiablo   Source File: MPQViewer.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void changed(ChangeEvent event, Actor actor) {
  DelegatingDrawable.this.changed(event, actor);
}
 
Example 13
Source Project: riiablo   Source File: MPQViewer.java    License: Apache License 2.0 votes vote down vote up
protected void changed(ChangeEvent event, Actor actor) {}