Example usage for com.vaadin.ui Window Window

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

Introduction

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

Prototype

public Window(String caption) 

Source Link

Document

Creates a new, empty window with a given title.

Usage

From source file:de.fzi.fhemapi.view.vaadin.HardwareControlApplication.java

License:Apache License

@Override
public void init() {

    mainWindow = new Window("Hardware Control Center");
    mainWindow.setSizeFull();/*w w w  . j ava 2 s.  c o  m*/
    mainWindow.setContent(new ServerDetailsForm());
    setMainWindow(mainWindow);

    //         try {
    //               FHEMServer server = new FHEMServer("127.0.0.1", 8090);
    //               mainWindow.setContent(new HWindow(server));
    //               setMainWindow(mainWindow);
    //            } catch (ConnectException e) {
    //               mainWindow.setContent(new Window("Could not connect to FHEM!\n Cause: "+e.getMessage()));
    //               setMainWindow(mainWindow);
    //               getMainWindow().showNotification("Error!", e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
    //         }
}

From source file:de.fzi.fhemapi.view.vaadin.ui.ServerDetailsForm.java

License:Apache License

public ServerDetailsForm() {
    FormLayout layout = new FormLayout();
    setCompositionRoot(layout);// w w  w  .j  a va 2s  .  co  m

    Label title = new Label("<h1> Server Details</h1>");
    title.setContentMode(Label.CONTENT_XHTML);
    layout.addComponent(title);

    final TextField serverIP = new TextField("Server IP");

    serverIP.setWidth(COMMON_FIELD_WIDTH);
    layout.addComponent(serverIP);

    final TextField port = new TextField("Port");
    port.setWidth(COMMON_FIELD_WIDTH);
    layout.addComponent(port);

    Button applyButton = new Button("Apply");
    layout.addComponent(applyButton);

    applyButton.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                //               Window mainWindow = new Window();
                FHEMServer server = new FHEMServer((String) serverIP.getValue(),
                        Integer.parseInt((String) port.getValue()));
                getWindow().setContent(new HWindow(server));
                //               VaadinServletResponse response = 
                //                        (VaadinServletResponse) VaadinService.getCurrentResponse();
                //                     Cookie ipCookie = new Cookie("ip", (String)serverIP.getValue());
                //                     Cookie portCookie = new Cookie("port", (String) port.getValue());
                //                     ipCookie.setMaxAge(30 * 24 * 60 * 60);
                //                     ipCookie.setPath("/HWC");
                //                     portCookie.setMaxAge(30 * 24 * 60 * 60);
                //                     portCookie.setPath("/HWC");
                //                     response.addCookie(ipCookie);
                //                     response.addCookie(portCookie);
            } catch (ConnectException e) {
                getWindow().setContent(new Window("Could not connect to FHEM!\n Cause: " + e.getMessage()));
                getWindow().showNotification("Error!", e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    //
    //       VaadinServletRequest request = 
    //                (VaadinServletRequest) VaadinService.getCurrentRequest();
    //       if(request != null){
    //             Cookie[] cookies = request.getCookies();
    //             for (Cookie cookie : cookies) {
    //                if (cookie.getName().equals("ip")) {
    //                   serverIP.setValue(cookie.getValue());
    //                }else if(cookie.getName().equals("port")){
    //                   port.setValue(cookie.getValue());
    //                }
    //             }
    //       }

}

From source file:de.gzockoll.prototype.vaadin6.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    // Create the custom bean.
    Person bean = new Person();

    // Create a form and use FormLayout as its layout.
    final Form form = new BeanValidationForm<Person>(bean);

    // Set form caption and description texts
    form.setCaption("Contact Information");
    form.setDescription("Please specify name of the person and the city where the person lives in.");
    form.setWriteThrough(false);//from www . j  a  va 2  s  . c  o m

    // Create a bean item that is bound to the bean.
    BeanItem<Person> item = new BeanItem<Person>(bean);

    // Bind the bean item as the data source for the form.
    form.setItemDataSource(item);
    window = new Window("My Vaadin Application");
    setMainWindow(window);
    window.addComponent(form);
    Button commit = new Button("Commit", form, "commit");
    window.addComponent(commit);
    Button restore = new Button("Restore", form, "discard");
    window.addComponent(restore);

}

