Thursday, April 26, 2012

Re: Disable TreeItem selection in Tree

Syed:

Not sure if you ever got around to it. A few strategies can be used
here. I wasn't able to find something out of the box to do it.
However, a few approaches can be used in this case. I took what I
thought would be the easiest/fastest to illustrate how to accomplish
it.

Essentially, I am wrapping the TreeItem's with a FlowPanel and playing
with the CSS properties a bit. You can add the logic that you need and
use something similar for only the nodes you want.

Tree tree = new Tree();
String items[] = {"Uno", "Dos", "Tres"};

for (String item : items) {
TreeItem topitem = tree.addItem(item);
InlineLabel label = new InlineLabel("Hoja - " + item);
label.getElement().getStyle().setOpacity(0.5);

FlowPanel layer = new FlowPanel();
layer.getElement().getStyle().setCursor(Cursor.AUTO);
layer.add(label);
topitem.addItem(layer);
}

Best regards,

Alfredo

On Mon, Apr 23, 2012 at 11:50 AM, Syed Fazal Ahmad <syedfahmad@gmail.com> wrote:
> Hi There:
>
> I have created a Tree and have added the TreeItems to it. I would like
> to disable selection of certain nodes depending on my business rules.
> However, I have not been able disable selection of a given node. If I
> could even gray-out the node it would be helpful. I will appreciate if
> someone could provide insight on how to achieve the above.
>
> Thanks for your help
> Syed
>
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>



--
Alfredo Quiroga-Villamil

AOL/Yahoo/Gmail/MSN IM:  lawwton

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment