Example usage for com.vaadin.ui Embedded Embedded

List of usage examples for com.vaadin.ui Embedded Embedded

Introduction

In this page you can find the example usage for com.vaadin.ui Embedded Embedded.

Prototype

public Embedded(String caption, Resource source) 

Source Link

Document

Creates a new Embedded object whose contents is loaded from given resource.

Usage

From source file:de.mendelson.comm.as2.webclient2.AboutDialog.java

/**Could be overwritten, contains the content to display*/
@Override//w  w  w  .j  a  v a 2  s.c  om
public AbstractComponent getContentPanel() {
    int maxX = 7;
    Panel panel = new Panel();
    GridLayout gridLayout = new GridLayout(maxX, 17);
    gridLayout.setSizeFull();
    Embedded logComm = new Embedded("", new ThemeResource("images/logocommprotocols.gif"));
    logComm.setType(Embedded.TYPE_IMAGE);
    VerticalLayout gapLayout = new VerticalLayout();
    gapLayout.setMargin(false, true, true, false);
    gapLayout.addComponent(logComm);
    gridLayout.addComponent(gapLayout, 0, 0, 1, 3);
    gridLayout.addComponent(
            new Label("<strong>" + AS2ServerVersion.getFullProductName() + "</strong>", Label.CONTENT_XHTML), 2,
            1, maxX - 1, 1);
    gridLayout.addComponent(new Label(AS2ServerVersion.getLastModificationDate()), 2, 2, maxX - 1, 2);
    gridLayout.addComponent(new Label("<hr/>", Label.CONTENT_XHTML), 0, 4, maxX - 1, 4);
    gridLayout.addComponent(new Label(Copyright.getCopyrightMessage(), Label.CONTENT_XHTML), 0, 5, maxX - 1, 5);
    gridLayout.addComponent(new Label(AS2ServerVersion.getStreet(), Label.CONTENT_XHTML), 0, 6, maxX - 1, 6);
    gridLayout.addComponent(new Label(AS2ServerVersion.getZip(), Label.CONTENT_XHTML), 0, 7, maxX - 1, 7);
    gridLayout.addComponent(new Label(AS2ServerVersion.getTelephone(), Label.CONTENT_XHTML), 0, 8, maxX - 1, 8);
    gridLayout.addComponent(new Label(AS2ServerVersion.getInfoEmail(), Label.CONTENT_XHTML), 0, 9, maxX - 1, 9);
    gridLayout.addComponent(new Label("<hr/>", Label.CONTENT_XHTML), 0, 10, 6, 10);
    gridLayout.addComponent(
            new Link("http://www.mendelson.de", new ExternalResource("http://www.mendelson.de")), 0, 11,
            maxX - 1, 11);
    gridLayout.addComponent(
            new Link("http://www.mendelson-e-c.com", new ExternalResource("http://www.mendelson-e-c.com")), 0,
            12, maxX - 1, 12);
    gridLayout.addComponent(new Label("<hr/>", Label.CONTENT_XHTML), 0, 13, maxX - 1, 13);
    gridLayout.addComponent(new Label("<br/>", Label.CONTENT_XHTML), 0, 14, maxX - 1, 14);
    gridLayout.addComponent(
            new Label("[Based on VAADIN " + com.vaadin.terminal.gwt.server.ApplicationServlet.VERSION + "]"), 0,
            16, maxX - 1, 16);
    panel.addComponent(gridLayout);
    return (panel);
}

From source file:de.mendelson.comm.as2.webclient2.AS2WebUI.java

/**
 * Init is invoked on application load (when a user accesses the application
 * for the first time)./*  www . ja v  a 2s  .  c om*/
 */
