Example usage for com.vaadin.ui VerticalLayout removeAllComponents

List of usage examples for com.vaadin.ui VerticalLayout removeAllComponents

Introduction

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

Prototype

@Override
public void removeAllComponents() 

Source Link

Document

Removes all components from the container.

Usage

From source file:org.hbrs.nosql.mongoweb.gui.views.UseCase4.java

@Override
protected void setUp() {
    //Add your Vaadin Coding here ;)
    //MongoDB Connector
    MongoDBConnector mongo = new MongoDBConnector();

    VerticalLayout uc4 = new VerticalLayout();

    TextField uc4input = new TextField();

    uc4input.setCaption("Geben Sie das Semester ein fr das Sie die Anzahl der Abschlsse wollen!");

    Button button = new Button("Suche");

    button.addClickListener(e -> {//from   ww w  .  j av a 2 s .c om
        uc4.removeAllComponents();

        LocalTime t1 = LocalTime.now();

        // load list with values
        int uc4Answer = mongo.getQuery4(uc4input.getValue());

        LocalTime t2 = LocalTime.now();
        Duration elapsed = Duration.between(t1, t2);

        String uc4Answ = uc4Answer + "";
        uc4.addComponent(new Label(uc4Answ));

        uc4.addComponent(new Label("Time: " + elapsed));

        addComponent(uc4);
    });
    addComponents(uc4input, button);
    setMargin(true);
    setSpacing(true);
}

From source file:org.hbrs.nosql.mongoweb.gui.views.UseCase5.java

@Override
protected void setUp() {
    //Add your Vaadin Coding here ;)
    //MongoDB Connector
    MongoDBConnector mongo = new MongoDBConnector();

    VerticalLayout uc5 = new VerticalLayout();

    Button button = new Button("Unternehmen suchen");

    button.addClickListener(e -> {// ww w  . j av  a  2s  . c o m
        uc5.removeAllComponents();

        LocalTime t1 = LocalTime.now();

        // load list with values
        List uc5answer = mongo.getQuery5();

        LocalTime t2 = LocalTime.now();
        Duration elapsed = Duration.between(t1, t2);

        // query over list
        for (int i = 0; i < uc5answer.size(); i++) {
            //create and post labels for list elements
            uc5.addComponent(new Label((String) uc5answer.get(i)));
        }

        uc5.addComponent(new Label("Time: " + elapsed));

        addComponent(uc5);
    });

    addComponents(button);
    setMargin(true);
    setSpacing(true);
}

From source file:org.hbrs.nosql.mongoweb.gui.views.UseCase6.java

@Override
protected void setUp() {
    //Add your Vaadin Coding here ;)
    //MongoDB Connector
    MongoDBConnector mongo = new MongoDBConnector();

    VerticalLayout uc6 = new VerticalLayout();

    Button button = new Button("Welcher Professor hat die meisten Arbeiten untersttzt?");

    button.addClickListener(e -> {/*w w  w .j a v a2s.  co  m*/
        uc6.removeAllComponents();

        LocalTime t1 = LocalTime.now();

        // load list with values
        AggregationOutput uc6answer = mongo.getQuery6();

        LocalTime t2 = LocalTime.now();
        Duration elapsed = Duration.between(t1, t2);

        // query over list
        for (DBObject place : uc6answer.results()) {
            if (!place.get("_id").equals("")) {
                uc6.addComponent(new Label(place.get("_id") + ": " + place.get("Anzahl")));
            }
        }

        uc6.addComponent(new Label("Time: " + elapsed));

        addComponent(uc6);
    });

    addComponents(button);
    setMargin(true);
    setSpacing(true);
}

From source file:org.hbrs.nosql.mongoweb.gui.views.UseCase7.java

