de.decidr.ui.view.Header.java Source code

Java tutorial

Introduction

Here is the source code for de.decidr.ui.view.Header.java

Source

/*
 * The DecidR Development Team licenses this file to you 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 de.decidr.ui.view;

import com.vaadin.terminal.FileResource;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Embedded;

import de.decidr.model.annotations.Reviewed;
import de.decidr.model.annotations.Reviewed.State;
import de.decidr.ui.main.DecidrUI;
import de.decidr.ui.main.UIConventions;

/**
 * The header contains the logo of the tenant which uses the DecidR application.
 * 
 * I don't see why we need an extra horizontalLayout in here at the moment. I'll
 * leave it commented should the need arise ~wf
 * 
 * @author Geoffrey-Alexeij Heinze
 */
@Reviewed(reviewers = { "unknown" }, lastRevision = "0", currentReviewState = State.NeedsReview)
public class Header extends CustomComponent {

    private static final long serialVersionUID = 1L;
    //    private HorizontalLayout horizontalLayout = null;
    private Embedded decidrLogo = null;

    /**
     * Default constructor which calls the init method to initalize the
     * components
     */
    public Header() {
        init();
    }

    /**
     * Returns the embedded component where the logo is stored
     * 
     * @return the decidrLogo
     */
    public Embedded getDecidrLogo() {
        return decidrLogo;
    }

    /**
     * This method initializes the components of the {@link Header} component.
     */
    private void init() {
        //        horizontalLayout = new HorizontalLayout();
        //        this.setCompositionRoot(horizontalLayout);
        //
        //        horizontalLayout.setWidth(800, Sizeable.UNITS_PIXELS);
        //Do not set size to allow container to adjust to height of the logo.

        decidrLogo = new Embedded("", new FileResource(
                UIConventions.getLogoFile(DecidrUI.getCurrent().getCurrentTenantId()), DecidrUI.getCurrent()));
        this.setCompositionRoot(decidrLogo);

        //        horizontalLayout.addComponent(decidrLogo);
    }
}