Example usage for com.vaadin.ui Window getParent

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

Introduction

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

Prototype

@Override
    public HasComponents getParent() 

Source Link

Usage

From source file:com.save.client.promodeals.PDDataGridProperties.java

@Override
public void gridRenrderersAndGenerator() {
    getColumn("view").setWidth(40);
    getColumn("edit").setWidth(40);
    getColumn("del").setWidth(40);
    getDefaultHeaderRow().join("view", "edit", "del").setText("");

    setFrozenColumnCount(1);//from   w  w w  .jav  a  2  s  .  c o m

    getColumn("del").setRenderer(new FontIconRenderer(e -> {
        Object itemId = e.getItemId();
        Item item = getContainerDataSource().getItem(itemId);

        Window sub = delete(itemId,
                CommonUtilities.convertStringToInt(item.getItemProperty("sn").getValue().toString()));
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
    }));

    getColumn("edit").setRenderer(new FontIconRenderer(e -> {
        Object itemId = e.getItemId();
        Item item = getContainerDataSource().getItem(itemId);

        Window sub = new AcknowledgementPromoForm(getClientId(), (int) item.getItemProperty("sn").getValue());
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }

        sub.addCloseListener((Window.CloseEvent event) -> {
            getContainerDataSource().removeAllItems();
            setContainerDataSource(new PDDataContainer(getClientId()));
        });
    }));

    getColumn("view").setRenderer(new FontIconRenderer(e -> {
        Object itemId = e.getItemId();
        Item item = getContainerDataSource().getItem(itemId);

        Window sub = new PromoDealAcknowledgementReport(
                CommonUtilities.convertStringToInt(item.getItemProperty("sn").getValue().toString()));
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
    }));

    recalculateColumnWidths();
}

From source file:com.save.client.promodeals.PromoUI.java

public PromoUI(int clientId) {
    this.clientId = clientId;

    setWidth("90%");
    setHeight("100%");
    setMargin(new MarginInfo(true, true, false, false));

    PDDataGridProperties dataGrid = new PDDataGridProperties(getClientId());

    Button button = new Button("Acknowledgement Form");
    button.setWidthUndefined();/*from   ww  w. jav a2  s  .co  m*/
    button.setIcon(FontAwesome.OPENID);
    button.addStyleName(ValoTheme.BUTTON_LINK);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener((Button.ClickEvent event) -> {
        Window sub = new com.save.clients.AcknowledgementPromoForm(getClientId());
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }

        sub.addCloseListener((Window.CloseEvent e) -> {
            dataGrid.getContainerDataSource().removeAllItems();
            dataGrid.setContainerDataSource(new PDDataContainer(getClientId()));
        });
    });
    addComponent(button);
    setComponentAlignment(button, Alignment.TOP_RIGHT);

    addComponent(dataGrid);
    setExpandRatio(dataGrid, 2);
}

From source file:com.save.employee.maintenance.MRDataGridProperties.java

@Override
public void gridRenrderersAndGenerator() {
    //TODO/*w w  w . ja v a2  s.co  m*/
    removeColumn("id");
    getColumn("edit").setWidth(40);
    //        getColumn("view").setWidth(40);
    getColumn("del").setWidth(40);
    getDefaultHeaderRow().join("edit", "del").setText("");

    setFrozenColumnCount(1);

    getColumn("del").setRenderer(new FontIconRenderer(e -> {
        Object itemId = e.getItemId();
        Item item = getContainerDataSource().getItem(itemId);

        Window sub = deletConfirmationWindow(
                CommonUtilities.convertStringToInt(item.getItemProperty("id").getValue().toString()), itemId);
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
    }));

    //        getColumn("view").setRenderer(new FontIconRenderer(e -> {
    //            Object itemId = e.getItemId();
    //            Item item = getContainerDataSource().getItem(itemId);
    //            
    //            Window sub = new MRFormWindow(getEmployeeId(), 
    //                    true, 
    //                    CommonUtilities.convertStringToInt(item.getItemProperty("id").getValue().toString()));
    //            if(sub.getParent() == null){
    //                UI.getCurrent().addWindow(sub);                
    //            }
    //        }));

    getColumn("edit").setRenderer(new FontIconRenderer(e -> {
        Object itemId = e.getItemId();
        Item item = getContainerDataSource().getItem(itemId);

        Window sub = new MRFormWindow(getEmployeeId(),
                CommonUtilities.convertStringToInt(item.getItemProperty("id").getValue().toString()), this);
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
    }));

    recalculateColumnWidths();
}

