Example usage for com.vaadin.ui Window setResizable

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

Introduction

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

Prototype

public void setResizable(boolean resizable) 

Source Link

Document

Sets window resizable.

Usage

From source file:com.oodrive.nuage.webui.component.window.AbstractConfirmationWindow.java

License:Apache License

@SuppressWarnings("serial")
@Override/*from   ww  w .j a v  a2  s.  c  o  m*/
public Window init(final AbstractItemModel model) {

    // Add new window
    final Window vvrConfirmationWindow = new Window("Confirmation");
    vvrConfirmationWindow.center();
    vvrConfirmationWindow.setResizable(false);
    final VerticalLayout vvrConfirmationLayout = new VerticalLayout();
    vvrConfirmationLayout.setMargin(true);
    vvrConfirmationWindow.setContent(vvrConfirmationLayout);

    // Message to display before buttons
    final Label confirmationMessage = new Label(confirmation);
    vvrConfirmationLayout.addComponent(confirmationMessage);
    vvrConfirmationLayout.setComponentAlignment(confirmationMessage, Alignment.MIDDLE_CENTER);
    vvrConfirmationLayout.setSpacing(true);

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    vvrConfirmationLayout.addComponent(buttonLayout);
    // Button OK
    final Button okButton = new Button("OK");
    buttonLayout.setSizeFull();
    buttonLayout.addComponent(okButton);
    buttonLayout.setComponentAlignment(okButton, Alignment.MIDDLE_CENTER);
    okButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                action.execute(model);
                vvrConfirmationWindow.close();
            } catch (final Exception e) {
                vvrConfirmationWindow.close();
            }
        }
    });

    // Button cancel
    final Button cancelButton = new Button("Cancel");
    buttonLayout.addComponent(cancelButton);
    buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER);
    cancelButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            // Just close the window
            vvrConfirmationWindow.close();
        }
    });
    return vvrConfirmationWindow;
}

From source file:com.oodrive.nuage.webui.component.window.ErrorWindow.java

License:Apache License

@SuppressWarnings("serial")
@Override/* w w  w  .  jav a  2s . c  o m*/
public final Window init(final AbstractItemModel model) {
    // Add new window with title "Error"
    final Window vvrErrorWindow = new Window("Error");
    vvrErrorWindow.center();
    vvrErrorWindow.setResizable(false);
    final VerticalLayout vvrErrorLayout = new VerticalLayout();
    vvrErrorLayout.setMargin(true);
    vvrErrorWindow.setContent(vvrErrorLayout);

    // Display message
    final Label errorMessage = new Label(message);
    vvrErrorLayout.addComponent(errorMessage);
    vvrErrorLayout.setComponentAlignment(errorMessage, Alignment.MIDDLE_CENTER);
    vvrErrorLayout.setSpacing(true);

    // Button OK
    final Button okButton = new Button("OK");
    vvrErrorLayout.addComponent(okButton);
    vvrErrorLayout.setComponentAlignment(okButton, Alignment.BOTTOM_CENTER);
    okButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            // Just close the window
            vvrErrorWindow.close();
        }
    });
    return vvrErrorWindow;
}

From source file:com.oodrive.nuage.webui.component.window.VvrAttributesWindow.java

License:Apache License

