Example usage for com.vaadin.ui Embedded setType

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

Introduction

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

Prototype

public void setType(int type) 

Source Link

Document

Sets the object type.

Usage

From source file:org.processbase.ui.servlet.MainWindow.java

License:Open Source License

Layout getHeader() {
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth("100%");
    header.setMargin(false);//from w w  w . j a v a 2s .  c  o m
    header.setSpacing(true);

    ThemeResource themeResource = new ThemeResource("icons/processbase.png");
    Embedded logo = new Embedded();
    logo.setSource(themeResource);
    logo.setType(Embedded.TYPE_IMAGE);

    header.addComponent(logo);
    header.setExpandRatio(logo, 1.0f);

    Label helloUser = new Label("Welcome, " + user.getFirstName() + " " + user.getLastName());
    //        helloUser.setStyleName(Runo.LABEL_H2);
    header.addComponent(helloUser);
    header.setComponentAlignment(helloUser, Alignment.MIDDLE_RIGHT);
    header.setExpandRatio(helloUser, 1.0f);

    Button profile = new Button(((PbApplication) getApplication()).getPbMessages().getString("btnProfile"),
            new Button.ClickListener() {

                public void buttonClick(ClickEvent event) {
                    openProfileWindow();
                }
            });
    profile.setStyleName(Runo.BUTTON_LINK);
    header.addComponent(profile);
    header.setComponentAlignment(profile, Alignment.MIDDLE_RIGHT);

    Button logout = new Button(((PbApplication) getApplication()).getPbMessages().getString("btnLogout"),
            new Button.ClickListener() {

                public void buttonClick(ClickEvent event) {
                    openLogoutWindow();
                }
            });
    logout.setStyleName(Runo.BUTTON_LINK);
    header.addComponent(logout);
    header.setComponentAlignment(logout, Alignment.MIDDLE_RIGHT);

    return header;
}

From source file:org.universAAL.ucc.controller.desktop.ToolController.java