From source file:com.save.employee.maintenance.MRUI.java

public MRUI(int employeeId) {
    this.employeeId = employeeId;

    setWidth("90%");
    setHeight("100%");
    setMargin(new MarginInfo(true, false, false, false));

    MRDataGridProperties dataGrid = new MRDataGridProperties(getEmployeeId());

    Button mrForm = new Button("Maintenance/Reimbursement Form");
    mrForm.setWidthUndefined();/*from   ww w  .  j av  a 2 s.c o m*/
    mrForm.setIcon(FontAwesome.OPENID);
    mrForm.addStyleName(ValoTheme.BUTTON_SMALL);
    mrForm.addStyleName(ValoTheme.BUTTON_LINK);
    mrForm.addClickListener((Button.ClickEvent event) -> {
        Window sub = new MRFormWindow(getEmployeeId());
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }

        sub.addCloseListener((Window.CloseEvent e) -> {
            dataGrid.getContainerDataSource().removeAllItems();
            dataGrid.setContainerDataSource(new MRDataContainer(getEmployeeId()));
        });
    });

    addComponent(mrForm);
    setComponentAlignment(mrForm, Alignment.MIDDLE_RIGHT);

    addComponent(dataGrid);
    setExpandRatio(dataGrid, 2);
}

From source file:com.save.employee.request.RLDataGridProperties.java

@Override
public void gridRenrderersAndGenerator() {
    //TODO/* w  ww . ja  va 2  s  .co m*/
    removeColumn("id");
    getDefaultHeaderRow().join("edit", "liquidate", "view", "del").setText("");

    setFrozenColumnCount(1);

    getColumn("del").setRenderer(new FontIconRenderer(e -> {
        Object itemId = e.getItemId();
        Item item = getContainerDataSource().getItem(itemId);

        int result = rls
                .getRLById(CommonUtilities.convertStringToInt(item.getItemProperty("id").getValue().toString()))
                .getLiquidated();
        if (result == 1) {
            //                Notification.show(label.getCaption(), Notification.Type.WARNING_MESSAGE);
            ErrorLoggedNotification.showWarningLoggedOnWindow(
                    "Your are not allowed to delete a reguest that has already been liquidated!",
                    this.getClass().getName());
            return;
        }

        Window sub = deletConfirmationWindow(
                CommonUtilities.convertStringToInt(item.getItemProperty("id").getValue().toString()), itemId);
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
    }));

    getColumn("liquidate").setRenderer(new FontIconRenderer(e -> {
        Object itemId = e.getItemId();
        Item item = getContainerDataSource().getItem(itemId);

        int result = rls
                .getRLById(CommonUtilities.convertStringToInt(item.getItemProperty("id").getValue().toString()))
                .getLiquidated();
        if (result == 1) {
            Notification.show("Request has already been Liquidated. Click View instead!",
                    Notification.Type.WARNING_MESSAGE);
            return;
        }

        Window sub = new RequestFormWindow(getEmployeeId(),
                CommonUtilities.convertStringToInt(item.getItemProperty("id").getValue().toString()), true,
                this);
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
    }));

    getColumn("view").setRenderer(new FontIconRenderer(e -> {
        Object itemId = e.getItemId();
        Item item = getContainerDataSource().getItem(itemId);

        Window sub = new ViewRLWindow(getEmployeeId(),
                CommonUtilities.convertStringToInt(item.getItemProperty("id").getValue().toString()));
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
    }));

    getColumn("edit").setRenderer(new FontIconRenderer(e -> {
        Object itemId = e.getItemId();
        Item item = getContainerDataSource().getItem(itemId);

        int result = rls
                .getRLById(CommonUtilities.convertStringToInt(item.getItemProperty("id").getValue().toString()))
                .getLiquidated();
        if (result == 1) {
            Notification.show("Request has already been Liquidated. Click View instead!",
                    Notification.Type.WARNING_MESSAGE);
            return;
        }

        Window sub = new RequestFormWindow(getEmployeeId(),
                CommonUtilities.convertStringToInt(item.getItemProperty("id").getValue().toString()), false,
                this);
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
    }));

    recalculateColumnWidths();
}

