Example usage for com.vaadin.ui Panel setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:edu.nps.moves.mmowgli.modules.actionplans.MediaSubWindow.java

License:Open Source License

public MediaSubWindow(Resource res) {
    setCaption("Action Plan Image");
    setModal(true);//from   w  ww.java  2 s . c  o  m
    setWidth("640px");
    setHeight("480px");

    TabSheet tabs = new TabSheet();
    tabs.setSizeFull();
    setContent(tabs);

    Panel pan = new Panel();
    tabs.addTab(pan, "Fit Window");
    pan.setSizeFull();

    VerticalLayout layout = new VerticalLayout();
    pan.setContent(layout);
    layout.setSizeFull();
    layout.addStyleName("m-background-lightgrey");
    layout.setMargin(false);

    image = new ScaleImage();
    image.setSizeFull();
    image.setSource(res);

    layout.addComponent(image);
    layout.setComponentAlignment(image, Alignment.MIDDLE_CENTER);
    layout.setExpandRatio(image, 1.0f);

    tabs.addTab(buildNestedImage(res), "Actual Size");
}

From source file:edu.nps.moves.mmowgli.modules.gamemaster.SetBlogHeadlineWindow.java

License:Open Source License

@Override
public void attach() {
    Panel p = new Panel();
    setContent(p);/*from www .  j a  v a 2s.co m*/
    p.setSizeFull();

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("m-blogheadline");
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setSizeFull();
    p.setContent(layout);

    layout.addComponent(infoLab = new Label(
            "Game masters can communicate with players throughout the game.  Add a new headling, tooltip and link here."));

    layout.addComponent(textLab = new Label("Enter headline:"));
    textTF = new TextField();
    textTF.setInputPrompt("Enter new headline or choose from previous ones below");
    textTF.setWidth("100%");
    textTF.addStyleName("m-blogtextfield");
    layout.addComponent(textTF);

    layout.addComponent(toolTipLab = new Label("Enter headline tooltip:"));
    toolTipTF = new TextField();
    toolTipTF.setWidth("100%");
    layout.addComponent(toolTipTF);

    layout.addComponent(urlLab = new Label("Enter blog entry url:"));
    urlTF = new TextField();
    urlTF.setWidth("100%");
    layout.addComponent(urlTF);

    table = new Table("Previous headlines");
    table.setSizeFull();
    table.setImmediate(true);
    table.setColumnExpandRatio("date", 1);
    table.setColumnExpandRatio("text", 1);
    table.setColumnExpandRatio("tooltip", 1);
    table.setColumnExpandRatio("url", 1);
    table.setSelectable(true);
    table.setMultiSelect(true); // return whole pojo
    table.addItemClickListener(this);
    table.setContainerDataSource(MessageUrl.getContainer());
    layout.addComponent(table);

    layout.addComponent(nullCheckBox);
    nullCheckBox.addValueChangeListener(new CBListener());
    HorizontalLayout buttHl = new HorizontalLayout();
    buttHl.setSpacing(true);
    buttHl.addComponent(cancelButt);
    buttHl.addComponent(okButt);
    layout.addComponent(buttHl);
    layout.setComponentAlignment(buttHl, Alignment.TOP_RIGHT);
    layout.setExpandRatio(table, 1.0f); // gets all
    setWidth("675px");
    setHeight("455px");
}

From source file:eu.lod2.stat.dsdrepo.DSDRepoComponent.java

public DSDRepoComponent(Repository repository, String dataGraph, String repoGraph) {
    this.repository = repository;
    this.dataGraph = dataGraph;
    this.repoGraph = repoGraph;

    initializeRepoGraph();//ww  w .  j av a2 s.  c  o m

    dcRepo = new SparqlDCRepository(repository);
    graph = new SparqlDCGraph(repository, dataGraph);

    setSizeFull();
    VerticalLayout rootLayout = new VerticalLayout();
    rootLayout.setSizeFull();
    rootLayout.setSpacing(true);
    setDebugId("dsd-repo");

    mainLayout = new VerticalLayout();
    mainLayout.setSizeUndefined();
    mainLayout.setWidth("100%");
    //        mainLayout.setHeight("800px");
    mainLayout.setSpacing(true);

    HorizontalLayout menuLayout = new HorizontalLayout();
    menuLayout.setSpacing(true);
    menuLayout.setWidth("100%");
    rootLayout.addComponent(menuLayout);
    rootLayout.setExpandRatio(menuLayout, 0.0f);

    final MenuBar menu = new MenuBar();
    menu.addStyleName("dsd");
    cmdFindDSD = new MenuBar.Command() {
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            for (MenuBar.MenuItem item : menu.getItems()) {
                if (item == selectedItem) {
                    if (!item.getStyleName().contains("selected")) {
                        if (ds != null)
                            item.setStyleName("selected");
                        findDSDs();
                    }
                } else
                    item.setStyleName("bleja");
            }
        }
    };
    menu.addItem("Find Suitable DSDs", cmdFindDSD).setStyleName("bleja");
    cmdCreateDSD = new MenuBar.Command() {
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            for (MenuBar.MenuItem item : menu.getItems()) {
                if (item == selectedItem) {
                    if (!item.getStyleName().contains("selected")) {
                        if (ds != null)
                            item.setStyleName("selected");
                        createDSD();
                    }
                } else
                    item.setStyleName("bleja");
            }
        }
    };
    menu.addItem("Create DSD", cmdCreateDSD).setStyleName("bleja");
    cmdStoreDSD = new MenuBar.Command() {
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            for (MenuBar.MenuItem item : menu.getItems()) {
                if (item == selectedItem) {
                    if (!item.getStyleName().contains("selected")) {
                        if (ds != null)
                            item.setStyleName("selected");
                        storeDSD();
                    }
                } else
                    item.setStyleName("bleja");
            }
        }
    };
    menu.addItem("Store DSD", cmdStoreDSD).setStyleName("bleja");

    menuLayout.addComponent(menu);
    Label spaceLbl = new Label("");
    menuLayout.addComponent(spaceLbl);
    menuLayout.setExpandRatio(spaceLbl, 2.0f);
    Label lbl = new Label("Choose dataset: ");
    lbl.setSizeUndefined();
    menuLayout.addComponent(lbl);

    Collection<DataSet> colDataSets = graph.getDataSets();
    if (colDataSets == null)
        colDataSets = new LinkedList<DataSet>();
    selectDataSet = new ComboBox(null, colDataSets);
    selectDataSet.setImmediate(true);
    selectDataSet.setNewItemsAllowed(false);
    selectDataSet.setNullSelectionAllowed(false);
    selectDataSet.setWidth("300px");
    selectDataSet.addListener(new Property.ValueChangeListener() {
        public void valueChange(Property.ValueChangeEvent event) {
            ds = (DataSet) event.getProperty().getValue();
        }
    });
    menuLayout.addComponent(selectDataSet);

    Panel mainPanel = new Panel(mainLayout);
    mainPanel.setSizeFull();
    mainPanel.setScrollable(true);
    mainPanel.setStyleName(Reindeer.PANEL_LIGHT);

    Label hrLabel = new Label("<hr/>", Label.CONTENT_XHTML);
    rootLayout.addComponent(hrLabel);
    rootLayout.setExpandRatio(hrLabel, 0.0f);
    rootLayout.addComponent(mainPanel);
    rootLayout.setExpandRatio(mainPanel, 2.0f);
    rootLayout.setMargin(true, false, true, false);

    setCompositionRoot(rootLayout);
}

