org.balisunrise.vaadin.components.Editor.java Source code

Java tutorial

Introduction

Here is the source code for org.balisunrise.vaadin.components.Editor.java

Source

/*
 * Copyright (C) 2016 Glauco Knihs. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Please contact Glauco Knihs, Rua 10 de Junho, N469, Centro, 
 * Guabiruba-SC, CEP 88360-000, BRAZIL, eglauko@hotmail.com, 
 * if you need additional information or have any questions.
 */

package org.balisunrise.vaadin.components;

import com.vaadin.ui.Alignment;
import com.vaadin.ui.VerticalLayout;

/**
 *
 * @author Glauco
 */
public class Editor extends VerticalLayout {

    private Messenger messenger;

    private Panel panel;

    private ActionsLine actionsLine;

    private boolean expandPanel;

    public Editor(Messenger messenger, Panel panel, ActionsLine actionsLine) {
        this.messenger = messenger;
        this.panel = panel;
        this.actionsLine = actionsLine;
        expandPanel = true;
        init();
    }

    private void init() {
        setStyleName("b-editor");
        if (expandPanel) {
            setSizeFull();
        } else {
            setWidth("100%");
            setHeightUndefined();
        }

        addComponent(messenger);
        setComponentAlignment(messenger, Alignment.TOP_LEFT);

        addComponent(panel);
        setComponentAlignment(panel, Alignment.TOP_LEFT);
        if (expandPanel)
            setExpandRatio(panel, .1f);

        addComponent(actionsLine);
        if (expandPanel)
            setComponentAlignment(actionsLine, Alignment.BOTTOM_LEFT);
        else
            setComponentAlignment(actionsLine, Alignment.TOP_LEFT);
    }

    public Messenger getMessenger() {
        return messenger;
    }

    public void setMessenger(Messenger messenger) {
        this.messenger = messenger;
    }

    public Panel getPanel() {
        return panel;
    }

    public void setPanel(Panel panel) {
        this.panel = panel;
    }

    public ActionsLine getActionsLine() {
        return actionsLine;
    }

    public void setActionsLine(ActionsLine actionsLine) {
        this.actionsLine = actionsLine;
    }

    public boolean isExpandPanel() {
        return expandPanel;
    }

    public void setExpandPanel(boolean expandPanel) {
        this.expandPanel = expandPanel;
    }

}