@Override
public void init() {
    this.user = null;
    //display fav icon, set theme
    setTheme("mendelson");
    ICON_IN = new ThemeResource("images/in16x16.gif");
    ICON_OUT = new ThemeResource("images/out16x16.gif");
    ICON_PENDING = new ThemeResource("images/state_pending16x16.gif");
    ICON_STOPPED = new ThemeResource("images/state_stopped16x16.gif");
    ICON_FINISHED = new ThemeResource("images/state_finished16x16.gif");
    ICON_ALL = new ThemeResource("images/state_all16x16.gif");
    this.browser = ((WebApplicationContext) getContext()).getBrowser();
    //register the database drivers for the VM
    try {
        Class.forName("org.hsqldb.jdbcDriver");
    } catch (Exception e) {
        e.printStackTrace();
        mainWindow.showNotification("Fatal", e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
        return;
    }
    //establish database connection
    try {
        this.configConnection = DBDriverManager.getConnectionWithoutErrorHandling(DBDriverManager.DB_CONFIG,
                "localhost");
        this.runtimeConnection = DBDriverManager.getConnectionWithoutErrorHandling(DBDriverManager.DB_RUNTIME,
                "localhost");
    } catch (Exception e) {
        e.printStackTrace();
        mainWindow.showNotification("Fatal", e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
    }
    Embedded logoImage = new Embedded("", new ThemeResource("images/logo.jpg"));
    logoImage.setType(Embedded.TYPE_IMAGE);
    this.mainWindow.addComponent(logoImage);
    LoginForm loginForm = new LoginForm();
    loginForm.addListener(new LoginListener() {
        @Override
        public void onLogin(LoginEvent event) {
            try {
                String username = event.getLoginParameter("username");
                String password = event.getLoginParameter("password");
                UserAccess access = new UserAccess(Logger.getAnonymousLogger());
                User foundUser = access.readUser(username);
                if (foundUser == null || foundUser.getPasswdCrypted() == null
                        || !(foundUser.getPasswdCrypted().equals(User.cryptPassword(password.toCharArray())))
                        || !foundUser.getPermission(1).equals("FULL")) {
                    mainWindow.showNotification("Login failed", "Wrong credentials or no permission",
                            Window.Notification.TYPE_WARNING_MESSAGE);
                } else {
                    //login accepted
                    AS2WebUI.this.user = foundUser;
                    AS2WebUI.this.labelUsername.setValue("User: " + AS2WebUI.this.user.getName());
                    AS2WebUI.this.mainWindow.removeComponent(AS2WebUI.this.loginPanel);
                    AS2WebUI.this.mainWindow.addComponent(AS2WebUI.this.mainPanel);
                    AS2WebUI.this.refreshOverviewTableData();
                }
            } catch (Exception e) {
                e.printStackTrace();
                mainWindow.showNotification("Service not available",
                        "Login not possible at the moment - please try later",
                        Window.Notification.TYPE_WARNING_MESSAGE);
            }
        }
    });
    this.loginPanel.addComponent(loginForm);
    this.mainWindow.addComponent(this.loginPanel);
    this.mainPanel.addComponent(this.createMenuBar());
    this.mainPanel.addComponent(this.createButtonBar());
    this.overviewTable = this.createOverviewTable();
    this.mainPanel.addComponent(overviewTable);
    this.footerLayout = new HorizontalLayout();
    footerLayout.setMargin(true, false, false, false);
    footerLayout.setSpacing(true);
    footerLayout.addComponent(this.footerTransactionSum);
    footerLayout.addComponent(this.footerTransactionOkSum);
    footerLayout.addComponent(this.footerTransactionPendingSum);
    footerLayout.addComponent(this.footerTransactionErrorSum);
    this.mainPanel.addComponent(footerLayout);
    this.setMainWindow(this.mainWindow);
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.description.DescriptionViewImpl.java

License:Open Source License

/**
 * Die Methode initialisiert alle bentigten Labels, und Icons.
 * /*ww w  . j a  v a2  s. c  o m*/
 * @author Tobias Lindner
 */
private void initializeTextsHeadlinesAndIcons() {
    int anzPixelIcon = 27;

    //Stochastische Eingabe Beschreibung
    stochasticHeadline = new Label("<h3>Stochastische Eingabe</h3>");
    stochasticHeadline.setContentMode(Label.CONTENT_XHTML);
    stochasticHeadline.addStyleName("descriptionHeadline");
    stochasticText = new Label(
            "Diese Methode hat zum Ziel den zuknftigen Cashflow auf Basis der Werte aus vergangenen Methoden zu berechnen. "
                    + "Dabei werden die Werte der vergangenen Methoden von Ihnen angegeben und die potenziellen Cashflows fr die nchsten Jahre mit dem AR(p) Modell berechnet.");
    stochasticText.addStyleName("wrap");
    stochasticText.addStyleName("descriptionText");
    iconStochastic = new Embedded(null, new ThemeResource(
            "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
    iconStochastic.setWidth(anzPixelIcon, UNITS_PIXELS);
    iconStochastic.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void click(ClickEvent event) {
            if (stochasticText.isVisible()) {
                stochasticText.setVisible(false);
                iconStochastic.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128.png"));
            } else {
                stochasticText.setVisible(true);
                iconStochastic.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
            }
        }
    });

    //Deterministische Eingabe Beschreibung
    deterministicHeadline = new Label("<h3>Deterministische Eingabe</h3>");
    deterministicHeadline.setContentMode(Label.CONTENT_XHTML);
    deterministicHeadline.addStyleName("descriptionHeadline");
    deterministicText = new Label(
            "Bei der deterministischen Berechnung werden die von Ihnen geschtzten Cashflows der nchsten Perioden angegeben.");
    deterministicText.addStyleName("wrap");
    deterministicText.addStyleName("descriptionText");
    iconDeterministic = new Embedded(null, new ThemeResource(
            "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
    iconDeterministic.setWidth(anzPixelIcon, UNITS_PIXELS);
    iconDeterministic.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void click(ClickEvent event) {
            if (deterministicText.isVisible()) {
                deterministicText.setVisible(false);
                iconDeterministic.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128.png"));
            } else {
                deterministicText.setVisible(true);
                iconDeterministic.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
            }
        }
    });

    //FCF Beschreibung
    fcfHeadline = new Label("<h3>FCF</h3>");
    fcfHeadline.setContentMode(Label.CONTENT_XHTML);
    fcfHeadline.addStyleName("descriptionHeadline");
    fcfText = new Label(
            "Beim FCF Verfahren wird der freie Cash Flow aus dem operativen Cash-Flow abzglich des Saldos aus Investitionsttigkeiten errechnet.");
    fcfText.addStyleName("wrap");
    fcfText.addStyleName("descriptionText");
    iconFCF = new Embedded(null, new ThemeResource(
            "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
    iconFCF.setWidth(anzPixelIcon, UNITS_PIXELS);
    iconFCF.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void click(ClickEvent event) {
            if (fcfText.isVisible()) {
                fcfText.setVisible(false);
                iconFCF.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128.png"));
            } else {
                fcfText.setVisible(true);
                iconFCF.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
            }
        }
    });

    //UKV Beschreibung
    ukvHeadline = new Label("");//<h3>UKV</h3>");
    ukvHeadline.setContentMode(Label.CONTENT_XHTML);
    ukvHeadline.addStyleName("descriptionHeadline");
    ukvText = new Label("");
    //"Beim Umsatz-Kosten-Verfahren wird der Cashflow aus Werten aus GuV und Bilanz berechnet. Die dafr notwendigen Posten sind: "
    //+ "Umsatzerlse, Herstellkosten des Umsatzes, Kosten F&E, Verwaltungskosten, Sonstiger Aufwand, Ertrag, Ertrge aus Wertpapieren, Zinsen und hnliche Aufwendungen, Auerordentliche Ertrge & Aufwendungen, Abschreibungen, Pensionsrckstellungen");
    ukvText.addStyleName("wrap");
    ukvText.addStyleName("descriptionText");
    iconUKV = new Embedded(null, new ThemeResource(
            "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
    iconUKV.setWidth(anzPixelIcon, UNITS_PIXELS);
    iconUKV.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void click(ClickEvent event) {
            if (ukvText.isVisible()) {
                ukvText.setVisible(false);
                iconUKV.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128.png"));
            } else {
                ukvText.setVisible(true);
                iconUKV.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
            }
        }
    });

    //GKV Beschreibung
    gkvHeadline = new Label("<h3>GKV</h3>");
    gkvHeadline.setContentMode(Label.CONTENT_XHTML);
    gkvHeadline.setStyleName("descriptionHeadline");
    gkvText = new Label(
            "Beim Gesamt-Kosten-Verfahren wird der Cashflow aus Werten aus GuV und Bilanz berechnet. Die dafr notwendigen Posten sind: "
                    + "Umsatzerlse, Erhhung des Bestandes an fertigen Erzeugnissen, Verminderung des Bestandes an fertigen Erzeugnissen, Materialaufwand, Personalaufwand mit Lhne/Gehlter, "
                    + "Einstellungs-/Entlassungskosten, Pensionsrckstellungen, Sonstige Personalkosten, Abschreibungen, Sonstiger Aufwand, Ertrag, Ertrge aus Wertpapieren, Zinsen und hnliche Aufwendungen, "
                    + "Auerordentliche Ertrge, Auerordentliche Aufwendungen, Ertragssteuern, Abschreibungen, Pensionsrckstellungen");
    gkvText.addStyleName("wrap");
    gkvText.addStyleName("descriptionText");
    iconGKV = new Embedded(null, new ThemeResource(
            "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
    iconGKV.setWidth(anzPixelIcon, UNITS_PIXELS);
    iconGKV.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void click(ClickEvent event) {
            if (gkvText.isVisible()) {
                gkvText.setVisible(false);
                iconGKV.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128.png"));
            } else {
                gkvText.setVisible(true);
                iconGKV.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
            }
        }
    });

    //APV Beschreibung
    apvHeadline = new Label("<h3>APV</h3>");
    apvHeadline.setContentMode(Label.CONTENT_XHTML);
    apvHeadline.setStyleName("descriptionHeadline");
    apvText = new Label(
            "Nach dieser Methode berechnet sich der Unternehmenswert aus dem Wert des rein eigenfinanzierten Unternehmens "
                    + "zuzglich der Steuervorteile durch das verzinsliche Fremdkapital, abzglich des verzinslichen Fremdkapitals.");
    apvText.addStyleName("wrap");
    apvText.addStyleName("descriptionText");
    iconAPV = new Embedded(null, new ThemeResource(
            "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
    iconAPV.setWidth(anzPixelIcon, UNITS_PIXELS);
    iconAPV.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void click(ClickEvent event) {
            if (apvText.isVisible()) {
                apvText.setVisible(false);
                iconAPV.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128.png"));
            } else {
                apvText.setVisible(true);
                iconAPV.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
            }
        }
    });

    //FTE Beschreibung
    fteHeadline = new Label("<h3>FTE</h3>");
    fteHeadline.setContentMode(Label.CONTENT_XHTML);
    fteHeadline.addStyleName("descriptionHeadline");
    fteText = new Label(
            "Die Flow-to-Equity Methode diskontiert alle zuknftigen Cashflows auf einen Stichtag und addiert den diskontierten Restwert. "
                    + "Folglich betrachtet dieses Verfahren fr die Berechnung des Unternehmenswertes ausschlielich das Eigenkapital.");
    fteText.addStyleName("wrap");
    fteText.addStyleName("descriptionText");
    iconFTE = new Embedded(null, new ThemeResource(
            "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
    iconFTE.setWidth(anzPixelIcon, UNITS_PIXELS);
    iconFTE.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void click(ClickEvent event) {
            if (fteText.isVisible()) {
                fteText.setVisible(false);
                iconFTE.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128.png"));
            } else {
                fteText.setVisible(true);
                iconFTE.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
            }
        }
    });

    //WACC Beschreibung
    waccHeadline = new Label("<h3>WACC</h3>");
    waccHeadline.setContentMode(Label.CONTENT_XHTML);
    waccHeadline.setStyleName("descriptionHeadline");
    waccText = new Label(
            "WACC sind gewichtete Kapitalkosten. Sie werden durch das gewichtete Mittel der Eigen- und Fremdkapitalkosten berechnet, "
                    + "wobei die Fremdkapitalkosten um den Steuervorteil zu reduzieren sind: Mit Hilfe der nach WACC berechneten Kapitalkosten lsst sich der Unternehmenswert durch das Free-Cash-Flow-Verfahren (FCF) ermitteln. "
                    + "Dabei wird der Marktwert des Fremdkapitals von den diskontierten FCF-Werten subtrahiert.");
    waccText.addStyleName("wrap");
    waccText.addStyleName("descriptionText");
    iconWACC = new Embedded(null, new ThemeResource(
            "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
    iconWACC.setWidth(anzPixelIcon, UNITS_PIXELS);
    iconWACC.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void click(ClickEvent event) {
            if (waccText.isVisible()) {
                waccText.setVisible(false);
                iconWACC.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128.png"));
            } else {
                waccText.setVisible(true);
                iconWACC.setSource(new ThemeResource(
                        "./images/icons/newIcons/1421209133_circle_next_arrow_disclosure-128_rotated.png"));
            }
        }
    });

    //Szenario Beschreibung
    scenarioHeadline = new Label("<h1>Szenarien</h1>");
    scenarioHeadline.setContentMode(Label.CONTENT_XHTML);
    scenarioHeadline.setStyleName("descriptionHeadline");

    scenarioText = new Label(
            "Fr jedes Szenario knnen Sie unterschiedliche Berechnungswerte fr die Eigen- und Fremdkapitalrendite, sowie die einzelnen Steuerstze angeben. "
                    + "Bei dem Flow-to-Equity Verfahren beschrnken sich die geforderten Werte auf die Eigenkapitalkosten. Sie mssen mindestens ein Szenario in die Berechnung einbeziehen.");
    scenarioText.addStyleName("wrap");
    scenarioText.addStyleName("descriptionText");

}

From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.projectlist.ProjectListViewImpl.java

License:Open Source License

/**
 * Konkrete Ausprogrammierung der Darstellung eines einzelnen Projekts.
 * Ein Projekt wird durch ein VerticalLayout dargestellt, das ein Label
 * mit dem Projektname enthlt. Auerdem bekommt es einen ClickListener,
 * um ein Projekt als selektiert zu kennzeichnen und die Details zum Projekt
 * anzuzeigen./*w w w  .  j a va2 s  . c o  m*/
 * 
 * @author Christian Scherer, Mirko Gpfrich, Marco Glaser
 * @param project
 *            das darzustellende Projekt und der aktuelle Index der Liste
 * @param i
 *            der Index der zu erstellenden Komponente (besonders fuer den
 *            Loeschbutton relevant)
 * @return ein VerticalLayout Objekt, das zur Eingliederung in das UI dient
 */
private VerticalLayout generateSingleProjectUI(Project project, int i) {

    final Project proj = project;
    final int a = i;
    //erzeugt eine Panel fr ein Projekt
    singleProject = new VerticalLayout();
    HorizontalLayout container = new HorizontalLayout();
    container.setSizeFull();
    if (i == 0) {
        singleProject.setStyleName("singleProjectSelected");
        presenter.projectSelected(project);
    } else {
        singleProject.setStyleName("singleProject");
    }
    Embedded icon = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418828714_editor_open_folder-128.png"));
    icon.setHeight(40, UNITS_PIXELS);
    icon.setWidth(40, UNITS_PIXELS);
    Label gap1 = new Label();
    Label gap2 = new Label();
    Label gap3 = new Label();
    gap1.setWidth("15px");
    gap2.setWidth("15px");
    gap3.setSizeFull();
    Label projectName = new Label(project.getName());
    projectName.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    projectName.setHeight(Sizeable.SIZE_UNDEFINED, 0);
    projectName.setStyleName("projectName");

    //Legt ein Layout fr das Projekt-Panel fest
    //panelContent.setSizeFull();
    container.addComponent(gap1);
    container.addComponent(icon);
    container.addComponent(gap2);
    container.addComponent(projectName);
    container.addComponent(gap3);
    container.setExpandRatio(gap3, 1.0f);

    singleProject.addComponent(container);
    singleProject.setWidth(100, UNITS_PERCENTAGE);
    singleProject.setHeight(70, UNITS_PIXELS);
    container.setComponentAlignment(icon, Alignment.MIDDLE_CENTER);
    container.setComponentAlignment(projectName, Alignment.MIDDLE_CENTER);

    singleProject.addListener(new LayoutClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void layoutClick(LayoutClickEvent event) {
            presenter.projectSelected(proj);
            switchProjectsStyle(a);

            eventBus.fireEvent(new SelectProjectEvent());
        }

    });

    //      singleProject.addListener(this);
    //      projectListPanel.addComponent(singleProject);
    logger.debug("Einzelnes Projektelement erzeugt");

    return singleProject;
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.parameterScreen.input.ParameterInputViewImpl.java

License:Open Source License

private void generateUi() {
    setMargin(true);/*  w ww.j  a  va  2s  .co  m*/
    //setSizeFull();

    gridLayout = new GridLayout(3, 30);
    gridLayout.setSpacing(true);
    gridLayout.setSizeUndefined();
    gridLayout.setStyleName("parameter");

    addComponent(gridLayout);

    //Hhe des FragezeichenIcons
    String heightQuestionIcon = "20px";

    // Basisjahr

    labelBasisYear = new Label("Basisjahr");
    gridLayout.addComponent(labelBasisYear, 0, 1);

    textfieldBasisYear = new TextField();
    textfieldBasisYear.setImmediate(true);
    textfieldBasisYear.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            presenter.basisYearChosen((String) textfieldBasisYear.getValue());
        }
    });
    gridLayout.addComponent(textfieldBasisYear, 1, 1);

    labelBasisYear.setStyleName("parameter");
    textfieldBasisYear.setStyleName("parameter");

    questionIconBasisYear = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418765983_circle_help_question-mark-128.png"));
    questionIconBasisYear.setHeight(heightQuestionIcon);
    questionIconBasisYear.setStyleName("questionIcon");
    questionIconBasisYear.setDescription(toolTipBasisYear);

    gridLayout.addComponent(questionIconBasisYear, 2, 1);

    //Anzahl zu prognistizierender Perioden
    labelNumPeriods = new Label("Anzahl zu prognostizierender Perioden");
    gridLayout.addComponent(labelNumPeriods, 0, 2);

    textfieldNumPeriodsToForecast = new TextField();
    textfieldNumPeriodsToForecast.setImmediate(true);
    textfieldNumPeriodsToForecast.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            presenter.numberPeriodsToForecastChosen((String) textfieldNumPeriodsToForecast.getValue());
        }
    });

    gridLayout.addComponent(textfieldNumPeriodsToForecast, 1, 2);

    labelNumPeriods.setStyleName("parameter");
    textfieldNumPeriodsToForecast.setStyleName("parameter");

    questionIconNumPeriods = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418765983_circle_help_question-mark-128.png"));
    questionIconNumPeriods.setHeight(heightQuestionIcon);
    questionIconNumPeriods.setStyleName("questionIcon");
    questionIconNumPeriods.setDescription(toolTipNumPeriodsToForecast);

    gridLayout.addComponent(questionIconNumPeriods, 2, 2);

    //Anzahl der Iterationen
    labelIterations = new Label("Anzahl der Iterationen");
    gridLayout.addComponent(labelIterations, 0, 3);

    textfieldIterations = new TextField();
    textfieldIterations.setImmediate(true);
    textfieldIterations.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            logger.debug(textfieldIterations.getValue());
            presenter.iterationChosen((String) textfieldIterations.getValue());
        }
    });
    gridLayout.addComponent(textfieldIterations, 1, 3);

    labelIterations.setStyleName("parameter");
    textfieldIterations.setStyleName("parameter");

    questionIconIterations = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418765983_circle_help_question-mark-128.png"));
    questionIconIterations.setHeight(heightQuestionIcon);
    questionIconIterations.setStyleName("questionIcon");
    questionIconIterations.setDescription(toolTipIterations);

    gridLayout.addComponent(questionIconIterations, 2, 3);

    //Anzahl einbezogener vergangener Perioden
    labelNumPastPeriods = new Label("Anzahl einbezogener vergangener Perioden");
    gridLayout.addComponent(labelNumPastPeriods, 0, 4);

    textfieldNumPastPeriods = new TextField();
    textfieldNumPastPeriods.setImmediate(true);
    // textfieldNumPastPeriods: Wert darf hier nicht gesetzt werden
    // -> ber Event, sodass der Wert ins Projekt bernommen wird und nicht
    // nur einfach angezeigt wird ohne ausgewertet werden zu knnen
    // textfieldNumPastPeriods.setValue(5);
    textfieldNumPastPeriods.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            presenter.relevantPastPeriodsChosen((String) textfieldNumPastPeriods.getValue());
        }
    });

    gridLayout.addComponent(textfieldNumPastPeriods, 1, 4);

    labelNumPastPeriods.setStyleName("parameter");
    textfieldNumPastPeriods.setStyleName("parameter");

    questionIconNumPastPeriods = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418765983_circle_help_question-mark-128.png"));
    questionIconNumPastPeriods.setHeight(heightQuestionIcon);
    questionIconNumPastPeriods.setStyleName("questionIcon");
    questionIconNumPastPeriods.setDescription(toolTipNumPastPeriods);

    gridLayout.addComponent(questionIconNumPastPeriods, 2, 4);

    // Anzahl anzugebender, vergangener Perioden
    //      labelNumSpecifiedPastPeriods = new Label("Anzahl anzugebender, vergangener Perioden");
    //      gridLayout.addComponent(labelNumSpecifiedPastPeriods, 0, 5);
    //      
    //      textfieldNumSpecifiedPastPeriods = new TextField();
    //      textfieldNumSpecifiedPastPeriods.setImmediate(true);
    //      textfieldNumSpecifiedPastPeriods.addListener(new Property.ValueChangeListener() {
    //         private static final long serialVersionUID = 1L;
    //
    //         public void valueChange(ValueChangeEvent event) {
    //            logger.debug(textfieldNumSpecifiedPastPeriods.getValue());
    //            presenter.specifiedPastPeriodsChosen((String) textfieldNumSpecifiedPastPeriods
    //                  .getValue());
    //         }
    //      });
    //      
    //      gridLayout.addComponent(textfieldNumSpecifiedPastPeriods, 1, 5);
    //      
    //      labelNumSpecifiedPastPeriods.setStyleName("parameter");
    //      textfieldNumSpecifiedPastPeriods.setStyleName("parameter");
    //      
    //      questionIconNumSpecifiedPastPeriods = new Embedded (null, new ThemeResource("./images/icons/newIcons/1418765983_circle_help_question-mark-128.png"));
    //      questionIconNumSpecifiedPastPeriods.setHeight(heightQuestionIcon);
    //      questionIconNumSpecifiedPastPeriods.setStyleName("questionIcon");
    //      questionIconNumSpecifiedPastPeriods.setDescription(toolTipNumSpecifiedPastPeriods);
    //      
    //      gridLayout.addComponent(questionIconNumSpecifiedPastPeriods, 2, 5);

    // Deterministische Parameter

    //Anzahl anzugebender Perioden
    labelNumPeriods_deterministic = new Label("Anzahl Perioden");
    gridLayout.addComponent(labelNumPeriods_deterministic, 0, 7);

    textfieldNumPeriodsToForecast_deterministic = new TextField();
    textfieldNumPeriodsToForecast_deterministic.setImmediate(true);
    textfieldNumPeriodsToForecast_deterministic.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            presenter.numberPeriodsToForecastChosen_deterministic(
                    (String) textfieldNumPeriodsToForecast_deterministic.getValue());
        }
    });

    gridLayout.addComponent(textfieldNumPeriodsToForecast_deterministic, 1, 7);

    labelNumPeriods_deterministic.setStyleName("parameter");
    textfieldNumPeriodsToForecast_deterministic.setStyleName("parameter");

    questionIconNumPeriods_deterministic = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418765983_circle_help_question-mark-128.png"));
    questionIconNumPeriods_deterministic.setHeight(heightQuestionIcon);
    questionIconNumPeriods_deterministic.setStyleName("questionIcon");
    questionIconNumPeriods_deterministic.setDescription(toolTipNumPeriodsToForecast_deterministic);

    gridLayout.addComponent(questionIconNumPeriods_deterministic, 2, 7);

}

