How to integrate this calender widget as a Vaadin component?

Dear reader,

I found this create calendar multi view widget http://code.google.com/p/ftr-gwt-library/ & http://www.future-earth.eu/gwt/calendar/MainDemoApp.html and want it integrated in the Vaadin application I’m working on.
Looks like this calendar widget has dependencies to
http://code.google.com/p/gwt-dnd/ and
http://code.google.com/p/cobogw/
So I attached all three jar files to my posting.

I played around several days meanwhile and I’m totally stuck.

This is what I tried:

The MyAppWidgetSet.gwt.xml


<module>
	<!-- Inherit DefaultWidgetSet -->
	<inherits name="com.vaadin.terminal.gwt.DefaultWidgetSet" />
	
	<inherits name="eu.future.earth.gwt.FtrGwtDate" />
	<inherits name='com.google.gwt.user.User'/>
    <inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/>
    <inherits name="org.cobogw.gwt.user.CSS"/>
	<inherits name="com.google.gwt.json.JSON"/>
	<!-- Specify the app entry point class.                   -->
        <stylesheet src='FtrGwtDate.css'/>
		<stylesheet src='FtrGwtDatePicker.css'/>
	<!-- Entry point -->
	<entry-point class="org.myapp.gwt.client.MyAppWidgetSet"/>
</module>

The MyAppWidgetSet.java:


package org.myapp.gwt.client;

public class MyAppWidgetSet extends DefaultWidgetSet
{
	@Override
	public Paintable createWidget(UIDL uidl)
	{
		final Class type = resolveWidgetType(uidl);
		
		if ( VCalendarMultiView.class == type )
		{
			return new VCalendarMultiView(new SampleEventCacheController(), new DefaultStringPanelRenderer());
		}

		return super.createWidget(uidl);
	}

	@Override
	protected Class resolveWidgetType(UIDL uidl)
	{
		final String tag = uidl.getTag();
		if ( "calendermultiview".equals(tag) )
		{
			return VCalendarMultiView.class;
		}
		return super.resolveWidgetType(uidl);
	}
}

The CalendarMultiView.java


package org.myapp.core.front.guielements;

public class CalenderMultiView extends AbstractComponent
{
	public CalenderMultiView()
	{
		super();
	}

	@Override
	public void changeVariables(Object source, Map variables)
	{
		super.changeVariables(source, variables);
	}

	@Override
	public void paintContent(PaintTarget target) throws PaintException
	{
		super.paintContent(target);
	}

	@Override
	public String getTag()
	{
		return "calendermultiview";
	}
}

The VCalendarMultiView.java


package org.myapp.gwt.client.ui;

public class VCalendarMultiView extends MultiView implements Paintable
{
    public static final String CLASSNAME = "v-calendarmultiview";

    protected ApplicationConnection client;

    protected String id;

    protected boolean immediate;

    protected boolean readonly;

    protected boolean enabled;

  
	public VCalendarMultiView(EventController newController, DateRenderer newRenderer)
	{
		super(newController, newRenderer);
                setStyleName(CLASSNAME);
	}

	@Override
	public void updateFromUIDL(UIDL uidl, ApplicationConnection client)
	{
          if (client.updateComponent(this, uidl, true))
          {
              return;
          }

          this.client = client;
          id = uidl.getId();
          immediate = uidl.getBooleanAttribute("immediate");

          readonly = uidl.getBooleanAttribute("readonly");
          enabled = !uidl.getBooleanAttribute("disabled");
	}

	public ApplicationConnection getClient()
	{
		return client;
	}

	public String getId()
	{
		return id;
	}

	public boolean isImmediate()
	{
		return immediate;
	}

	public boolean isReadonly()
	{
		return readonly;
	}

	public boolean isEnabled()
	{
		return enabled;
	}
}

I’m using the com.vaadin.tools.WidgetsetCompiler as following:

  • program arguments: -out WebContent/VAADIN/widgetsets org.myapp.gwt.MusicPortWidgetSet
  • vm arguments: -Xms256M -Xmx512M -Xss8M
  • In the Run Configuration in the Classpath tab, I added /WEB-INF/src as folder (User Entries)

The forth file I attached are some files (such as SampleEventCacheController.java used by MyAppWidgetset for VCalendarMultiView, etc.) of the sample application that the calendar guys provide via SVN.

Now this is the result output when running the widget set compiler:


