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:org.geant.sat.ui.EntityListViewer.java

License:BSD License

/**
 * Creates a subwindow for editing assessor details of entity.
 * /*from w  ww .j a v a  2  s .c o  m*/
 * @param details
 *            entity
 */
private void editAssessors(EntityDetails details) {
    Window subWindowNewEntity = new Window(getString("lang.window.newentity.editassessors.title"));
    subWindowNewEntity.setWidth("80%");
    subWindowNewEntity.setModal(true);
    VerticalLayout subContent = new VerticalLayout();
    subContent.setWidth("100%");
    TwinColSelect<AssessorDetails> selectAssessors = new TwinColSelect<>(
            getString("lang.window.newentity.editassessors.assessors"));
    selectAssessors.setItemCaptionGenerator(new AssessorDetailsHelper());
    selectAssessors.setWidth("100%");
    selectAssessors.setData(details);
    ListAssessorsResponse resp = getMainUI().getSatApiClient().getAssessors();
    if (!verifySuccess(resp)) {
        return;
    }
    List<AssessorDetails> assessorDetails = resp.getAssessors();
    selectAssessors.setItems(assessorDetails);
    selectAssessors.updateSelection(
            AssessorDetailsHelper.selectionToSet(assessorDetails, details.getAssessors()),
            new HashSet<AssessorDetails>());
    subContent.addComponent(selectAssessors, 0);
    Button editButton = new Button(getString("lang.window.newentity.buttonModify"));
    subContent.addComponent(editButton, 1);
    editButton.addClickListener(this::editedAssessors);
    Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel"));
    subContent.addComponent(cancelButton, 2);
    cancelButton.addClickListener(this::canceledEditAssessors);
    subWindowNewEntity.setContent(subContent);
    getMainUI().addWindow(subWindowNewEntity);
}

From source file:org.geant.sat.ui.EntityListViewer.java

License:BSD License

/**
 * Add entity click handler - creates a sub window for user to enter the
 * data.//from   w ww  . j  av  a  2  s  . com
 * 
 * @param event
 *            button click event.
 */
private void addEntity(ClickEvent event) {

    // We create a simple window for user to enter entity information
    // no declarative design used, we form it locally
    Window subWindowNewEntity = new Window(getString("lang.window.newentity.title"));
    subWindowNewEntity.setModal(true);
    subWindowNewEntity.setWidth("50%");
    VerticalLayout subContent = new VerticalLayout();
    TextField field = new TextField(getString("lang.window.newentity.textFieldName"));
    field.setWidth("80%");
    subContent.addComponent(field, 0);
    field = new TextField(getString("lang.window.newentity.textFieldDescription"));
    field.setWidth("80%");
    subContent.addComponent(field, 1);
    Button okButton = new Button(getString("lang.window.newentity.buttonCreate"));
    subContent.addComponent(okButton, 2);
    okButton.addClickListener(this::addedEntity);
    Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel"));
    subContent.addComponent(cancelButton, 3);
    cancelButton.addClickListener(this::canceledEntityAdd);
    subWindowNewEntity.setContent(subContent);
    subWindowNewEntity.center();
    getMainUI().addWindow(subWindowNewEntity);

}

From source file:org.geant.sat.ui.ScheduleSurveyViewer.java

License:BSD License

/**
 * Creates a subwindow for editing survey details of entity.
 * //from w ww . j a v  a  2  s  .c  om
 * @param details
 *            entity
 */
private void editSurveys(EntityDetails details) {
    Window subWindowNewEntity = new Window(getString("lang.window.surveyschedule.editsids.title"));
    subWindowNewEntity.setModal(true);
    VerticalLayout subContent = new VerticalLayout();
    TwinColSelect<String> selectSids = new TwinColSelect<>(getString("lang.window.newentity.editsids.sids"));
    selectSids.setData(details);
    ListAllSurveysResponse resp = getMainUI().getSatApiClient().getSurveys();
    if (!verifySuccess(resp)) {
        return;
    }
    List<SurveyDetails> surveyDetails = resp.getSurveys();
    // parse active sids
    List<String> activeSurveyDetails = new ArrayList<String>();
    for (SurveyDetails surveyDetail : surveyDetails) {
        if (surveyDetail.getActive()) {
            activeSurveyDetails.add(surveyDetail.getSid());
        }
    }
    selectSids.setItems(activeSurveyDetails);
    // set current sids as selection
    selectSids.updateSelection(details.getSids(), new HashSet<String>());
    subContent.addComponent(selectSids, 0);
    Button editButton = new Button(getString("lang.window.newentity.buttonModify"));
    subContent.addComponent(editButton, 1);
    editButton.addClickListener(this::editedSurveys);
    Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel"));
    subContent.addComponent(cancelButton, 2);
    cancelButton.addClickListener(this::canceledEditSurveys);
    subWindowNewEntity.setContent(subContent);
    getMainUI().addWindow(subWindowNewEntity);
}

