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, Component content) 

Source Link

Document

Creates a new, empty window with the given content and title.

Usage

From source file:com.logviewer.ui.dialog.FilterLog.java

License:Open Source License

public void showDialog() {
    if (this.dialog == null) {
        this.dialog = new Window(i18n.get("label.filter.log.title"), buildContetDialog());
        this.dialog.setId("load-file");
        this.dialog.setModal(false);
        this.dialog.setDraggable(true);
        this.dialog.setResizable(true);
        this.dialog.setWidth(50, Sizeable.Unit.PERCENTAGE);
        this.dialog.setHeight(50, Sizeable.Unit.PERCENTAGE);
        this.dialog.center();
    }//from ww w. j  ava 2  s .co m
    currentUI.addWindow(dialog);
}

From source file:com.logviewer.ui.dialog.LastMinute.java

License:Open Source License

public void showDialog(int minutes) {
    this.dialog = new Window(i18n.get("label.lastminute.title"), buildContetDialog(minutes));
    this.dialog.setId("load-file");
    this.dialog.setModal(true);
    this.dialog.setDraggable(true);
    this.dialog.setResizable(true);
    this.dialog.setWidth(50, Sizeable.Unit.PERCENTAGE);
    this.dialog.setHeight(50, Sizeable.Unit.PERCENTAGE);
    this.dialog.center();
    UI.getCurrent().addWindow(dialog);/*from  ww w .  j  a  v  a  2  s  .  c  o  m*/
}

From source file:com.openhris.commons.AboutHris.java

public Window aboutHris() {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);//from w ww.  jav a 2 s .c om
    vlayout.setMargin(true);

    final Window subWindow = new Window("About HRMS", vlayout);
    subWindow.setWidth("300px");

    Label version = new Label("Version: <b>1.0</b>");
    version.setContentMode(Label.CONTENT_XHTML);
    subWindow.addComponent(version);

    Label title = new Label("Title: <b>Human Resource Information System</b>");
    title.setContentMode(Label.CONTENT_XHTML);
    subWindow.addComponent(title);

    Label developer = new Label("Developed By: <b>Engr. Godfrey D. Beray</b>");
    developer.setContentMode(Label.CONTENT_XHTML);
    subWindow.addComponent(developer);

    Label framework = new Label("Framework: <b>VAADIN - Sept2012</b>");
    framework.setContentMode(Label.CONTENT_XHTML);
    subWindow.addComponent(framework);

    return subWindow;
}

From source file:com.openhris.employee.allowance.EmployeeAllowanceInformation.java

Window remarks(final String buttonCaption) {
    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);/*w ww .  jav a2 s .  c o  m*/
    v.setSpacing(true);

    remarksSubWindow = new Window("REMARKS", v);
    remarksSubWindow.setWidth("400px");
    remarksSubWindow.setModal(true);
    remarksSubWindow.center();

    remarks = new TextArea("Add Remarks: ");
    remarks.setWidth("100%");
    remarks.setRows(3);
    remarksSubWindow.addComponent(remarks);

    Button b = new Button(buttonCaption);
    b.setWidth("100%");
    b.addListener(updateClickListener);
    remarksSubWindow.addComponent(b);

    return remarksSubWindow;
}

From source file:com.openhris.employee.EmployeeAddress.java