Compiling module org.myapp.gwt.MyAppWidgetSet
   Refreshing module from source
      Validating newly compiled units
         Removing units with errors
            [ERROR]
 Errors in 'jar:file:/C:/Users/Victor/Documents/EclipseProjects/myapp/WebContent/WEB-INF/lib/ftr-gwt-library-date-1.1.0.jar!/eu/future/earth/gwt/client/date/week/staend/ResizeDragController.java'
               [ERROR]
 Line 75: No source code is available for type java.util.Calendar; did you forget to inherit a required module?
               [ERROR]
 Line 75: No source code is available for type java.util.GregorianCalendar; did you forget to inherit a required module?
            [ERROR]
 Errors in 'jar:file:/C:/Users/Victor/Documents/EclipseProjects/myapp/WebContent/WEB-INF/lib/org.cobogw.gwt-1.2.5.jar!/org/cobogw/gwt/user/client/ui/Button.java'
               [ERROR]
 Line 225: No source code is available for type org.cobogw.gwt.event.client.Event2; did you forget to inherit a required module?
              [ERROR]
 Line 14: No source code is available for type java.util.Calendar; did you forget to inherit a required module?
              
              [....]

              
         Removing invalidated units
            [WARN]
 Compilation unit 'file:/C:/Users/Victor/Documents/EclipseProjects/myapp/WebContent/WEB-INF/src/eu/future/earth/gwt/client/date/DefaultStringEventDataDialog.java' is removed due to invalid reference(s):
               [WARN]
 jar:file:/C:/Users/Victor/Documents/EclipseProjects/myapp/WebContent/WEB-INF/lib/ftr-gwt-library-date-1.1.0.jar!/eu/future/earth/gwt/client/date/DateRenderer.java
               [WARN]
 jar:file:/C:/Users/Victor/Documents/EclipseProjects/myapp/WebContent/WEB-INF/lib/ftr-gwt-library-date-1.1.0.jar!/eu/future/earth/gwt/client/TimeBox.java
            [WARN]
 Compilation unit 'jar:file:/C:/Users/Victor/Documents/EclipseProjects/myapp/WebContent/WEB-INF/lib/ftr-gwt-library-date-1.1.0.jar!/eu/future/earth/gwt/client/date/horizontal/ExtendedHorizontalAbsolutePanel.java' is removed due to invalid reference(s):
               [WARN]
 jar:file:/C:/Users/Victor/Documents/EclipseProjects/myapp/WebContent/WEB-INF/lib/ftr-gwt-library-date-1.1.0.jar!/eu/future/earth/gwt/client/date/horizontal/HorizontalItemRow.java
            [WARN]
 Compilation unit 'jar:file:/C:/Users/Victor/Documents/EclipseProjects/myapp/WebContent/WEB-INF/lib/ftr-gwt-library-date-1.1.0.jar!/eu/future/earth/gwt/client/date/week/whole/WholeDayPanelDropController.java' is removed due to invalid reference(s):
                   [WARN]
 jar:file:/C:/Users/Victor/Documents/EclipseProjects/myapp/WebContent/WEB-INF/lib/ftr-gwt-library-date-1.1.0.jar!/eu/future/earth/gwt/client/date/horizontal/BaseHorizontalRowPanel.java
            
            [....]

         
   [ERROR]
 An internal compiler exception occurred
com.google.gwt.dev.jjs.InternalCompilerException: Failed to get JNode
	at com.google.gwt.dev.jjs.impl.TypeMap.get(TypeMap.java:75)
	at com.google.gwt.dev.jjs.impl.BuildTypeMap$BuildDeclMapVisitor.createField(BuildTypeMap.java:353)
	at com.google.gwt.dev.jjs.impl.BuildTypeMap$BuildDeclMapVisitor.visit(BuildTypeMap.java:283)
	at org.eclipse.jdt.internal.compiler.ast.FieldDeclaration.traverse(FieldDeclaration.java:285)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1232)
	at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:687)
	at com.google.gwt.dev.jjs.impl.BuildTypeMap.createPeersForNonTypeDecls(BuildTypeMap.java:937)
	at com.google.gwt.dev.jjs.impl.BuildTypeMap.exec(BuildTypeMap.java:927)
	at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:278)
	at com.google.gwt.dev.Precompile.precompile(Precompile.java:300)
	at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:180)
	at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:150)
	at com.google.gwt.dev.GWTCompiler$1.run(GWTCompiler.java:119)
	at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
	at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
	at com.google.gwt.dev.GWTCompiler.main(GWTCompiler.java:126)
	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.vaadin.tools.WidgetsetCompiler$1.run(WidgetsetCompiler.java:52)
	at java.lang.Thread.run(Unknown Source)
      [ERROR]
 <no source info>: public abstract class java.util.Calendar
	extends java.lang.Object
	implements : java.io.Serializable, java.lang.Cloneable, Comparable<java.util.Calendar>
/*   fields   */
static final [unresolved]
 boolean $assertionsDisabled
static final [unresolved]
 int ALL_FIELDS
public static final [unresolved]
 int ALL_STYLES
public static final [unresolved]
 int AM
public static final [unresolved]
 int AM_PM
static final [unresolved]
 int AM_PM_MASK
public static final [unresolved]
 int APRIL
public static final [unresolved]
 int AUGUST
private static final [unresolved]
 int COMPUTED
public static final [unresolved]
 int DATE
static final [unresolved]
 int DATE_MASK