@SuppressWarnings("serial")
@Override/*  w ww  . j a  v a  2s  .  c o  m*/
public final Window init(final AbstractItemModel model) {

    // Cast model in vvrModel
    final VvrModel vvrModel = (VvrModel) model;
    // Add new window
    final Window vvrAttributesWindow = new Window("VVR Attributes");
    vvrAttributesWindow.center();
    vvrAttributesWindow.setWidth("400px");
    vvrAttributesWindow.setResizable(false);

    final VerticalLayout layout = new VerticalLayout();
    vvrAttributesWindow.setContent(layout);
    layout.setMargin(true);

    final FormLayout vvrAttributesLayout = new FormLayout();
    layout.addComponent(vvrAttributesLayout);
    vvrAttributesLayout.setMargin(true);

    // Enter NAME
    String value = vvrModel.getVvrName();
    if (value == null) {
        value = "";
    }
    final TextField name = new TextField("Name", value);
    name.setSizeFull();
    vvrAttributesLayout.addComponent(name);

    // Enter description
    value = vvrModel.getVvrDescription();
    if (value == null) {
        value = "";
    }
    final TextField desc = new TextField("Description", value);
    desc.setSizeFull();
    vvrAttributesLayout.addComponent(desc);

    // Enter name
    final TextField vvrUUID = new TextField("UUID");
    vvrUUID.setValue(vvrUuid.toString());
    vvrUUID.setReadOnly(true);
    vvrUUID.setSizeFull();
    vvrAttributesLayout.addComponent(vvrUUID);

    // OK button
    final HorizontalLayout hzlayout = new HorizontalLayout();
    layout.addComponent(hzlayout);
    hzlayout.setSizeFull();

    final Button okButton = new Button("OK");
    hzlayout.addComponent(okButton);
    hzlayout.setComponentAlignment(okButton, Alignment.MIDDLE_CENTER);

    okButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            WaitingComponent.executeBackground(vvrModel, new Background() {
                @Override
                public void processing() {
                    vvrModel.setVvrName(name.getValue());
                    vvrModel.setVvrDescription(desc.getValue());
                }

                @Override
                public void postProcessing() {
                }
            });
            vvrAttributesWindow.close();
        }
    });

    // Cancel button
    final Button cancelButton = new Button("Cancel");
    hzlayout.addComponent(cancelButton);
    hzlayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER);

    cancelButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            // Just close the window
            vvrAttributesWindow.close();
        }
    });
    return vvrAttributesWindow;
}

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

private Window editDateEntryWindow(final String entryDate) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setWidth("100%");
    vlayout.setMargin(true);//from w w  w.  ja  va2 s. co  m
    vlayout.setSpacing(true);

    final Window window = new Window("EDIT DATE ENTRY", vlayout);
    window.setResizable(false);

    Button editBtn = new Button("EDIT DATE ENTRY?");
    editBtn.setWidth("100%");
    editBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            boolean result = si.editEmploymentDateEntry(getEmployeeId(), entryDate);
            if (result) {
                getWindow().showNotification("Update Entry Date.", Window.Notification.TYPE_TRAY_NOTIFICATION);
                (window.getParent()).removeWindow(window);
            }
        }
    });
    window.addComponent(editBtn);

    return window;
}

From source file:com.pms.component.ganttchart.DemoUI.java

License:Apache License

