Example usage for com.vaadin.ui GridLayout setSizeFull

List of usage examples for com.vaadin.ui GridLayout setSizeFull

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:com.tripoin.util.ui.calendar.NotificationTestUI.java

License:Apache License

@Override
protected void init(com.vaadin.server.VaadinRequest request) {
    GridLayout content = new GridLayout(1, 2);
    content.setSizeFull();
    content.setRowExpandRatio(1, 1.0f);// ww  w  . ja v a 2 s .co m
    setContent(content);
    final Button btn = new Button("Show working notification", new Button.ClickListener() {
        /**
        * 
        */
        private static final long serialVersionUID = -165570248584063787L;

        @Override
        public void buttonClick(ClickEvent event) {
            Notification.show("This will disappear when you move your mouse!");
        }
    });
    content.addComponent(btn);

    provider = new DummyEventProvider();
    final Calendar cal = new Calendar(provider);
    cal.setLocale(Locale.US);
    cal.setSizeFull();
    cal.setHandler(new DateClickHandler() {
        /**
        * 
        */
        private static final long serialVersionUID = 1903111449161995776L;

        @Override
        public void dateClick(DateClickEvent event) {
            provider.addEvent(event.getDate());
            Notification.show("This should disappear, but if wont unless clicked.");

            // this requestRepaint call interferes with the notification
            cal.markAsDirty();
        }
    });
    content.addComponent(cal);

    java.util.Calendar javaCal = java.util.Calendar.getInstance();
    javaCal.set(java.util.Calendar.YEAR, 2000);
    javaCal.set(java.util.Calendar.MONTH, 0);
    javaCal.set(java.util.Calendar.DAY_OF_MONTH, 1);
    Date start = javaCal.getTime();
    javaCal.set(java.util.Calendar.DAY_OF_MONTH, 31);
    Date end = javaCal.getTime();

    cal.setStartDate(start);
    cal.setEndDate(end);
}

From source file:de.kaiserpfalzEdv.vaadin.about.AboutViewImpl.java

License:Apache License

private GridLayout createGridLayout(final int cols, final int rows) {
    GridLayout result = new GridLayout(cols, rows);

    result.setSizeFull();
    result.setSpacing(true);//from  www  . java 2  s  .  c om
    result.setResponsive(true);

    return result;
}

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

/**Could be overwritten, contains the content to display*/
@Override//  www.j  a v  a  2s .  c o  m
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:dhbw.clippinggorilla.userinterface.views.InterestProfileView.java

