Could not add a converter (in binding)

Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Could not add a converter (in binding)

Postby Sandy » Thu Jun 25, 2009 11:14 pm

Hello,

If I add a converter to a bound field (or table-column), i get:

ASTEditor string replacement problem
ASTEditor (internal class for source/ASTNode's manipulations) found a problem while replacing a substring in the compilation unit source code. This problem can be caused by prior problems in AST manipulations. Please contact support and provide a test case and log file.


Show stack trace.
Hide stack trace.

Stack trace:
com.instantiations.designer.core.utils.exception.DesignerException: 201 (ASTEditor string replacement problem).
at com.instantiations.designer.core.utils.ast.ASTEditor$4.postVisit(ASTEditor.java:666)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
at com.instantiations.designer.core.utils.ast.ASTEditor.replaceSubstring(ASTEditor.java:698)
at com.instantiations.designer.core.utils.ast.ASTEditor.replaceSubstring(ASTEditor.java:633)
at com.instantiations.designer.core.utils.ast.ASTEditor$14.endVisit(ASTEditor.java:2402)
at org.eclipse.jdt.core.dom.QualifiedName.accept0(QualifiedName.java:173)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2525)
at org.eclipse.jdt.core.dom.SimpleType.accept0(SimpleType.java:137)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2548)
at org.eclipse.jdt.core.dom.ParameterizedType.accept0(ParameterizedType.java:175)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2525)
at org.eclipse.jdt.core.dom.VariableDeclarationStatement.accept0(VariableDeclarationStatement.java:272)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2548)
at org.eclipse.jdt.core.dom.Block.accept0(Block.java:136)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2525)
at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:502)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478)
at com.instantiations.designer.core.utils.ast.ASTEditor.resolveImports(ASTEditor.java:2391)
at com.instantiations.designer.core.utils.ast.ASTEditor.addBodyDeclaration(ASTEditor.java:2005)
at com.instantiations.designer.core.utils.ast.ASTEditor.addMethodDeclaration(ASTEditor.java:1724)
at com.instantiations.designer.core.utils.ast.ASTEditor.addMethodDeclaration(ASTEditor.java:1692)
at com.instantiations.designer.swing.databinding.model.DataBindingsRootInfo.commit(DataBindingsRootInfo.java:451)
at com.instantiations.designer.swing.databinding.DatabindingsProvider$5.run(DatabindingsProvider.java:449)
at com.instantiations.designer.core.utils.execution.ExecutionUtils.run(ExecutionUtils.java:229)
at com.instantiations.designer.swing.databinding.DatabindingsProvider.saveEdit(DatabindingsProvider.java:447)
at com.instantiations.designer.swing.databinding.DatabindingsProvider.editBinding(DatabindingsProvider.java:418)
at com.instantiations.designer.core.databinding.ui.property.AbstractBindingProperty.editBinding(AbstractBindingProperty.java:60)
at com.instantiations.designer.core.databinding.ui.property.AbstractBindingProperty.editBinding(AbstractBindingProperty.java:49)
at com.instantiations.designer.swing.databinding.ui.property.JTableSelfObserveProperty.createBinding(JTableSelfObserveProperty.java:33)
at com.instantiations.designer.core.databinding.ui.property.ObservePropertyEditor.openDialog(ObservePropertyEditor.java:84)
at com.instantiations.designer.core.model.property.editor.TextDialogPropertyEditor$1.onClick(TextDialogPropertyEditor.java:25)
at com.instantiations.designer.core.model.property.editor.presentation.ButtonPropertyEditorPresentation$3$1.run(ButtonPropertyEditorPresentation.java:92)
at com.instantiations.designer.core.utils.execution.ExecutionUtils.runLog(ExecutionUtils.java:52)
at com.instantiations.designer.core.model.property.editor.presentation.ButtonPropertyEditorPresentation$3.handleEvent(ButtonPropertyEditorPresentation.java:90)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)

