ui.LifetimeBackground.java Source code

Java tutorial

Introduction

Here is the source code for ui.LifetimeBackground.java

Source

/*
 * Copyright 2015 lifetime.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ui;

import ui.helper.DataLayout;
import com.vaadin.server.StreamResource;
import com.vaadin.ui.AbsoluteLayout;
import com.vaadin.ui.Image;

/**
 *
 * @author lifetime
 */
public class LifetimeBackground extends AbsoluteLayout {
    private final Image image;
    private final DataLayout data;

    public LifetimeBackground(String language, Image image, DataLayout data) {
        setSizeFull();
        this.image = image;
        image.setSizeFull();
        this.data = data;
        addComponents(image, data);
        setPosition(data, getDataPosition());
    }

    private ComponentPosition getDataPosition() {
        ComponentPosition pos = new AbsoluteLayout.ComponentPosition();
        pos.setBottom(0f, Unit.PERCENTAGE);
        return pos;
    }

    public void setSource(StreamResource streamResource) {
        image.setSource(streamResource);
    }

}