public Component getSources(InterestProfile profile) {
    VerticalLayout windowLayout = new VerticalLayout();
    windowLayout.setWidth("100%");
    VerticalLayout sourcesLayout = new VerticalLayout();
    sourcesLayout.setWidth("100%");
    Panel sourcesPanel = new Panel(sourcesLayout);

    List<CheckBox> checkBoxes = new ArrayList<>();
    HashMap<String, GridLayout> sourceLayouts = new HashMap<>();
    profile.getSources().entrySet().stream()
            .sorted((e1, e2) -> e1.getKey().getName().compareToIgnoreCase(e2.getKey().getName())).forEach(e -> {
                Source source = e.getKey();
                boolean enabled = e.getValue();
                GridLayout sourceLayout = new GridLayout(5, 1);
                sourceLayout.setSizeFull();

                CheckBox sourceSelected = new CheckBox();
                sourceSelected.setValue(enabled);
                sourceSelected.addStyleName(ValoTheme.CHECKBOX_LARGE);
                sourceSelected.addValueChangeListener(v -> profile.getSources().replace(source, v.getValue()));
                checkBoxes.add(sourceSelected);

                Image sourceLogo = new Image();
                sourceLogo.addStyleName("logosmall");
                sourceLogo.setSource(new ExternalResource(source.getLogo()));
                sourceLogo.addClickListener(c -> {
                    sourceSelected.setValue(!sourceSelected.getValue());
                    profile.getSources().replace(source, sourceSelected.getValue());
                });/*from ww  w  . j  a va 2s. c  o  m*/
                VerticalLayout layoutLogo = new VerticalLayout(sourceLogo);
                layoutLogo.setWidth("150px");
                layoutLogo.setHeight("50px");
                layoutLogo.setMargin(false);
                layoutLogo.setSpacing(false);
                layoutLogo.setComponentAlignment(sourceLogo, Alignment.MIDDLE_LEFT);

                Label labelHeadLine = new Label(
                        source.getCategory().getIcon().getHtml() + "  " + source.getName(), ContentMode.HTML);
                labelHeadLine.addStyleName(ValoTheme.LABEL_H3);

                Label labelDescription = new Label(source.getDescription(), ContentMode.HTML);
                labelDescription.setWidth("300px");
                PopupView popup = new PopupView(null, labelDescription);

                Button buttonDescription = new Button(VaadinIcons.INFO_CIRCLE_O);
                buttonDescription.addClickListener(ce -> {
                    popup.setPopupVisible(true);
                });

                sourceLayout.addComponents(sourceSelected, layoutLogo, labelHeadLine, popup, buttonDescription);
                sourceLayout.setComponentAlignment(sourceSelected, Alignment.MIDDLE_CENTER);
                sourceLayout.setComponentAlignment(layoutLogo, Alignment.MIDDLE_CENTER);
                sourceLayout.setColumnExpandRatio(2, 5);
                sourceLayout.setSpacing(true);

                sourceLayouts.put(source.getName().toLowerCase().replaceAll(" ", "").replaceAll("-", "")
                        .replaceAll("_", ""), sourceLayout);
                sourcesLayout.addComponent(sourceLayout);
            });

    sourcesPanel.setContent(sourcesLayout);
    sourcesPanel.setHeight("100%");
    sourcesPanel.setCaption(Language.get(Word.SOURCES));
    Language.setCustom(Word.SOURCES, s -> sourcesPanel.setCaption(s));
    windowLayout.addComponent(sourcesPanel);
    windowLayout.setExpandRatio(sourcesPanel, 1);
    windowLayout.setSpacing(false);
    windowLayout.setMargin(false);

    CheckBox checkBoxSelectAll = new CheckBox();
    Language.setCustom(Word.SELECT_ALL, s -> checkBoxSelectAll.setCaption(s));
    checkBoxSelectAll.setWidth("100%");
    checkBoxSelectAll.addValueChangeListener(e -> {
        profile.getSources().replaceAll((c, enabled) -> checkBoxSelectAll.getValue());
        checkBoxes.forEach(c -> c.setValue(checkBoxSelectAll.getValue()));
    });

    TextField textFieldSearch = new TextField();
    Language.setCustom(Word.SEARCH, s -> textFieldSearch.setPlaceholder(s));
    textFieldSearch.setWidth("100%");
    textFieldSearch.setMaxLength(255);
    textFieldSearch.setPlaceholder(Language.get(Word.SEARCH));
    textFieldSearch.addValueChangeListener(searchValue -> {
        sourceLayouts.forEach((sourceName, sourceLayout) -> {
            if (!sourceName.contains(searchValue.getValue().toLowerCase().replaceAll(" ", "")
                    .replaceAll("-", "").replaceAll("_", ""))) {
                sourcesLayout.removeComponent(sourceLayout);
            } else {
                sourcesLayout.addComponent(sourceLayout);
            }
        });
    });

    Label placeholder = new Label();
    placeholder.setWidth("100%");

    GridLayout footer = new GridLayout(3, 1);
    footer.setSpacing(true);
    footer.setMargin(new MarginInfo(true, false, false, false));
    footer.addStyleName("menubar");
    footer.setWidth("100%");
    footer.addComponents(checkBoxSelectAll, textFieldSearch, placeholder);
    footer.setComponentAlignment(checkBoxSelectAll, Alignment.MIDDLE_LEFT);
    footer.setComponentAlignment(textFieldSearch, Alignment.MIDDLE_CENTER);

    windowLayout.addComponent(footer);
    windowLayout.setHeight("350px");
    return windowLayout;
}