Full context stack trace:
com.instantiations.designer.core.utils.exception.DesignerException: 0 (Wrapper).
at com.instantiations.designer.core.utils.ast.ASTEditor$14.endVisit(ASTEditor.java:2413)
at org.eclipse.jdt.core.dom.QualifiedName.accept0(QualifiedName.java:173)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2525)
at org.eclipse.jdt.core.dom.SimpleType.accept0(SimpleType.java:137)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2548)
at org.eclipse.jdt.core.dom.ParameterizedType.accept0(ParameterizedType.java:175)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2525)
at org.eclipse.jdt.core.dom.VariableDeclarationStatement.accept0(VariableDeclarationStatement.java:272)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2548)
at org.eclipse.jdt.core.dom.Block.accept0(Block.java:136)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2525)
at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:502)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2478)
at com.instantiations.designer.core.utils.ast.ASTEditor.resolveImports(ASTEditor.java:2391)
at com.instantiations.designer.core.utils.ast.ASTEditor.addBodyDeclaration(ASTEditor.java:2005)
at com.instantiations.designer.core.utils.ast.ASTEditor.addMethodDeclaration(ASTEditor.java:1724)
at com.instantiations.designer.core.utils.ast.ASTEditor.addMethodDeclaration(ASTEditor.java:1692)
at com.instantiations.designer.swing.databinding.model.DataBindingsRootInfo.commit(DataBindingsRootInfo.java:451)
at com.instantiations.designer.swing.databinding.DatabindingsProvider$5.run(DatabindingsProvider.java:449)
at com.instantiations.designer.core.utils.execution.ExecutionUtils.run(ExecutionUtils.java:229)
at com.instantiations.designer.swing.databinding.DatabindingsProvider.saveEdit(DatabindingsProvider.java:447)
at com.instantiations.designer.swing.databinding.DatabindingsProvider.editBinding(DatabindingsProvider.java:418)
at com.instantiations.designer.core.databinding.ui.property.AbstractBindingProperty.editBinding(AbstractBindingProperty.java:60)
at com.instantiations.designer.core.databinding.ui.property.AbstractBindingProperty.editBinding(AbstractBindingProperty.java:49)
at com.instantiations.designer.swing.databinding.ui.property.JTableSelfObserveProperty.createBinding(JTableSelfObserveProperty.java:33)
at com.instantiations.designer.core.databinding.ui.property.ObservePropertyEditor.openDialog(ObservePropertyEditor.java:84)
at com.instantiations.designer.core.model.property.editor.TextDialogPropertyEditor$1.onClick(TextDialogPropertyEditor.java:25)
at com.instantiations.designer.core.model.property.editor.presentation.ButtonPropertyEditorPresentation$3$1.run(ButtonPropertyEditorPresentation.java:92)
at com.instantiations.designer.core.utils.execution.ExecutionUtils.runLog(ExecutionUtils.java:52)
at com.instantiations.designer.core.model.property.editor.presentation.ButtonPropertyEditorPresentation$3.handleEvent(ButtonPropertyEditorPresentation.java:90)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
Caused by: com.instantiations.designer.core.utils.exception.DesignerException: 201 (ASTEditor string replacement problem).
at com.instantiations.designer.core.utils.ast.ASTEditor$4.postVisit(ASTEditor.java:666)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
at com.instantiations.designer.core.utils.ast.ASTEditor.replaceSubstring(ASTEditor.java:698)
at com.instantiations.designer.core.utils.ast.ASTEditor.replaceSubstring(ASTEditor.java:633)
at com.instantiations.designer.core.utils.ast.ASTEditor$14.endVisit(ASTEditor.java:2402)
... 58 more



Adding the converter in the source manually will work fine, but parsing isnt possible:

    BeanProperty<JTable, Long> jTableBeanProperty_25 = BeanProperty.create("selectedElement.verkaufsdatum.timeInMillis");
    ELProperty<JTextField, Object> jTextFieldEvalutionProperty_24 = ELProperty.create("${text}");
    AutoBinding<JTable, Long, JTextField, Object> autoBinding_24 = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ, jt_losteileigenschaften_losverkaeufe_allgemein, jTableBeanProperty_25, jtf_verkaeufe_verkaufsdatum, jTextFieldEvalutionProperty_24);
    autoBinding_24.setConverter(nklTimeInMillisToFormatedDateConverter);
    autoBinding_24.bind();

