teichmann@5835: package org.dive4elements.river.client.client.ui; felix@5486: felix@5486: import com.google.gwt.core.client.GWT; felix@5486: felix@5486: import com.smartgwt.client.types.Alignment; felix@5486: import com.smartgwt.client.types.VerticalAlignment; felix@5486: import com.smartgwt.client.widgets.Img; felix@5486: import com.smartgwt.client.widgets.layout.HLayout; felix@5486: import com.smartgwt.client.widgets.layout.Layout; felix@5486: import com.smartgwt.client.widgets.layout.VLayout; felix@5486: teichmann@5835: import org.dive4elements.river.client.client.FLYSConstants; felix@5486: felix@5486: /** Basic static functionality to show spinning wheel. */ felix@5486: public class ScreenLock { felix@5486: felix@5486: /** The message class that provides i18n strings. */ felix@5486: protected static FLYSConstants messages = GWT.create(FLYSConstants.class); felix@5486: felix@5486: /** Disables input, grey out, show spinning wheel of joy. */ felix@5486: public static VLayout lockUI(Layout layout, VLayout lockScreen) { felix@5486: if (lockScreen == null) { felix@5486: lockScreen = new VLayout(); felix@5486: lockScreen.setWidth100(); felix@5486: lockScreen.setHeight100(); felix@5486: lockScreen.setBackgroundColor("#7f7f7f"); felix@5486: lockScreen.setOpacity(50); felix@5486: lockScreen.setAlign(VerticalAlignment.CENTER); felix@5486: lockScreen.setDefaultLayoutAlign(VerticalAlignment.CENTER); felix@5486: felix@5486: HLayout inner = new HLayout(); felix@5486: inner.setAlign(Alignment.CENTER); felix@5486: inner.setDefaultLayoutAlign(Alignment.CENTER); felix@5486: inner.setOpacity(100); felix@5486: felix@5486: Img img = new Img( felix@5486: GWT.getHostPageBaseURL() + messages.loadingImg(), felix@5486: 25, 25); felix@5486: felix@5486: inner.addMember(img); felix@5486: felix@5486: lockScreen.addMember(inner); felix@5486: } felix@5486: felix@5486: layout.addChild(lockScreen); felix@5486: return lockScreen; felix@5486: } felix@5486: felix@5486: /** Enable input, remove grey, remove spinning wheel of joy. */ felix@5486: public static void unlockUI(Layout layout, VLayout lockScreen) { felix@5486: layout.removeChild(lockScreen); felix@5486: } felix@5486: } felix@5486: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : felix@5486: