io.pelle.mango.client.gwt.widgets.Spacer.java Source code

Java tutorial

Introduction

Here is the source code for io.pelle.mango.client.gwt.widgets.Spacer.java

Source

/**
 * Copyright (c) 2013 Christian Pelster.
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Christian Pelster - initial API and implementation
 */
package io.pelle.mango.client.gwt.widgets;

import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Widget;

public class Spacer extends Widget {
    public Spacer(double width) {
        setElement(DOM.createSpan());
        Style style = getElement().getStyle();
        style.setVisibility(Visibility.HIDDEN);
        style.setMarginLeft(width, Unit.EM);
    }
}