From source file:de.holisticon.emapp.EmployeeManagerApp.java

License:Apache License

@Override
public void init() {

    ApplicationEventBus.register(new LoginHandler(this));
    ApplicationEventBus.register(new LogoutHandler(this));

    window = new Window("My Vaadin Application");
    setMainWindow(window);//from   w  ww .j  av  a  2  s. c o  m

    window.setContent(new LoginComponent());
}

From source file:de.informera.dev.nutchManager.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    File settings_folder = new File(System.getProperty("user.home") + "/.nutchManager");
    if (!settings_folder.isDirectory()) {
        settings_folder.mkdir();/*from  www  . j av a2s .  com*/
        new File(settings_folder.getAbsolutePath() + "/backups").mkdir();
        new File(settings_folder.getAbsolutePath() + "/instances").mkdir();
    }

    window = new Window("nutchManager");
    setMainWindow(window);
    this.setTheme("nutchManager");

    final HorizontalLayout technologies = new HorizontalLayout();
    technologies.setSpacing(true);
    technologies.addComponent(new Embedded("", new ThemeResource("images/nutch_logo_tm.gif")));
    technologies.addComponent(new Embedded("", new ThemeResource("images/vaadin.png")));

    final MenuBar mainMenu = new MenuBar();

    mainMenu.setWidth("100%");
    MenuItem menuFile = mainMenu.addItem("File", null, null);
    MenuItem subMenuFile = menuFile.addItem("Add new instance", null, null);

    // Define a common menu command for all the menu items.
    MenuBar.Command addNewInstanceFromMenu = new MenuBar.Command() {
        public void menuSelected(MenuItem selectedItem) {
            window.removeAllComponents();
            window.addComponent(technologies);
            window.addComponent(mainMenu);
            window.addWindow(new AddInstanceDialog());
        }
    };

    subMenuFile.setCommand(addNewInstanceFromMenu);

    window.addComponent(technologies);

    window.addComponent(mainMenu);

    // Begin the checkout of an old configuration
    // Check waether configuration has entries for nutch instances or not
    //      File settings_folder = new File( this.getClass().getClassLoader().getResource("/instance_conf").getPath() );

    File instances_folder = new File(settings_folder + "/instances");

    // If not: prompt to add an instance
    if (instances_folder.list().length < 1) {
        window.showNotification("ERROR", "No previous configuration found. Please add a nutch instance.",
                Notification.TYPE_ERROR_MESSAGE);
        Window addInstance = new AddInstanceDialog();
        window.addWindow(addInstance);
    } else {
        window.addComponent(new InstanceSelectionView());
    }

}

From source file:de.lmu.ifi.dbs.knowing.vaadin.MainApplication.java

License:Apache License

@Override
public void init() {
    main = new Window("Knowing Vaadin Application");
    mainLayout = (VerticalLayout) main.getContent();
    mainLayout.setMargin(false);/* w  w  w.  j a v a  2s  .c o  m*/
    // mainLayout.setStyleName("blue");
    setMainWindow(main);

    mainLayout.setSizeFull();
    mainLayout.addComponent(getMenu());

    HorizontalLayout content = new HorizontalLayout();
    contentPanel.setSizeFull();
    content.setSizeFull();
    content.addComponent(contentPanel);

    mainLayout.addComponent(content);
    mainLayout.setExpandRatio(content, 1);

    uiFactory = TypedActor.newInstance(UIFactory.class, new TypedActorFactory() {
        @Override
        public TypedActor create() {
            return new VaadinUIFactory(main);
        }
    });
}

From source file:de.lmu.ifi.dbs.knowing.vaadin.MainApplication.java

License:Apache License