public static final int DAY_OF_MONTH
static final [unresolved]
 int DAY_OF_MONTH_MASK
public static final int DAY_OF_WEEK
public static final [unresolved]
 int DAY_OF_WEEK_IN_MONTH
static final [unresolved]
 int DAY_OF_WEEK_IN_MONTH_MASK
static final [unresolved]
 int DAY_OF_WEEK_MASK
public static final int DAY_OF_YEAR
static final [unresolved]
 int DAY_OF_YEAR_MASK
public static final [unresolved]
 int DECEMBER
public static final [unresolved]
 int DST_OFFSET
static final [unresolved]
 int DST_OFFSET_MASK
public static final [unresolved]
 int ERA
static final [unresolved]
 int ERA_MASK
public static final [unresolved]
 int FEBRUARY
public static final [unresolved]
 int FIELD_COUNT
private static final [unresolved]
 java.lang.String[] FIELD_NAME
public static final [unresolved]
 int FRIDAY
public static final [unresolved]
 int HOUR
static final [unresolved]
 int HOUR_MASK
public static final int HOUR_OF_DAY
static final [unresolved]
 int HOUR_OF_DAY_MASK
public static final [unresolved]
 int JANUARY
public static final [unresolved]
 int JULY
public static final [unresolved]
 int JUNE
public static final [unresolved]
 int LONG
public static final [unresolved]
 int MARCH
public static final [unresolved]
 int MAY
public static final int MILLISECOND

[....]


[unresolved]
 private void updateTime() 
[unresolved]
 private void writeObject(java.io.ObjectOutputStream) throws Unresolved type java.io.IOException
/*   members   */
Unresolved type java.util.Calendar$CalendarAccessControlContext



         org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding
      [ERROR]
 at MonthPanel.java(48): private Calendar current = new GregorianCalendar();
         org.eclipse.jdt.internal.compiler.ast.FieldDeclaration

It’s an internal compiler error. I shortened it (see the […]
).

I have to amend that firstly I got an error that the com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImpl class (see gwt-dnd-2.5.6.jar) may not be abstract (although it was semantically correct). But I fixed it and now get what you can see above.
And: I already got it done to integrate the Reservr’s calendar in my widget set. So I assume that the widgetset compiler and the project settings are OK and working.

I know this is a very long posting, but I’m going in circles. I would be very glad if someone could look at this and help me.

Thanks a lot reading!
Victor
11140.jar (219 KB)
11141.jar (115 KB)
11142.jar (146 KB)
11143.jar (40.4 KB)

GWT does not directly support the java.util.Calendar class.

Apparently the date library emulates it somehow (there is a note around the middle of
ftp-gwt-library project page
), but your project/widgetset does not find that emulated implementation. This might require some GWT configuration to tell where to look for the sources for it - I don’t know the library.

Dear Henri,

ah, thanks a lot for your hint!

I should have read their website better… my brain was so skewed. I’m going to try it out and see how far I come!

Thanks a lot again!

Victor

It works!
Ah, very good and very satisfying after this struggle :rolleyes:.

All I had to change was


<module>
	<!-- Inherit DefaultWidgetSet -->
	<inherits name="com.vaadin.terminal.gwt.DefaultWidgetSet" />

	<inherits name="eu.future.earth.gwt.FtrGwtDate" />
	<!-- <inherits name='com.google.gwt.user.User'/> -- removed -->
    <inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/>
    <inherits name="org.cobogw.gwt.event.Event"/>  <!-- added -->
    <inherits name="org.cobogw.gwt.user.User"/> <!-- added -->
    <inherits name="org.cobogw.gwt.user.Button"/> <!-- added -->
    <inherits name="org.cobogw.gwt.user.CSS"/>
	<inherits name="com.google.gwt.json.JSON"/>
	<!-- Specify the app entry point class.                   -->
    <stylesheet src='FtrGwtDate.css'/>
	<stylesheet src='FtrGwtDatePicker.css'/>
	<!-- Entry point -->
	<entry-point class="org.myapp.gwt.client.MyAppWidgetSet"/>
  
</module>
  • In VCalendarMultiView.java use:

    public static final String CLASSNAME = FtrGwtDateCss.DATE_TYPE_PANEL;

instead of


    public static final String CLASSNAME = "v-calendermultiview;

to get started with provided CSS.

Ok, the component is still in dutch language (see attached screenshot), but since this calendar widget has nothing to do with dutch soccer, it’s acceptable (till tomorrow morning :grin:). I’m going to bed now…

Hope this thread helps others integrating a multi view calender widget into their Vaadin-based project.

@Henri: Your help was very appreciated! Thank you!

Kind regards,

Victor
11144.jpg

Hi Victor,

would you mind to provide your solution?
I’m trying to set up the calendar widget but I’m getting strange errors…

So I would appreciate it very much if you share your solution.

Thanks in advance.
Thomas