MenuBar working well in hosted page but not in the others

17 views
Skip to first unread message

Marko

unread,
Aug 16, 2011, 7:29:53 AM8/16/11
to Google Web Toolkit
Hi everyone.

I have my algorithm for menu after requesting their information in
database and it works well in hosted page.

But in the others my first items of a menu is not clickable :( and
even doesnt appear to be selected.

Can anyone help me on this. May be basic but i cant understand this.

Thankfully,
Mark

BST

unread,
Aug 16, 2011, 7:54:28 AM8/16/11
to google-we...@googlegroups.com
Could you elaborate, maybe provide code snippet ?

Marko Borges

unread,
Aug 16, 2011, 8:55:52 AM8/16/11
to google-we...@googlegroups.com
what i do is create my menu and in items and menu without items I add Command to go to a certain page.

this happens ok with the hosted page. but in another page the first item of each menu doesnt let execute Command and neither let select that item when mouse is over.

Here is the code:

<code>
for (int i = 0; i < result.size(); i++) {
final PageDTO page = result.get(i);
if (page.getParentid() == 1) {
mb.add(page);
}
}
boolean[] bools = new boolean[mb.size()];

MenuBar menu = new MenuBar();
menu.setAutoOpen(true);
menu.setHeight("25px");
menu.setAnimationEnabled(true);

for (int i = 0; i < result.size(); i++) {
final PageDTO page = result.get(i);
if (page.getParentid() != 1) {
for (int j = 0; j < mb.size(); j++) {
PageDTO parent = mb.get(j);
if (page.getParentid() == parent.getPageid()) {
bools[j] = true;
if (last == parent.getPageid()) {
lastName = parent.getPagename();
items.add(page.getPagename());
}
if (last == 0) {
items.add(page.getPagename());
last = parent.getPageid();
lastName = parent.getPagename();
}
if (i == result.size() - 1
|| last != parent.getPageid()) {
MenuBar menuButton = new MenuBar(true);
menuButton.addStyleName("demo-MenuItem");
menu.addSeparator();
MenuItem mi = new MenuItem(lastName,
menuButton);
mi.setHeight("20px");
menu.addItem(mi);
for (int x = 0; x < items.size(); x++) {
MenuItem mi2 = new MenuItem(items
.get(x), new Command() {

@Override
public void execute() {
ActivityDTO act = page
.getActivity();
boolean found = false;
if (act != null) {
Iterator itr = act
.getActivityPaths()
.iterator();
while (!found) {
ActivityPathDTO ap = (ActivityPathDTO) itr
.next();
found = true;
+ ap.getFolder()
+ ".htm");
}
}
}

});
menuButton.addItem(mi2);
}

items = new ArrayList<String>();
last = parent.getPageid();
lastName = parent.getPagename();
items.add(page.getPagename());

// break;
}
} else {
if (page.getParentid() > mb.get(j).getPageid()
&& !bools[j]) {
final PageDTO actual = mb.get(j);
bools[j] = true;
MenuItem mib = new MenuItem(mb.get(j)
.getPagename(), new Command() {

@Override
public void execute() {
ActivityDTO act = actual
.getActivity();
boolean found = false;
if (act != null) {
Iterator itr = act
.getActivityPaths()
.iterator();
while (!found) {
ActivityPathDTO ap = (ActivityPathDTO) itr
.next();
found = true;
+ ap.getFolder()
+ ".htm");
}
}
}

});
menu.addItem(mib);
}
}
}
}
}
RootPanel.get("navmenu").add(menu, 50, 50);
</code>

2011/8/16 BST <babus...@gmail.com>
Could you elaborate, maybe provide code snippet ?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Y_bxITPaS0cJ.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Marko Borges

unread,
Aug 16, 2011, 10:01:54 AM8/16/11
to google-we...@googlegroups.com

I tried this example and it happens the same =(
Is it a bug of gwt or something its missing on my project?

the first item of each menu cant be selected :( whyyyyyyyyyy?

2011/8/16 Marko Borges <markob...@gmail.com>

BST

unread,
Aug 17, 2011, 6:38:00 AM8/17/11
to google-we...@googlegroups.com
I just tried the example that you posted. It works for me. I am getting an alert whenever I select Bold or A or B. Are you expecting something else?

Marko Borges

unread,
Aug 17, 2011, 10:24:13 AM8/17/11
to google-we...@googlegroups.com
Sorry! I forgot to tell. I have it working now! Thanks for trying to help. 

Is there an easy way to insert blank space in Menu before inserting MenuItems?
If there is a way without having to edit css would be perfect. I tried to insert in an HorizontalPanel but my menu stays badly formatted inside of it :(

2011/8/17 BST <babus...@gmail.com>
I just tried the example that you posted. It works for me. I am getting an alert whenever I select Bold or A or B. Are you expecting something else?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
Reply all
Reply to author
Forward
0 new messages