Integrating CKEditor with SmartGWT - ckeditor

I tried to integrate CKEditor in a SmartGWT application using the gwt-ckeditor module. But I get an error when I try to display the application, in dev-mode:
[ERROR] [Eureka] - 18:21:15.139:TMR5[E]:WARN:drawing:campaignMessageDesignPage_id:draw() called on widget with current drawn state: handleDrawn, ignoring.
Class.getStackTrace(_1=>undef, _2=>undef, _3=>undef, _4=>undef)
Canvas.readyToDraw()
Canvas.draw(_1=>undef)
Layout.layoutChildren(_1=>"resized", _2=>0, _3=>19)
Canvas.$t1()
Canvas.resizeBy(_1=>0, _2=>19, _3=>undef, _4=>undef)
Canvas.resizeTo(_1=>1365, _2=>586, _3=>undef, _4=>undef)
Layout.resizeMembers(_1=>Array[12], _2=>Array[12], _3=>true)
** recursed on Layout.layoutChildren
com.smartgwt.client.core.JsObject$SGWT_WARN: 10:35:18.045:TMR7[E]:WARN:drawing:campaignMessageDesignPage_id:draw() called on widget with current drawn state: handleDrawn, ignoring.
Class.getStackTrace(_1=>undef, _2=>undef, _3=>undef, _4=>undef) Canvas.readyToDraw() Canvas.draw(_1=>undef) Layout.layoutChildren(_1=>"resized", _2=>0, _3=>19) Canvas.$t1() Canvas.resizeBy(_1=>0, _2=>19, _3=>undef, _4=>undef) Canvas.resizeTo(_1=>1365, _2=>586, _3=>undef, _4=>undef) Layout.resizeMembers(_1=>Array[12], _2=>Array[12], _3=>true) ** recursed on Layout.layoutChildren
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Thread.java:722)
Here a piece of my code:
public class CampaignMessageDesignPage extends Page {
protected VLayout mainLayout;
protected CKEditor ckEditor;
#Override
protected void prepareMainLayoutCanvasCandidate() {
mainLayout = createOrGetVLayoutById(campaignMessageDesignPage_id);
mainLayout.setWidth100();
mainLayout.setHeight100();
mainLayout.setDefaultLayoutAlign(Alignment.CENTER);
Canvas cnvEditor = new Canvas("cnvEditor");
CKConfig conf = new CKConfig(PRESET_TOOLBAR.FULL);
ckEditor = new CKEditor(conf);
conf.setBaseFloatZIndex(1000000);
conf.setUseFormPanel(false);
ckEditor.setHTML("");
ckEditor.setSize("100%", "100%");
cnvEditor.addChild(ckEditor);
cnvEditor.setSize("50%", "50%");
mainLayout.setMembers(cnvEditor);
}
#Override
protected final Canvas getMainLayoutCanvasCandidate() {
return this.mainLayout;
}
#Override
protected void process(final SimpleBO param) {
// TODO Auto-generated method stub
}
}
The draw() method is called elsewhere.
Do you have any idea?
Edit:
I tried some different stuff. I tried to add standard GWT widgets to my SmartGWT layout and it worked fine, so it's really a CKEditor related problem.
I also tried to create the content on page display, and obtained another error message, hopefully more useful:
18:45:06.698 [ERROR] [Eureka] 18:45:06.697:RDQ0[E]:WARN:Log:TypeError: Cannot call method 'replace' of undefined
unnamed() #
unnamed() # unknown source
unnamed() # Eureka/hosted.html?Eureka:76:35
unnamed() # Eureka/hosted.html?Eureka:54:12
onDraw() # unknown source
Canvas.draw() # Eureka/sc/modules/ISC_Core.js:2123:6
Canvas.drawChildren() # Eureka/sc/modules/ISC_Core.js:2177:197
Canvas.draw() # Eureka/sc/modules/ISC_Core.js:2114:247
Layout._drawNonMemberChildren() # Eureka/sc/modules/ISC_Foundation.js:374:21
Layout.drawChildren() # Eureka/sc/modules/ISC_Foundation.js:365:130
Canvas.draw() # Eureka/sc/modules/ISC_Core.js:2114:247
com.smartgwt.client.core.JsObject$SGWT_WARN: 18:45:06.697:RDQ0[E]:WARN:Log:TypeError: Cannot call method 'replace' of undefined
unnamed() #
unnamed() # unknown source
unnamed() # Eureka/hosted.html?Eureka:76:35
unnamed() # Eureka/hosted.html?Eureka:54:12
onDraw() # unknown source
Canvas.draw() # Eureka/sc/modules/ISC_Core.js:2123:6
Canvas.drawChildren() # Eureka/sc/modules/ISC_Core.js:2177:197
Canvas.draw() # Eureka/sc/modules/ISC_Core.js:2114:247
Layout._drawNonMemberChildren() # Eureka/sc/modules/ISC_Foundation.js:374:21
Layout.drawChildren() # Eureka/sc/modules/ISC_Foundation.js:365:130
Canvas.draw() # Eureka/sc/modules/ISC_Core.js:2114:247
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Thread.java:722)