From source file:eu.maxschuster.vaadin.signaturefield.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    getPage().setTitle(pageTitle);/*from w w w.  j av  a 2  s  .  c o m*/

    final VerticalLayout margin = new VerticalLayout();
    setContent(margin);

    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setWidth("658px");
    margin.addComponent(layout);
    margin.setComponentAlignment(layout, Alignment.TOP_CENTER);

    final Label header1 = new Label(pageTitle);
    header1.addStyleName("h1");
    header1.setSizeUndefined();
    layout.addComponent(header1);
    layout.setComponentAlignment(header1, Alignment.TOP_CENTER);

    final TabSheet tabSheet = new TabSheet();
    tabSheet.setWidth("100%");
    layout.addComponent(tabSheet);
    layout.setComponentAlignment(tabSheet, Alignment.TOP_CENTER);

    final Panel signaturePanel = new Panel();
    signaturePanel.addStyleName("signature-panel");
    signaturePanel.setWidth("100%");
    tabSheet.addTab(signaturePanel, "Demo");

    final VerticalLayout signatureLayout = new VerticalLayout();
    signatureLayout.setMargin(true);
    signatureLayout.setSpacing(true);
    signatureLayout.setSizeFull();
    signaturePanel.setContent(signatureLayout);

    final SignatureField signatureField = new SignatureField();
    signatureField.setWidth("100%");
    signatureField.setHeight("318px");
    signatureField.setPenColor(Color.ULTRAMARINE);
    signatureField.setBackgroundColor("white");
    signatureField.setConverter(new StringToDataUrlConverter());
    signatureField.setPropertyDataSource(dataUrlProperty);
    signatureField.setVelocityFilterWeight(0.7);
    signatureLayout.addComponent(signatureField);
    signatureLayout.setComponentAlignment(signatureField, Alignment.MIDDLE_CENTER);

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setWidth("100%");
    signatureLayout.addComponent(buttonLayout);

    final Button clearButton = new Button("Clear", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            signatureField.clear();
        }
    });
    buttonLayout.addComponent(clearButton);
    buttonLayout.setComponentAlignment(clearButton, Alignment.MIDDLE_LEFT);

    final Label message = new Label("Sign above");
    message.setSizeUndefined();
    buttonLayout.addComponent(message);
    buttonLayout.setComponentAlignment(message, Alignment.MIDDLE_CENTER);

    final ButtonLink saveButtonLink = new ButtonLink("Save", null);
    saveButtonLink.setTargetName("_blank");
    buttonLayout.addComponent(saveButtonLink);
    buttonLayout.setComponentAlignment(saveButtonLink, Alignment.MIDDLE_RIGHT);

    final Panel optionsPanel = new Panel();
    optionsPanel.setSizeFull();
    tabSheet.addTab(optionsPanel, "Options");

    final FormLayout optionsLayout = new FormLayout();
    optionsLayout.setMargin(true);
    optionsLayout.setSpacing(true);
    optionsPanel.setContent(optionsLayout);

    final ComboBox mimeTypeComboBox = new ComboBox(null, mimeTypeContainer);
    optionsLayout.addComponent(mimeTypeComboBox);
    mimeTypeComboBox.setItemCaptionPropertyId("mimeType");
    mimeTypeComboBox.setNullSelectionAllowed(false);
    mimeTypeComboBox.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            MimeType mimeType = (MimeType) event.getProperty().getValue();
            signatureField.setMimeType(mimeType);
        }
    });
    mimeTypeComboBox.setValue(MimeType.PNG);
    mimeTypeComboBox.setCaption("Result MIME-Type");

    final CheckBox immediateCheckBox = new CheckBox("immediate", false);
    optionsLayout.addComponent(immediateCheckBox);
    immediateCheckBox.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            boolean immediate = (Boolean) event.getProperty().getValue();
            signatureField.setImmediate(immediate);
        }
    });

    final CheckBox readOnlyCheckBox = new CheckBox("readOnly", false);
    optionsLayout.addComponent(readOnlyCheckBox);
    readOnlyCheckBox.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            boolean readOnly = (Boolean) event.getProperty().getValue();
            signatureField.setReadOnly(readOnly);
            mimeTypeComboBox.setReadOnly(readOnly);
            clearButton.setEnabled(!readOnly);
        }
    });

    final CheckBox requiredCheckBox = new CheckBox("required (causes bug that clears field)", false);
    optionsLayout.addComponent(requiredCheckBox);
    requiredCheckBox.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            boolean required = (Boolean) event.getProperty().getValue();
            signatureField.setRequired(required);
        }
    });

    final CheckBox clearButtonEnabledButton = new CheckBox("clearButtonEnabled", false);
    optionsLayout.addComponent(clearButtonEnabledButton);
    clearButtonEnabledButton.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            boolean clearButtonEnabled = (Boolean) event.getProperty().getValue();
            signatureField.setClearButtonEnabled(clearButtonEnabled);
        }
    });

    final Panel resultPanel = new Panel("Results:");
    resultPanel.setWidth("100%");
    layout.addComponent(resultPanel);

    final VerticalLayout resultLayout = new VerticalLayout();
    resultLayout.setMargin(true);
    resultPanel.setContent(resultLayout);

    final Image stringPreviewImage = new Image("String preview image:");
    stringPreviewImage.setWidth("500px");
    resultLayout.addComponent(stringPreviewImage);

    final Image dataUrlPreviewImage = new Image("DataURL preview image:");
    dataUrlPreviewImage.setWidth("500px");
    resultLayout.addComponent(dataUrlPreviewImage);

    final TextArea textArea = new TextArea("DataURL:");
    textArea.setWidth("100%");
    textArea.setHeight("300px");
    resultLayout.addComponent(textArea);

    final Label emptyLabel = new Label();
    emptyLabel.setCaption("Is Empty:");
    emptyLabel.setValue(String.valueOf(signatureField.isEmpty()));
    resultLayout.addComponent(emptyLabel);

    signatureField.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            String signature = (String) event.getProperty().getValue();
            stringPreviewImage.setSource(signature != null ? new ExternalResource(signature) : null);
            textArea.setValue(signature);
            emptyLabel.setValue(String.valueOf(signatureField.isEmpty()));
        }
    });
    dataUrlProperty.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            try {
                final DataUrl signature = (DataUrl) event.getProperty().getValue();
                dataUrlPreviewImage.setSource(
                        signature != null ? new ExternalResource(serializer.serialize(signature)) : null);
                StreamResource streamResource = null;
                if (signature != null) {
                    StreamSource streamSource = new StreamSource() {

                        @Override
                        public InputStream getStream() {
                            return new ByteArrayInputStream(signature.getData());
                        }
                    };
                    MimeType mimeType = MimeType.valueOfMimeType(signature.getMimeType());
                    String extension = null;

                    switch (mimeType) {
                    case JPEG:
                        extension = "jpg";
                        break;
                    case PNG:
                        extension = "png";
                        break;
                    }

                    streamResource = new StreamResource(streamSource, "signature." + extension);
                    streamResource.setMIMEType(signature.getMimeType());
                    streamResource.setCacheTime(0);
                }
                saveButtonLink.setResource(streamResource);
            } catch (MalformedURLException e) {
                logger.error(e.getMessage(), e);
            }
        }
    });
}