private Window removeAddressWindow(final int addressId) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);//from  w ww.j  ava  2 s  .co  m
    vlayout.setMargin(true);

    final Window window = new Window("REMOVE POSITION", vlayout);
    window.setWidth("300px");

    Button removeBtn = new Button("Remove Address?");
    removeBtn.setWidth("100%");
    removeBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            boolean result = eaService.removeEmployeeAddress(addressId);
            if (result) {
                employeeAddressTable();
                (window.getParent()).removeWindow(window);
                clearFields();
            } else {
                getWindow().showNotification("Cannot Remove Address, Contact your DBA!",
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    removeBtn.setImmediate(true);

    window.addComponent(removeBtn);

    return window;
}

From source file:com.openhris.employee.EmployeeCharacterReference.java

private Window removeCharacterReferenceWindow(final int characterReferenceId) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);/*  ww  w  . j  a  va  2  s .com*/
    vlayout.setMargin(true);

    final Window window = new Window("REMOVE REFERENCE", vlayout);
    window.setWidth("300px");

    Button removeBtn = new Button("Remove Character Reference?");
    removeBtn.setWidth("100%");
    removeBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            boolean result = charRefService.removeEmployeeCharacterReferenceC(characterReferenceId);

            if (result) {
                characterReferenceTable();
                (window.getParent()).removeWindow(window);
                clearFields();
            } else {
                getWindow().showNotification("Cannot Remove Reference, Contact your DBA!",
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    window.addComponent(removeBtn);

    return window;
}

From source file:com.openhris.employee.EmployeePersonalInformation.java

private Window getRemoveWindow(String employeeId) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);/*from w  w w.  j a va 2 s  . c om*/
    vlayout.setMargin(true);

    final Window window = new Window("REMOVE EMPLOYEE", vlayout);
    window.setWidth("350px");

    Button removeBtn = new Button("Are you sure your want to remove this Employee?");
    removeBtn.setWidth("100%");
    removeBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EmployeeMainUI employeeMainUI = new EmployeeMainUI(GlobalVariables.getUserRole(), 0);
            boolean result = employeeCurrentStatusService.removeEmployee(getEmployeeId());
            if (result) {
                clearFields();
                employeeMainUI.employeesTable(getEmployeeList(0));
                (window.getParent()).removeWindow(window);
            } else {
                getWindow().showNotification("Cannot Remove Employee, Contact your DBA!",
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    window.addComponent(removeBtn);

    return window;
}

From source file:com.openhris.employee.EmployeePersonalInformation.java

private Window updatePersonalInformationConfirmation(final PersonalInformation pi) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);//from  w w  w . j  a v a  2s  .c  o  m
    vlayout.setMargin(true);

    final Window window = new Window("UPDATE WINDOW", vlayout);
    window.setWidth("350px");

    final TextArea remarks = new TextArea("Remarks");
    remarks.setWidth("100%");
    remarks.setRows(3);
    window.addComponent(remarks);

    Button removeBtn = new Button("UPDATE EMPLOYEE?");
    removeBtn.setWidth("100%");
    removeBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (remarks.getValue() == null || remarks.getValue().toString().trim().isEmpty()) {
                getWindow().showNotification("Add remarks!", Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            boolean result = piService.updatePersonalInformation(pi, remarks.getValue().toString().trim());
            if (result) {
                getWindow().showNotification("Information Updated", Window.Notification.TYPE_TRAY_NOTIFICATION);
                (window.getParent()).removeWindow(window);
            } else {
                getWindow().showNotification("SQL Error", Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }

    });
    window.addComponent(removeBtn);

    return window;
}

From source file:com.openhris.employee.RemovePositionWindow.java

public RemovePositionWindow(int id) {
    this.id = id;
    setCaption("REMOVE POSITION");
    setWidth("300px");

    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);//from  ww  w . ja  v a 2 s . c  o m
    vlayout.setMargin(true);

    final Window window = new Window("REMOVE POSITION", vlayout);
    window.setWidth("300px");

    Button removeBtn = new Button("Remove Position?");
    removeBtn.setWidth("100%");
    removeBtn.addListener(this);
    addComponent(removeBtn);
}

From source file:com.openhris.employee.salary.EmployeeSalaryInformation.java

private Window setContributionMainBranch() {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);//from   w w w .  j a  va 2  s . c  o m
    vlayout.setSpacing(true);

    final Window subWindow = new Window("Set Branch", vlayout);
    subWindow.setWidth("300px");

    corporate = dropDown.populateCorporateComboBox(new ComboBox());
    corporate.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (corporate.getValue() == null) {
            } else {
                corporateId = companyService.getCorporateId(corporate.getValue().toString());
                trade = dropDown.populateTradeComboBox(trade, corporateId);
            }
        }
    });
    corporate.setWidth("100%");
    subWindow.addComponent(corporate);

    trade.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (trade.getValue() == null) {
            } else {
                tradeId = companyService.getTradeId(trade.getValue().toString(), corporateId);
                branch = dropDown.populateBranchComboBox(branch, tradeId, corporateId);
            }
        }
    });
    trade.setWidth("100%");
    subWindow.addComponent(trade);

    branch.setWidth("100%");
    branch.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (branch.getValue() == null) {
            } else {
                branchId = companyService.getBranchId(tradeId, branch.getValue().toString());
            }
        }
    });
    subWindow.addComponent(branch);

    final ComboBox remarks = new ComboBox("Remarks");
    remarks.setWidth("100%");
    remarks.setNullSelectionItemId(false);
    remarks.addItem("Transfer to new Branch.");
    remarks.addItem("Wrong Entry");
    subWindow.addComponent(remarks);

    Button updateBtn = new Button("SET BRANCH for CONTRIBUTION");
    updateBtn.setWidth("100%");
    updateBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (corporate.getValue() == null) {
                getWindow().showNotification("Select Corporation!", Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            if (trade.getValue() == null) {
                getWindow().showNotification("Select Trade!", Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            if (branch.getValue() == null) {
                getWindow().showNotification("Select Branch!", Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            if (remarks.getValue() == null) {
                getWindow().showNotification("Remarks required!", Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            boolean result = si.updateEmployeeContributionBranch(getEmployeeId(), branchId,
                    remarks.getValue().toString(), corporateId);
            if (result) {
                getWindow().showNotification("Successfully transferred to new Branch!");
                (subWindow.getParent()).removeWindow(subWindow);
            } else {
                getWindow().showNotification("SQL Error, Contact your DBA!");
                (subWindow.getParent()).removeWindow(subWindow);
            }
        }
    });
    subWindow.addComponent(updateBtn);

    return subWindow;
}