pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattux <mat...@hotmail.fr>
Subject Re: Prompt: override option click event
Date Fri, 18 May 2012 17:55:02 GMT
Ok so to add a bit to this:

I tried to override the TerraPromptSkin (TerraExtendedPromptSkin.java) class
so I could have some control on the buttonPressed event.
Here is an extract of the mock class:

	private ButtonPressListener optionButtonPressListener = new
ButtonPressListener() {
		public void buttonPressed(Button button) {
			int optionIndex = optionButtonBoxPane.indexOf(button);
			if (optionIndex >= 0) {
				//Prompt prompt = (Prompt)getComponent();

	public void install(Component component) {
		ExtendedPrompt prompt = (ExtendedPrompt) component;
		// We backup the options
		ArrayList options = new ArrayList(prompt.getOptions());
		// We reset the options so the subclass doesn't create the buttons that we
want to override
		prompt.getOptions().remove(0, options.getLength());
		BXMLSerializer bxmlSerializer = new BXMLSerializer();
		try {
		} catch(Exception exception) {
			throw new RuntimeException(exception);
		optionButtonBoxPane = (BoxPane)
		// We set the options back and create buttons with our custom listeners
		for (Object option : options) {
			PushButton optionButton = new PushButton(option);
			optionButton.setStyleName(TerraPromptSkin.class.getPackage().getName() +
			for (ButtonPressListener listener :
optionButton.getButtonPressListeners()) {

When putting a breakpoint in both the listener (at int optionIndex =
optionButtonBoxPane.indexOf(button);) and the install function (at
ExtendedPrompt prompt = (ExtendedPrompt) component;). The code definitely
goes through my install function. However, if I click on the prompt button,
it doesn't stop at my listener breakpoint and the prompt just closes.

Any ideas on what I'm doing wrong here would be much appreciated.


View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Prompt-override-option-click-event-tp3999325p4001268.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

View raw message