Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    HTMLPane click link event

    I am loading an HTMLPane, textbox and button in a portlet to make a mini browser. I would like the text box to update with the current url of the data in the HTMLPane (i.e. user clicks a link in the HTMLPane and navigates to a different url, that new url should show up in the textbox), but I can't find any event to attach to. Is there a way to do this? I tried using ContentLoadedHandler but that doesn't work since I'm loading it as ContentType.Page.

    To create the internals of the portlet I'm using the code below:

    Code:
    browserLayout = new VLayout();
    browserLayout.setWidth100();
    browserLayout.setHeight100();
    browserLayout.setOverflow(Overflow.HIDDEN);
    		
    DynamicForm df = new DynamicForm();
    df.setWidth100();
    df.setHeight100();
    df.setNumCols(1);
    final TextItem ti = new TextItem();
    ti.setShowTitle(false);
    ti.setWidth("*");
    ti.setHeight("*");
    		
    df.setFields(ti);
    		
    ImgButton gotoUrlBtn = new ImgButton();
    gotoUrlBtn.setSrc("RightArrow.png");
    gotoUrlBtn.setHeight(24);
    gotoUrlBtn.setWidth(24);
    gotoUrlBtn.addClickHandler(new ClickHandler(){
    
    	@Override
    	public void onClick(ClickEvent event) {
    		NavigateToUrl(ti.getValueAsString());
    	}});
    		
    HLayout hLayout = new HLayout();
    hLayout.setWidth100();
    hLayout.addMember(df);
    hLayout.addMember(gotoUrlBtn);
    		
    urlWindow = new HTMLPane();
    urlWindow.setContentsType(ContentsType.PAGE);
    //urlWindow.setRedrawOnResize(false);
    urlWindow.setWidth100();
    urlWindow.setHeight100();
    urlWindow.setOverflow(Overflow.AUTO);
    urlWindow.setScrollbarSize(0);
    /*urlWindow.addContentLoadedHandler(new ContentLoadedHandler() {
    @Override
    public void onContentLoaded(ContentLoadedEvent event) {
    	String url = urlWindow.getContentsURL();
    	ti.setValue(url);
    }});*/
    		
    browserLayout.addMember(hLayout);
    browserLayout.addMember(urlWindow);
    Thanks,
    Chris

    SmartGWTEE
    GWT 2.4
Working...
X