view gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/MyLoadHandler.java @ 9698:812a6a3eaaf5

another try
author dnt_bjoernsen <d.tironi@bjoernsen.de>
date Wed, 20 Jan 2021 17:19:59 +0100
parents
children 94362af5928e
line wrap: on
line source
package org.dive4elements.river.client.client.ui.map;

import com.google.gwt.event.dom.client.LoadEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.Image;
import com.smartgwt.client.widgets.layout.HLayout;

public class MyLoadHandler implements com.google.gwt.event.dom.client.LoadHandler {

	private Image m_image;
	HLayout m_row;

	public void setHandelReg(HandlerRegistration m_handelReg) {
		this.m_handelReg = m_handelReg;
	}

	private HandlerRegistration m_handelReg;

	public MyLoadHandler(HLayout row, Image image) {
		m_image = image;
		m_row = row;
	}

	@Override
	public void onLoad(LoadEvent event) {
	
		setDimensions(m_row, m_image.getHeight(), m_image.getWidth());
		if (m_handelReg != null)
			m_handelReg.removeHandler();
	}
	
	private void setDimensions(HLayout row, int height, int width) {
		final int minHeight = 30;
		row.setHeight(height < minHeight ? minHeight : height);
		row.setWidth(width);
	}

}

http://dive4elements.wald.intevation.org