From source file:eu.unifiedviews.plugins.transformer.metadata.MetadataVaadinDialog.java

License:Creative Commons License

@Override
protected void buildDialogLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(true);/*from   w ww.  ja v a2s .  co m*/
    mainLayout.setWidth("100%");
    mainLayout.setHeight(null);
    mainLayout.setMargin(false);
    //mainLayout.setSpacing(true);

    // top-level component properties
    setWidth("100%");
    setHeight("100%");

    txtOutSymbolicName = new TextField();
    txtOutSymbolicName.setCaption("Output graph name:");
    txtOutSymbolicName.setWidth("100%");
    mainLayout.addComponent(txtOutSymbolicName);

    tfComsodeDatasetId = new TextField();
    tfComsodeDatasetId.setCaption("COMSODE Dataset ID (will be used as part of the URI)");
    tfComsodeDatasetId.setWidth("100%");
    tfComsodeDatasetId.setInputPrompt("MICR_3");
    mainLayout.addComponent(tfComsodeDatasetId);

    tfDatasetUri = new TextField();
    tfDatasetUri.setCaption("Dataset URI:");
    tfDatasetUri.setWidth("100%");
    mainLayout.addComponent(tfDatasetUri);

    tfDistributionUri = new TextField();
    tfDistributionUri.setCaption("Distribution URI:");
    tfDistributionUri.setWidth("100%");
    mainLayout.addComponent(tfDistributionUri);

    tfDataDumpUrl = new TextField();
    tfDataDumpUrl.setCaption("Data dump URL:");
    tfDataDumpUrl.setWidth("100%");
    mainLayout.addComponent(tfDataDumpUrl);

    cbMime = new ComboBox();
    cbMime.setCaption("Media Type:");
    cbMime.setNewItemsAllowed(false);
    cbMime.setNullSelectionAllowed(false);
    cbMime.setWidth("100%");
    for (String u : mimes) {
        cbMime.addItem(u);
    }
    mainLayout.addComponent(cbMime);

    tfSparqlEndpointUrl = new TextField();
    tfSparqlEndpointUrl.setCaption("Sparql Endpoint URI:");
    tfSparqlEndpointUrl.setWidth("100%");
    tfSparqlEndpointUrl.setNullRepresentation("");
    tfSparqlEndpointUrl.setNullSettingAllowed(true);
    mainLayout.addComponent(tfSparqlEndpointUrl);

    tfContactPoint = new TextField();
    tfContactPoint.setCaption("Contact Point URL:");
    tfContactPoint.setWidth("100%");
    mainLayout.addComponent(tfContactPoint);

    tfLanguage = new TextField();
    tfLanguage.setCaption("Original language - RDF language tag:");
    tfLanguage.setInputPrompt("cs|sk|it");
    tfLanguage.setWidth("100%");
    mainLayout.addComponent(tfLanguage);

    tfTitle = new TextField();
    tfTitle.setCaption("Title original language:");
    tfTitle.setWidth("100%");
    mainLayout.addComponent(tfTitle);

    tfTitleEn = new TextField();
    tfTitleEn.setCaption("Title in English:");
    tfTitleEn.setWidth("100%");
    mainLayout.addComponent(tfTitleEn);

    tfDesc = new TextField();
    tfDesc.setCaption("Description original language:");
    tfDesc.setWidth("100%");
    mainLayout.addComponent(tfDesc);

    tfDescEn = new TextField();
    tfDescEn.setCaption("Description in English:");
    tfDescEn.setWidth("100%");
    mainLayout.addComponent(tfDescEn);

    chkQb = new CheckBox();
    chkQb.setCaption("Dataset is RDF Data Cube");
    chkQb.setWidth("100%");
    mainLayout.addComponent(chkQb);

    dfModified = new DateField();
    dfModified.setCaption("Modified:");
    dfModified.setWidth("100%");
    dfModified.setResolution(Resolution.DAY);
    mainLayout.addComponent(dfModified);

    chkNow = new CheckBox();
    chkNow.setCaption("Always use current date instead");
    chkNow.setWidth("100%");
    mainLayout.addComponent(chkNow);

    cbPeriodicity = new ComboBox();
    cbPeriodicity.setCaption("Periodicity:");
    cbPeriodicity.setNewItemsAllowed(false);
    cbPeriodicity.setNullSelectionAllowed(false);
    cbPeriodicity.setItemCaptionMode(ItemCaptionMode.EXPLICIT);
    cbPeriodicity.setWidth("100%");
    for (URLandCaption u : periodicities) {
        cbPeriodicity.addItem(u.url.toString());
        cbPeriodicity.setItemCaption(u.url.toString(), u.caption);
    }
    mainLayout.addComponent(cbPeriodicity);

    tcsLicenses = new TwinColSelect();
    tcsLicenses.setWidth("97%");
    tcsLicenses.setNewItemsAllowed(true);
    tcsLicenses.setLeftColumnCaption("Available licenses");
    tcsLicenses.setRightColumnCaption("Selected licenses");
    mainLayout.addComponent(tcsLicenses);

    tcsExamples = new TwinColSelect();
    tcsExamples.setWidth("97%");
    tcsExamples.setNewItemsAllowed(true);
    tcsExamples.setLeftColumnCaption("Available example resources");
    tcsExamples.setRightColumnCaption("Selected example resources");
    mainLayout.addComponent(tcsExamples);

    tcsSources = new TwinColSelect();
    tcsSources.setWidth("97%");
    tcsSources.setNewItemsAllowed(true);
    tcsSources.setLeftColumnCaption("Available sources");
    tcsSources.setRightColumnCaption("Selected sources");
    mainLayout.addComponent(tcsSources);

    tcsKeywords = new TwinColSelect();
    tcsKeywords.setWidth("97%");
    tcsKeywords.setNewItemsAllowed(true);
    tcsKeywords.setLeftColumnCaption("Available keywords");
    tcsKeywords.setRightColumnCaption("Selected keywords");
    mainLayout.addComponent(tcsKeywords);

    tcsThemes = new TwinColSelect();
    tcsThemes.setWidth("97%");
    tcsThemes.setNewItemsAllowed(true);
    tcsThemes.setLeftColumnCaption("Available themes");
    tcsThemes.setRightColumnCaption("Selected themes");
    mainLayout.addComponent(tcsThemes);

    tcsLanguages = new TwinColSelect();
    tcsLanguages.setWidth("97%");
    tcsLanguages.setNewItemsAllowed(true);
    tcsLanguages.setLeftColumnCaption("Available languages");
    tcsLanguages.setRightColumnCaption("Selected languages");
    mainLayout.addComponent(tcsLanguages);

    tcsAuthors = new TwinColSelect();
    tcsAuthors.setWidth("97%");
    tcsAuthors.setNewItemsAllowed(true);
    tcsAuthors.setLeftColumnCaption("Available authors");
    tcsAuthors.setRightColumnCaption("Selected authors");
    mainLayout.addComponent(tcsAuthors);

    tcsPublishers = new TwinColSelect();
    tcsPublishers.setWidth("97%");
    tcsPublishers.setNewItemsAllowed(true);
    tcsPublishers.setLeftColumnCaption("Available publishers");
    tcsPublishers.setRightColumnCaption("Selected publishers");
    mainLayout.addComponent(tcsPublishers);

    Panel p = new Panel();
    p.setSizeFull();
    p.setContent(mainLayout);

    setCompositionRoot(p);
}