public void buttonClick(ClickEvent event) {
    if (event.getButton() == toolWin.getuStoreButton()) {
        Embedded em = new Embedded("", new ExternalResource(createLink()));
        em.setType(Embedded.TYPE_BROWSER);
        em.setWidth("100%");
        em.setHeight("850px");
        Window w = new Window("uStore");
        w.setWidth("1250px");
        w.setHeight("800px");
        VerticalLayout v = new VerticalLayout();
        w.center();/*from  w  w w .j  a va 2s.  c  o m*/
        v.addComponent(em);
        w.setContent(v);
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(w);
    }
    if (event.getButton() == toolWin.getOpenAAL()) {
        //         Embedded em = new Embedded("", new ExternalResource(
        //               "http://wiki.openaal.org"));
        //         em.setType(Embedded.TYPE_BROWSER);
        //         em.setWidth("100%");
        //         em.setHeight("800px");
        //         Window w = new Window("openAAL");
        //         w.setWidth("1250px");
        //         w.setHeight("800px");
        //         VerticalLayout v = new VerticalLayout();
        //         w.center();
        //         v.addComponent(em);
        //         w.setContent(v);
        BrowseServicesWindow pw = new BrowseServicesWindow(app);
        PurchasedServicesController pc = new PurchasedServicesController(pw, app);
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(pw);
    }
    if (event.getButton() == toolWin.getInstallButton()) {
        // Later uncomment again only for testing commented out!
        Upload up = new Upload("", new AALServiceReceiver());
        up.setButtonCaption(res.getString("install.button"));
        up.addListener((Upload.FinishedListener) this);
        up.addListener((Upload.FailedListener) this);
        installWindow = new Window(res.getString("install.win.caption"));
        installWindow.setResizable(false);
        installWindow.center();
        installWindow.setWidth("400px");
        VerticalLayout v = new VerticalLayout();
        v.setSizeFull();
        v.setSpacing(true);
        v.setMargin(true);
        v.addComponent(up);
        installWindow.setContent(v);

        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(installWindow);
    }
    if (event.getButton() == toolWin.getLogoutButton()) {
        DesktopController.setCurrentPassword("");
        DesktopController.setCurrentUser("");
        //         if(!DesktopController.web.getSocket().isClosed()) {
        //            try {
        //               DesktopController.web.getSocket().close();
        //            } catch (IOException e) {
        //               e.printStackTrace();
        //            }
        //         }
        app.close();
    }

    if (event.getButton() == toolWin.getUninstallButton()) {
        app.getMainWindow().removeWindow(toolWin);
        List<RegisteredService> ids = new ArrayList<RegisteredService>();
        Document doc = Model.getSrvDocument();
        NodeList nodeList = doc.getElementsByTagName("service");
        for (int i = 0; i < nodeList.getLength(); i++) {
            RegisteredService srv = new RegisteredService();
            Element element = (Element) nodeList.item(i);
            System.err.println(element.getAttribute("serviceId"));
            srv.setServiceId(element.getAttribute("serviceId"));
            NodeList srvChilds = element.getChildNodes();
            for (int j = 0; j < srvChilds.getLength(); j++) {
                Node n = srvChilds.item(j);
                if (n.getNodeName().equals("application")) {
                    Element e = (Element) n;
                    srv.getAppId().add(e.getAttribute("appId"));
                }
                if (n.getNodeName().equals("bundle")) {
                    Element b = (Element) n;
                    srv.getBundleId().add(b.getAttribute("id"));
                    srv.setBundleVersion(b.getAttribute("version"));
                }
                if (n.getNodeName().equals("menuEntry")) {
                    Element e = (Element) n;
                    srv.setMenuName(e.getAttribute("entryName"));
                    srv.setIconURL(e.getAttribute("iconURL"));
                    srv.setProvider(e.getAttribute("vendor"));
                    srv.setServiceClass(e.getAttribute("serviceClass"));
                    srv.setUserID(e.getAttribute("userID"));
                }
            }
            ids.add(srv);
        }
        DeinstallWindow dw = new DeinstallWindow(ids);
        app.getMainWindow().addWindow(dw);
        DeinstallController dc = new DeinstallController(dw, app);
        //         frontend.uninstallService(Activator.getSessionKey(), "28002");
        //         frontend.getInstalledUnitsForService(Activator.getSessionKey(), "28002");
    }

    if (event.getButton() == toolWin.getPersonButton()) {
        AddNewPersonWindow apw = null;
        try {
            apw = new AddNewPersonWindow(null, null, app);
        } catch (JAXBException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(apw);
    }
    if (event.getButton() == toolWin.getConfigButton()) {
        AddNewHardwareWindow anhw = null;
        try {
            anhw = new AddNewHardwareWindow(null, null, app);
        } catch (JAXBException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(anhw);
    }
    if (event.getButton() == toolWin.getEditHW()) {
        RoomsWindow hardWare = null;
        try {
            hardWare = new RoomsWindow(app);
        } catch (JAXBException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(hardWare);

    }

    if (event.getButton() == toolWin.getEditPerson()) {
        HumansWindow hw = null;
        try {
            hw = new HumansWindow(app);
        } catch (JAXBException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(hw);
    }
    if (event.getButton() == toolWin.getEditUC()) {
        WhichBundleShouldBeConfiguredWindow uc = new WhichBundleShouldBeConfiguredWindow("Use Cases");
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(uc);

    }

}

From source file:ru.codeinside.adm.ui.AdminApp.java

License:Mozilla Public License

private Component registryTab() {
    Embedded embedded = new Embedded("", new ExternalResource("/registry"));
    embedded.setType(Embedded.TYPE_BROWSER);
    embedded.setWidth("100%");
    embedded.setHeight("100%");
    return embedded;
}

From source file:ru.codeinside.gses.webui.form.PrintPanel.java

License:Mozilla Public License

private Panel createDocumentPanel(Application app, String classId) {
    Embedded document = new Embedded(null, new FileResource(htmlFile, app));
    document.setDebugId(classId);/*from  w w w  .j a  va 2s  . c  o m*/
    document.setType(Embedded.TYPE_BROWSER);
    document.setSizeFull();

    VerticalLayout documentLayout = new VerticalLayout();
    documentLayout.setMargin(true);
    documentLayout.setSizeFull();
    documentLayout.addComponent(document);
    documentLayout.setExpandRatio(document, 1f);

    Panel documentPanel = new Panel(documentLayout);
    documentPanel.setSizeFull();
    return documentPanel;
}

From source file:se.natusoft.osgi.aps.apsadminweb.app.gui.vaadin.TabPanel.java

License:Open Source License

/**
 * Recreates all tabs./*ww w.jav a  2 s .c  om*/
 */
public void refreshTabs() {
    List<AdminWebReg> currentAdminWebs = this.adminWebService.getRegisteredAdminWebs();

    // Remove old
    removeAllComponents();

    VerticalLayout aboutTabLayout = new VerticalLayout();
    aboutTabLayout.setStyleName("aps-tabsheet-tab");
    aboutTabLayout.setMargin(true);
    aboutTabLayout.setSizeFull();
    Label aboutText = new HTMLFileLabel("/html/about-admin-web.html", APSTheme.THEME,
            getClass().getClassLoader());
    aboutTabLayout.addComponent(aboutText);
    addTab(aboutTabLayout, "About", null).setDescription("Information about APS Admin Web tool.");

    // Add new
    for (AdminWebReg adminWebReg : currentAdminWebs) {
        VerticalLayout tabLayout = new VerticalLayout();
        tabLayout.setStyleName("aps-tabsheet-tab");
        tabLayout.setSizeFull();
        tabLayout.setMargin(false);
        tabLayout.setSpacing(false);
        Embedded adminWeb = new Embedded("", new ExternalResource(adminWebReg.getUrl() + "?adminRefresh"));
        adminWeb.setType(Embedded.TYPE_BROWSER);
        adminWeb.setSizeFull();
        tabLayout.addComponent(adminWeb);
        tabLayout.setData(adminWebReg);

        Tab tab = addTab(tabLayout, adminWebReg.getName(), null);
        tab.setDescription(adminWebReg.getDescription() + "<br/>[" + adminWebReg.getName() + ":"
                + adminWebReg.getVersion() + "]");
    }
}