There's a component that does this for you in the SmartGWT-Extensions Google Code project:
http://code.google.com/p/smartgwt-extensions/source/browse/#svn%2Ftrunk%2Fmainprojects%2Fsrc%2Fmain%2Fjava%2Fcom%2Fsmartgwt%2Fextensions%2Fhtmleditor%2Fclient

Related

Why does this function fail at runtime?

I have the following piece of code, why does it fail at runtime?
Code from MainActivity:
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mainuilayout_fragment);
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
home_directory = mPrefs.getString("home_directory", home_directory);
JNIdc.config(home_directory);
This is the error that I get
2020-02-27 13:08:35.997 19527-19527/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.android.emulator, PID: 19527
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data``/app/com.android.emulator-DSqX_PGjDkqsKqoajwOoYw==/base.apk"],nativeLibraryDirectories=[/data/app/com.android.emulator-DSqX_PGjDkqsKqoajwOoYw==/lib/arm64, /system/lib64, /vendor/lib64]]] couldn't find "libdc.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
at java.lang.System.loadLibrary(System.java:1657)
at com.android.emulator.JNIdc.<clinit>(JNIdc.java:6)
at com.android.emulator.JNIdc.config(Native Method)
at com.android.emulator.MainActivity.onCreate(MainActivity.java:67)
at android.app.Activity.performCreate(Activity.java:7028)
at android.app.Activity.performCreate(Activity.java:7019)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2808)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2933)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1627)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:175)
at android.app.ActivityThread.main(ActivityThread.java:6722)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
Why do I get this error?
I believe that libdc.so is missing. It needs to be added first before it recognizes JNIdc.config. I receive an error when I try to solve the line for android.mk before running ndk-build. It says
/home/user/Desktop/project/app/shell/android/jni/Android.mk:21: /home/user/Desktop/project/app/shell/android/jni/../../core/core.mk: No such file or directory
make: *** No rule to make target '/home/user/Desktop/project/app/shell/android/jni/../../core/core.mk'. Stop.

Using a when clause in an enum class getter in Kotlin

I'm trying to get a specific getter of a property in kotlin to be based on the value of the enum it is called from. This is what I got so far:
enum class Endpoint {
EVENTS, GAMES;
val baseUrl = "https://www.example.com/api"
val path: String
get() = when(this){
EVENTS -> "$baseUrl/events"
GAMES -> "$baseUrl/games"
}
}
Called like this:
print(Endpoint.EVENTS.path)
While this compiles without any problem, as soon as I run it I get a NullPointerException with the error Attempt to invoke virtual method 'java.lang.Object [...].Endpoint[].clone()' on a null object reference
I'm not sure what I'm doing wrong or what the proper way to accomplish what is stated above is.
EDIT: Full log of the exception:
05-09 22:51:33.793 15673-15673/com.filippovigani.eventvods E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.filippovigani.eventvods, PID: 15673
java.lang.ExceptionInInitializerError
at com.filippovigani.eventvods.networking.Endpoint.getPath(Endpoint.kt:21)
at com.filippovigani.eventvods.networking.Endpoint.<init>(Endpoint.kt:25)
at com.filippovigani.eventvods.networking.Endpoint.<clinit>(Endpoint.kt)
at com.filippovigani.eventvods.networking.EventvodsApi$Companion.getEvents(EventvodsApi.kt:8)
at com.filippovigani.eventvods.MainActivity.onCreate(MainActivity.kt:19)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object com.filippovigani.eventvods.networking.Endpoint[].clone()' on a null object reference
at com.filippovigani.eventvods.networking.Endpoint.values(Endpoint.kt)
at com.filippovigani.eventvods.networking.Endpoint$WhenMappings.<clinit>(Unknown Source)
at com.filippovigani.eventvods.networking.Endpoint.getPath(Endpoint.kt:21) 
at com.filippovigani.eventvods.networking.Endpoint.<init>(Endpoint.kt:25) 
at com.filippovigani.eventvods.networking.Endpoint.<clinit>(Endpoint.kt) 
at com.filippovigani.eventvods.networking.EventvodsApi$Companion.getEvents(EventvodsApi.kt:8) 
at com.filippovigani.eventvods.MainActivity.onCreate(MainActivity.kt:19) 
at android.app.Activity.performCreate(Activity.java:5990) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
I can't reproduce your error, the code works fine. Nevertheless, I think the solution is a bit too complex, why don't you use a constructor argument to provide the constant-specific value:
enum class Endpoint(service: String) {
EVENTS("/events"), GAMES("/games");
private val baseUrl = "https://www.example.com/api"
val path: String = baseUrl + service
}
The exception indicates you're trying to access path within the constructor of the enum. This causes a problem because the enum is not yet ready for use during construction.
This means the following chain of calls results in failure:
Init Endpoint
Init Endpoint.EVENTS
Call to Endpoint.getPath() (This does not show in your code)
Uses Endpoint$WhenMapping, begin init of that class.
Endpoint$WhenMapping uses EndPoint.values(), but since we're still initializing the instances of the enum, the values array cannot be provided, returning null.
To ensure it is not modified, WhenMapping clones and caches the array, but since the array is null when it never should be outside of initialization this causes the NPE.
Simply put your code somehow relies on a class that requires itself to be fully initialized to use. Since your code does not display how you're calling Endpoint.EVENTS.path this is all that can be said about it.