From source file:fi.jasoft.dragdroplayouts.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();//w w  w  .  j a  v  a 2  s .com
    setContent(content);

    Label header = new Label("DragDropLayouts for Vaadin 8");
    header.setStyleName(ValoTheme.LABEL_H1);
    content.addComponent(header);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSizeFull();
    content.addComponent(hl);
    content.setExpandRatio(hl, 1);

    VerticalSplitPanel split = new VerticalSplitPanel();
    hl.addComponent(split);
    hl.setExpandRatio(split, 1);

    CssLayout placeHolder = new CssLayout(new Label("No view selected."));
    placeHolder.setSizeFull();
    split.setFirstComponent(placeHolder);

    Panel codePanel = new Panel(codeLabel);
    codePanel.setSizeFull();
    split.setSecondComponent(codePanel);

    navigator = new Navigator(this, placeHolder);

    navigator.addViewChangeListener(new ViewChangeListener() {

        @Override
        public boolean beforeViewChange(ViewChangeEvent event) {
            DemoView view = (DemoView) event.getNewView();
            selection.getSelectionModel().select(view);
            codeLabel.setValue(getFormattedSourceCode(view.getSource()));
            return true;
        }

        @Override
        public void afterViewChange(ViewChangeEvent event) {
            // TODO Auto-generated method stub

        }
    });

    try {
        addView(new DragdropAbsoluteLayoutDemo(navigator));
        addView(new DragdropVerticalLayoutDemo(navigator));
        addView(new DragdropHorizontalLayoutDemo(navigator));
        addView(new DragdropGridLayoutDemo(navigator));
        addView(new DragdropCssLayoutDemo(navigator));
        addView(new DragdropFormLayoutDemo(navigator));
        addView(new DragdropPanelDemo(navigator));

        addView(new DragdropLayoutDraggingDemo(navigator));
        addView(new DragdropHorizontalSplitPanelDemo(navigator));
        addView(new DragdropVerticalSplitPanelDemo(navigator));
        addView(new DragdropTabsheetDemo(navigator));
        addView(new DragdropAccordionDemo(navigator));

        addView(new DragdropDragFilterDemo(navigator));
        addView(new DragdropCaptionModeDemo(navigator));

        addView(new DragdropV7VerticalLayoutDemo(navigator));
        addView(new DragdropV7HorizontalLayoutDemo(navigator));

        // addView(new DragdropIframeDragging(navigator));

    } catch (Exception e) {
        e.printStackTrace();
        return;
    }

    hl.addComponent(selection = createViewSelection(), 0);

    String fragment = Page.getCurrent().getUriFragment();
    if (fragment == null || fragment.equals("")) {
        navigator.navigateTo(DragdropAbsoluteLayoutDemo.NAME);
    }
}

