Sha256: 684aa08f2446f071f9a93cd600099db7bdcd27bcdc3f56d2724114d9a00a8a8d
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
/** * Sencha GXT 3.1.1 - Sencha for GWT * Copyright(c) 2007-2014, Sencha, Inc. * licensing@sencha.com * * http://www.sencha.com/products/gxt/license/ */ package com.dldinternet.aws.cfn.stacker.desktop.client.layout; import com.google.gwt.dom.client.Element; import com.sencha.gxt.widget.core.client.Window; import java.util.Random; public class CenterDesktopLayout extends LimitedDesktopLayout implements DesktopLayout { private static final int MINIMUM = 50; private static final int VARIANCE = 50; private int left; private int top; private Random random = new Random(); @Override public DesktopLayoutType getDesktopLayoutType() { return DesktopLayoutType.CENTER; } @Override public void layoutDesktop(Window requestWindow, RequestType requestType, Element element, Iterable<Window> windows, int containerWidth, int containerHeight) { if (requestType == RequestType.LAYOUT) { left = MINIMUM; top = MINIMUM; } super.layoutDesktop(requestWindow, requestType, element, windows, containerWidth, containerHeight); } @Override protected void layoutWindow(Window window, int containerWidth, int containerHeight, int width, int height) { int offset = window.getHeader().getOffsetHeight(); if (((left + VARIANCE + width) > containerWidth) || ((top + VARIANCE + height) > containerHeight)) { left = MINIMUM; top = MINIMUM; } left += offset + random.nextInt(VARIANCE); top += offset + random.nextInt(VARIANCE); window.setPixelSize(width, height); window.setPosition(left, top); } }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aws-cfn-stacker-0.0.6 | ui/src/com/dldinternet/aws/cfn/stacker/desktop/client/layout/CenterDesktopLayout.java |