Predicate projection not working in parquet

First of all I am new to this forum and I am a novice in parquet and trying to understand the nitty gritty of it. Have written a java Map Reduce code to validate the predicate & column projection. Here is the challenge that I face which I need help from you experts.
Predicate Projection code:
public static class PushDown implements UnboundRecordFilter {
private final UnboundRecordFilter filter;
public PushDown()
{
filter = ColumnRecordFilter.column("Age",ColumnPredicates.equalTo(35));
}
#Override
public RecordFilter bind(Iterable<ColumnReader> readers) {
return filter.bind(readers);
}
}
Invoking the predicate projection:
AvroParquetInputFormat.setUnboundRecordFilter(job, PushDown.class);
Got Below Error:
Error: parquet.io.ParquetDecodingException: Can not read value at 1 in block 0 in file hdfs://quickstart.cloudera:8020/parq/customer/wocomp/part-m-00000.parquet
at parquet.hadoop.InternalParquetRecordReader.nextKeyValue(InternalParquetRecordReader.java:241)
at parquet.hadoop.ParquetRecordReader.nextKeyValue(ParquetRecordReader.java:227)
at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:556)
at org.apache.hadoop.mapreduce.task.MapContextImpl.nextKeyValue(MapContextImpl.java:80)
at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.nextKeyValue(WrappedMapper.java:91)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1671)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.UnsupportedOperationException
at parquet.column.impl.ColumnReaderImpl$Binding.getBinary(ColumnReaderImpl.java:118)
at parquet.column.impl.ColumnReaderImpl.getBinary(ColumnReaderImpl.java:417)
at parquet.filter.ColumnPredicates$1.apply(ColumnPredicates.java:67)
at parquet.filter.ColumnRecordFilter.isMatch(ColumnRecordFilter.java:72)
at parquet.io.FilteredRecordReader.skipToMatch(FilteredRecordReader.java:80)
at parquet.io.FilteredRecordReader.read(FilteredRecordReader.java:60)
at parquet.hadoop.InternalParquetRecordReader.nextKeyValue(InternalParquetRecordReader.java:216)
... 12 more
Additional Info:
I am able to validate the Column Projection using below code and I could see Results like this. which was like this without column projection
Schema projection = Schema.createRecord("AvgAge", "", "", false);
List<Schema.Field> fields = new ArrayList<Schema.Field>();
fields.add(new Schema.Field("Age", Schema.create(Schema.Type.LONG), "",""));
projection.setFields(fields);
AvroParquetInputFormat.setRequestedProjection(job, projection);
Questions:
Q1. In above code, what needs to be corrected for filter push down to work?
Q2. I don't see much info in logs to validate projection. Could you help how we should be validating the filter/column projection?
Appreciate your time looking this and trying to help out. Thank you.

make tianium module replace R.layout. or R.id in java class