From source file:dhbw.ka.mwi.businesshorizon2.ui.parameterScreen.ParameterScreenViewImpl.java

License:Open Source License

/**
* Diese Methode setzt das Layout fr den Screen fest sowie den Titel der Anwendung.
*
* @author Christian Scherer, Mirko Gpfrich, Marco Glaser
*/// w  w  w  .  j a  v a 2 s  .  c o m
private void generateUi() {

    mainLayout.setSizeFull();
    mainLayout.setStyleName("mainLayout");
    leftLayout.setSizeFull();
    leftLayout.setStyleName("leftContainer");
    rightLayout.setSizeFull();
    bottomLayout.setSizeFull();
    bottomLeftLayout.setSizeFull();
    //leftContentLayout.setWidth(85, UNITS_PERCENTAGE);
    //leftContentLayout.setHeight(100, UNITS_PERCENTAGE);
    topRightLayout.setStyleName("topBar");
    leftContentLayout.setSizeFull();

    horizontalSplitPanel = new HorizontalSplitPanel();
    horizontalSplitPanel.setSplitPosition(30, UNITS_PERCENTAGE);
    horizontalSplitPanel.setLocked(true);
    horizontalSplitPanel.setStyleName("horizontalMain");
    verticalSplitPanel = new VerticalSplitPanel();
    verticalSplitPanel.setSplitPosition(15, UNITS_PERCENTAGE);
    verticalSplitPanel.setLocked(true);
    verticalSplitPanel.setWidth(90, UNITS_PERCENTAGE);
    verticalSplitPanel.setHeight(100, UNITS_PERCENTAGE);
    horizontalSplitPanelRight = new HorizontalSplitPanel();
    horizontalSplitPanelRight.setSplitPosition(30, UNITS_PERCENTAGE);
    horizontalSplitPanelRight.setLocked(true);
    horizontalSplitPanelRight.addStyleName("horizontalBottom");
    horizontalSplitPanelRight.setHeight(90, UNITS_PERCENTAGE);
    horizontalSplitPanelRight.setWidth(100, UNITS_PERCENTAGE);

    leftL = new Label("links");
    rightTopL = new Label("rechts Oben");
    rightBottomL = new Label("rechts Unten");
    leftBottomL = new Label("links Unten");

    rightLayout.addComponent(verticalSplitPanel);
    //   topRightLayout.addComponent(rightTopL);
    //   bottomRightLayout.addComponent(rightBottomL);
    //   bottomLeftLayout.addComponent(leftBottomL);
    bottomLayout.addComponent(horizontalSplitPanelRight);

    horizontalSplitPanel.addComponent(leftLayout);
    horizontalSplitPanel.addComponent(rightLayout);

    verticalSplitPanel.addComponent(topRightLayout);
    verticalSplitPanel.addComponent(bottomLayout);

    horizontalSplitPanelRight.addComponent(bottomLeftLayout);
    horizontalSplitPanelRight.addComponent(bottomRightLayout);

    rightLayout.setComponentAlignment(verticalSplitPanel, Alignment.MIDDLE_CENTER);
    bottomLayout.setComponentAlignment(horizontalSplitPanelRight, Alignment.MIDDLE_CENTER);

    mainLayout.addComponent(horizontalSplitPanel);

    setContent(mainLayout);

    //linke Seite Logo
    leftLogolayout = new VerticalLayout();
    leftLogolayout.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    leftLogolayout.setHeight(100, UNITS_PERCENTAGE);

    logo = new Embedded(null, new ThemeResource("images/Logo_businesshorizon.png"));

    leftLogolayout.addComponent(logo);
    leftLogolayout.setComponentAlignment(logo, Alignment.MIDDLE_CENTER);

    //linke Seite Infos
    gap = new Label();
    gap.setHeight("10px");

    titleIcon = new Embedded(null, new ThemeResource(
            "./images/icons/newIcons/1418775155_device_board_presentation_content_chart-128.png"));
    titleIcon.setWidth(70, UNITS_PIXELS);
    titleIcon.setHeight(70, UNITS_PIXELS);

    seitenLabel = new Label("Schritt 2");
    seitenLabel.setStyleName("seitenLabel");
    seitenLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);

    splitter = new Label("<hr style='border:none;background-color:black;height:2px'>", Label.CONTENT_XHTML);
    splitter.setWidth(98, UNITS_PERCENTAGE);

    descriptionLabel = new Label("Stochastische Methode:");
    descriptionLabel.setStyleName("descriptionLabel");
    descriptionLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);

    descriptionLabel2 = new Label("Bitte geben Sie die Parameter ein");
    descriptionLabel2.setStyleName("descriptionLabel");
    descriptionLabel2.setWidth(Sizeable.SIZE_UNDEFINED, 0);

    descriptionLayout = new VerticalLayout();
    descriptionLayout.addComponent(descriptionLabel);
    descriptionLayout.addComponent(descriptionLabel2);
    descriptionLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_CENTER);
    descriptionLayout.setComponentAlignment(descriptionLabel2, Alignment.MIDDLE_CENTER);
    descriptionLayout.setWidth(100, UNITS_PERCENTAGE);
    descriptionLayout.setHeight(60, UNITS_PIXELS);

    splitter2 = new Label("<hr style='border:none;background-color:black;height:2px'>", Label.CONTENT_XHTML);
    splitter2.setWidth(98, UNITS_PERCENTAGE);

    middleGap = new Label();
    middleGap.setHeight("10px");

    menuButtonsLayout = new HorizontalLayout();
    menuButtonsLayout.setWidth(100, UNITS_PERCENTAGE);
    menuButtonsLayout.setHeight(Sizeable.SIZE_UNDEFINED, 0);

    homeButtonLayout = new VerticalLayout();
    homeButtonLayout.setSizeFull();

    homeButton = new Button();
    homeButton.setHeight(30, UNITS_PIXELS);
    homeButton.setWidth(30, UNITS_PIXELS);
    homeButton.setStyleName("homeButton");

    homeButtonLabel = new Label("Startseite");
    homeButtonLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    homeButtonLabel.setStyleName("topBarButtonLabel");

    homeButtonLayout.addComponent(homeButton);
    homeButtonLayout.addComponent(homeButtonLabel);
    homeButtonLayout.setComponentAlignment(homeButton, Alignment.TOP_CENTER);
    homeButtonLayout.setComponentAlignment(homeButtonLabel, Alignment.MIDDLE_CENTER);

    menuButtonsLayout.addComponent(homeButtonLayout);
    //
    //   accountButtonLayout = new VerticalLayout();
    //   accountButtonLayout.setSizeFull();
    //   
    //   accountButton = new Button();
    //   accountButton.setHeight(30, UNITS_PIXELS);
    //   accountButton.setWidth(30, UNITS_PIXELS);
    //   accountButton.setStyleName("accountButton");
    //   
    //   accountButtonLabel = new Label("Mein Konto");
    //   accountButtonLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    //   accountButtonLabel.setStyleName("topBarButtonLabel");
    //   
    //   accountButtonLayout.addComponent(accountButton);
    //   accountButtonLayout.addComponent(accountButtonLabel);
    //   accountButtonLayout.setComponentAlignment(accountButton, Alignment.TOP_CENTER);;
    //   accountButtonLayout.setComponentAlignment(accountButtonLabel, Alignment.MIDDLE_CENTER);
    //   
    //   menuButtonsLayout.addComponent(accountButtonLayout);

    bottomGap = new Label();
    bottomGap.setHeight("380px");

    leftContentLayout.addComponent(gap);
    leftContentLayout.addComponent(titleIcon);
    leftContentLayout.addComponent(seitenLabel);
    leftContentLayout.addComponent(splitter);
    leftContentLayout.addComponent(descriptionLayout);
    leftContentLayout.addComponent(splitter2);
    leftContentLayout.addComponent(middleGap);
    leftContentLayout.addComponent(menuButtonsLayout);
    leftContentLayout.addComponent(bottomGap);

    leftContentLayout.setComponentAlignment(seitenLabel, Alignment.TOP_CENTER);
    leftContentLayout.setComponentAlignment(titleIcon, Alignment.TOP_CENTER);

    leftLayout.addComponent(leftLogolayout);
    leftLayout.addComponent(leftContentLayout);
    leftLayout.setExpandRatio(leftContentLayout, 1.0f);

    //Buttonleiste oben

    TopBarButton button = new TopBarButton("saveButton", "Speichern");
    addTopButton(button.getButtonComponent());
    button = new TopBarButton("resetInput", "Daten zurcksetzen");
    addTopButton(button.getButtonComponent());
    button = new TopBarButton("back", "Zurck");
    addTopButton(button.getButtonComponent());
    button = new TopBarButton("abbort", "Abbrechen");
    addTopButton(button.getButtonComponent());
    button.getButton().addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            System.out.println("cancel on safe");
            presenter.abbrechen();
        }

    });

}

