001/**
002 * Copyright (c) 2011 - 2015, Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg)
003 * All rights reserved. This program and the accompanying materials
004 * are made available under the terms of the Eclipse Public License v1.0
005 * which accompanies this distribution, and is available at
006 * http://www.eclipse.org/legal/epl-v10.html
007 *
008 * Contributors:
009 *         Florian Pirchner - Initial implementation
010 */
011package org.eclipse.osbp.runtime.web.vaadin.components.dialogs;
012
013import com.vaadin.ui.FormLayout;
014import com.vaadin.ui.HorizontalLayout;
015import com.vaadin.ui.VerticalLayout;
016import com.vaadin.ui.Window;
017
018// TODO: Auto-generated Javadoc
019/**
020 * The Class AbstractInputDialog.
021 */
022public abstract class AbstractInputDialog extends AbstractDialog {
023
024    /**
025     * Instantiates a new abstract input dialog.
026     *
027     * @param config
028     *            the config
029     * @param options
030     *            the options
031     */
032    protected AbstractInputDialog(DialogConfig config, Option... options) {
033        super(config, options);
034    }
035
036    /**
037     * Prepare the main layout.
038     */
039    protected void prepareLayout() {
040        window = new Window();
041        window.setModal(true);
042        mainLayout = new VerticalLayout();
043        mainLayout.setSizeFull();
044        mainLayout.setMargin(true);
045        mainLayout.setSpacing(true);
046        window.setContent(mainLayout);
047
048        customArea = new FormLayout();
049        ((FormLayout) customArea).setSpacing(true);
050        customArea.setSizeFull();
051        mainLayout.addComponent(customArea);
052        mainLayout.setExpandRatio(customArea, 1.0f);
053
054        fillForm((FormLayout) customArea);
055
056        optionsArea = new HorizontalLayout();
057        optionsArea.setSpacing(true);
058        mainLayout.addComponent(optionsArea);
059    }
060
061    /**
062     * Fill the form and bind it to a datasource.
063     *
064     * @param customArea
065     *            the custom area
066     */
067    protected abstract void fillForm(FormLayout customArea);
068
069}