开发者

How to style an Horizontal Splitter panel in GWT 1.5

I have this requirement to style a right side of a horizontal splitter panel. From what i know, GWT 1.7 has support for the individual panel (left and right) styles, But we are using GWT 1.5 here.

gwt code:

HTML div1 = new HTML("Div 1");
div1.setWidth("200px");
div1.setHeight("200px");
HTML div2 = new HTML("Div 2");
div2.setWidth("400px");
div2.setHeight("500px");

HorizontalSplitPanel horizontalSPanel = new HorizontalSplitPanel();
horizontalSPanel.setLeftWidget(div1);
horizontalSPanel.setR开发者_StackOverflow中文版ightWidget(div2);

RootPanel.get().add(horizontalSPanel);

corresponding output:

<div class="gwt-HorizontalSplitPanel" style="position: relative; height: 100%;">
    <div style="border: medium none ; margin: 0pt; padding: 0pt; position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px;">
        <div style="border: medium none ; margin: 0pt; padding: 0pt; overflow: auto; position: absolute; top: 0px; bottom: 0px; width: 511px;">
            <div class="gwt-HTML" style="width: 200px; height: 200px;">Div 1</div>
        </div>
        <div style="position: absolute; top: 0px; bottom: 0px; left: 511px;">
            <table height="100%" cellspacing="0" cellpadding="0" class="hsplitter">
            <tbody>
                <tr><td valign="middle" align="center">
                    <img border="0" style="background: transparent url(http://localhost:8888/com.xyzpackage.MyEntryPoint/4BF90CCB5E6B04D22EF1776E8EBF09F8.cache.png) no-repeat scroll 0px 0px; width: 7px; height: 7px; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;" src="http://localhost:8888/com.xyzpackage.MyEntryPoint/clear.cache.gif"/>
                </td></tr>
            </tbody>
            </table>
        </div>
        <div style="border: medium none ; margin: 0pt; padding: 0pt; overflow: auto; position: absolute; top: 0px; bottom: 0px; right: 0px; left: 518px;">
            <div class="gwt-HTML" style="width: 400px; height: 500px;">Div 2</div>
        </div>
    </div>
</div>

is there any way in which i can apply a style only to the RHS div ?

basically, I got a requirement which does not permit my application to have a vertical scrollbar in the RHS view.


You can always wrap the Div 2 into another Div and give this one the overflowY:hidden attribute, so you don't need to go through the DOM tree.

Is the same approach used in ScrollPanel only for the opposite reason.


Had to resort to DOM:

                Node node = horizontalSPanel.getElement().getFirstChildElement().getChildNodes().getItem(2);
                // set the overflow y to hidden, this is in point of view of GWT current version
                // does not allow user to set style to right or left containers. 
                DOM.setStyleAttribute((Element) node, "overflowY", "hidden");

This is very lame and uses hard coding

Any one having a better solution ??

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