From source file:org.geant.sat.ui.ScheduleSurveyViewer.java

License:BSD License

/**
 * Creates a subwindow for editing assessor details of entity.
 * /*  w w w.  jav  a  2s  .  c om*/
 * @param details
 *            entity
 */
private void editAssessors(EntityDetails details) {
    Window subWindowNewEntity = new Window(getString("lang.window.surveyschedule.editassessors.title"));
    subWindowNewEntity.setWidth("80%");
    subWindowNewEntity.setModal(true);
    VerticalLayout subContent = new VerticalLayout();
    subContent.setWidth("100%");
    TwinColSelect<AssessorDetails> selectAssessors = new TwinColSelect<>(
            getString("lang.window.newentity.editassessors.assessors"));
    selectAssessors.setItemCaptionGenerator(new AssessorDetailsHelper());
    selectAssessors.setWidth("100%");
    selectAssessors.setData(details);
    ListAssessorsResponse resp = getMainUI().getSatApiClient().getAssessors();
    if (!verifySuccess(resp)) {
        return;
    }
    List<AssessorDetails> assessorDetails = resp.getAssessors();
    selectAssessors.setItems(assessorDetails);
    selectAssessors.updateSelection(
            AssessorDetailsHelper.selectionToSet(assessorDetails, details.getAssessors()),
            new HashSet<AssessorDetails>());
    subContent.addComponent(selectAssessors, 0);
    Button editButton = new Button(getString("lang.window.newentity.buttonModify"));
    subContent.addComponent(editButton, 1);
    editButton.addClickListener(this::editedAssessors);
    Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel"));
    subContent.addComponent(cancelButton, 2);
    cancelButton.addClickListener(this::canceledEditAssessors);
    subWindowNewEntity.setContent(subContent);
    getMainUI().addWindow(subWindowNewEntity);
}

From source file:org.glassfish.fighterfish.hellovaadin.MyVaadinApplication.java

License:Open Source License

@Override
public void init() {
    // Main window is the primary browser window
    window = new Window("Hello Window");
    setMainWindow(window);/*from   w w  w.j  a v  a 2 s. co  m*/
    // "Hello world" text is added to window as a Label component
    window.addComponent(new Label("Hello World!"));
}

From source file:org.hip.vif.admin.groupadmin.ui.ReferencingQuestionLookup.java

License:Open Source License

/**
 * Constructor//from   w  ww . j a  v  a 2  s.c o m
 * 
 * @param inQuestions
 *            ContributionContainer
 * @param inWidth
 *            int
 * @param inHeight
 *            int
 */
public ReferencingQuestionLookup(final ContributionContainer inQuestions, final int inWidth,
        final int inHeight) {
    final IMessages lMessages = Activator.getMessages();
    lookup = new Window(lMessages.getMessage("lookup.window.title.referencing")); //$NON-NLS-1$
    lookup.addStyleName("vif-lookup"); //$NON-NLS-1$
    lookup.setWidth(inWidth, Unit.PIXELS);
    lookup.setHeight(inHeight, Unit.PIXELS);

    final VerticalLayout lLayout = (VerticalLayout) lookup.getContent();
    lLayout.setStyleName("vif-lookup"); //$NON-NLS-1$
    lLayout.setMargin(true);
    lLayout.setSpacing(true);

    lLayout.addComponent(createTable(inQuestions));

    final Button lClose = new Button(lMessages.getMessage("lookup.window.button.close"), //$NON-NLS-1$
            new Button.ClickListener() {
                @Override
                public void buttonClick(final ClickEvent inEvent) {
                    lookup.close();
                }
            });
    lClose.setClickShortcut(KeyCode.ESCAPE);
    lClose.setImmediate(true);
    lClose.setStyleName("vif-lookup-close"); //$NON-NLS-1$
    lLayout.addComponent(lClose);
}

From source file:org.hip.vif.app.Admin.java

License:Open Source License