From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java

public Component getSources(GroupInterestProfile profile, boolean isAdmin) {
    VerticalLayout windowLayout = new VerticalLayout();
    windowLayout.setWidth("100%");
    VerticalLayout sourcesLayout = new VerticalLayout();
    sourcesLayout.setWidth("100%");
    Panel sourcesPanel = new Panel(sourcesLayout);

    List<CheckBox> checkBoxes = new ArrayList<>();
    HashMap<String, GridLayout> sourceLayouts = new HashMap<>();
    profile.getSources().entrySet().stream()
            .sorted((e1, e2) -> e1.getKey().getName().compareToIgnoreCase(e2.getKey().getName())).forEach(e -> {
                Source source = e.getKey();
                boolean enabled = e.getValue();
                GridLayout sourceLayout = new GridLayout(5, 1);
                sourceLayout.setSizeFull();

                CheckBox sourceSelected = new CheckBox();
                sourceSelected.setValue(enabled);
                sourceSelected.addStyleName(ValoTheme.CHECKBOX_LARGE);
                sourceSelected.addValueChangeListener(v -> profile.getSources().replace(source, v.getValue()));
                sourceSelected.setEnabled(isAdmin);
                checkBoxes.add(sourceSelected);

                Image sourceLogo = new Image();
                sourceLogo.addStyleName("logosmall");
                sourceLogo.setSource(new ExternalResource(source.getLogo()));
                if (isAdmin) {
                    sourceLogo.addClickListener(c -> {
                        sourceSelected.setValue(!sourceSelected.getValue());
                        profile.getSources().replace(source, sourceSelected.getValue());
                    });/*from   w  ww .  j  a  va 2 s .  co  m*/
                }
                VerticalLayout layoutLogo = new VerticalLayout(sourceLogo);
                layoutLogo.setWidth("150px");
                layoutLogo.setHeight("50px");
                layoutLogo.setMargin(false);
                layoutLogo.setSpacing(false);
                layoutLogo.setComponentAlignment(sourceLogo, Alignment.MIDDLE_LEFT);

                Label labelHeadLine = new Label(
                        source.getCategory().getIcon().getHtml() + "  " + source.getName(), ContentMode.HTML);
                labelHeadLine.addStyleName(ValoTheme.LABEL_H3);

                Label labelDescription = new Label(source.getDescription(), ContentMode.HTML);
                labelDescription.setWidth("300px");
                PopupView popup = new PopupView(null, labelDescription);

                Button buttonDescription = new Button(VaadinIcons.INFO_CIRCLE_O);
                buttonDescription.addClickListener(ce -> {
                    popup.setPopupVisible(true);
                });

                sourceLayout.addComponents(sourceSelected, layoutLogo, labelHeadLine, popup, buttonDescription);
                sourceLayout.setComponentAlignment(sourceSelected, Alignment.MIDDLE_CENTER);
                sourceLayout.setComponentAlignment(layoutLogo, Alignment.MIDDLE_CENTER);
                sourceLayout.setColumnExpandRatio(2, 5);
                sourceLayout.setSpacing(true);

                sourceLayouts.put(source.getName().toLowerCase().replaceAll(" ", "").replaceAll("-", "")
                        .replaceAll("_", ""), sourceLayout);
                sourcesLayout.addComponent(sourceLayout);
            });

    sourcesPanel.setContent(sourcesLayout);
    sourcesPanel.setHeight("100%");
    sourcesPanel.setCaption(Language.get(Word.SOURCES));
    Language.setCustom(Word.SOURCES, s -> sourcesPanel.setCaption(s));
    windowLayout.addComponent(sourcesPanel);
    windowLayout.setExpandRatio(sourcesPanel, 1);
    windowLayout.setSpacing(false);
    windowLayout.setMargin(false);

    CheckBox checkBoxSelectAll = new CheckBox();
    Language.setCustom(Word.SELECT_ALL, s -> checkBoxSelectAll.setCaption(s));
    checkBoxSelectAll.setWidth("100%");
    checkBoxSelectAll.addValueChangeListener(e -> {
        profile.getSources().replaceAll((c, enabled) -> checkBoxSelectAll.getValue());
        checkBoxes.forEach(c -> c.setValue(checkBoxSelectAll.getValue()));
    });
    checkBoxSelectAll.setEnabled(isAdmin);

    TextField textFieldSearch = new TextField();
    Language.setCustom(Word.SEARCH, s -> textFieldSearch.setPlaceholder(s));
    textFieldSearch.setWidth("100%");
    textFieldSearch.setMaxLength(255);
    textFieldSearch.setPlaceholder(Language.get(Word.SEARCH));
    textFieldSearch.addValueChangeListener(searchValue -> {
        sourceLayouts.forEach((sourceName, sourceLayout) -> {
            if (!sourceName.contains(searchValue.getValue().toLowerCase().replaceAll(" ", "")
                    .replaceAll("-", "").replaceAll("_", ""))) {
                sourcesLayout.removeComponent(sourceLayout);
            } else {
                sourcesLayout.addComponent(sourceLayout);
            }
        });
    });

    Label placeholder = new Label();
    placeholder.setWidth("100%");

    GridLayout footer = new GridLayout(3, 1);
    footer.setSpacing(true);
    footer.setMargin(new MarginInfo(true, false, false, false));
    footer.addStyleName("menubar");
    footer.setWidth("100%");
    footer.addComponents(checkBoxSelectAll, textFieldSearch, placeholder);
    footer.setComponentAlignment(checkBoxSelectAll, Alignment.MIDDLE_LEFT);
    footer.setComponentAlignment(textFieldSearch, Alignment.MIDDLE_CENTER);

    windowLayout.addComponent(footer);
    windowLayout.setHeight("350px");
    return windowLayout;
}

