ui.welcome.WelcomeView.java Source code

Java tutorial

Introduction

Here is the source code for ui.welcome.WelcomeView.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.welcome;

import ui.helper.DataLayout;
import ui.data.PersonalDataLayout;
import com.vaadin.server.ThemeResource;
import com.vaadin.ui.AbsoluteLayout;
import com.vaadin.ui.Image;
import java.util.Calendar;

/**
 *
 * @author lifetime
 */
public class WelcomeView extends AbsoluteLayout {
    private final String language;
    private final WelcomeBackground background;
    private final WelcomeDesk desk;
    private final WelcomeActions actions;

    public WelcomeView(String language) {
        setSizeFull();
        this.language = language;
        background = new WelcomeBackground(language, getWelcomeImage(language), getWelcomeDataLayout(language));
        desk = new WelcomeDesk(language);
        actions = new WelcomeActions(language, desk);
        addComponents(background, desk, actions);
    }

    private static Image getWelcomeImage(String language) {
        return new Image("", new ThemeResource("../img/background.jpg"));
    }

    private static DataLayout getWelcomeDataLayout(String language) {
        Calendar cal = Calendar.getInstance();
        cal.set(2015, 6, 26);
        return new PersonalDataLayout(language, "vitae", "vitaelifetime@gmail.com", cal.getTime());
    }

    public String getLanguage() {
        return language;
    }

    public WelcomeBackground getBackground() {
        return background;
    }

    public WelcomeDesk getDesk() {
        return desk;
    }

    public WelcomeActions getActions() {
        return actions;
    }

}