pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edvin Syse ...@syse.no>
Subject RE: Hi
Date Mon, 17 Oct 2011 13:34:04 GMT
Hi,

tableView.removeSelectedIndex() will alter the selection range if your TableView is in multi
select mode.

What you want to do is:

tableView.getTableData().remove(tableView.getSelectedIndex());

(You might also want to check that tableView.getSelectedIndex() is larger than -1 before calling
remove)

-- Edvin

-----Original Message-----
From: V SANTOSH PAVAN RAJU BS [mailto:pavanraju.mca@gmail.com] 
Sent: 17. oktober 2011 08:56
To: dev@pivot.apache.org
Subject: Hi

In my application i need to delete rows which are in TableView. I have created a TableView
and by adding buttonPressListeners i have written in the following way:

deleteButton.getButtonPressListeners().add(new ButtonPressListener() {  @Override public void
buttonPressed(Button button) {  int rowIndex = tableView.getSelectedIndex(); tableView.removeSelectedIndex(rowIndex);
}
});

But it is showing error like:

java.lang.IllegalStateException: Table view is not in multi-select mode.
at org.apache.pivot.wtk.TableView.removeSelectedRange(TableView.java:1647)
at org.apache.pivot.wtk.TableView.removeSelectedIndex(TableView.java:1629)
at
com.sampleapplication_allaccounts.AccountsEditor$5.buttonPressed(AccountsEditor.java:200)
at
org.apache.pivot.wtk.Button$ButtonPressListenerList.buttonPressed(Button.java:194)
at org.apache.pivot.wtk.Button.press(Button.java:412)
at org.apache.pivot.wtk.PushButton.press(PushButton.java:70)
at
org.apache.pivot.wtk.skin.PushButtonSkin.mouseClick(PushButtonSkin.java:77)
at
org.apache.pivot.wtk.skin.terra.TerraPushButtonSkin.mouseClick(TerraPushButtonSkin.java:586)
at
org.apache.pivot.wtk.Component$ComponentMouseButtonListenerList.mouseClick(Component.java:483)
at org.apache.pivot.wtk.Component.mouseClick(Component.java:2777)
at org.apache.pivot.wtk.Container.mouseUp(Container.java:774)
at org.apache.pivot.wtk.Container.mouseUp(Container.java:759)
at org.apache.pivot.wtk.Container.mouseUp(Container.java:759)
at org.apache.pivot.wtk.Container.mouseUp(Container.java:759)
at
org.apache.pivot.wtk.ApplicationContext$DisplayHost.processMouseEvent(ApplicationContext.java:914)
at java.awt.Component.processEvent(Unknown Source) at
org.apache.pivot.wtk.ApplicationContext$DisplayHost.processEvent(ApplicationContext.java:709)
at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown
Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown
Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown
Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown
Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown
Source) at java.awt.EventQueue$1.run(Unknown Source) at java.awt.EventQueue$1.run(Unknown
Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue$2.run(Unknown Source) at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown
Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown
Source) at java.awt.EventDispatchThread.run(Unknown Source)

By observing this i understood that in need to set the selectMode to multi in TableView but
i am supposed to delete rows one by one.

Can you help me in this regard.

--
Thanks & Regards
B.S.V.S.Pavan Raju.
Skype: skype_pavan1
Hyderabad.

Mime
View raw message