pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lello <rborre...@gmail.com>
Subject Re: TableView selectedRowChanged
Date Wed, 01 Dec 2010 08:50:45 GMT

Well...kind of working, I needed to press twice the down key, so I rewrote
the keyPressed as


public class MyRowEditor extends TableViewRowEditor {

	@Override
	public boolean keyPressed(int keyCode, Keyboard.KeyLocation kl) {
		boolean consumed = false;
		System.out.println("key pressed");
		//if (keyCode == Keyboard.KeyCode.KEYPAD_DOWN || keyCode ==
Keyboard.KeyCode.KEYPAD_UP) {
		if (keyCode == Keyboard.KeyCode.DOWN) {
			System.out.println("Down pressed");
			close(true);
			consumed = true;
			int index = getTableView().getSelectedIndex();
			getTableView().setSelectedIndex(index+1);
		} else if (keyCode == Keyboard.KeyCode.UP) {
			System.out.println("UP pressed");
			close(true);
			consumed = true;
			int index = getTableView().getSelectedIndex();
			getTableView().setSelectedIndex(index-1);
		}
		return consumed;
	}
}

I have also overridden the selectedRowChanged() method to check for
isEditing and endEdit(), however, I still get the initial error: 

Duplicate listener org.apache.pivot.wtk.content.TableViewRowEditor$1@10ade7e
added to org.apache.pivot.wtk.Container$ContainerMouseListenerList@956254
java.lang.IllegalArgumentException: Component already has a parent.
        at org.apache.pivot.wtk.TablePane$Row.insert(TablePane.java:199)
        at org.apache.pivot.wtk.TablePane$Row.add(TablePane.java:187)
        at
org.apache.pivot.wtk.content.TableViewRowEditor.open(TableViewRowEditor.java:301)
        at org.apache.pivot.wtk.Window.open(Window.java:585)
        at
org.apache.pivot.wtk.content.TableViewRowEditor.beginEdit(TableViewRowEditor.java:182)


-- 
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/TableView-selectedRowChanged-tp1992938p1997773.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Mime
View raw message