From source file:dhbw.ka.mwi.businesshorizon2.ui.scenarioscreen.ScenarioScreenViewImpl.java

License:Open Source License

/**
 * Erstelle das GUI zum Prozessschritt "Szenarien"
 * //from  w  w  w.j  a va  2s  . c om
 * @author Julius Hacker, Tobias Lindner
 */
private void generateUi() {

    addScenarioLayout = new HorizontalLayout();

    addIcon = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418766077_circle_add_plus_-128_green.png"));
    addIcon.setHeight(30, UNITS_PIXELS);

    addLabel = new Label("Szenario hinzufgen");
    addLabel.addStyleName("scenarios");
    addLabel.addStyleName("addScenario");

    addScenarioLayout.addComponent(addIcon);

    gap3 = new Label();
    gap3.setWidth(10, UNITS_PIXELS);

    addScenarioLayout.addComponent(gap3);
    addScenarioLayout.addComponent(addLabel);
    addScenarioLayout.setComponentAlignment(addLabel, Alignment.MIDDLE_CENTER);

    addScenarioLayout.addListener(new LayoutClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void layoutClick(LayoutClickEvent event) {
            presenter.addScenario();
        }
    });

    gap4 = new Label();
    gap4.setHeight(15, UNITS_PIXELS);

    this.vlScenarios = new VerticalLayout();
    this.vlScenarios.setSizeFull();
    this.setMargin(true);

    addComponent(addScenarioLayout);
    setComponentAlignment(addScenarioLayout, Alignment.MIDDLE_LEFT);
    addComponent(gap4);
    addComponent(this.vlScenarios);

    vlScenarios.addStyleName("scenarios");
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.scenarioscreen.ScenarioScreenViewImpl.java