private void openStepEditor(AbstractStep step) {
    final Window win = new Window("Step Editor");
    win.setResizable(false);
    win.center();/* w ww. j a v a2s  .  com*/

    final Collection<Component> hidden = new ArrayList<Component>();

    BeanItem<AbstractStep> item = new BeanItem<AbstractStep>(step);

    final FieldGroup group = new FieldGroup(item);
    group.setBuffered(true);

    TextField captionField = new TextField("Caption");
    captionField.setNullRepresentation("");
    group.bind(captionField, "caption");

    TextField descriptionField = new TextField("Description");
    descriptionField.setNullRepresentation("");
    group.bind(descriptionField, "description");
    descriptionField.setVisible(false);
    hidden.add(descriptionField);

    NativeSelect captionMode = new NativeSelect("Caption Mode");
    captionMode.addItem(Step.CaptionMode.TEXT);
    captionMode.addItem(Step.CaptionMode.HTML);
    group.bind(captionMode, "captionMode");
    captionMode.setVisible(false);
    hidden.add(captionMode);

    final NativeSelect parentStepSelect = new NativeSelect("Parent Step");
    parentStepSelect.setEnabled(false);
    if (!gantt.getSteps().contains(step)) {
        // new step
        parentStepSelect.setEnabled(true);
        for (Step parentStepCanditate : gantt.getSteps()) {
            parentStepSelect.addItem(parentStepCanditate);
            parentStepSelect.setItemCaption(parentStepCanditate, parentStepCanditate.getCaption());
            if (step instanceof SubStep) {
                if (parentStepCanditate.getSubSteps().contains(step)) {
                    parentStepSelect.setValue(parentStepCanditate);
                    parentStepSelect.setEnabled(false);
                    break;
                }
            }
        }
    }
    parentStepSelect.setVisible(false);
    hidden.add(parentStepSelect);

    TextField bgField = new TextField("Background color");
    bgField.setNullRepresentation("");
    group.bind(bgField, "backgroundColor");
    bgField.setVisible(false);
    hidden.add(bgField);

    DateField startDate = new DateField("Start date");
    startDate.setLocale(gantt.getLocale());
    startDate.setTimeZone(gantt.getTimeZone());
    startDate.setResolution(Resolution.SECOND);
    startDate.setConverter(new DateToLongConverter());
    group.bind(startDate, "startDate");

    DateField endDate = new DateField("End date");
    endDate.setLocale(gantt.getLocale());
    endDate.setTimeZone(gantt.getTimeZone());
    endDate.setResolution(Resolution.SECOND);
    endDate.setConverter(new DateToLongConverter());
    group.bind(endDate, "endDate");

    CheckBox showMore = new CheckBox("Show all settings");
    showMore.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            for (Component c : hidden) {
                c.setVisible((Boolean) event.getProperty().getValue());
            }
            win.center();
        }
    });

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    win.setContent(content);

    content.addComponent(captionField);
    content.addComponent(captionMode);
    content.addComponent(descriptionField);
    content.addComponent(parentStepSelect);
    content.addComponent(bgField);
    content.addComponent(startDate);
    content.addComponent(endDate);
    content.addComponent(showMore);

    HorizontalLayout buttons = new HorizontalLayout();
    content.addComponent(buttons);

    Button ok = new Button("Ok", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                group.commit();
                AbstractStep step = ((BeanItem<AbstractStep>) group.getItemDataSource()).getBean();
                gantt.markStepDirty(step);
                if (parentStepSelect.isEnabled() && parentStepSelect.getValue() != null) {
                    SubStep subStep = addSubStep(parentStepSelect, step);
                    step = subStep;
                }
                if (step instanceof Step && !gantt.getSteps().contains(step)) {
                    gantt.addStep((Step) step);
                }
                if (ganttListener != null && step instanceof Step) {
                    ganttListener.stepModified((Step) step);
                }
                win.close();
            } catch (CommitException e) {
                Notification.show("Commit failed", e.getMessage(), Type.ERROR_MESSAGE);
                e.printStackTrace();
            }
        }

        private SubStep addSubStep(final NativeSelect parentStepSelect, AbstractStep dataSource) {
            SubStep subStep = new SubStep();
            subStep.setCaption(dataSource.getCaption());
            subStep.setCaptionMode(dataSource.getCaptionMode());
            subStep.setStartDate(dataSource.getStartDate());
            subStep.setEndDate(dataSource.getEndDate());
            subStep.setBackgroundColor(dataSource.getBackgroundColor());
            subStep.setDescription(dataSource.getDescription());
            subStep.setStyleName(dataSource.getStyleName());
            ((Step) parentStepSelect.getValue()).addSubStep(subStep);
            return subStep;
        }
    });
    Button cancel = new Button("Cancel", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            group.discard();
            win.close();
        }
    });
    Button delete = new Button("Delete", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            AbstractStep step = ((BeanItem<AbstractStep>) group.getItemDataSource()).getBean();
            if (step instanceof SubStep) {
                SubStep substep = (SubStep) step;
                substep.getOwner().removeSubStep(substep);
            } else {
                gantt.removeStep((Step) step);
                if (ganttListener != null) {
                    ganttListener.stepDeleted((Step) step);
                }
            }
            win.close();
        }
    });
    buttons.addComponent(ok);
    buttons.addComponent(cancel);
    buttons.addComponent(delete);
    win.setClosable(true);

    DashboardUI.getCurrent().getUI().addWindow(win);
}

From source file:com.pms.component.ganttchart.scheduletask.TaskGanntChart.java

License:Apache License

private void openStepEditor(AbstractStep step) {
    final Window win = new Window("More Info");
    win.setResizable(false);
    win.center();//from  w  w  w.j  a  v a  2s .c  o m

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    win.setContent(content);

    String taskName = step.getCaption();
    UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory");
    UserStory userStory = userStoryDAO.getCurrentWorkingUserStory(project);

    TaskDAO taskDAO = (TaskDAO) DashboardUI.context.getBean("Task");
    Task task1 = taskDAO.getTaskFromUserStroyNameAndTaskName(userStory.getName(), taskName);

    TextField userStoryNameField = new TextField("Task Name");
    userStoryNameField.setValue(task1.getName());

    TextField userStoryPriority = new TextField("Priority");
    userStoryPriority.setValue(String.valueOf(task1.getPriority()));

    TextField userStoryState = new TextField("State");
    userStoryState.setValue(task1.getState());

    TextField projectName = new TextField("Project Name");
    projectName.setValue(project.getName());

    TextField userStoryName = new TextField("UserStoryName Name");
    userStoryName.setValue(userStory.getName());

    content.addComponent(userStoryNameField);
    content.addComponent(userStoryPriority);
    content.addComponent(userStoryState);
    content.addComponent(projectName);
    content.addComponent(userStoryName);

    Button ok = new Button("Ok", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            win.close();
        }

    });

    content.addComponent(ok);
    win.setClosable(true);

    DashboardUI.getCurrent().getUI().addWindow(win);
}