private Window getAboutDialog() {
    if (aboutWindow == null) {
        aboutWindow = new Window("About...");
        aboutWindow.setModal(true);/* ww w .  j a va2 s  . c om*/
        aboutWindow.setWidth("400px");

        VerticalLayout layout = (VerticalLayout) aboutWindow.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setStyleName("grey");

        CssLayout titleLayout = new CssLayout();
        H2 title = new H2("Knowing Vaadin Application");
        titleLayout.addComponent(title);
        SmallText description = new SmallText("<br>Copyright (c) Nepomuk Seiler, LMU Database <br>"
                + "Licensed under Apache Software Foundation 2.0 license (ASF).<br><br>"
                + "This software contains modules licenced under<br>"
                + " the Apache Software Foundation 2.0 license (ASF) and EPL<br><br>"
                + "Many thanks to Kai Tdter, Chris Brind, Neil Bartlett and<br>"
                + " Petter Holmstrm for their OSGi and Vaadin<br>"
                + " related work, blogs, and bundles.<br><br>"
                + "The icons are from the Silk icon set by Mark James<br>"
                + "<a href=\"http://www.famfamfam.com/lab/icons/silk/\">http://www.famfamfam.com/lab/icons/silk/</a>");
        description.setSizeUndefined();
        description.setContentMode(Label.CONTENT_XHTML);

        titleLayout.addComponent(description);
        aboutWindow.addComponent(titleLayout);

        @SuppressWarnings("serial")
        Button close = new Button("Close", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                (aboutWindow.getParent()).removeWindow(aboutWindow);
            }

        });
        layout.addComponent(close);
        layout.setComponentAlignment(close, Alignment.TOP_RIGHT);
    }
    return aboutWindow;
}

From source file:de.marrrschine.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    window = new Window("My Vaadin Application");
    setMainWindow(window);//from ww  w  .  java2s  . co m
    // Handle the events with an anonymous class
    final Button button = new Button("Click It!", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            ServiceConsumer serviceConsumer = new ServiceConsumer();
            // JSONArray jsonArray = serviceConsumer.consumeServiceGet();
        }
    });
    window.addComponent(button);

    ServiceConsumer serviceConsumer = new ServiceConsumer();
    final Table table = new Table("Available Prospects");
    table.addContainerProperty("Firstname", String.class, null);
    table.addContainerProperty("Lastname", String.class, null);
    JSONArray jsonArray;
    try {
        jsonArray = serviceConsumer.consumeServiceGet();
        int i = 0;
        for (Object object : jsonArray) {
            i++;
            JSONObject jsonObj = (JSONObject) object;
            // System.out.println(object.get("firstname"));
            String firstname = (String) jsonObj.get("firstname");
            String lastname = (String) jsonObj.get("lastname");
            // String lastname = (String) object.get("lastname");
            table.addItem(new Object[] { firstname, lastname }, i);
            table.setPageLength(i);
        }
    } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    window.addComponent(table);
}

From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java

License:Open Source License

public static Window createPopupWindow() {
    Window window = new Window(null);
    window.setModal(true);//from   ww  w .ja v a  2s .c o  m
    window.setSizeUndefined();
    window.setResizable(false);
    window.center();

    return window;
}

From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java

License:Open Source License

public static Window showSimplePopupWindow(String caption, String contentText) {
    Window window = new Window(null);
    window.setModal(true);/*from  www . ja  v  a 2s .co  m*/
    window.setSizeUndefined();
    window.setResizable(false);
    window.center();

    VerticalLayout popupLayout = new VerticalLayout();
    popupLayout.setMargin(true);
    popupLayout.setSpacing(true);
    popupLayout.setSizeUndefined();
    Label contentLabel = new Label(contentText);
    contentLabel.setWidth(100, Unit.PERCENTAGE);
    popupLayout.addComponent(contentLabel);
    Button okayButton = new Button(I18nProperties.getCaption(Captions.actionOkay));
    okayButton.addClickListener(e -> {
        window.close();
    });
    CssStyles.style(okayButton, ValoTheme.BUTTON_PRIMARY);
    popupLayout.addComponent(okayButton);
    popupLayout.setComponentAlignment(okayButton, Alignment.BOTTOM_RIGHT);

    window.setCaption(caption);
    window.setContent(popupLayout);

    UI.getCurrent().addWindow(window);

    return window;
}