From source file:dhbw.clippinggorilla.userinterface.windows.ManageSourcesWindow.java

public void refreshSources() {
    sourcesLayout.removeAllComponents();
    SourceUtils.getSources().stream().sorted((s1, s2) -> s1.getName().compareToIgnoreCase(s2.getName()))
            .forEach(source -> {//from www.  j  a  v a 2 s .com
                try {
                    GridLayout sourceLayout = new GridLayout(4, 1);
                    sourceLayout.setSizeFull();

                    Image sourceLogo = new Image();
                    URL url = source.getLogo();
                    if (url != null) {
                        sourceLogo.setSource(new ExternalResource(url));
                    }
                    sourceLogo.setWidth("150px");

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

                    Label labelHeadLine = new Label(
                            source.getCategory().getIcon().getHtml() + "  " + source.getName(),
                            ContentMode.HTML);
                    labelHeadLine.addStyleName(ValoTheme.LABEL_H2);

                    Label labelDescription = new Label(source.getDescription(), ContentMode.HTML);
                    labelDescription.addStyleName(ValoTheme.LABEL_SMALL);
                    labelDescription.setWidth("100%");

                    sourceText.setMargin(false);
                    sourceText.addComponents(labelHeadLine, labelDescription);

                    Button buttonEdit = new Button(VaadinIcons.EDIT);
                    buttonEdit.addStyleName(ValoTheme.BUTTON_PRIMARY);
                    buttonEdit.addClickListener(
                            ce -> UI.getCurrent().addWindow(NewSourceWindow.createEditMode(source)));

                    Button buttonDelete = new Button(VaadinIcons.TRASH);
                    buttonDelete.addStyleName(ValoTheme.BUTTON_DANGER);
                    buttonDelete.addClickListener(ce -> {
                        sourcesLayout.removeComponent(sourceLayout);
                        sourceLayouts.remove(source.getName().toLowerCase().replaceAll(" ", "")
                                .replaceAll("-", "").replaceAll("_", ""));
                        SourceUtils.removeSource(source);
                    });

                    sourceLayout.addComponents(sourceLogo, sourceText, buttonEdit, buttonDelete);
                    sourceLayout.setComponentAlignment(sourceLogo, Alignment.MIDDLE_CENTER);
                    sourceLayout.setComponentAlignment(buttonEdit, Alignment.MIDDLE_CENTER);
                    sourceLayout.setComponentAlignment(buttonDelete, Alignment.MIDDLE_CENTER);
                    sourceLayout.setColumnExpandRatio(1, 5);
                    sourceLayout.setSpacing(true);

                    sourceLayouts.put(source.getName().toLowerCase().replaceAll(" ", "").replaceAll("-", "")
                            .replaceAll("_", ""), sourceLayout);
                    sourcesLayout.addComponent(sourceLayout);
                } catch (Exception e) {
                    Log.error("Skipping Source! ", e);
                }
            });
}