or:
    ELProperty<LosteilPersonZuord, Object> losteilPersonZuordEvalutionProperty_1 = ELProperty.create("${gueltigBis.timeInMillis}");
    jTableBinding_2.addColumnBinding(losteilPersonZuordEvalutionProperty_1).setColumnName("g\u00FCeltig bis").setEditable(false).setConverter(nklTimeInMillisToFormatedDateConverter);



Please, I *am* not allowed to give testcases outside, and they would be TO complicate, too.
Could you help although?

Many thanks,
Sandy
________________________________________________________
Sorry for typos and bad English.
You may correct me if you like to.
Sandy
 
Posts: 12
Joined: Tue May 05, 2009 11:38 pm

Re: Could not add a converter (in binding)

Postby Eric Clayberg » Sat Jun 27, 2009 3:05 pm

Please send us a simple test case that illustrates the problem.

We can't do anything without a test case.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Could not add a converter (in binding)

Postby Sandy » Mon Jun 29, 2009 1:51 am

Okay,

you would like to tell me that adding a converter works all right for the rest of the world :)

A "simple test case" with a big framework on our side is not that simple, and I am not allowed to.

Besides adding the code manually works fine, only the parsing didn't work just as adding in the gui.

Perhaps If I show the converter-code?

    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Date;

    import org.jdesktop.beansbinding.Converter;

    public class XXXConverter extends Converter
    {


    public Object convertForward(Object value)
    {

    Calendar cal = Calendar.getInstance();
    Long val = new Long(value.toString());

    cal.setTimeInMillis(val);
    java.util.Date date = cal.getTime();

    SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy H:mm:ss");
    String formated_date = sdf.format(new Date());


    return formated_date;
    }


    public Object convertReverse(Object value)
    {
    return null;
    }


Perhaps you can help, otherwise I will add the converters after finishing the frame.

Sandy
________________________________________________________
Sorry for typos and bad English.
You may correct me if you like to.
Sandy
 
Posts: 12
Joined: Tue May 05, 2009 11:38 pm

Re: Could not add a converter (in binding)

Postby Eric Clayberg » Tue Jun 30, 2009 6:02 am

Converters are supported. See the docs...

Image

If you create a simple test case (presumably w/o your framework), we will be happy to take a look at it. I'm sure you would be allowed to do that.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Could not add a converter (in binding)

Postby Sandy » Tue Jun 30, 2009 11:17 pm

Hello,

I first *took* the GUI-Element to add the converter.
But after klicking "ok"-Button the first error in the first posting rise up. This was how my trouble starts and what this thread is about.

*After* failing with the desing-GUI I tryed to add the converter manually in the sorce. The result was FINE (program work, converter work), but swithing back do design-tab fails.

Okay, I think this will not lead to an end.

Our converter was small and easy and works fine. The beansbing works fine. SwingBuilder doesn't. A testcase is easy: Build a class of my converter and add it to a bound date-field in "TimeInMillies".

LG,
Sandy
________________________________________________________
Sorry for typos and bad English.
You may correct me if you like to.
Sandy
 
Posts: 12
Joined: Tue May 05, 2009 11:38 pm

Re: Could not add a converter (in binding)

Postby Eric Clayberg » Fri Jul 03, 2009 5:08 am

Sandy wrote:A testcase is easy: Build a class of my converter and add it to a bound date-field in "TimeInMillies".

Good. In that case, it should be easy for you to send us a test case.

We are happy to look at any test case that you provide that exactly reproduces the problem you are having.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Could not add a converter (in binding)

Postby Eric Clayberg » Sat Jul 04, 2009 9:46 am

BTW, we tried your converter in our own test case, and it worked just fine.

This only further illustrates why it is important for you to send a test case that illustrates the problem you are having.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to Swing Designer

Who is online

Users browsing this forum: No registered users and 1 guest