License:Open Source License

/**
 * Die Methode fuegt der View ein Szenario hinzu. Sie baut hierzu saemtliche
 * notwendigen GUI-Elemente und entsprechenden Listener hinzu.
 * /*  w  ww.ja  v a  2 s. c o m*/
 * Auf ein GridLayout umgestellt.
 * 
 * @author Julius Hacker, Tobias Lindner
 * @param rateReturnEquity Standardwert fuer die Renditeforderung Eigenkapital
 * @param rateReturnCapitalStock Standardwert fuer die Renditeforderung Fremdkapital
 * @param businessTax Standardwert fuer die Gewerbesteuer
 * @param corporateAndSolitaryTax Standardwert fuer die Koerperschaftssteuer mit Solidaritaetszuschlag.
 */

@Override
public void addScenario(String rateReturnEquity, String rateReturnCapitalStock, String corporateAndSolitaryTax,
        String businessTax, String personalTaxRate, boolean isIncludeInCalculation, final int number) {
    HashMap<String, AbstractComponent> scenarioComponents = new HashMap<String, AbstractComponent>();

    Property.ValueChangeListener changeListener = new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            presenter.updateScenario(number);
            logger.debug("TextChange ausgeloest");
            logger.debug("ChangeListener " + System.identityHashCode(this));
            presenter.isValid();
        }
    };

    final GridLayout gl = new GridLayout(3, 7);
    gl.addStyleName("gridLayoutScenarios");
    gl.setSizeFull();
    gl.setColumnExpandRatio(0, 2);
    gl.setColumnExpandRatio(1, 1);
    gl.setColumnExpandRatio(2, 1);

    final Label scenarioName = new Label("<strong>Szenario " + number + "</strong>");
    scenarioName.setContentMode(Label.CONTENT_XHTML);
    scenarioComponents.put("label", scenarioName);

    logger.debug("SzenarioName: " + scenarioName);
    gl.addComponent(scenarioName, 0, 0);

    //EK Rendite
    final Label textEigenkapital = new Label("Renditeforderung Eigenkapital: ");
    textEigenkapital.setSizeFull();

    final TextField tfEigenkapital = new TextField();

    if (!"0.0".equals(rateReturnEquity)) {
        tfEigenkapital.setValue(rateReturnEquity);
    }

    tfEigenkapital.setImmediate(true);
    tfEigenkapital.addStyleName("scenario");
    tfEigenkapital.addListener(changeListener);

    gl.addComponent(textEigenkapital, 0, 1);
    gl.addComponent(tfEigenkapital, 1, 1);

    scenarioComponents.put("rateReturnEquity", tfEigenkapital);

    // Fremdkapital      
    final Label textFremdkapitel = new Label("Renditeforderung FK: ");

    final TextField tfFremdkapital = new TextField();

    if (!"0.0".equals(rateReturnCapitalStock)) {
        tfFremdkapital.setValue(rateReturnCapitalStock);
    }

    tfFremdkapital.setImmediate(true);
    tfFremdkapital.addStyleName("scenario");
    tfFremdkapital.addListener(changeListener);

    gl.addComponent(textFremdkapitel, 0, 2);
    gl.addComponent(tfFremdkapital, 1, 2);

    scenarioComponents.put("rateReturnCapitalStock", tfFremdkapital);

    //Gewerbesteuer
    final Label textGewerbesteuer = new Label("Gewerbesteuer:");
    final TextField tfGewerbesteuer = new TextField();

    if (!"0.0".equals(businessTax)) {
        tfGewerbesteuer.setValue(businessTax);
    }

    tfGewerbesteuer.setImmediate(true);
    tfGewerbesteuer.addStyleName("scenario");
    tfGewerbesteuer.addListener(changeListener);

    gl.addComponent(textGewerbesteuer, 0, 3);
    gl.addComponent(tfGewerbesteuer, 1, 3);

    scenarioComponents.put("businessTax", tfGewerbesteuer);

    //Krperschaftssteuer
    final Label textKoerperschaftssteuer = new Label("Krperschaftssteuer mit Solidarittszuschlag: ");

    final TextField tfKoerperschaftssteuer = new TextField();

    if (!"0.0".equals(corporateAndSolitaryTax)) {
        tfKoerperschaftssteuer.setValue(corporateAndSolitaryTax);
    }

    tfKoerperschaftssteuer.setImmediate(true);
    tfKoerperschaftssteuer.addStyleName("scenario");
    tfKoerperschaftssteuer.addListener(changeListener);

    gl.addComponent(textKoerperschaftssteuer, 0, 4);
    gl.addComponent(tfKoerperschaftssteuer, 1, 4);

    scenarioComponents.put("corporateAndSolitaryTax", tfKoerperschaftssteuer);

    // Persnlicher Steuersatz
    final Label textPersonalTaxRate = new Label("pers\u00F6nlicher Steuersatz: ");
    final TextField tfPersonalTaxRate = new TextField();
    if (!"0.0".equals(personalTaxRate)) {
        tfPersonalTaxRate.setValue(personalTaxRate);
    }
    tfPersonalTaxRate.setImmediate(true);
    tfPersonalTaxRate.addStyleName("scenario");
    tfPersonalTaxRate.addListener(changeListener);

    gl.addComponent(textPersonalTaxRate, 0, 5);
    gl.addComponent(tfPersonalTaxRate, 1, 5);

    scenarioComponents.put("personalTaxRate", tfPersonalTaxRate);

    deleteIcon = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418766003_editor_trash_delete_recycle_bin_-128.png"));
    deleteIcon.setHeight(60, UNITS_PIXELS);
    deleteIcon.addStyleName("deleteScenario");

    deleteIcon.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void click(ClickEvent event) {
            presenter.removeScenario(number);
        }

    });

    gl.addComponent(deleteIcon, 2, 0, 2, 6);
    gl.setComponentAlignment(deleteIcon, Alignment.MIDDLE_CENTER);

    final Label gap = new Label();
    gap.setHeight(20, UNITS_PIXELS);

    gl.addComponent(gap, 0, 6);

    scenarioComponents.put("scenario", gl);

    this.scenarios.add(scenarioComponents);
    this.vlScenarios.addComponent(gl);

    //Button bei 3 Scenarios deaktivieren
    if (number == 3) {
        deactivateAddScenario();
    }
}