From source file:com.pms.component.ganttchart.scheduletask.UserStoryGanntChart.java

License:Apache License

private void openStepEditor(AbstractStep step) {
    final Window win = new Window("More Info");
    win.setResizable(false);
    win.center();//from   ww  w  .j a  v  a  2 s.com

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    win.setContent(content);

    String userStoryName = step.getCaption();
    UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory");
    UserStory userStory = userStoryDAO.getUserStoryFormProjectNameAndUserStoryName(project.getName(),
            userStoryName);

    TextField userStoryNameField = new TextField("User Story Name");
    userStoryNameField.setValue(userStory.getName());

    TextField userStoryPriority = new TextField("Priority");
    userStoryPriority.setValue(String.valueOf(userStory.getPriority()));

    TextField userStoryState = new TextField("State");
    userStoryState.setValue(userStory.getState());

    TextField projectName = new TextField("Project Name");
    projectName.setValue(project.getName());

    content.addComponent(userStoryNameField);
    content.addComponent(userStoryPriority);
    content.addComponent(userStoryState);
    content.addComponent(projectName);

    Button ok = new Button("Ok", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            win.close();
        }

    });

    content.addComponent(ok);
    win.setClosable(true);

    DashboardUI.getCurrent().getUI().addWindow(win);
}

From source file:com.save.client.RemoveAccountWindow.java

void getConfirmationWindow(final String str) {
    final Window sub = new Window("Conifrm?");
    sub.setWidth("180px");
    sub.setHeight("150px");
    sub.center();/*from   w  ww .j  a  va  2s  .c  om*/
    sub.setResizable(false);
    UI.getCurrent().addWindow(sub);

    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);
    vlayout.setSpacing(true);

    vlayout.addComponent(new Label("Client is a Distributor!"));

    Button removeBtn = new Button("REMOVE");
    removeBtn.setWidth("100%");
    removeBtn.addClickListener((Button.ClickEvent event) -> {
        boolean result = clientService.removeAccount(getClientId(), str);
        if (result) {
            sub.close();
            close();
        }
    });
    vlayout.addComponent(removeBtn);

    sub.setContent(vlayout);
    sub.addCloseListener((CloseEvent e) -> {
        close();
    });
}

From source file:com.snowy.UsersList.java

