Daren
unread,Jan 7, 2011, 3:08:50 PM1/7/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jmatter
Hello,
I want to write a custom view for one of my record types and return
that view when a certain command is invoked. In preparation for this
development effort, I am trying to return a ListView to display all of
the records.
Here is the source of the command:
@Cmd
public static ListView ValidateRecords(CommandInfo cmdInfo) {
AbstractListEO invalidRecList =
getAllRecords(cmdInfo);
System.out.println("Creating SimpleListEO...");
return new ListView(invalidRecList);
}
The code for getting the records is equally simple:
public static AbstractListEO getAllRecords(CommandInfo cmdInfo) {
HBMPersistenceMechanism persistor =
getPersistor(cmdInfo);
AbstractListEO list = persistor.hql("from " +
Ns_BasicFieldVisit.class.getName() );
return list;
}
I see that some examples (Sympster, session + SessionView) use the
AlternateView mechanism to return a custom view, while others (Self,
space + spaceView) directly return a view in the command. Returning
the view in the command works best for me because I want the record
type to behave normally in all other cases.
Using the direct view return method, when I invoke the command I get
an exception that “Component creation must be done on the event
dispatch thread” (attached).
Any suggestions?
org.jvnet.substance.api.UiThreadingViolationException: Component
creation must be done on Event Dispatch Thread
at
org.jvnet.substance.utils.SubstanceCoreUtilities.testComponentCreatio
nThreadingViolation(SubstanceCoreUtilities.java:2322)
at
org.jvnet.substance.swingx.SubstancePanelUI.createUI(SubstancePanelUI
.java:35)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.Trampoline.invoke(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
at javax.swing.UIDefaults.getUI(Unknown Source)
at javax.swing.UIManager.getUI(Unknown Source)
at javax.swing.JPanel.updateUI(Unknown Source)
at javax.swing.JPanel.<init>(Unknown Source)
at javax.swing.JPanel.<init>(Unknown Source)
at javax.swing.JPanel.<init>(Unknown Source)
at com.u2d.view.swing.list.ListView.<init>(ListView.java:26)
at
org.natureserve.observations.desktop.domain.Ns_BasicFieldVisit.Valida
teRecords(Ns_BasicFieldVisit.java:534)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.u2d.element.TypeCommand.execute(TypeCommand.java:82)
at com.u2d.element.TypeCommand.execute(TypeCommand.java:72)
at
com.u2d.view.swing.CommandAdapter.executeCommand(CommandAdapter.java:
161)
at com.u2d.view.swing.CommandAdapter.access
$200(CommandAdapter.java:21)
at com.u2d.view.swing.CommandAdapter
$2.offEDT(CommandAdapter.java:142)
at com.u2d.view.swing.SwingViewMechanism
$20.run(SwingViewMechanism.java:
1155)
at java.lang.Thread.run(Unknown Source)
UIDefaults.getUI() failed: createUI() failed for
com.u2d.view.swing.list.ListVie
w[,
0,0,0x0,invalid,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,bord
er=,flags=9,maximumSize=,minimumSize=,preferredSize=]
java.lang.reflect.Invocati
onTargetException
java.lang.Error
at javax.swing.UIDefaults.getUIError(Unknown Source)
at javax.swing.MultiUIDefaults.getUIError(Unknown Source)
at javax.swing.UIDefaults.getUI(Unknown Source)
at javax.swing.UIManager.getUI(Unknown Source)
at javax.swing.JPanel.updateUI(Unknown Source)
at javax.swing.JPanel.<init>(Unknown Source)
at javax.swing.JPanel.<init>(Unknown Source)
at javax.swing.JPanel.<init>(Unknown Source)
at com.u2d.view.swing.list.ListView.<init>(ListView.java:26)
at
org.natureserve.observations.desktop.domain.Ns_BasicFieldVisit.Valida
teRecords(Ns_BasicFieldVisit.java:534)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.u2d.element.TypeCommand.execute(TypeCommand.java:82)
at com.u2d.element.TypeCommand.execute(TypeCommand.java:72)
at
com.u2d.view.swing.CommandAdapter.executeCommand(CommandAdapter.java:
161)
at com.u2d.view.swing.CommandAdapter.access
$200(CommandAdapter.java:21)
at com.u2d.view.swing.CommandAdapter
$2.offEDT(CommandAdapter.java:142)
at com.u2d.view.swing.SwingViewMechanism
$20.run(SwingViewMechanism.java:
1155)
at java.lang.Thread.run(Unknown Source)
org.jvnet.substance.api.UiThreadingViolationException: Component
creation must be done on Event Dispatch Thread