From source file:fi.jasoft.qrcode.demo.QRCodeDemo.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();//from  www  . j a  va  2 s.c om
    setContent(content);

    Label header = new Label("QR Code Generator");
    header.setStyleName(ValoTheme.LABEL_H2);
    content.addComponent(header);

    HorizontalSplitPanel root = new HorizontalSplitPanel();
    root.setSizeFull();
    root.setSplitPosition(50, Unit.PERCENTAGE);
    root.setLocked(true);

    Panel panel = new Panel(root);
    panel.setSizeFull();
    content.addComponent(panel);
    content.setExpandRatio(panel, 1);

    VerticalLayout first = new VerticalLayout();
    first.setSizeFull();
    root.setFirstComponent(first);

    first.addComponent(
            new HorizontalLayout(createPrimaryColorSelect(), createSecondaryColorSelect(), createSizeSelect()));

    code = new QRCode();
    code.setWidth("100px");
    code.setHeight("100px");

    final TextArea text = new TextArea("Text embedded in QR Code");
    text.setPlaceholder("Type the message of the QR code here");
    text.setSizeFull();
    text.setValueChangeMode(ValueChangeMode.LAZY);
    text.addValueChangeListener(e -> {
        code.setValue(e.getValue());
    });

    first.addComponent(text);
    first.setExpandRatio(text, 1);

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

    vl.addComponent(code);
    vl.setComponentAlignment(code, Alignment.MIDDLE_CENTER);

    root.setSecondComponent(vl);
}

From source file:fr.univlorraine.mondossierweb.views.CalendrierMobileView.java

License:Apache License

