by Robert » Fri Feb 09, 2007 1:23 am
Hi. Tutorial which you showed works fine but I still have the same problem. When there is following line in my widget :private static final AppConstants CONSTANTS = (AppConstants) GWT.create(AppConstants.class) - it is possible to view current window with designer. It is not possible to browse all other coposite widgets which use widget with this declaration.
Example code:
import java.util.ArrayList;
import java.util.List;
import com.bitcomp.gwt.client.container.NewsItem;
import com.bitcomp.gwt.client.container.PropertiesData;
import com.bitcomp.gwt.client.util.FormatDate;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
public class CalendarPanel extends Composite implements ClickListener{
private static final AppConstants CONSTANTS = (AppConstants) GWT.create(AppConstants.class);
private DesktopCalendarPanel desktopCalendarPanel;
private VerticalPanel verticalPanel;
private CalendarNewsPanel calendarNewsPanel;
private static CalendarPanel singleton;
private static AddCalendarEventsDialog dlgAdd;
private static CalendarEventsDialog dlgUpdate;
private static RemoveEventYesNoDialog dlgRemoveYesNo;
private static InfoDialog dlgNoMessageToDelete;
private static InfoDialog dlgNoMessageToUpdate;
PropertiesData properties;
final Button updateButton;
final Button addButton;
final Button removeButton;
public CalendarPanel(PropertiesData properties) {
super();
singleton = this;
this.properties = properties;
dlgAdd = new AddCalendarEventsDialog(this.properties);
dlgUpdate = new UpdateCalendarEventsDialog(this.properties);
dlgRemoveYesNo = new RemoveEventYesNoDialog(this.properties);
dlgNoMessageToDelete = new InfoDialog("No event selected to delete");
dlgNoMessageToUpdate = new InfoDialog("No event selected to update");
verticalPanel = new VerticalPanel();
final Label calendarLabel = new Label("Calendar");
verticalPanel.add(calendarLabel);
desktopCalendarPanel = new DesktopCalendarPanel(this.properties);
verticalPanel.add(desktopCalendarPanel);
final Label eventsLabel = new Label("Events");
verticalPanel.add(eventsLabel);
verticalPanel.setWidth("100%");
FormatDate fd = new FormatDate();
calendarNewsPanel = new CalendarNewsPanel(fd.getCurrentDateForDatabase("."), properties);
verticalPanel.add(calendarNewsPanel);
verticalPanel.setCellVerticalAlignment(calendarNewsPanel, HasVerticalAlignment.ALIGN_BOTTOM);
calendarNewsPanel.setVisible(true);
HorizontalPanel horizontalButtonsPanel = new HorizontalPanel();
verticalPanel.add(horizontalButtonsPanel);
horizontalButtonsPanel.setSpacing(3);
removeButton = new Button();
horizontalButtonsPanel.add(removeButton);
removeButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
}
});
removeButton.setText("Remove");
removeButton.addClickListener(this);
updateButton = new Button();
updateButton.addClickListener(this);
horizontalButtonsPanel.add(updateButton);
updateButton.setText("Update");
addButton = new Button();
addButton.addClickListener(this);
horizontalButtonsPanel.add(addButton);
addButton.setText("Add");
initWidget(verticalPanel);
}
/**
* Gets the singleton CalendarDesktopPanel instance.
*/
public static CalendarPanel get() {
return singleton;
}
//called with date in dbformat
public void changeDate(String date){
//save current calendar date in properties (dd/mm/yyyy format)
FormatDate fd = new FormatDate();
properties.setCalendarDate(fd.formatForDatabase(date, "."));
properties.setCurrentCalendarId("");
int calendarIndex = verticalPanel.getWidgetIndex(calendarNewsPanel);
calendarNewsPanel.removeFromParent();
calendarNewsPanel = new CalendarNewsPanel(date, properties);
verticalPanel.add(calendarNewsPanel);
verticalPanel.insert(calendarNewsPanel, calendarIndex);
}
/**
* <b>getDate()</b><br>
* Get date in calendar format.<br>
*/
public String getDate(){
return properties.getCalendarDate();
}
public void refreshCalendarNewsPanel(){
FormatDate fd = new FormatDate();
int calendarIndex = verticalPanel.getWidgetIndex(calendarNewsPanel);
calendarNewsPanel.removeFromParent();
calendarNewsPanel = new CalendarNewsPanel(fd.formatForDatabase(properties.getCalendarDate(), "."), properties);
verticalPanel.add(calendarNewsPanel);
verticalPanel.insert(calendarNewsPanel, calendarIndex);
}
public void refreshCalendar(){
desktopCalendarPanel.loadFromDb();
}
public void onClick(Widget sender) {
if (sender == this.addButton) {
NewsItem ni = new NewsItem();
int left = (Window.getClientWidth() - 400) / 2;
int top = (Window.getClientHeight() - 200) / 2;
dlgAdd.setText("Add new event");
dlgAdd.setPopupPosition(left, top);
dlgAdd.setDefaultDate(getDate());
dlgAdd.setDefaultText(ni);
dlgAdd.show();
} else if (sender == this.updateButton){
if (!properties.getCurrentCalendarId().equals("")){
NewsItem ni = new NewsItem();
ni = MainDesktopPanel.get().getMessage();
int left = (Window.getClientWidth() - 400) / 2;
int top = (Window.getClientHeight() - 200) / 2;
dlgUpdate.setText("Update selected event");
dlgUpdate.setPopupPosition(left, top);
dlgUpdate.setDefaultDate(getDate());
dlgUpdate.setDefaultText(ni);
dlgUpdate.show();
}else{
int left = (Window.getClientWidth() - 280) / 2;
int top = (Window.getClientHeight() - 100) / 2;
dlgNoMessageToUpdate.setText("Dialog");
dlgNoMessageToUpdate.setPopupPosition(left, top);
dlgNoMessageToUpdate.show();
}
}else if (sender == this.removeButton){
if (!properties.getCurrentCalendarId().equals("")){
int left = (Window.getClientWidth() - 280) / 2;
int top = (Window.getClientHeight() - 100) / 2;
dlgRemoveYesNo.setText("Dialog");
dlgRemoveYesNo.setPopupPosition(left, top);
dlgRemoveYesNo.show();
}else{
int left = (Window.getClientWidth() - 280) / 2;
int top = (Window.getClientHeight() - 100) / 2;
dlgNoMessageToDelete.setText("Dialog");
dlgNoMessageToDelete.setPopupPosition(left, top);
dlgNoMessageToDelete.show();
}
}
}
}
Eclipse log:
!ENTRY com.swtdesigner 4 4 2007-02-09 11:07:33.925
!MESSAGE Designer internal error [6.1.0.20070201202821]: com.swtdesigner.properties.PropertyException: org.apache.commons.lang.exception.NestableError: Exception during loading of class com.bitcomp.gwt.client.ui.AppConstants
!STACK 0
org.apache.commons.lang.exception.NestableError: com.swtdesigner.properties.PropertyException: org.apache.commons.lang.exception.NestableError: Exception during loading of class com.bitcomp.gwt.client.ui.AppConstants
at com.swtdesigner.model.swing.properties.custom.DesignTimeHelper.execute(DesignTimeHelper.java:56)
at com.swtdesigner.model.JavaInfo.notifyPropertyChanged(JavaInfo.java:5446)
at com.swtdesigner.model.JavaInfo.notifyPropertyChanged(JavaInfo.java:5428)
at com.swtdesigner.gef.common.property.DesignerEditorPropertyComposite.handleRootNodeSelected(DesignerEditorPropertyComposite.java:588)
at com.swtdesigner.gef.common.property.DesignerEditorPropertyComposite.updatePropertyComposite(DesignerEditorPropertyComposite.java:789)
at com.swtdesigner.gef.DesignerEditor.parseCompilationUnit(DesignerEditor.java:1094)
at com.swtdesigner.gef.DesignerEditor.refreshDesignView(DesignerEditor.java:1144)
at com.swtdesigner.gef.DesignerEditor$14.widgetSelected(DesignerEditor.java:891)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: com.swtdesigner.properties.PropertyException: org.apache.commons.lang.exception.NestableError: Exception during loading of class com.bitcomp.gwt.client.ui.AppConstants
at com.swtdesigner.gwt.model.widgets.panel.ThisCompositeInfo.createGUIComponent(ThisCompositeInfo.java:182)
at com.swtdesigner.model.JavaInfo$19.execute(JavaInfo.java:5451)
at com.swtdesigner.model.swing.properties.custom.DesignTimeHelper.execute(DesignTimeHelper.java:54)
... 30 more
Caused by: org.apache.commons.lang.exception.NestableError: Exception during loading of class com.bitcomp.gwt.client.ui.AppConstants
at com.swtdesigner.gwt.loader.GWTClassLoader.findClass(GWTClassLoader.java:118)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at com.bitcomp.gwt.client.ui.CalendarPanel.<clinit>(CalendarPanel.java:25)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at com.swtdesigner.model.swt.widgets.ConstructorSourcePropertiesHelper.createObject(ConstructorSourcePropertiesHelper.java:243)
at com.swtdesigner.gwt.model.widgets.UIObjectInfo.createWidgetInstance(UIObjectInfo.java:240)
at com.swtdesigner.gwt.model.widgets.panel.CompositeInfo.createWidgetInstance(CompositeInfo.java:42)
at com.swtdesigner.gwt.model.widgets.UIObjectInfo.createWidget(UIObjectInfo.java:214)
at com.swtdesigner.gwt.model.widgets.WidgetInfo.createWidget(WidgetInfo.java:164)
at com.swtdesigner.gwt.model.widgets.panel.AbstractContainerInfo.createWidget(AbstractContainerInfo.java:174)
at com.swtdesigner.gwt.model.widgets.panel.AbstractContainerInfo.createChildrenWidgets(AbstractContainerInfo.java:194)
at com.swtdesigner.gwt.model.widgets.panel.AbstractContainerInfo.createWidget(AbstractContainerInfo.java:175)
at com.swtdesigner.gwt.model.widgets.panel.HTMLTableInfo.createWidget(HTMLTableInfo.java:85)
at com.swtdesigner.gwt.model.widgets.panel.FlexTableInfo.createWidget(FlexTableInfo.java:96)
at com.swtdesigner.gwt.model.widgets.panel.AbstractContainerInfo.createChildrenWidgets(AbstractContainerInfo.java:194)
at com.swtdesigner.gwt.model.widgets.panel.AbstractContainerInfo.createWidget(AbstractContainerInfo.java:175)
at com.swtdesigner.gwt.model.widgets.panel.ThisCompositeInfo.createWidget(ThisCompositeInfo.java:187)
at com.swtdesigner.gwt.model.widgets.panel.ThisCompositeInfo.createGUIComponent(ThisCompositeInfo.java:179)
... 32 more
Caused by: java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key __marker_method
at java.util.ResourceBundle.getObject(ResourceBundle.java:326)
at java.util.ResourceBundle.getString(ResourceBundle.java:286)
at com.swtdesigner.gwt.loader.GWTDumps.dumpConstants(GWTDumps.java:74)
at com.swtdesigner.gwt.loader.GWTClassLoader.findClass(GWTClassLoader.java:111)
... 54 more