public UsersList(data d) {
    this.d = d;/*  ww w . j a v a 2  s  .com*/
    c.addContainerProperty("id", Integer.class, "");
    retrieveActiveUsers();
    //this.addItem("Chase");
    //this.addItem("Cole");

    //ll.addComponent(ll);
    //PopupView pop = new PopupView(null,ll);
    //pop.s
    //pop.addPopupVisibilityListener(e->{
    //   ll.addComponent(hl);
    //});

    //TODO add the select listener
    ls.addValueChangeListener(e -> {
        if (e.getProperty().getValue() != null) {
            Window w = new Window("Confirm Challenge");
            int id = Integer.parseInt(c.getItem(e.getProperty().getValue().toString()).getItemProperty("id")
                    .getValue().toString());
            String Username = e.getProperty().getValue().toString();
            //Logger.getLogger(UsersList.class.getName()).info(Username);
            //Logger.getLogger(UsersList.class.getName()).info(id+"");
            VerticalLayout ll = new VerticalLayout();
            VerticalLayout bb = new VerticalLayout();
            HorizontalLayout hl = new HorizontalLayout();
            Label la = new Label("Send challenge to " + Username + "?");
            bb.addComponent(la);
            ll.addComponent(bb);

            ll.setSizeUndefined();
            bb.setComponentAlignment(la, Alignment.MIDDLE_CENTER);

            ll.addComponent(hl);
            ll.setSpacing(true);
            ll.setMargin(new MarginInfo(true, true, false, true));
            hl.setMargin(new MarginInfo(false, true, true, true));
            hl.setSpacing(true);
            Button cancle = new Button("Cancel", b -> {
                w.close();
            });
            Button send = new Button("Send", c -> {
                if (d.sendChallenge(id)) {
                    ll.removeAllComponents();
                    ll.addComponent(new Label("Challenge Sent Succesfully!"));
                    ll.addComponent(new Button("Close", dd -> {
                        w.close();
                    }));
                    w.setCaption("Success");
                    ll.setSpacing(true);
                    ll.setMargin(true);
                } else {
                    ll.removeAllComponents();
                    ll.addComponent(new Label("Challenge Dend Failed"));
                    ll.addComponent(new Button("Close", dd -> {
                        w.close();
                    }));
                    w.setCaption("Failure");
                    ll.setSpacing(true);
                    ll.setMargin(true);
                }
            });
            hl.addComponents(cancle, send);
            //      this.addComponent(pop);
            //    ll.addComponent(la);
            //   pop.setPopupVisible(true);
            //w.setPosition(null, null);
            w.center();
            w.setModal(true);
            w.setClosable(false);
            w.setResizable(false);
            w.setContent(ll);
            this.getUI().addWindow(w);

        }
    });

    this.setSizeFull();
    this.addStyleName("mine");
    this.addComponent(ls);
    ls.setContainerDataSource(c);
    //ls.setContainerDataSource((Container) hm.keySet());
    ls.setSizeFull();
    ls.setImmediate(true);

}

From source file:com.tripoin.util.ui.calendar.BeanItemContainerTestUI.java

License:Apache License

/**
 * Opens up a modal dialog window where an event can be modified
 * /*from   ww  w  .java  2s . co  m*/
 * @param event
 *            The event to modify
 */
private void editEvent(final BasicEvent event) {
    Window modal = new Window("Add event");
    modal.setModal(true);
    modal.setResizable(false);
    modal.setDraggable(false);
    modal.setWidth("300px");
    final FieldGroup fieldGroup = new FieldGroup();

    FormLayout formLayout = new FormLayout();
    TextField captionField = new TextField("Caption");
    captionField.setImmediate(true);
    TextField descriptionField = new TextField("Description");
    descriptionField.setImmediate(true);
    DateField startField = new DateField("Start");
    startField.setResolution(Resolution.MINUTE);
    startField.setImmediate(true);
    DateField endField = new DateField("End");
    endField.setImmediate(true);
    endField.setResolution(Resolution.MINUTE);

    formLayout.addComponent(captionField);
    formLayout.addComponent(descriptionField);
    formLayout.addComponent(startField);
    formLayout.addComponent(endField);

    fieldGroup.bind(captionField, ContainerEventProvider.CAPTION_PROPERTY);
    fieldGroup.bind(descriptionField, ContainerEventProvider.DESCRIPTION_PROPERTY);
    fieldGroup.bind(startField, ContainerEventProvider.STARTDATE_PROPERTY);
    fieldGroup.bind(endField, ContainerEventProvider.ENDDATE_PROPERTY);

    fieldGroup.setItemDataSource(new BeanItem<BasicEvent>(event,
            Arrays.asList(ContainerEventProvider.CAPTION_PROPERTY, ContainerEventProvider.DESCRIPTION_PROPERTY,
                    ContainerEventProvider.STARTDATE_PROPERTY, ContainerEventProvider.ENDDATE_PROPERTY)));
    modal.setContent(formLayout);
    modal.addCloseListener(new Window.CloseListener() {
        /**
        * 
        */
        private static final long serialVersionUID = -3427881784024691882L;

        @Override
        public void windowClose(CloseEvent e) {
            // Commit changes to bean
            try {
                fieldGroup.commit();
            } catch (CommitException e1) {
                e1.printStackTrace();
            }

            if (events.containsId(event)) {
                /*
                 * BeanItemContainer does not notify container listeners
                 * when the bean changes so we need to trigger a
                 * ItemSetChange event
                 */
                BasicEvent dummy = new BasicEvent();
                events.addBean(dummy);
                events.removeItem(dummy);

            } else {
                events.addBean(event);
            }
        }
    });
    getUI().addWindow(modal);
}