public void refresh() {
    //On vrifie le droit d'accder  la vue
    if (UI.getCurrent() instanceof MdwTouchkitUI
            && (userController.isEnseignant() || userController.isEtudiant())
            && MdwTouchkitUI.getCurrent() != null && MdwTouchkitUI.getCurrent().getEtudiant() != null) {
        removeAllComponents();//  ww  w  . ja  v a  2 s . c o  m

        /* Style */
        setMargin(false);
        setSpacing(false);
        setSizeFull();

        //NAVBAR
        HorizontalLayout navbar = new HorizontalLayout();
        navbar.setSizeFull();
        navbar.setHeight("40px");
        navbar.setStyleName("navigation-bar");

        //Bouton retour
        if (userController.isEnseignant()) {
            returnButton = new Button();
            returnButton.setIcon(FontAwesome.ARROW_LEFT);
            //returnButton.setStyleName(ValoTheme.BUTTON_ICON_ONLY);
            returnButton.setStyleName("v-nav-button");
            returnButton.addClickListener(e -> {
                if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent()
                        .getDossierEtuFromView().equals(ListeInscritsMobileView.NAME)) {
                    MdwTouchkitUI.getCurrent().navigateToListeInscrits();
                }

                if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent()
                        .getDossierEtuFromView().equals(RechercheMobileView.NAME)) {
                    MdwTouchkitUI.getCurrent().navigateToRecherche(null);
                }
            });
            navbar.addComponent(returnButton);
            navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT);
        }

        //Title
        Label labelNavBar = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom());
        labelNavBar.setStyleName("v-label-navbar");
        navbar.addComponent(labelNavBar);
        navbar.setComponentAlignment(labelNavBar, Alignment.MIDDLE_CENTER);

        navbar.setExpandRatio(labelNavBar, 1);
        addComponent(navbar);

        VerticalLayout globalLayout = new VerticalLayout();
        //globalLayout.setSizeFull();
        globalLayout.setSpacing(true);
        globalLayout.setMargin(true);
        globalLayout.setStyleName("v-scrollableelement");

        if (MdwTouchkitUI.getCurrent().getEtudiant() != null
                && MdwTouchkitUI.getCurrent().getEtudiant().getCalendrier() != null
                && MdwTouchkitUI.getCurrent().getEtudiant().getCalendrier().size() > 0) {

            List<Examen> listeExam = MdwTouchkitUI.getCurrent().getEtudiant().getCalendrier();

            for (Examen exam : listeExam) {
                Panel panelCalendrier = new Panel();
                panelCalendrier.setSizeFull();
                HorizontalLayout labelExamenLayout = new HorizontalLayout();
                labelExamenLayout.setMargin(true);
                labelExamenLayout.setSpacing(true);
                labelExamenLayout.setSizeFull();

                //Dtail de l'preuve
                VerticalLayout detailLayout = new VerticalLayout();
                detailLayout.setSizeFull();
                //ajout de la date
                Label dateLabel = new Label(exam.getDatedeb());
                dateLabel.setStyleName(ValoTheme.LABEL_BOLD);
                detailLayout.addComponent(dateLabel);
                dateLabel.addStyleName("v-label-align-right");

                //ajout de l'heure
                Label heureLabel = new Label(exam.getHeure());
                detailLayout.addComponent(heureLabel);
                heureLabel.setStyleName("v-label-align-right");

                //ajout de la salle
                Label salleLabel = new Label(exam.getLibsalle());
                detailLayout.addComponent(salleLabel);
                salleLabel.setStyleName("v-label-align-right");

                //ajout du batiment
                Label batimentLabel = new Label(exam.getBatiment());
                detailLayout.addComponent(batimentLabel);
                batimentLabel.setStyleName("v-label-align-right");

                //Libelle de l'preuve
                VerticalLayout libelleLayout = new VerticalLayout();
                libelleLayout.setSizeFull();
                Label libLabel = new Label(exam.getEpreuve());
                libLabel.setSizeFull();
                libLabel.setStyleName(ValoTheme.LABEL_BOLD);
                libelleLayout.addComponent(new Label(""));
                libelleLayout.addComponent(libLabel);

                //Ajout des 2 layouts dans le layout principal 
                labelExamenLayout.addComponent(detailLayout);
                labelExamenLayout.addComponent(libelleLayout);

                //Ajout du layout principal dans le panel
                panelCalendrier.setContent(labelExamenLayout);

                //Ajout du panel  la vue
                globalLayout.addComponent(panelCalendrier);

            }

        } else {
            Panel panelCalendrier = new Panel();
            panelCalendrier.setSizeFull();
            HorizontalLayout labelExamenLayout = new HorizontalLayout();
            labelExamenLayout.setMargin(true);
            labelExamenLayout.setSizeFull();
            Label aucunExamen = new Label(
                    applicationContext.getMessage(NAME + ".examen.aucun", null, getLocale()));
            aucunExamen.setStyleName(ValoTheme.LABEL_COLORED);
            aucunExamen.addStyleName(ValoTheme.LABEL_BOLD);
            aucunExamen.setWidth("100%");
            aucunExamen.addStyleName("label-centre");
            labelExamenLayout.addComponent(aucunExamen);
            panelCalendrier.setContent(labelExamenLayout);
            globalLayout.addComponent(panelCalendrier);
        }

        addComponent(globalLayout);
        setExpandRatio(globalLayout, 1);
    }
}

From source file:fr.univlorraine.mondossierweb.views.CalendrierView.java

License:Apache License

/**
 * Initialise la vue/*w ww  . ja v  a2  s  . c  o m*/
 */