From source file:com.save.employee.request.RLUI.java

public RLUI(int employeeId) {
    this.employeeId = employeeId;

    setWidth("90%");
    setHeight("100%");
    setMargin(new MarginInfo(true, false, false, false));

    RLDataGridProperties dataGrid = new RLDataGridProperties(getEmployeeId());

    Button rlForm = new Button("Request/Liquidation FORM");
    rlForm.setIcon(FontAwesome.OPENID);//from   www .  j a va2  s .com
    rlForm.addStyleName(ValoTheme.BUTTON_SMALL);
    rlForm.addStyleName(ValoTheme.BUTTON_LINK);
    rlForm.addClickListener((Button.ClickEvent event) -> {
        Window sub = new RequestFormWindow(getEmployeeId(), 0, false, dataGrid);
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
        sub.addCloseListener((Window.CloseEvent e) -> {
            dataGrid.getContainerDataSource().removeAllItems();
            dataGrid.setContainerDataSource(new RLDataContainer(getEmployeeId()));
        });
    });

    addComponent(rlForm);
    setComponentAlignment(rlForm, Alignment.MIDDLE_RIGHT);

    addComponent(dataGrid);
    setExpandRatio(dataGrid, 2);
}

From source file:com.save.global.ErrorLoggedNotification.java

public static void showWarningLoggedOnWindow(String warning, String className) {
    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();/*from   ww  w.  j  a  va 2  s.  c o  m*/
    v.setMargin(true);

    Window sub = new Window("WARNING MESSAGE!");
    sub.setWidth("500px");
    if (sub.getParent() == null) {
        UI.getCurrent().addWindow(sub);
    }
    sub.setModal(true);

    Panel panel = new Panel();
    panel.setSizeFull();
    panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    panel.setContent(new Label(warning + " on \n" + className, ContentMode.HTML));
    panel.getContent().setHeightUndefined();
    v.addComponent(panel);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();
}

From source file:com.save.reports.maintenance.MaintenanceReportUI.java

@Override
public void buttonClick(Button.ClickEvent event) {
    //TODO/*from w  w  w .j  ava  2 s  .  co m*/
    switch (event.getButton().getCaption()) {
    case "FILTER": {
        reset();
        Window sub = filterReport();
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
        break;
    }

    default: {
        if (!isEmployeeSelect() && !isAmountSelect() && !isDateSelect()) {
            Window sub = exportLargeData();
            if (sub.getParent() == null) {
                UI.getCurrent().addWindow(sub);
            }

            return;
        }

        processExportDataToExcel();

        break;
    }
    }
}

From source file:com.save.reports.promodeals.PromoDealReportUI.java

@Override
public void buttonClick(Button.ClickEvent event) {
    switch (event.getButton().getCaption()) {
    case "FILTER": {
        reset();/*from w w w.  java2s.  com*/
        Window sub = filterReport();
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
        break;
    }
    default: {
        if (!isClientSelect() && !isAmountSelect() && !isDateSelect()) {
            Window sub = exportLargeData();
            if (sub.getParent() == null) {
                UI.getCurrent().addWindow(sub);
            }

            return;
        }

        processExportDataToExcel();

        break;
    }
    }
}

From source file:com.save.reports.reimbursement.ReimbursementReportUI.java

@Override
public void buttonClick(Button.ClickEvent event) {
    //TODO//  www  . j  a v  a2  s. c  o  m
    switch (event.getButton().getCaption()) {
    case "FILTER": {
        reset();
        Window sub = filterReport();
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
        break;
    }

    default: {
        if (!isEmployee() && !isAmount() && !isDate()) {
            Window sub = exportLargeData();
            if (sub.getParent() == null) {
                UI.getCurrent().addWindow(sub);
            }

            return;
        }

        processExportDataToExcel();

        break;
    }
    }
}