@Override
protected void setUp() {
    //Add your Vaadin Coding here ;)
    //Add your Vaadin Coding here ;)
    //MongoDB Connector
    MongoDBConnector mongo = new MongoDBConnector();

    VerticalLayout uc7 = new VerticalLayout();

    TextField uc7input = new TextField();

    uc7input.setCaption("Thema prfen!");

    Button button = new Button("Suche");

    button.addClickListener(e -> {/*from   w ww.j  av  a2 s . c om*/
        uc7.removeAllComponents();

        LocalTime t1 = LocalTime.now();

        // load list with values
        List uc7answer = mongo.getQuery7(uc7input.getValue());

        LocalTime t2 = LocalTime.now();
        Duration elapsed = Duration.between(t1, t2);

        // query over list
        for (int i = 0; i < uc7answer.size(); i++) {
            //create and post labels for list elements
            uc7.addComponent(new Label((String) uc7answer.get(i)));
        }

        uc7.addComponent(new Label("Time: " + elapsed));

        addComponent(uc7);
    });
    addComponents(uc7input, button);
    setMargin(true);
    setSpacing(true);
}

From source file:org.hbrs.nosql.mongoweb.gui.views.UseCase8.java

@Override
protected void setUp() {
    //Add your Vaadin Coding here ;)
    //MongoDB Connector
    MongoDBConnector mongo = new MongoDBConnector();

    VerticalLayout uc8 = new VerticalLayout();

    Label uc8label = new Label("Welche Professoren haben wieviele Arbeiten zu einem Thema betreut?");

    TextField uc8input = new TextField();
    uc8input.setCaption("Thema:");

    Button button = new Button("Suche");

    button.addClickListener(e -> {//from w  ww .ja  v  a 2  s.c o  m
        uc8.removeAllComponents();

        LocalTime t1 = LocalTime.now();

        // load list with values
        AggregationOutput uc8answer = mongo.getQuery8(uc8input.getValue());

        LocalTime t2 = LocalTime.now();
        Duration elapsed = Duration.between(t1, t2);

        // query over list
        for (DBObject place : uc8answer.results()) {
            if (!place.get("_id").equals("")) {
                uc8.addComponent(new Label(place.get("_id") + ": " + place.get("Anzahl")));
            }
        }

        uc8.addComponent(new Label("Time: " + elapsed));

        addComponent(uc8);
    });

    addComponents(uc8label, uc8input, button);
    setMargin(true);
    setSpacing(true);
}

From source file:org.rhegium.vaadin.internal.mvc.VaadinUiBinderService.java

License:Apache License