@PostConstruct
public void init() {
    //On vrifie le droit d'accder  la vue
    if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant())
            && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) {
        /* Style */
        setMargin(true);
        setSpacing(true);

        //Si on n'a pas dj essayer de rcuprer le calendrier
        if (!MainUI.getCurrent().getEtudiant().isCalendrierRecupere()) {
            etudiantController.recupererCalendrierExamens();
        }

        /* Titre */
        HorizontalLayout titleLayout = new HorizontalLayout();
        titleLayout.setWidth("100%");
        Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale()));
        title.addStyleName(ValoTheme.LABEL_H1);
        titleLayout.addComponent(title);
        titleLayout.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
        //Test si on a des diplomes ou des etapes
        if (MainUI.getCurrent().getEtudiant().getCalendrier() != null
                && MainUI.getCurrent().getEtudiant().getCalendrier().size() > 0) {
            Button pdfButton = new Button();
            pdfButton.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
            pdfButton.addStyleName("button-big-icon");
            pdfButton.addStyleName("red-button-icon");
            pdfButton.setIcon(FontAwesome.FILE_PDF_O);
            pdfButton.setDescription(
                    applicationContext.getMessage(NAME + ".btn.pdf.description", null, getLocale()));
            if (PropertyUtils.isPushEnabled()) {
                MyFileDownloader fd = new MyFileDownloader(calendrierController.exportPdf());
                fd.extend(pdfButton);
            } else {
                FileDownloader fd = new FileDownloader(calendrierController.exportPdf());
                fd.setOverrideContentType(false);
                fd.extend(pdfButton);
            }
            titleLayout.addComponent(pdfButton);
            titleLayout.setComponentAlignment(pdfButton, Alignment.MIDDLE_RIGHT);
        }
        addComponent(titleLayout);

        VerticalLayout globalLayout = new VerticalLayout();
        globalLayout.setSizeFull();
        globalLayout.setSpacing(true);

        /* Message d'info */
        if (applicationContext.getMessage(NAME + ".message.info", null, getLocale()) != null) {
            Panel panelVue = new Panel();

            HorizontalLayout vueLayout = new HorizontalLayout();
            vueLayout.setMargin(true);
            vueLayout.setSpacing(true);
            vueLayout.setSizeFull();

            Label vueLabel = new Label(
                    applicationContext.getMessage(NAME + ".message.info", null, getLocale()));
            vueLabel.setContentMode(ContentMode.HTML);
            vueLabel.setStyleName(ValoTheme.LABEL_SMALL);
            vueLayout.addComponent(vueLabel);
            vueLayout.setExpandRatio(vueLabel, 1);

            panelVue.setContent(vueLayout);
            globalLayout.addComponent(panelVue);
        }

        /* Le Calendrier */
        Panel panelCalendrier = new Panel(
                applicationContext.getMessage(NAME + ".calendrier.title", null, getLocale()));
        panelCalendrier.setSizeFull();

        if (MainUI.getCurrent().getEtudiant() != null
                && MainUI.getCurrent().getEtudiant().getCalendrier() != null
                && MainUI.getCurrent().getEtudiant().getCalendrier().size() > 0) {

            BeanItemContainer<Examen> bic = new BeanItemContainer<>(Examen.class,
                    MainUI.getCurrent().getEtudiant().getCalendrier());
            Table calendrierTable = new Table(null, bic);
            calendrierTable.setWidth("100%");
            String[] colonnes_to_create = CAL_FIELDS;
            if (configController.isAffNumPlaceExamen()) {
                colonnes_to_create = CAL_FIELDS_AVEC_PLACE;
            }
            for (String fieldName : colonnes_to_create) {
                calendrierTable.setColumnHeader(fieldName,
                        applicationContext.getMessage(NAME + ".table." + fieldName, null, getLocale()));
            }
            calendrierTable.addGeneratedColumn("batiment", new BatimentColumnGenerator());
            calendrierTable.addGeneratedColumn("salle", new SalleColumnGenerator());
            calendrierTable.setColumnHeader("batiment",
                    applicationContext.getMessage(NAME + ".table.batiment", null, getLocale()));
            calendrierTable.setColumnHeader("salle",
                    applicationContext.getMessage(NAME + ".table.salle", null, getLocale()));
            String[] colonnes_to_display = CAL_FIELDS_ORDER;
            if (configController.isAffNumPlaceExamen()) {
                colonnes_to_display = CAL_FIELDS_ORDER_AVEC_PLACE;
            }
            calendrierTable.setVisibleColumns((Object[]) colonnes_to_display);
            calendrierTable.setColumnCollapsingAllowed(true);
            calendrierTable.setColumnReorderingAllowed(true);
            calendrierTable.setSelectable(false);
            calendrierTable.setImmediate(true);
            calendrierTable.setStyleName("noscrollabletable");
            calendrierTable.setPageLength(calendrierTable.getItemIds().size());

            panelCalendrier.setContent(calendrierTable);
        } else {
            HorizontalLayout labelExamenLayout = new HorizontalLayout();
            labelExamenLayout.setMargin(true);
            labelExamenLayout.setSizeFull();
            Label aucunExamen = new Label(
                    applicationContext.getMessage(NAME + ".examen.aucun", null, getLocale()));
            aucunExamen.setStyleName(ValoTheme.LABEL_COLORED);
            aucunExamen.addStyleName(ValoTheme.LABEL_BOLD);
            labelExamenLayout.addComponent(aucunExamen);
            panelCalendrier.setContent(labelExamenLayout);
        }
        globalLayout.addComponent(panelCalendrier);

        addComponent(globalLayout);
    }
}

From source file:fr.univlorraine.mondossierweb.views.FavorisMobileView.java

License:Apache License

/**
 * Initialise la vue//  w  w  w . j  a va  2  s  .  c  om
 */