From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java

public Component getThirdStage(Source s) {
    Label header = new Label(Language.get(Word.CRAWLER));
    header.addStyleName(ValoTheme.LABEL_H1);

    Crawler crawler;//ww w . j ava  2  s.  c o  m
    if (s.getCrawler() != null) {
        crawler = s.getCrawler();
    } else {
        crawler = new Crawler(s);
        s.setCrawler(crawler);
    }

    GridLayout mainGrid = new GridLayout(2, 2);
    mainGrid.setSizeFull();
    mainGrid.setSpacing(true);

    FormLayout layoutForms = new FormLayout();

    //Exclude or Include
    RadioButtonGroup<Boolean> radios = new RadioButtonGroup<>();
    radios.setItems(true, false);
    radios.setItemCaptionGenerator(b -> b ? Language.get(Word.INCLUDE_TAGS) : Language.get(Word.EXCLUDE_TAGS));
    radios.setItemIconGenerator(b -> b ? VaadinIcons.CHECK : VaadinIcons.CLOSE);
    radios.setSelectedItem(true);
    radios.addValueChangeListener(event -> include = event.getValue());

    //By Class
    CssLayout addByClassGroup = new CssLayout();
    addByClassGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    TextField textFieldAddByClass = new TextField();
    textFieldAddByClass.setWidth("465px");
    Button buttonAddByClass = new Button(VaadinIcons.PLUS);
    buttonAddByClass.addClickListener(e -> {
        crawler.addByClass(textFieldAddByClass.getValue(), include);
        refreshList(mainGrid, crawler);
        textFieldAddByClass.clear();
    });
    addByClassGroup.addComponents(textFieldAddByClass, buttonAddByClass);
    addByClassGroup.setCaption(Language.get(Word.BYCLASS));

    //ByTag
    CssLayout addByTagGroup = new CssLayout();
    addByTagGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    TextField textFieldAddByTag = new TextField();
    Button buttonAddByTag = new Button(VaadinIcons.PLUS);
    textFieldAddByTag.setWidth("465px");
    buttonAddByTag.addClickListener(e -> {
        crawler.addByTag(textFieldAddByTag.getValue(), include);
        refreshList(mainGrid, crawler);
        textFieldAddByTag.clear();
    });
    addByTagGroup.addComponents(textFieldAddByTag, buttonAddByTag);
    addByTagGroup.setCaption(Language.get(Word.BYTAG));

    //ByID
    CssLayout addByIDGroup = new CssLayout();
    addByIDGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    TextField textFieldAddByID = new TextField();
    textFieldAddByID.setWidth("465px");
    Button buttonAddByID = new Button(VaadinIcons.PLUS);
    buttonAddByID.addClickListener(e -> {
        crawler.addByID(textFieldAddByID.getValue(), include);
        refreshList(mainGrid, crawler);
        textFieldAddByID.clear();
    });
    addByIDGroup.addComponents(textFieldAddByID, buttonAddByID);
    addByIDGroup.setCaption(Language.get(Word.BYID));

    //ByAttribute
    CssLayout addByAttributeGroup = new CssLayout();
    addByAttributeGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    TextField textFieldAddByAttributeKey = new TextField();
    textFieldAddByAttributeKey.setWidth("233px");
    TextField textFieldAddByAttributeValue = new TextField();
    textFieldAddByAttributeValue.setWidth("232px");
    Button buttonAddByAttribute = new Button(VaadinIcons.PLUS);
    buttonAddByAttribute.addClickListener(e -> {
        crawler.addByAttribute(textFieldAddByAttributeKey.getValue(), textFieldAddByAttributeValue.getValue(),
                include);
        refreshList(mainGrid, crawler);
        textFieldAddByAttributeKey.clear();
        textFieldAddByAttributeValue.clear();
    });
    addByAttributeGroup.addComponents(textFieldAddByAttributeKey, textFieldAddByAttributeValue,
            buttonAddByAttribute);
    addByAttributeGroup.setCaption(Language.get(Word.BYATTRIBUTEVALUE));

    layoutForms.addComponents(radios, addByClassGroup, addByTagGroup, addByIDGroup, addByAttributeGroup);
    mainGrid.addComponent(layoutForms);

    Label labelResult = new Label();
    Panel panelResult = new Panel(labelResult);
    labelResult.setWidth("100%");
    panelResult.setWidth("100%");
    panelResult.setHeight("175px");
    mainGrid.addComponent(panelResult, 0, 1, 1, 1);

    Button buttonTestURL = new Button();
    buttonTestURL.setIcon(VaadinIcons.EXTERNAL_LINK);
    buttonTestURL.setCaption(Language.get(Word.OPEN_LINK));

    Button buttonTest = new Button(Language.get(Word.TEST), VaadinIcons.CLIPBOARD_CHECK);
    buttonTest.addClickListener(ce -> {
        Article a = CrawlerUtils.executeRandom(crawler);
        labelResult.setValue(a.getBody());
        if (reg != null) {
            reg.remove();
        }
        reg = buttonTestURL
                .addClickListener(cev -> UI.getCurrent().getPage().open(a.getUrl(), "_blank", false));
    });

    refreshList(mainGrid, crawler);

    Runnable cancel = () -> close();
    Runnable next = () -> validateThirdStage(s);

    VerticalLayout windowLayout = new VerticalLayout();
    windowLayout.addComponents(header, mainGrid, getFooter(cancel, next, buttonTest, buttonTestURL));
    windowLayout.setComponentAlignment(header, Alignment.MIDDLE_CENTER);
    windowLayout.setExpandRatio(mainGrid, 5);
    windowLayout.setWidth("1250px");
    return windowLayout;
}

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.
 * //from w w  w  . ja v  a  2 s . c om
 * 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.MainControlPanel.java