what should I use to replace the R.layout.flash_activity in titanium when building titanium module with ant.
the issue I occured:
error:
jason#jason-Inspiron-3542:/workspace/wechat_login/android$ ant
Buildfile: /workspace/wechat_login/android/build.xml
python.set.exec:
python.check:
[echo] Testing for Python
[exec] Python 2.7.6
init:
process.annotations:
[javac] Compiling 1 source file to /workspace/wechat_login/android/build/classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
[javac] warning: The following options were not recognized by any processor: '[kroll.jsonFile, kroll.jsonPackage, kroll.checkTiContext]'
[javac] /workspace/wechat_login/android/src/com/happystock/wxapi/WXEntryActivity.java:18: error: package R does not exist
[javac] setContentView(R.layout.entry);
[javac] ^
[javac] 1 error
[javac] 1 warning
BUILD FAILED
/home/jason/.titanium/mobilesdk/linux/3.5.0.GA/module/android/build.xml:163: Compile failed; see the compiler error output for details.
code:
public class WXEntryActivity extends Activity implements IWXAPIEventHandler{
private IWXAPI api;
private static final String APP_ID = "wx44e8a5248161f***";
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.entry);
api = WXAPIFactory.createWXAPI(this, APP_ID, false);
api.handleIntent(getIntent(), this);
}
Thanks!
Use
int layoutEntry = TiRHelper.getApplicationResource("layout.entry");
setContentView(layoutEntry);
The other thing to make sure is that your resource is actually in platform/android/res/layout/entry.xml or it may not be packaged properly.
I have found a solution on this page that worked for me. You can read more about it there. But if you feel like cutting corners, the code is:
//declaration
View raingBarWrapper;
int resId_raingBarHolder = -1, resId_ratingBar = -1;
//fetching app package name and resources
String packageName = proxy.getActivity().getPackageName();
Resources resources = proxy.getActivity().getResources();
//fetching resource id
resId_raingBarHolder = resources.getIdentifier("raingbar_layout", "layout", packageName);
resId_ratingBar = resources.getIdentifier("ratingbar_default","id", packageName);
LayoutInflater inflater = LayoutInflater.from(getActivity());
//inflating "raingbar_layout" xml file
raingBarWrapper = inflater.inflate(resId_raingBarHolder, null);
//getting reference to RatingBar component in layout
ratingBar = (RatingBar) raingBarWrapper.findViewById(resId_ratingBar);
setNativeView(raingBarWrapper);
//adding properties to RatingBar component
ratingBar.setNumStars(stars);
ratingBar.setStepSize(stepSize);
ratingBar.setRating(rating);

JavaFX 2 -- Setting the defaultButton property: mutually exclusive?