@PostConstruct
public void init() {

    //On vrifie le droit d'accder  la vue
    if (UI.getCurrent() instanceof MdwTouchkitUI && userController.isEnseignant()) {
        removeAllComponents();

        /* Style */
        setSizeFull();

        liste_types_inscrits = new LinkedList<String>();
        liste_types_inscrits.add("ELP");
        liste_types_inscrits.add("VET");

        liste_type_arbo = new LinkedList<String>();
        liste_type_arbo.add("CMP");
        liste_type_arbo.add("VET");

        List<Favoris> lfav = favorisController.getFavoris();

        //NAVBAR
        HorizontalLayout navbar = new HorizontalLayout();
        navbar.setSizeFull();
        navbar.setHeight("40px");
        navbar.setStyleName("navigation-bar");

        //Bouton info
        infoButton = new Button();
        infoButton.setIcon(FontAwesome.INFO);
        infoButton.setStyleName("v-nav-button");
        infoButton.addClickListener(e -> {
            /**
             * NOUVELLE VERSION
             */
            Notification note = new Notification(
                    applicationContext.getMessage("helpWindowMobile.text.enseignant", null, getLocale()), "",
                    Notification.TYPE_TRAY_NOTIFICATION, true);
            note.setPosition(Position.MIDDLE_CENTER);
            note.setDelayMsec(6000);
            note.show(UI.getCurrent().getPage());
            /**
             * ANCIENNE VERSION
             */
            /*
            //afficher message
            HelpMobileWindow hbw = new HelpMobileWindow(applicationContext.getMessage("helpWindowMobile.text.enseignant", null, getLocale()),applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()),false);
                    
            UI.getCurrent().addWindow(hbw);
            */
        });
        navbar.addComponent(infoButton);
        navbar.setComponentAlignment(infoButton, Alignment.MIDDLE_LEFT);

        //Title
        Label labelFav = new Label(applicationContext.getMessage(NAME + ".title.label", null, getLocale()));
        labelFav.setStyleName("v-label-navbar");
        navbar.addComponent(labelFav);
        navbar.setComponentAlignment(labelFav, Alignment.MIDDLE_CENTER);

        //Bouton Search
        Button searchButton = new Button();
        searchButton.setIcon(FontAwesome.SEARCH);
        searchButton.setStyleName("v-nav-button");
        navbar.addComponent(searchButton);
        navbar.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT);
        searchButton.addClickListener(e -> {
            ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME);
        });
        navbar.setExpandRatio(labelFav, 1);
        addComponent(navbar);

        VerticalLayout globalLayout = new VerticalLayout();
        globalLayout.setSizeFull();
        globalLayout.setSpacing(true);
        globalLayout.setMargin(true);

        FormLayout labelLayout = new FormLayout();
        labelLayout.setSizeFull();
        labelLayout.setMargin(false);
        labelLayout.setSpacing(false);

        Label infoLabel = new Label(applicationContext.getMessage(NAME + ".info.label", null, getLocale()));
        infoLabel.setStyleName(ValoTheme.LABEL_SMALL);
        infoLabel.setIcon(FontAwesome.INFO_CIRCLE);
        infoLabel.setWidth("100%");

        labelLayout.addComponent(infoLabel);
        globalLayout.addComponent(labelLayout);

        if (lfav != null && lfav.size() > 0) {
            if (favorisContientVet(lfav)) {

                Panel vetPanel = new Panel(
                        applicationContext.getMessage(NAME + ".vetpanel.title", null, getLocale()));
                vetPanel.setStyleName("centertitle-panel");
                vetPanel.addStyleName("v-colored-panel-caption");
                vetPanel.setSizeFull();

                VerticalLayout vetLayout = new VerticalLayout();
                vetLayout.setSizeFull();
                vetLayout.setHeight(null);
                int i = 0;
                for (Favoris fav : lfav) {
                    if (fav.getId().getTypfav().equals(Utils.VET)) {
                        i++;

                        HorizontalLayout favVetLayout = new HorizontalLayout();
                        favVetLayout.setSizeFull();
                        favVetLayout.setMargin(true);
                        favVetLayout.setSpacing(true);
                        favVetLayout.setStyleName("v-layout-multiline");
                        favVetLayout.setWidth("100%");
                        favVetLayout.setHeight("100%");

                        Button codeButton = new Button(fav.getId().getIdfav());
                        codeButton.setCaption(fav.getId().getIdfav());
                        Utils.setButtonStyle(codeButton);
                        codeButton.setWidth("90px");
                        codeButton.addClickListener(e -> {
                            accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav());
                        });

                        Button libButton = new Button(favorisController.getLibObjFavori(fav.getId().getTypfav(),
                                fav.getId().getIdfav()));
                        Utils.setButtonStyle(libButton);
                        libButton.setHeight("100%");
                        libButton.setWidth("100%");
                        libButton.addClickListener(e -> {
                            accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav());
                        });

                        favVetLayout.addComponent(codeButton);
                        //favVetLayout.setComponentAlignment(codeButton, Alignment.MIDDLE_CENTER);
                        favVetLayout.addComponent(libButton);
                        favVetLayout.setComponentAlignment(libButton, Alignment.MIDDLE_CENTER);
                        favVetLayout.setExpandRatio(libButton, 1);
                        vetLayout.addComponent(favVetLayout);
                        if (i > 1) {
                            favVetLayout.addStyleName("line-separator");
                        }
                    }
                }
                vetPanel.setContent(vetLayout);
                globalLayout.addComponent(vetPanel);

            }

            if (favorisContientElp(lfav)) {
                Panel elpPanel = new Panel(
                        applicationContext.getMessage(NAME + ".elppanel.title", null, getLocale()));
                elpPanel.setStyleName("centertitle-panel");
                elpPanel.addStyleName("v-colored-panel-caption");
                elpPanel.setSizeFull();

                VerticalLayout elpLayout = new VerticalLayout();
                elpLayout.setSizeFull();
                elpLayout.setHeight(null);
                int i = 0;
                for (Favoris fav : lfav) {
                    if (fav.getId().getTypfav().equals(Utils.ELP)) {
                        i++;
                        HorizontalLayout favElpLayout = new HorizontalLayout();
                        favElpLayout.setSizeFull();
                        favElpLayout.setMargin(true);
                        favElpLayout.setSpacing(true);
                        favElpLayout.setStyleName("v-layout-multiline");
                        favElpLayout.setWidth("100%");
                        favElpLayout.setHeight("100%");

                        Button codeButton = new Button(fav.getId().getIdfav());
                        Utils.setButtonStyle(codeButton);
                        codeButton.setWidth("90px");
                        codeButton.addClickListener(e -> {
                            accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav());
                        });

                        Button libButton = new Button(favorisController.getLibObjFavori(fav.getId().getTypfav(),
                                fav.getId().getIdfav()));
                        Utils.setButtonStyle(libButton);
                        libButton.setHeight("100%");
                        libButton.setWidth("100%");
                        libButton.addClickListener(e -> {
                            accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav());
                        });

                        favElpLayout.addComponent(codeButton);
                        favElpLayout.addComponent(libButton);
                        favElpLayout.setComponentAlignment(libButton, Alignment.MIDDLE_CENTER);
                        favElpLayout.setExpandRatio(libButton, 1);
                        elpLayout.addComponent(favElpLayout);
                        if (i > 1) {
                            favElpLayout.addStyleName("line-separator");
                        }
                    }
                }
                elpPanel.setContent(elpLayout);
                globalLayout.addComponent(elpPanel);
            }

        }

        labelAucunFavoriLayout = new HorizontalLayout();
        labelAucunFavoriLayout.setMargin(true);
        labelAucunFavoriLayout.setSizeFull();
        Button aucunFavoris = new Button(
                applicationContext.getMessage(NAME + ".favoris.aucun", null, getLocale()));
        aucunFavoris.setStyleName("v-nav-button");
        aucunFavoris.addStyleName(ValoTheme.BUTTON_LINK);
        aucunFavoris.addClickListener(e -> {
            ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME);
        });

        labelAucunFavoriLayout.addComponent(aucunFavoris);
        labelAucunFavoriLayout.setVisible(false);
        globalLayout.addComponent(labelAucunFavoriLayout);

        if (lfav == null || lfav.size() == 0) {
            labelAucunFavoriLayout.setVisible(true);
        }

        //addComponent(globalLayout);
        contentLayout.setStyleName("v-scrollableelement");
        contentLayout.addComponent(globalLayout);
        addComponent(contentLayout);
        setExpandRatio(contentLayout, 1);

    }
}