License:Apache License

/**
 * Build the main layout.//w  ww.  j  a v a2s .c  om
 */
private void buildMainLayout() {
    infoCell = createCell("img/128x128/information2.png", Alignment.TOP_RIGHT, 0,
            "<p>Show/edit your profile and personel settings.</p>", "help-right");
    profileCell = createCell("img/128x128/preferences.png", Alignment.TOP_LEFT, 1,
            "<p>Get information on how you use this KIT Data Manager instance.</p>", "help-left");
    administrationCell = createCell("img/128x128/gears_preferences.png", Alignment.BOTTOM_RIGHT, 2,
            "<p>Logout.</p>", "help-right");
    logoutCell = createCell("img/128x128/exit.png", Alignment.BOTTOM_LEFT, 3,
            "<p>Show KIT Data Manager settings.<br/>This view is only available for administrators and group manager</p>.",
            "help-left");

    GridLayout actionCellLayout = new UIUtils7.GridLayoutBuilder(2, 2)
            .addComponent(infoCell, Alignment.BOTTOM_RIGHT, 0, 0, 1, 1)
            .addComponent(profileCell, Alignment.BOTTOM_LEFT, 1, 0, 1, 1)
            .addComponent(administrationCell, Alignment.TOP_RIGHT, 0, 1, 1, 1)
            .addComponent(logoutCell, Alignment.TOP_LEFT, 1, 1, 1, 1).getLayout();
    actionCellLayout.setSpacing(true);
    actionCellLayout.setMargin(true);
    actionCellLayout.setSizeFull();

    actionCellLayout.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            if (event.getClickedComponent() instanceof Image) {
                // Check if childComponent is disabled
                if (!event.getChildComponent().isEnabled()) {
                    return;
                }
                Image img = (Image) event.getClickedComponent();
                if ("image0".equals(img.getId())) {
                    parent.updateView(AdminUIMainView.VIEW.INFORMATION);
                } else if ("image1".equals(img.getId())) {
                    parent.updateView(AdminUIMainView.VIEW.PROFILE);
                } else if ("image2".equals(img.getId())) {
                    parent.updateView(AdminUIMainView.VIEW.SETTINGS);
                } else if ("image3".equals(img.getId())) {
                    parent.logout();
                }
            }
        }
    });

    mainLayout = new VerticalLayout(actionCellLayout);
    mainLayout.setSizeFull();
}