From source file:edu.kit.dama.ui.admin.administration.user.UserDataForm.java

License:Apache License

private Embedded getRegisterUserButton() {
    if (registerUserEmbeddedIcon == null) {
        String id = "registerUserButton";
        LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ...");

        registerUserEmbeddedIcon = new Embedded("", new ThemeResource(IconContainer.USER_NEW));
        registerUserEmbeddedIcon.setId(DEBUG_ID_PREFIX + id);
        registerUserEmbeddedIcon.addStyleName("myclickablecomponent");

        registerUserEmbeddedIcon.addClickListener((MouseEvents.ClickEvent event) -> {
            UIComponentTools.showWarning("User registration only possible via login page.");
        });/*from   w  ww . j  a v  a 2 s. com*/
    }
    return registerUserEmbeddedIcon;
}

From source file:edu.kit.dama.ui.commons.util.UIUtils7.java

License:Apache License

public static void openResourceSubWindow(File sourceFile) {
    boolean fileAccessible = sourceFile != null && sourceFile.exists() && sourceFile.canRead();

    // Set subwindow for displaying file resource
    final Window window = new Window(fileAccessible ? sourceFile.getName() : "Information");
    window.center();/* w ww  .j  av  a 2s.  c  om*/
    // Set window layout
    VerticalLayout windowLayout = new VerticalLayout();
    windowLayout.setSizeFull();

    if (fileAccessible) {
        // Set resource that has to be embedded
        final Embedded resource = new Embedded(null, new FileResource(sourceFile));
        if ("application/octet-stream".equals(resource.getMimeType())) {
            window.setWidth("570px");
            window.setHeight("150px");
            windowLayout.setMargin(true);

            Label attentionNote = new Label(
                    "A file preview is not possible as the file type is not supported by your browser.");
            attentionNote.setContentMode(ContentMode.HTML);
            Link fileURL = new Link("Click here for downloading the file.", new FileResource(sourceFile));

            windowLayout.addComponent(attentionNote);
            windowLayout.addComponent(fileURL);
            windowLayout.setComponentAlignment(attentionNote, Alignment.MIDDLE_CENTER);
            windowLayout.setComponentAlignment(fileURL, Alignment.MIDDLE_CENTER);
        } else {
            window.setResizable(true);
            window.setWidth("800px");
            window.setHeight("500px");
            final Image image = new Image(null, new FileResource(sourceFile));
            image.setSizeFull();
            windowLayout.addComponent(image);
        }
    } else {
        //file is not accessible
        window.setWidth("570px");
        window.setHeight("150px");
        windowLayout.setMargin(true);
        Label attentionNote = new Label("Provided file cannot be accessed.");
        attentionNote.setContentMode(ContentMode.HTML);
        windowLayout.addComponent(attentionNote);
        windowLayout.setComponentAlignment(attentionNote, Alignment.MIDDLE_CENTER);
    }

    window.setContent(windowLayout);
    UI.getCurrent().addWindow(window);
}