Okay, I give up!

I've been trying to get this to work but I'm just too much of Newbie-
ness to figure this out!

I'm trying to create a widget that does what the original poster is
trying to do, that is, show the contents of an application log in real-
time.  I've created UiBinder where the .xml looks like this:

<ui:UiBinder ...>
    <ui:style>
    </ui:style>
    <g:ScrollPanel>
        <g:Label ui:field="theLabel" />
    </g:ScrollPanel>
</ui:UiBinder>

and my Java class look like this:

public class LogViewer extends ResizeComposite {
    private static LogViewerUiBinder uiBinder =
GWT.create(LogViewerUiBinder.class);
    interface LogViewerUiBinder extends UiBinder<Widget, LogViewer> {
    }

    @UiField Label theLabel;

    public LogViewer() {
        initWidget(uiBinder.createAndBindUi(this));
    }

    public void append(String text) {
        Element element = theLabel.getElement();
        element.appendChild(new HTML(text).getElement());
    }
}

The two problems I'm having are that the scroll bars never show up and
the widget seems to only take up space that it needs to show text
string being appended.  I suspect part of my problem is that I don't
understand how to get panels to size themselves to fit an area of the
screen.  In my case, I have a DockLayoutPanel with menu bar along the
"west" side and a display area that is supposed to take up the rest of
the display area in the "center" of the panel.  The UiBinder looks
like this:

<ui:UiBinder ...>
    <ui:style>
        .content {
            border-left: 1px solid #999;
            border-right: 1px solid #999;
            border-bottom: 1px solid #999;
        }

    </ui:style>

    <g:DockLayoutPanel unit="EM">
        <g:north size="5">
            <g:Label>Top</g:Label>
        </g:north>
        <g:center size="auto" >
            <g:VerticalPanel ui:field="panelContent"
styleName="{style.content}" spacing="5" width="auto"/>
        </g:center>
        <g:west size="20">
            <pb:MenuBar ui:field="menuBar" />
        </g:west>
    </g:DockLayoutPanel>
</ui:UiBinder>

The logging widget I'm trying to create is put into the
"contentPanel".

What am I doing wrong?  How can I get the scroll bars to appear and
have the ScrollPanel take up the entire area of the contentPanel (or
have the "contentPanel" take up the entire area to the right of the
"west" menubar?

Thanks,
Dave.


On Jul 18, 9:31 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> On 18 juil, 17:27, Stefan Bachert <stefanbach...@yahoo.de> wrote:
>
> > Hi Magnus,
>
> > I never had have this case.
> > I would try two approaches
>
> > a) You can play with nodes. There is a insert after 
> > functionalityhttp://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/g...
>
> D'oh! right, of course! Document.get().createTextNode()
> +Element#appendChild().
> And it should work with Label#getElement if you're afraid of creating
> a new widget yourself from scratch (though really, for such a thing,
> it'd be really easy)

-- 
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-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to