From source file:edu.kit.dama.ui.admin.schedule.SchedulerBasePropertiesLayout.java

License:Apache License

/**
 * Default constructor.//w  w w . j a va  2 s  . co m
 */
public SchedulerBasePropertiesLayout() {
    super();
    LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ...");

    setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1));

    setSizeFull();
    setMargin(true);
    setSpacing(true);

    setColumns(3);
    setRows(3);
    //first row
    addComponent(getIdField(), 0, 0);
    addComponent(getGroupField(), 1, 0);
    addComponent(getNameField(), 2, 0);

    //second row
    addComponent(getDescriptionArea(), 0, 1, 2, 1);
    Button addTriggerButton = new Button();
    addTriggerButton.setDescription("Add a new trigger.");
    addTriggerButton.setIcon(new ThemeResource(IconContainer.ADD));
    addTriggerButton.addClickListener((Button.ClickEvent event) -> {
        addTrigger();
    });

    Button removeTriggerButton = new Button();
    removeTriggerButton.setDescription("Remove the selected trigger.");
    removeTriggerButton.setIcon(new ThemeResource(IconContainer.DELETE));
    removeTriggerButton.addClickListener((Button.ClickEvent event) -> {
        removeTrigger();
    });

    Button refreshTriggerButton = new Button();
    refreshTriggerButton.setDescription("Refresh the list of triggers.");
    refreshTriggerButton.setIcon(new ThemeResource(IconContainer.REFRESH));
    refreshTriggerButton.addClickListener((Button.ClickEvent event) -> {
        reloadTriggers();
    });

    VerticalLayout buttonLayout = new VerticalLayout(addTriggerButton, refreshTriggerButton,
            removeTriggerButton);
    buttonLayout.setComponentAlignment(addTriggerButton, Alignment.TOP_RIGHT);
    buttonLayout.setComponentAlignment(removeTriggerButton, Alignment.TOP_RIGHT);
    buttonLayout.setMargin(true);

    GridLayout triggerLayout = new UIUtils7.GridLayoutBuilder(2, 2).addComponent(getTriggerTable(), 0, 0, 1, 2)
            .addComponent(buttonLayout, 1, 0, 1, 2).getLayout();
    triggerLayout.setSizeFull();
    triggerLayout.setMargin(false);
    triggerLayout.setColumnExpandRatio(0, .95f);
    triggerLayout.setColumnExpandRatio(1, .05f);
    triggerLayout.setRowExpandRatio(0, .9f);
    triggerLayout.setRowExpandRatio(1, .05f);
    triggerLayout.setRowExpandRatio(2, .05f);

    //third row
    addComponent(triggerLayout, 0, 2, 2, 2);
    addTriggerComponent = new AddTriggerComponent(this);

    setRowExpandRatio(1, .3f);
    setRowExpandRatio(2, .6f);
}