@Override
protected Component prepareView(View<Component, ?, ?> view) {
    // Get view context pane
    VerticalLayout content = (VerticalLayout) view.getComponent();

    // Remove all existing components since we read the content from xml
    content.removeAllComponents();

    return content;
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.SashRenderer.java

License:Open Source License

public void generateSplitPanelStructure(MPartSashContainer sash) {
    VerticalLayout layout = (VerticalLayout) sash.getWidget();
    layout.removeAllComponents();

    ComponentContainer sashWidget = null;

    @SuppressWarnings("unchecked")
    List<MPartSashContainerElement> renderableAndVisible = (List<MPartSashContainerElement>) filterRenderableAndVisibleElements(
            sash);/*  www  .j  a v a  2s. com*/

    if (renderableAndVisible.isEmpty()) {
        sashWidget = new VerticalLayout();
    } else if (renderableAndVisible.size() == 1) {
        sashWidget = new VerticalLayout();
        MPartSashContainerElement child = renderableAndVisible.get(0);
        sashWidget.addComponent((Component) child.getWidget());
    } else {
        sashWidget = sash.isHorizontal() ? new SashWidgetHorizontal() : new SashWidgetVertical();
        AbstractSplitPanel currentSashWidget = (AbstractSplitPanel) sashWidget;
        currentSashWidget.setLocked(sash.getTags().contains(Tags.NO_RESIZE));
        for (int i = 0; i < renderableAndVisible.size(); i++) {
            MPartSashContainerElement child = renderableAndVisible.get(i);

            if (currentSashWidget.getFirstComponent() == null) {
                currentSashWidget.setFirstComponent((Component) child.getWidget());
            } else {
                if (i == renderableAndVisible.size() - 1) {
                    currentSashWidget.setSecondComponent((Component) child.getWidget());
                } else {
                    AbstractSplitPanel newSashWidget = sash.isHorizontal() ? new SashWidgetHorizontal()
                            : new SashWidgetVertical();
                    newSashWidget.setLocked(sash.getTags().contains(Tags.NO_RESIZE));
                    newSashWidget.setFirstComponent((Component) child.getWidget());
                    currentSashWidget.setSecondComponent(newSashWidget);
                    currentSashWidget = newSashWidget;
                }
            }
        }
    }

    sashWidget.setSizeFull();
    layout.addComponent(sashWidget);

    setWeights(sash);
}

From source file:ru.codeinside.gses.webui.form.EForm.java

License:Mozilla Public License

@Override
public void detach() {
    VerticalLayout layout = (VerticalLayout) getLayout();
    if (integration != null) {
        layout.removeAllComponents();
        integration = null;//from   w w w  .j a  v a2 s  .  c o  m
    }
    if (serial != null) {
        ActivitiApp app = (ActivitiApp) getApplication();
        app.getForms().remove(serial);
    }
    super.detach();
}

From source file:ru.codeinside.gses.webui.supervisor.SupervisorWorkplace.java

License:Mozilla Public License

private Component createAssignerToTaskComponent(final String taskId,
        final ProcedureHistoryPanel procedureHistoryPanel, final ControlledTasksTable table) {
    final Task task = Flash.flash().getProcessEngine().getTaskService().createTaskQuery().taskId(taskId)
            .singleResult();/*  ww  w.jav  a  2s. co m*/
    final VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeFull();
    verticalLayout.setSpacing(true);
    Button backButton = new Button("?");
    backButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            bidChanger.back();
        }
    });
    verticalLayout.addComponent(backButton);

    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSizeFull();
    horizontalLayout.setSpacing(true);

    LazyLoadingContainer2 orgGroupsLazyQueryContainer = new LazyLoadingContainer2(
            new GroupsQuery(GroupsQueryDefinition.Mode.ORG, Flash.login()));
    final FilterTable orgGroupsTable = new FilterTable();
    orgGroupsTable.setFilterBarVisible(true);
    orgGroupsTable.setSizeFull();
    orgGroupsTable.setImmediate(true);
    orgGroupsTable.setSelectable(true);
    orgGroupsTable.setFilterDecorator(new FilterDecorator_());
    orgGroupsTable.setFilterGenerator(new FilterGenerator_());
    orgGroupsLazyQueryContainer.addContainerProperty("name", String.class, null);
    orgGroupsLazyQueryContainer.addContainerProperty("title", String.class, null);
    orgGroupsTable.setContainerDataSource(orgGroupsLazyQueryContainer);
    orgGroupsTable.setHeight("150px");
    orgGroupsTable.setCaption("?  ");
    orgGroupsTable.setColumnHeaders(new String[] { " ", "? " });

    LazyLoadingContainer2 empGroupsLazyQueryContainer = new LazyLoadingContainer2(
            new GroupsQuery(GroupsQueryDefinition.Mode.EMP, Flash.login()));
    final FilterTable empGroupsTable = new FilterTable();
    empGroupsTable.setFilterBarVisible(true);
    empGroupsTable.setSizeFull();
    empGroupsTable.setImmediate(true);
    empGroupsTable.setSelectable(true);
    empGroupsTable.setFilterDecorator(new FilterDecorator_());
    empGroupsTable.setFilterGenerator(new FilterGenerator_());
    empGroupsLazyQueryContainer.addContainerProperty("name", String.class, null);
    empGroupsLazyQueryContainer.addContainerProperty("title", String.class, null);
    empGroupsTable.setContainerDataSource(empGroupsLazyQueryContainer);
    empGroupsTable.setCaption("?  ?");
    empGroupsTable.setHeight("150px");
    empGroupsTable.setColumnHeaders(new String[] { " ", "? " });

    final Table employeesTable = new Table();
    employeesTable.setSizeFull();
    employeesTable.setSelectable(true);
    employeesTable.setHeight("150px");
    employeesTable.setCaption(
            "? ? ? ?, ?   ");
    employeesTable.addContainerProperty("login", String.class, null);
    employeesTable.addContainerProperty("fio", String.class, null);
    employeesTable.setColumnHeaders(new String[] { "", "" });
    employeesTable.setVisible(false);

    orgGroupsTable.addListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            if (task == null) {
                alreadyGone();
                return;
            }
            empGroupsTable.select(null);
            employeesTable.setVisible(true);
            String groupName = event.getItem().getItemProperty("name") != null
                    ? (String) event.getItem().getItemProperty("name").getValue()
                    : "";
            GroupMembersQueryDefinition groupMembersQueryDefinition = new GroupMembersQueryDefinition(groupName,
                    GroupMembersQuery.Mode.ORG);
            LazyQueryContainer groupMembersContainer = new LazyQueryContainer(groupMembersQueryDefinition,
                    new GroupMembersFactory(task.getId()));
            employeesTable.setContainerDataSource(groupMembersContainer);
        }
    });

    empGroupsTable.addListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            if (task == null) {
                alreadyGone();
                return;
            }
            orgGroupsTable.select(null);
            employeesTable.setVisible(true);
            String groupName = event.getItem().getItemProperty("name") != null
                    ? (String) event.getItem().getItemProperty("name").getValue()
                    : "";
            GroupMembersQueryDefinition groupMembersQueryDefinition = new GroupMembersQueryDefinition(groupName,
                    GroupMembersQuery.Mode.SOC);
            LazyQueryContainer groupMembersContainer = new LazyQueryContainer(groupMembersQueryDefinition,
                    new GroupMembersFactory(task.getId()));
            employeesTable.setContainerDataSource(groupMembersContainer);
        }
    });

    final VerticalLayout assignButtonLayout = new VerticalLayout();

    employeesTable.addListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            if (task == null) {
                alreadyGone();
                return;
            }
            final String assigneeLogin = event.getItem().getItemProperty("login").getValue().toString();
            final String taskName = task.getName();
            Button assignButton = new Button("?");
            assignButton.addListener(new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                    final String error = ActivitiBean.get().claim(taskId, assigneeLogin, Flash.login(), true);
                    if (!StringUtils.isEmpty(error)) {
                        getWindow().showNotification(
                                "??  " + assigneeLogin
                                        + "  ? " + taskName,
                                Window.Notification.TYPE_WARNING_MESSAGE);
                        AdminServiceProvider.get().createLog(Flash.getActor(), "activiti task", taskId, "claim",
                                "Fail claim to =>" + assigneeLogin, false);
                    } else {
                        getWindow().showNotification(
                                "? " + assigneeLogin + "  ? " + taskName);
                        AdminServiceProvider.get().createLog(Flash.getActor(), "activiti task", taskId, "claim",
                                "Claim to =>" + assigneeLogin, true);
                        fireTaskChangedEvent(taskId, SupervisorWorkplace.this);
                    }
                    procedureHistoryPanel.refresh();
                    table.refresh();
                    bidChanger.change(item1);
                }
            });
            assignButtonLayout.removeAllComponents();
            assignButtonLayout.addComponent(assignButton);
        }
    });

    horizontalLayout.addComponent(orgGroupsTable);
    horizontalLayout.addComponent(empGroupsTable);
    verticalLayout.addComponent(horizontalLayout);
    verticalLayout.addComponent(employeesTable);
    verticalLayout.addComponent(assignButtonLayout);
    return verticalLayout;
}