topLayout.printTop();
RootPanel.get("Top-Menu").add(topMenu.mainMenu());
RootPanel.get("irisPage").add(agentListPageContent.loadPage());
// top Layout
package com.client;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.Image;
public class topLayout
{
public static void printTop()
{
HTML topContent = new HTML("<table width='1004' border='0'
cellspacing='0' cellpadding='0'>"
+ "<tr>"
+ "<td>"
+ " <table width='1004' border='0' cellspacing='0'
cellpadding='0'>"
+ "<tr style='background-image:url(images/headerbg.gif);
height:
72px;'>"
+ "<td width='29' height='72'></td>"
+ "<td width='634'><img src='images/logo.gif' width='242'
height='72' /></td>"
+ "<td width='336'><img src='images/airtelindia.gif'
width='230'
height='72' /></td>"
+ "</tr>"
+ "<tr>"
+ "<td width='29' height='37' ><img
src='images/menuleftbg.gif'
width='29' height='37' /></td>"
+ "<td><div style='width:759px; background-image:url(images/
menubg.gif); height:37px;'>"
+ "<table width='758' border='0' cellspacing='0'
cellpadding='0' style='font-family:Arial, Helvetica, sans-serif; font-
size:18px; margin-top:8px; color:#FFFFFF;' >"
+ "<tr>"
+ "<td width=\"100%\" class='menu-text' align='center'
id='Top-
Menu'> </td>"
+ "</tr>"
+ "</table>"
+ "</div></td>"
+ "<td><img src='images/menurightbg.gif'
width='230' height='37' /
></td>"
+ "</tr>"
+"</table>"
+"</td>"
+"</tr>"
+"</table>");
RootPanel.get("TopContents").add(topContent);
}
}
//topMenu
package com.client;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.Panel;
public class topMenu extends Composite{
public static Widget mainMenu()
{
Command menuClick = new Command()
{
public void execute()
{
dashBoardPage.dashBoard();
}
};
Command menuClick1 = new Command()
{
public void execute()
{
createUserPage.createUser();
}
};
Command menuClick2 = new Command()
{
public void execute()
{
userListPage.createUser();
}
};
Command menuClick3 = new Command()
{
public void execute()
{
createApplicationPage.createApplication();
}
};
Command menuClick4 = new Command()
{
public void execute()
{
applicationListPage.applicationList();
}
};
Command menuClick5 = new Command()
{
public void execute()
{
createJobPage.createJob();
}
};
Command menuClick6 = new Command()
{
public void execute()
{
jobListPage.jobList();
}
};
Command menuClick7 = new Command()
{
public void execute()
{
createAgentPage.createAgent();
}
};
Command menuClick8 = new Command()
{
public void execute()
{
agentListPage.agentList();
}
};
Command menuClick9 = new Command()
{
public void execute()
{
blackoutPage.blackOut();
}
};
Command menuClick10 = new Command()
{
public void execute()
{
blackListPage.blackList();
}
};
// Top-level menu
MenuBar menuDash = new MenuBar();
//menuDash.addStyleName("demo-MenuItem");
MenuItem menuDashBoard = new MenuItem("Dash-Board",
menuClick);
// Item to fire a command
MenuBar menuUser = new MenuBar();
//menuUser.addStyleName("demo-MenuItem");
// Item to fire a command
MenuItem menuUser1 = new MenuItem("Create User",
menuClick1);
MenuItem menuUser2 = new MenuItem ("List Users",
menuClick2);
MenuBar menuApplication = new MenuBar();
//menuApplication.addStyleName("demo-MenuItem");
// Item to fire a command
MenuItem menuApplication1= new MenuItem("Create
Application",
menuClick3);
MenuItem menuApplication2= new MenuItem("List
Application",
menuClick4);
MenuBar menuJob = new MenuBar();
//menuApplication.addStyleName("demo-MenuItem");
// Item to fire a command
MenuItem menuJob1= new MenuItem("Create Job",
menuClick5);
MenuItem menuJob2= new MenuItem("List Job", menuClick6);
MenuBar menuAgent = new MenuBar();
//menuApplication.addStyleName("demo-MenuItem");
// Item to fire a command
MenuItem menuAgent1= new MenuItem("Create Agent",
menuClick7);
MenuItem menuAgent2= new MenuItem("List Agent",
menuClick8);
MenuBar menuBlackoutwindow = new MenuBar();
//menuApplication.addStyleName("demo-MenuItem");
// Item to fire a command
MenuItem menuBlackoutwindow1= new MenuItem("Blackout
window",
menuClick9);
MenuBar menuBlacklist = new MenuBar();
//menuApplication.addStyleName("demo-MenuItem");
// Item to fire a command
MenuItem menuBlacklist1= new MenuItem("Black List",
menuClick10);
//MenuItem menuBlacklist2= new MenuItem("List Blackout
window",
menuClick);
// Level-two menu - vertical=true
// Assemble the menu system
MenuBar menuMain = new MenuBar();
menuMain.setAutoOpen(true);
menuMain.setAnimationEnabled(true);
menuMain.addItem (menuDashBoard);
menuMain.addItem ("Users",menuUser);
menuUser.addItem (menuUser1);
menuUser.addItem (menuUser2);
menuMain.addItem ("Application",menuApplication);
menuApplication.addItem (menuApplication1);
menuApplication.addItem (menuApplication2);
menuMain.addItem ("Job",menuJob);
menuJob.addItem (menuJob1);
menuJob.addItem (menuJob2);
menuMain.addItem ("Agent",menuAgent);
menuAgent.addItem (menuAgent1);
menuAgent.addItem (menuAgent2);
menuMain.addItem (menuBlackoutwindow1);
menuMain.addItem (menuBlacklist1);
return menuMain;
}
}
/// agentListPage
package com.client;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.Panel;
public class topMenu extends Composite{
public static Widget mainMenu()
{
Command menuClick = new Command()
{
public void execute()
{
dashBoardPage.dashBoard();
}
};
Command menuClick1 = new Command()
{
public void execute()
{
createUserPage.createUser();
}
};
Command menuClick2 = new Command()
{
public void execute()
{
userListPage.createUser();
}
};
Command menuClick3 = new Command()
{
public void execute()
{
createApplicationPage.createApplication();
}
};
Command menuClick4 = new Command()
{
public void execute()
{
applicationListPage.applicationList();
}
};
Command menuClick5 = new Command()
{
public void execute()
{
createJobPage.createJob();
}
};
Command menuClick6 = new Command()
{
public void execute()
{
jobListPage.jobList();
}
};
Command menuClick7 = new Command()
{
public void execute()
{
createAgentPage.createAgent();
}
};
Command menuClick8 = new Command()
{
public void execute()
{
agentListPage.agentList();
}
};
Command menuClick9 = new Command()
{
public void execute()
{
blackoutPage.blackOut();
}
};
Command menuClick10 = new Command()
{
public void execute()
{
blackListPage.blackList();
}
};
// Top-level menu
MenuBar menuDash = new MenuBar();
//menuDash.addStyleName("demo-MenuItem");
MenuItem menuDashBoard = new MenuItem("Dash-Board",
menuClick);
// Item to fire a command
MenuBar menuUser = new MenuBar();
//menuUser.addStyleName("demo-MenuItem");
// Item to fire a command
MenuItem menuUser1 = new MenuItem("Create User",
menuClick1);
MenuItem menuUser2 = new MenuItem ("List Users",
menuClick2);
MenuBar menuApplication = new MenuBar();
//menuApplication.addStyleName("demo-MenuItem");
// Item to fire a command
MenuItem menuApplication1= new MenuItem("Create
Application",
menuClick3);
MenuItem menuApplication2= new MenuItem("List
Application",
menuClick4);
MenuBar menuJob = new MenuBar();
//menuApplication.addStyleName("demo-MenuItem");
// Item to fire a command
MenuItem menuJob1= new MenuItem("Create Job",
menuClick5);
MenuItem menuJob2= new MenuItem("List Job", menuClick6);
MenuBar menuAgent = new MenuBar();
//menuApplication.addStyleName("demo-MenuItem");
// Item to fire a command
MenuItem menuAgent1= new MenuItem("Create Agent",
menuClick7);
MenuItem menuAgent2= new MenuItem("List Agent",
menuClick8);
MenuBar menuBlackoutwindow = new MenuBar();
//menuApplication.addStyleName("demo-MenuItem");
// Item to fire a command
MenuItem menuBlackoutwindow1= new MenuItem("Blackout
window",
menuClick9);
MenuBar menuBlacklist = new MenuBar();
//menuApplication.addStyleName("demo-MenuItem");
// Item to fire a command
MenuItem menuBlacklist1= new MenuItem("Black List",
menuClick10);
//MenuItem menuBlacklist2= new MenuItem("List Blackout
window",
menuClick);
// Level-two menu - vertical=true
// Assemble the menu system
MenuBar menuMain = new MenuBar();
menuMain.setAutoOpen(true);
menuMain.setAnimationEnabled(true);
menuMain.addItem (menuDashBoard);
menuMain.addItem ("Users",menuUser);
menuUser.addItem (menuUser1);
menuUser.addItem (menuUser2);
menuMain.addItem ("Application",menuApplication);
menuApplication.addItem (menuApplication1);
menuApplication.addItem (menuApplication2);
menuMain.addItem ("Job",menuJob);
menuJob.addItem (menuJob1);
menuJob.addItem (menuJob2);
menuMain.addItem ("Agent",menuAgent);
menuAgent.addItem (menuAgent1);
menuAgent.addItem (menuAgent2);
menuMain.addItem (menuBlackoutwindow1);
menuMain.addItem (menuBlacklist1);
return menuMain;
}
}
//agentListWidget
package com.client;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.Image;
public class agentListWidget
{
public static void widgetInterface (){
HTML Test = new HTML ("Event Message Here");
Test.setStyleName("curve-gray");
RootPanel.get("msgDiv").add(Test);
Borders.simpleBorder(Test, 6);
//RootPanel.get("details").add(allList.agentListData());
final Image agentShow = new Image();
//RootPanel.detachNow(agentShow);
agentShow.setUrl("images/show.gif");
agentShow.setStyleName("cursor-hand");
RootPanel.get("img-show-button").add(agentShow);
agentShow.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
Window.alert("Command Fired");
}
});
HTML DeleteBlue = new HTML ("Delete");
//RootPanel.detachNow(agentShow);
DeleteBlue.setStyleName("curve-deepskyblue");
RootPanel.get("btn-delete").add(DeleteBlue);
Borders.simpleBorder(DeleteBlue, 5);
DeleteBlue.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
Window.alert("Command Fired");
}
});
//Borders.glowBorder(Test,5,4,"#CC3399");
//RootPanel.detachNow();
HTML selectAll = new HTML ("Select all");
Image downarrow = new Image();
downarrow.setUrl("images/arrow-down.gif");
downarrow.setStyleName("float-right");
//selectAll.add(downarrow);
selectAll.setStyleName("curve-gray");
RootPanel.get("selectAll").add(selectAll);
//RootPanel.get("selectAll").add(downarrow);
Borders.simpleBorder(selectAll, 5);
selectAll.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
Window.alert("Command Fired");
}
});
HTML agentStatus = new HTML ("Status");
agentStatus.setStyleName("curve-lightredish");
RootPanel.get("agent-status").add(agentStatus);
Borders.simpleBorder(agentStatus, 5);
agentStatus.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
Window.alert("Command Fired");
}
});
HTML agentCircle = new HTML ("Circle");
agentCircle.setStyleName("curve-gray");
RootPanel.get("agent-circle").add(agentCircle);
Borders.simpleBorder(agentCircle, 5);
agentCircle.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
Window.alert("Command Fired");
}
});
HTML agentAgentId = new HTML ("Agent Id");
agentAgentId.setStyleName("curve-gray");
RootPanel.get("agent-agentId").add(agentAgentId);
Borders.simpleBorder(agentAgentId, 5);
agentAgentId.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
Window.alert("Command Fired");
}
});
}
}
problems:
When i load this get the error mentioned.
When i click on menu it changes the contents but not shows any gwt
widgets only html part get displayed...
On Nov 26, 6:01 pm, Brian <[EMAIL PROTECTED]> wrote:
> Yeah we definitely need to see the code -- but as a wild shot in the
> dark -- on your widget are you overriding onAttach() and forgetting to
> call super.onAttach() ?
>
> On Nov 26, 7:44 am, gregor <[EMAIL PROTECTED]> wrote:
>
> > Can you post example code that caused the exception?
>
> > On Nov 26, 6:50 am, Bhupen <[EMAIL PROTECTED]> wrote:
>
> > > hi, I am new to GWT and working on some project... i have added few
> > > widget in my application.... and when i am changing the contents with
> > > menu it's not showing any widget... apart from widget all the things
> > > coming properly and i m getting following error
>
> > > [ERROR] Uncaught exception escaped
> > > java.lang.AssertionError: A widget in the detach list was found not
> > > attached to the document. The is likely caused by wrapping an existing
> > > element and removing it from the document without calling
> > > RootPanel.detachNow().
> > > at com.google.gwt.user.client.ui.RootPanel.detachWidgets
> > > (RootPanel.java:200)
> > > at com.google.gwt.user.client.ui.RootPanel$1.onWindowClosed
> > > (RootPanel.java:221)
> > > at com.google.gwt.user.client.Window.fireClosedImpl(Window.java:
> > > 465)
> > > at com.google.gwt.user.client.Window.fireClosedAndCatch
> > > (Window.java:
> > > 456)
> > > at com.google.gwt.user.client.Window.onClosed(Window.java:430)
> > > 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.google.gwt.dev.shell.MethodAdaptor.invoke
> > > (MethodAdaptor.java:
> > > 103)
> > > at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod
> > > (IDispatchImpl.java:126)
> > > at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke
> > > (IDispatchProxy.java:155)
> > > at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke
> > > (IDispatchImpl.java:294)
> > > at com.google.gwt.dev.shell.ie.IDispatchImpl.method6
> > > (IDispatchImpl.java:194)
> > > at org.eclipse.swt.internal.ole.win32.COMObject.callback6
> > > (COMObject.java:117)
> > > at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native
> > > Method)
> > > at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:
> > > 1925)
> > > at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:
> > > 2966)
> > > at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720)
> > > at com.google.gwt.dev.GWTShell.run(GWTShell.java:593)
> > > at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)
>
> > > And when i pur RootPanel.detachNow(widget)... then nothing is showing
> > > with that panel..
>
> > > and getting the following error
>
> > > [ERROR] Uncaught exception escaped
> > > java.lang.AssertionError: detachNow() called on a widget not currently
> > > in the detach list
> > > at com.google.gwt.user.client.ui.RootPanel.detachNow
> > > (RootPanel.java:
> > > 87)
> > > at com.client.agentListWidget.widgetInterface
> > > (agentListWidget.java:
> > > 15)
> > > at com.client.IRIS$1.onClick(IRIS.java:57)
> > > at
> > > com.google.gwt.user.client.ui.ClickListenerCollection.fireClick
> > > (ClickListenerCollection.java:34)
> > > at com.google.gwt.user.client.ui.Image.onBrowserEvent
> > > (Image.java:484)
> > > at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:
> > > 1308)
> > > at com.google.gwt.user.client.DOM.dispatchEventAndCatch
> > > (DOM.java:
> > > 1287)
> > > at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1255)
> > > 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.google.gwt.dev.shell.MethodAdaptor.invoke
> > > (MethodAdaptor.java:
> > > 103)
> > > at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod
> > > (IDispatchImpl.java:126)
> > > at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke
> > > (IDispatchProxy.java:155)
> > > at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke
> > > (IDispatchImpl.java:294)
> > > at com.google.gwt.dev.shell.ie.IDispatchImpl.method6
> > > (IDispatchImpl.java:194)
> > > at org.eclipse.swt.internal.ole.win32.COMObject.callback6
> > > (COMObject.java:117)
> > > at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native
> > > Method)
> > > at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:
> > > 1925)
> > > at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:
> > > 2966)
> > > at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720)
> > > at com.google.gwt.dev.GWTShell.run(GWTShell.java:593)
> > > at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)
>
> > > Please help me out of this problem...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---