In Visual Basic 6, if you set the DefaultButton property of a form button control to true, the same property on all the other button controls in the form was set to false, i.e. the property was mutually exclusive (like a radio button).
I am getting behavior on my GUI that seems to indicate that more than one button in JavaFX may have the defaultButton property set to true, and that more than one button will receive VK_Enter button events from the system.
The JavaFX 2.2 documentation for the setDefaultButton() method and defaultButton property does not clarify this issue.
I have one AnchorPanel with a bunch of controls and another with a separate bunch of controls. These are shown on the same stage, and which one is setVisible(true) to the user depends on what information he's working with.
I'm wondering if I need to iterate through the button controls on my active panes and set the defaultButton property to false for all of them before I try to set one to true in order to avoid odd behavior resulting from more than one button receiving Enter Key events.
EDIT 05/05/2013 -- Here is the ChangeListener code I have. I had originally written it as an anonymous inner class that I was attaching directly to the focusedProperty of the TextField control txtDx. However, I thought that maybe I could fix my error by removing the Listener during those times when I didn't want it firing (i.e., when its pane was invisitble or disabled). So I moved the Listener to an inner class and have an instance of it referenced to by an instance variable. Having the reference allows me to add and remove the Listener depending on which pane is displayed.
Anyway, here is the Listener class:
private class FocusPropertyChangeListener implements ChangeListener<Boolean> {
FocusPropertyChangeListener() { System.out.println("New FPCL instance"); }
#Override
public void changed(ObservableValue<? extends Boolean> ov,
Boolean oldb, Boolean newb) {
System.out.println("Focus change triggered");
if (ancEncEditor.isVisible() && !ancEncEditor.isDisabled()) {
boolean b = (newb != null && newb.booleanValue() == true);
System.out.println("txtDx focus change event triggered: DxAdd = " + b);
btnWindowCommit.setDefaultButton(!b);
btnWindowClose.setCancelButton(true);
btnDxAdd.setDefaultButton(b);
}
}
}
As you can see, in the event handler I make two (presumably concurrent) calls to setDefaultButton. The intent is to use btnDxAdd if I am editing in txtDx, otherwise use btnWindowCommit. I'll try getting rid of the presumably unneeded calls to setDefaultButton and see if I still get ConcurrentModificationExceptions.
EDIT 05/05/2013 -- Adding the stack trace. Here goes...
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:894)
at java.util.HashMap$EntryIterator.next(HashMap.java:934)
at java.util.HashMap$EntryIterator.next(HashMap.java:932)
at com.sun.javafx.collections.ObservableMapWrapper$ObservableEntrySet$1.next(ObservableMapWrapper.java:560)
at com.sun.javafx.collections.ObservableMapWrapper$ObservableEntrySet$1.next(ObservableMapWrapper.java:548)
at com.sun.javafx.scene.KeyboardShortcutsHandler.processAccelerators(KeyboardShortcutsHandler.java:286)
at com.sun.javafx.scene.KeyboardShortcutsHandler.dispatchBubblingEvent(KeyboardShortcutsHandler.java:119)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
at javafx.event.Event.fireEvent(Event.java:171)
at javafx.scene.Scene$KeyHandler.process(Scene.java:3513)
at javafx.scene.Scene$KeyHandler.access$2300(Scene.java:3472)
at javafx.scene.Scene.impl_processKeyEvent(Scene.java:1904)
at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2270)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:136)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:100)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:163)
at com.sun.glass.ui.View.handleKeyEvent(View.java:518)
at com.sun.glass.ui.View.notifyKey(View.java:951)
at com.sun.glass.ui.win.WinApplication._enterNestedEventLoop(Native Method)
at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:383)
at com.sun.glass.ui.EventLoop.enter(EventLoop.java:83)
at com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:520)
at javafx.stage.Stage.showAndWait(Stage.java:397)
at org.kls.md.censusassistant.DialogController.showAndWait(DialogController.java:94)
at org.kls.md.censusassistant.DCMainEditor.handleEncDetails(DCMainEditor.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:279)
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1435)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
at javafx.event.Event.fireEvent(Event.java:171)
at javafx.scene.Node.fireEvent(Node.java:6863)
at javafx.scene.control.Button.fire(Button.java:179)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:193)
at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:336)
at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:329)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
at javafx.event.Event.fireEvent(Event.java:171)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3328)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3168)
at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3123)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1563)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2265)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:250)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:173)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:292)
at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
at com.sun.glass.ui.View.notifyMouse(View.java:922)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
at java.lang.Thread.run(Thread.java:722)
EDIT 05/05/2013 -- I altered my code so that I would no longer be clearing former settings of defaultButton, i.e. just one call to setDefaultButton(true). The idea was that since the backing code performs this operation using a Runnable, -perhaps- this was the cause of the ConcurrentModificationExceptions I was getting.
So, now it does appear that in fact I am no longer able to trigger ConcurrentModificationExceptions in my code when I attempt to change between btnDxAdd and btnWindowCommit as the default button.
However ...
I am also no longer able to get the behavior I want. When I am editing in the txtDx control now, I can press the Enter key all day and the button will not fire. I have confirmed that my focusProperty ChangeListener fired and that a single call to txtDx.setDefaultButton(true) was made. Regardless, I am not able to get the behavior I want.
Bug about javadoc clarification : javafx-jira.kenai.com/browse/RT-30200
Bug about implementation : https://javafx-jira.kenai.com/browse/RT-30206
I watched code from skin class, which is observable from OpenJFX:
What is happening, when you setDefault(true/false):
Runnable defaultButtonRunnable = new Runnable() {
public void run() {
if (!getSkinnable().isDisabled()) {
getSkinnable().fire();
}
}
};
private void setDefaultButton(boolean value) {
KeyCode acceleratorCode = KeyCode.ENTER;
defaultAcceleratorKeyCodeCombination =
new KeyCodeCombination(acceleratorCode);
if (! value) {
/*
** first check of there's a default button already
*/
Runnable oldDefault = getSkinnable().getParent().getScene().getAccelerators().get(defaultAcceleratorKeyCodeCombination);
if (!defaultButtonRunnable.equals(oldDefault)) {
/*
** is it us?
*/
getSkinnable().getParent().getScene().getAccelerators().remove(defaultAcceleratorKeyCodeCombination);
}
}
getSkinnable().getParent().getScene().getAccelerators().put(defaultAcceleratorKeyCodeCombination, defaultButtonRunnable);
}
How it works : when you set new button as default, it finds the existing default button, and removes acelerator on ENTER key press from acelerators list stored at scene. And adds itself as a default button. So you don't need to setDefault on other buttons.

Resources