@Override
public void init() {
    LOG.debug("VIF Administration application initialized.");

    Window lWindow = new Window("VIF Administration");
    setMainWindow(lWindow);/* ww w  . java2 s  .c  o  m*/
    afterInit(lWindow);
}

From source file:org.hip.vif.app.Forum.java

License:Open Source License

@Override
public void init() {
    LOG.debug("VIF Forum application initialized.");

    Window lWindow = new Window("VIF Forum");
    setMainWindow(lWindow);//from   ww  w . j  ava  2  s  .com
    afterInit(lWindow);
}

From source file:org.icrisat.gdms.ui.GDMSMain.java

@Override
public void init() {

    /*try{         //ww  w . j  a  v a  2s.c o  m
       System.out.println(GDMSModel.getGDMSModel().getWorkbenchParams().getDbName()+"  "+GDMSModel.getGDMSModel().getWorkbenchParams().getHost()+"   "+GDMSModel.getGDMSModel().getWorkbenchParams().getPort()+"   "+GDMSModel.getGDMSModel().getWorkbenchParams().getUsername()+"   "+GDMSModel.getGDMSModel().getWorkbenchParams().getPassword());
       hibernateUtil = new HibernateUtil(GDMSModel.getGDMSModel().getWorkbenchParams());
       HibernateSessionProvider sessionProvider = new HibernateSessionPerThreadProvider(hibernateUtil.getSessionFactory());
       workbenchManager = new WorkbenchDataManagerImpl(sessionProvider);
    }catch (FileNotFoundException e) {
       //_mainHomePage.getMainWindow().getWindow().showNotification("Error retrieving Dataset details.", Notification.TYPE_ERROR_MESSAGE);
       return;
    }catch (IOException ei) {
       //_mainHomePage.getMainWindow().getWindow().showNotification("Error retrieving Dataset details.", Notification.TYPE_ERROR_MESSAGE);
       return;
    }catch (URISyntaxException e) {
       //_mainHomePage.getMainWindow().getWindow().showNotification("Error retrieving Dataset details.", Notification.TYPE_ERROR_MESSAGE);
       return;
    }
    */

    try {
        int userId = GDMSModel.getGDMSModel().getWorkbenchDataManager().getWorkbenchRuntimeData().getUserId();
        User user1 = GDMSModel.getGDMSModel().getWorkbenchDataManager().getUserById(userId);

        _gdmsModel = GDMSModel.getGDMSModel();
        User user2 = new User();
        user2.setUserid(new Integer(user1.getUserid()));
        user2.setName(user1.getName());
        user2.setPassword(user1.getPassword());
        _gdmsModel.setLoggedInUser(user2);

        setTheme("gdmstheme");

        _main = new Window("Genotyping Data Management System (GDMS)");
        //GDMSModel.getGDMSModel().getWorkbenchParams().getHibernateSessionProviderForCentral().getSession();
        /*try{
           System.out.println(".............  workbenchloogedin user:"+workbenchManager.getWorkbenchRuntimeData().getUserId());
        }catch (MiddlewareQueryException e) {
           e.printStackTrace();
        }*/
        _mainLayout = (VerticalLayout) _main.getContent();
        _mainLayout.setMargin(false);
        _mainLayout.setStyleName(Reindeer.LAYOUT_BLUE);
        _mainLayout.addListener(this);
        _mainLayout.setImmediate(true);

        _main.setImmediate(true);
        setMainWindow(_main);

        buildMainView();
    } catch (MiddlewareQueryException e) {
        e.printStackTrace();
    } catch (ConfigException e) {
        e.printStackTrace();
        //_mainHomePage.getMainWindow().getWindow().showNotification(e.getMessage(),  Notification.TYPE_ERROR_MESSAGE);
        //return null;
    }

}

From source file:org.icrisat.gdms.ui.GDMSMain.java

void openLoginWindow() {

    if (null == loginWindow) {
        loginWindow = new Window("Login");
        LoginDialog loginBox = new LoginDialog(this);
        loginWindow.addComponent(loginBox);
        loginWindow.setWidth("400px");
        loginWindow.setBorder(Window.BORDER_NONE);
        loginWindow.setClosable(true);/*w w  w  .j av  a 2 s.c  om*/
        loginWindow.center();

    }

    if (!getMainWindow().getChildWindows().contains(loginWindow)) {
        getMainWindow().addWindow(loginWindow);
    }
}