Example usage for com.vaadin.ui Alignment BOTTOM_RIGHT

List of usage examples for com.vaadin.ui Alignment BOTTOM_RIGHT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment BOTTOM_RIGHT.

Prototype

Alignment BOTTOM_RIGHT

To view the source code for com.vaadin.ui Alignment BOTTOM_RIGHT.

Click Source Link

Usage

From source file:com.neatresults.mgnltweaks.neatu2b.ui.form.field.U2BField.java

License:Open Source License

/**
 * Initialize the field. <br>/*w ww.  j  av a 2s  .  co m*/
 * Create as many configured Field as we have related values already stored.
 */
@Override
protected void initFields(final PropertysetItem newValue) {
    root.removeAllComponents();
    final TextField id = createTextField("Id", newValue);
    root.addComponent(id);
    final TextField title = createTextField("Title", newValue);
    root.addComponent(title);

    final TextFieldDefinition def = new TextFieldBuilder("description").label("Description").rows(3)
            .definition();
    final TextArea description = (TextArea) createLocalField(def, newValue.getItemProperty(def.getName()),
            false);
    newValue.addItemProperty(def.getName(), description.getPropertyDataSource());
    description.setNullRepresentation("");
    description.setWidth("100%");
    description.setNullSettingAllowed(true);
    root.addComponent(description);

    HorizontalLayout ddLine = new HorizontalLayout();
    final TextField publishedAt = createTextField("Published", newValue);
    ddLine.addComponent(publishedAt);
    final TextField duration = createTextField("Duration", newValue);
    ddLine.addComponent(duration);
    ddLine.addComponent(createTextField("Definition", newValue));

    Button fetchButton = new Button("Fetch metadata");
    fetchButton.addStyleName("magnoliabutton");
    fetchButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {

            String idStr = id.getValue();
            // extract id from url when whole url is passed
            if (idStr.startsWith("http")) {
                idStr = StringUtils.substringBefore(StringUtils.substringAfter(idStr, "?v="), "&");
            }

            U2BService service = null;
            try {
                RestEasyClient client = (RestEasyClient) restClientRegistry.getRestClient("youtube");
                service = client.getClientService(U2BService.class);
            } catch (RegistrationException e) {
                log.error("Failed to get a client for [" + U2BService.class.getName() + "] with: "
                        + e.getMessage(), e);
            }
            if (service != null) {
                String key = u2bModule.getGoogleKey();
                JsonNode response = service.meta(idStr, "snippet", key);
                try {
                    if (response.get("items").getElements().hasNext()) {
                        JsonNode videoItem = response.get("items").getElements().next();
                        String descriptionStr = videoItem.get("snippet").get("description").getTextValue();
                        newValue.getItemProperty("description").setValue(descriptionStr);
                        String titleStr = videoItem.get("snippet").get("title").getTextValue();
                        newValue.getItemProperty("title").setValue(titleStr);
                        Iterator<Entry<String, JsonNode>> thumbs = videoItem.get("snippet").get("thumbnails")
                                .getFields();
                        while (thumbs.hasNext()) {
                            Entry<String, JsonNode> entry = thumbs.next();
                            newValue.getItemProperty(entry.getKey() + "Url")
                                    .setValue(entry.getValue().get("url").getTextValue());
                            newValue.getItemProperty(entry.getKey() + "Width")
                                    .setValue("" + entry.getValue().get("width").getLongValue());
                            newValue.getItemProperty(entry.getKey() + "Height")
                                    .setValue("" + entry.getValue().get("height").getLongValue());
                        }
                        String publishedAtStr = videoItem.get("snippet").get("publishedAt").getTextValue();
                        newValue.getItemProperty("published").setValue(publishedAtStr);
                    }
                } catch (Exception e) {
                    log.error("Failed to parse the video metadata.", e);
                }

                response = service.meta(idStr, "contentDetails", key);
                try {
                    if (response.get("items").getElements().hasNext()) {
                        JsonNode videoItem = response.get("items").getElements().next();
                        String durationStr = videoItem.get("contentDetails").get("duration").getTextValue();
                        newValue.getItemProperty("duration").setValue(durationStr);
                        String definition = videoItem.get("contentDetails").get("definition").getTextValue();
                        newValue.getItemProperty("definition").setValue(definition);
                    }
                } catch (Exception e) {
                    log.error("Failed to parse the video duration.", e);
                }
            }
        }
    });

    ddLine.addComponent(fetchButton);
    ddLine.setWidth(100, Unit.PERCENTAGE);
    ddLine.setHeight(-1, Unit.PIXELS);
    ddLine.setComponentAlignment(fetchButton, Alignment.BOTTOM_RIGHT);
    root.addComponent(ddLine);

    PropertysetItem item = (PropertysetItem) getPropertyDataSource().getValue();
    root.addComponent(createEntryComponent("default", item), root.getComponentCount() - 1);
    root.addComponent(createEntryComponent("standard", item), root.getComponentCount() - 1);
    root.addComponent(createEntryComponent("medium", item), root.getComponentCount() - 1);
    root.addComponent(createEntryComponent("high", item), root.getComponentCount() - 1);
    root.addComponent(createEntryComponent("maxres", item), root.getComponentCount() - 1);
}

From source file:com.openhris.calendar.CalendarScheduleWindow.java

VerticalLayout scheduleLayout() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/* w  ww .  ja v  a 2  s  .  com*/
    layout.setSpacing(true);

    eventType = createEventTypelect();
    layout.addComponent(eventType);

    startDate = createDateField("Start Date: ");
    layout.addComponent(startDate);

    endDate = createDateField("End Date: ");
    layout.addComponent(endDate);

    caption = createTextField("Caption: ");
    layout.addComponent(caption);

    location = createTextField("Where: ");
    layout.addComponent(location);

    description = new TextArea("Description: ");
    description.setWidth("100%");
    description.setRows(3);
    layout.addComponent(description);

    color = createStyleNameSelect();
    layout.addComponent(color);

    saveEventButton = new Button("SAVE", saveEventBtnListener);
    saveEventButton.setWidth("100%");

    deleteEventButton = new Button("DELETE", deleteEventBtnListener);
    deleteEventButton.setWidth("100%");

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setWidth("100%");
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(saveEventButton);
    //        buttons.addComponent(editEventButton);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);

    return layout;
}

From source file:com.openhris.calendar.CalendarScheduleWindow.java

VerticalLayout populateSchedule(CalendarComponentEvents.EventClick event) {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*from  www.  j  ava  2  s. com*/
    layout.setSpacing(true);

    eventType = createEventTypelect();
    eventType.setValue(basicEvent.getEventType());
    layout.addComponent(eventType);

    startDate = createDateField("Start Date: ");
    startDate.setValue(event.getCalendarEvent().getStart());
    layout.addComponent(startDate);

    endDate = createDateField("End Date: ");
    endDate.setValue(event.getCalendarEvent().getEnd());
    layout.addComponent(endDate);

    caption = createTextField("Caption: ");
    caption.setValue(event.getCalendarEvent().getCaption());
    layout.addComponent(caption);

    location = createTextField("Where: ");
    location.setValue(getBasicEvent().getLocation());
    layout.addComponent(location);

    description = new TextArea("Description: ");
    description.setWidth("100%");
    description.setRows(3);
    description.setValue(event.getCalendarEvent().getDescription());
    layout.addComponent(description);

    color = createStyleNameSelect();
    color.setValue(basicEvent.getStyleName());
    layout.addComponent(color);

    eventDataId = createTextField("id: ");
    eventDataId.setValue(getBasicEvent().getEventId());
    eventDataId.setVisible(false);
    layout.addComponent(eventDataId);

    editEventButton = new Button("EDIT", editEventBtnListener);
    editEventButton.setWidth("100%");

    deleteEventButton = new Button("DELETE", deleteEventBtnListener);
    deleteEventButton.setWidth("100%");

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setWidth("100%");
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(editEventButton);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);

    return layout;
}

From source file:com.openhris.payroll.ViewFullScreen.java

public ViewFullScreen(boolean prev, int branchId, String payrollDate) {
    this.prev = prev;
    this.branchId = branchId;
    this.payrollDate = payrollDate;

    setSizeFull();/* ww  w  . java2  s. c o m*/
    setImmediate(true);
    setClosable(false);

    vlayout.setMargin(false);
    vlayout.setSpacing(true);
    vlayout.setSizeFull();

    payrollRegisterTable(getBranchId(), getPayrollDate(), getPrev());
    vlayout.addComponent(payrollRegisterTbl);

    Button closeBtn = new Button("Close");
    closeBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            PayrollRegisterMainUI payrollRegisterMainUI = new PayrollRegisterMainUI(getBranchId());
            payrollRegisterMainUI.payrollRegisterTable(getBranchId(), getPayrollDate(), getPrev())
                    .removeAllItems();
            payrollRegisterMainUI.payrollRegisterTable(getBranchId(), getPayrollDate(), getPrev());
            close();
        }
    });
    vlayout.addComponent(closeBtn);
    vlayout.setComponentAlignment(closeBtn, Alignment.BOTTOM_RIGHT);
    addComponent(vlayout);
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deploymentplan.DeploymentPlanPanel.java

License:Open Source License

@PostConstruct
public void init() {
    setSizeFull();/*from   w  w  w . j ava2 s .c  om*/

    TreeTable table = new TreeTable();

    VerticalLayout mainContent = new VerticalLayout();
    mainContent.setSpacing(true);
    mainContent.setMargin(true);
    mainContent.setStyleName("deployable-style");
    mainContent.setSizeFull();

    setContent(mainContent);

    HorizontalLayout toolBar = new HorizontalLayout();
    toolBar.setMargin(true);
    toolBar.setSpacing(true);
    toolBar.setWidth("100%");

    // Deployment Plan name
    Label deploymentPlanNameLabel = new Label("Plan");
    toolBar.addComponent(deploymentPlanNameLabel);
    toolBar.setExpandRatio(deploymentPlanNameLabel, 1);

    deploymentPlanName = new TextField();
    deploymentPlanName.setInputPrompt(getDefaultName());
    deploymentPlanName.setWidth("100%");
    toolBar.addComponent(deploymentPlanName);
    toolBar.setComponentAlignment(deploymentPlanName, Alignment.TOP_LEFT);
    toolBar.setExpandRatio(deploymentPlanName, 3);

    error = new Label("", ContentMode.HTML);
    error.addStyleName("error");
    error.setSizeUndefined();
    error.addStyleName("light");
    error.addStyleName("v-animate-reveal");
    error.setVisible(false);
    toolBar.addComponent(error);
    toolBar.setComponentAlignment(error, Alignment.TOP_RIGHT);
    toolBar.setExpandRatio(error, 1);
    mainContent.addComponent(toolBar);
    mainContent.setComponentAlignment(toolBar, Alignment.TOP_LEFT);
    mainContent.setExpandRatio(toolBar, 1);

    VerticalLayout deploymentPlanContainer = new VerticalLayout();
    DragAndDropWrapper deploymentPlanContainerWrapper = new DragAndDropWrapper(deploymentPlanContainer);
    DropHandler deploymentPlanDropHandler = new DeploymentDropHandler(deploymentViewManager, this,
            notifierService);
    deploymentPlanContainerWrapper.setDropHandler(deploymentPlanDropHandler);
    deploymentPlanContainerWrapper.setSizeFull();
    mainContent.addComponent(deploymentPlanContainerWrapper);
    mainContent.setExpandRatio(deploymentPlanContainerWrapper, 10);

    container.addContainerProperty(TREE_ITEM_ID, String.class, null);
    table.setSizeFull();
    table.setImmediate(true);
    table.setMultiSelect(true);
    table.setSelectable(true);
    table.setContainerDataSource(container);
    table.setDragMode(Table.TableDragMode.MULTIROW);
    table.setItemCaptionPropertyId(TREE_ITEM_ID);
    table.setCellStyleGenerator(new ItemStyle(DeployableContainerType.DEPLOYED));
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setDropHandler(new OrderedContainerDropHandler(table, deploymentPlanDropHandler));
    table.addShortcutListener(new ShortcutListener("Delete", ShortcutAction.KeyCode.DELETE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            Table table = (Table) target;
            Collection<DeployableEntry> deployableEntries = (Collection<DeployableEntry>) table.getValue();
            for (DeployableEntry deployableEntry : deployableEntries) {
                removeDeployable(deployableEntry);
            }
        }
    });
    deploymentPlanContainer.addComponent(table);

    HorizontalLayout footer = new HorizontalLayout();
    footer.setSizeFull();
    footer.setSpacing(true);
    footer.setMargin(true);
    footer.addStyleName("footer");
    footer.setWidth("100%");

    deployIt = new CheckBox("Deploy this deployment plan");
    footer.addComponent(deployIt);
    footer.setComponentAlignment(deployIt, Alignment.TOP_LEFT);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(true);
    Button cancel = new Button("Cancel");
    cancel.addClickListener(new CancelButtonListener());
    Button create = new Button("Create");
    create.addClickListener(new CreateButtonListener());
    create.addStyleName("wide");
    create.addStyleName("default");
    buttons.addComponent(cancel);
    buttons.addComponent(create);
    footer.addComponent(buttons);
    footer.setComponentAlignment(buttons, Alignment.TOP_RIGHT);

    mainContent.addComponent(footer);
    mainContent.setComponentAlignment(footer, Alignment.BOTTOM_RIGHT);
    mainContent.setExpandRatio(footer, 1);
}

From source file:com.purebred.core.view.Results.java

License:Open Source License

private HorizontalLayout createNavigationLine() {

    HorizontalLayout resultCountDisplay = new HorizontalLayout();
    Label showingLabel = new Label(uiMessageSource.getMessage("entityResults.showing") + " &nbsp ",
            Label.CONTENT_XHTML);
    showingLabel.setSizeUndefined();/*  w ww  . j  ava  2s. co m*/
    showingLabel.addStyleName("small");
    resultCountDisplay.addComponent(showingLabel);
    firstResultTextField = createFirstResultTextField();
    firstResultTextField.addStyleName("small");
    firstResultTextField.setSizeUndefined();
    resultCountDisplay.addComponent(firstResultTextField);
    resultCountLabel = new Label("", Label.CONTENT_XHTML);
    resultCountLabel.setSizeUndefined();
    resultCountLabel.addStyleName("small");
    resultCountDisplay.addComponent(resultCountLabel);

    Label spaceLabel = new Label(" &nbsp; ", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    resultCountDisplay.addComponent(spaceLabel);

    Button refreshButton = new Button(null, getResultsTable(), "refresh");
    refreshButton.setDescription(uiMessageSource.getMessage("entityResults.refresh.description"));
    refreshButton.setSizeUndefined();
    refreshButton.addStyleName("borderless");
    refreshButton.setIcon(new ThemeResource("icons/16/refresh-blue.png"));
    resultCountDisplay.addComponent(refreshButton);

    HorizontalLayout navigationButtons = new HorizontalLayout();
    navigationButtons.setMargin(false, true, false, false);
    navigationButtons.setSpacing(true);

    String perPageText = uiMessageSource.getMessage("entityResults.pageSize");
    pageSizeMenu = new Select();
    pageSizeMenu.addStyleName("small");
    pageSizeMenu.addItem(5);
    pageSizeMenu.setItemCaption(5, "5 " + perPageText);
    pageSizeMenu.addItem(10);
    pageSizeMenu.setItemCaption(10, "10 " + perPageText);
    pageSizeMenu.addItem(25);
    pageSizeMenu.setItemCaption(25, "25 " + perPageText);
    pageSizeMenu.addItem(50);
    pageSizeMenu.setItemCaption(50, "50 " + perPageText);
    pageSizeMenu.addItem(100);
    pageSizeMenu.setItemCaption(100, "100 " + perPageText);
    pageSizeMenu.setFilteringMode(Select.FILTERINGMODE_OFF);
    pageSizeMenu.setNewItemsAllowed(false);
    pageSizeMenu.setNullSelectionAllowed(false);
    pageSizeMenu.setImmediate(true);
    pageSizeMenu.setWidth(8, UNITS_EM);
    navigationButtons.addComponent(pageSizeMenu);

    firstButton = new Button(null, getResultsTable(), "firstPage");
    firstButton.setDescription(uiMessageSource.getMessage("entityResults.first.description"));
    firstButton.setSizeUndefined();
    firstButton.addStyleName("borderless");
    firstButton.setIcon(new ThemeResource("icons/16/first.png"));
    navigationButtons.addComponent(firstButton);

    previousButton = new Button(null, getResultsTable(), "previousPage");
    previousButton.setDescription(uiMessageSource.getMessage("entityResults.previous.description"));
    previousButton.setSizeUndefined();
    previousButton.addStyleName("borderless");
    previousButton.setIcon(new ThemeResource("icons/16/previous.png"));
    navigationButtons.addComponent(previousButton);

    nextButton = new Button(null, getResultsTable(), "nextPage");
    nextButton.setDescription(uiMessageSource.getMessage("entityResults.next.description"));
    nextButton.setSizeUndefined();
    nextButton.addStyleName("borderless");
    nextButton.setIcon(new ThemeResource("icons/16/next.png"));
    navigationButtons.addComponent(nextButton);

    lastButton = new Button(null, getResultsTable(), "lastPage");
    lastButton.setDescription(uiMessageSource.getMessage("entityResults.last.description"));
    lastButton.setSizeUndefined();
    lastButton.addStyleName("borderless");
    lastButton.setIcon(new ThemeResource("icons/16/last.png"));
    navigationButtons.addComponent(lastButton);

    HorizontalLayout navigationLine = new HorizontalLayout();
    navigationLine.setWidth("100%");
    navigationLine.setMargin(true, true, true, false);

    navigationLine.addComponent(resultCountDisplay);
    navigationLine.setComponentAlignment(resultCountDisplay, Alignment.BOTTOM_LEFT);

    navigationLine.addComponent(navigationButtons);
    navigationLine.setComponentAlignment(navigationButtons, Alignment.BOTTOM_RIGHT);

    return navigationLine;
}

From source file:com.skysql.manager.ui.CalendarDialog.java

License:Open Source License

/**
 * Initializes a modal window to edit schedule event.
 *
 * @param event the event/*from www.  j a  va  2 s . c om*/
 * @param newEvent the new event
 */
private void createCalendarEventPopup(CalendarCustomEvent event, boolean newEvent) {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);

    scheduleEventPopup = new Window(null, layout);
    scheduleEventPopup.setWidth("400px");
    scheduleEventPopup.setModal(true);
    scheduleEventPopup.center();

    Date occurrence = event.getOccurrence();
    if (!newEvent && occurrence != null) {
        Form form = new Form();
        form.setCaption("This is a repeat occurrence");
        layout.addComponent(form);

        DateField dateField = new DateField("Occurrence Start");
        if (useSecondResolution) {
            dateField.setResolution(Resolution.SECOND);
        } else {
            dateField.setResolution(Resolution.MINUTE);
        }
        dateField.setValue(event.getStart());
        dateField.setEnabled(false);
        form.addField("dateField", dateField);
        form.setFooter(null);

        HorizontalLayout editLayout = new HorizontalLayout();
        editLayout.setSpacing(true);
        layout.addComponent(editLayout);

        final Label label = new Label("Click to change the original event below:");
        editLayout.addComponent(label);
        editLayout.setComponentAlignment(label, Alignment.BOTTOM_LEFT);

        editOriginalButton = new Button("Edit", new ClickListener() {

            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent clickEvent) {
                scheduleEventForm.setEnabled(true);
                applyEventButton.setEnabled(true);
                label.setValue("Editing original event:");
                editOriginalButton.setVisible(false);
            }
        });
        editLayout.addComponent(editOriginalButton);

        scheduleEventForm.setEnabled(false);
    } else {
        scheduleEventForm.setEnabled(true);
    }

    layout.addComponent(scheduleEventForm);

    applyEventButton = new Button("Add", new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            commitCalendarEvent();
        }
    });
    Button cancel = new Button("Cancel", new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            discardCalendarEvent();
        }
    });
    deleteEventButton = new Button("Delete", new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            deleteCalendarEvent();
        }
    });
    scheduleEventPopup.addListener(new CloseListener() {
        private static final long serialVersionUID = 1L;

        public void windowClose(CloseEvent e) {
            discardCalendarEvent();
        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(cancel);
    buttons.addComponent(applyEventButton);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);
}

From source file:com.skysql.manager.ui.CalendarDialog.java

License:Open Source License

/**
 * Show delete popup./* ww w .  j  av a2  s .  c o  m*/
 *
 * @param event the event
 */
private void showDeletePopup(final CalendarCustomEvent event) {
    if (event == null) {
        return;
    }

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

    deleteSchedulePopup = new Window("Delete Recurring Event", layout);
    deleteSchedulePopup.setWidth("740px");
    deleteSchedulePopup.setModal(true);
    deleteSchedulePopup.center();
    deleteSchedulePopup.setContent(layout);
    deleteSchedulePopup.addCloseListener(new CloseListener() {
        private static final long serialVersionUID = 1L;

        public void windowClose(CloseEvent e) {
            UI.getCurrent().removeWindow(deleteSchedulePopup);
        }
    });

    Label warning = new Label(
            "Do you want to delete the original event, or this and all future occurrences of the event, or only the selected occurrence?");
    layout.addComponent(warning);

    Button cancel = new Button("Cancel", new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(deleteSchedulePopup);
        }
    });

    Button deleteAll = new Button("Delete Original Event", new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent dummy) {
            String scheduleID = (String) event.getData();
            Schedule.delete(scheduleID);

            schedule.getScheduleList().remove(scheduleID);

            ArrayList<CalendarCustomEvent> eventsList = eventsMap.remove(scheduleID);
            for (CalendarCustomEvent removeEvent : eventsList) {
                if (dataSource.containsEvent(removeEvent)) {
                    dataSource.removeEvent(removeEvent);
                }
            }

            UI.getCurrent().removeWindow(deleteSchedulePopup);

            UI.getCurrent().removeWindow(scheduleEventPopup);

        }
    });

    Button deleteFuture = new Button("Delete All Future Events", new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent dummy) {
            String scheduleID = (String) event.getData();
            ScheduleRecord scheduleRecord = schedule.getScheduleList().get(scheduleID);
            VEvent vEvent = iCalSupport.readVEvent(scheduleRecord.getICal());
            ManagerUI.log("before Delete All Future Events\n" + vEvent);
            iCalSupport.deleteAllFuture(vEvent, event.getStart());
            ManagerUI.log("after Delete All Future Events\n" + vEvent);
            scheduleRecord.setICal(vEvent.toString());

            Schedule.update(scheduleID, vEvent.toString());
            ArrayList<CalendarCustomEvent> eventsList = eventsMap.remove(scheduleID);
            for (CalendarCustomEvent removeEvent : eventsList) {
                if (dataSource.containsEvent(removeEvent)) {
                    dataSource.removeEvent(removeEvent);
                }
            }

            schedule.getScheduleList().put(scheduleID, scheduleRecord);

            addEventsToMap(scheduleID, vEvent, event.getNode());
            eventsList = eventsMap.get(scheduleID);
            for (CalendarCustomEvent addEvent : eventsList) {
                if (!dataSource.containsEvent(addEvent)) {
                    dataSource.addEvent(addEvent);
                }
            }

            UI.getCurrent().removeWindow(deleteSchedulePopup);

            UI.getCurrent().removeWindow(scheduleEventPopup);

        }
    });

    Button deleteSelected = new Button("Delete Only This Event", new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent dummy) {
            String scheduleID = (String) event.getData();
            ScheduleRecord scheduleRecord = schedule.getScheduleList().get(scheduleID);
            VEvent vEvent = iCalSupport.readVEvent(scheduleRecord.getICal());
            ManagerUI.log("before Exclude\n" + vEvent);
            iCalSupport.addExcludedDate(vEvent, event.getStart());
            ManagerUI.log("after Exclude\n" + vEvent);
            scheduleRecord.setICal(vEvent.toString());

            Schedule.update(scheduleID, vEvent.toString());
            ArrayList<CalendarCustomEvent> eventsList = eventsMap.remove(scheduleID);
            for (CalendarCustomEvent removeEvent : eventsList) {
                if (dataSource.containsEvent(removeEvent)) {
                    dataSource.removeEvent(removeEvent);
                }
            }

            schedule.getScheduleList().put(scheduleID, scheduleRecord);

            addEventsToMap(scheduleID, vEvent, event.getNode());
            eventsList = eventsMap.get(scheduleID);
            for (CalendarCustomEvent addEvent : eventsList) {
                if (!dataSource.containsEvent(addEvent)) {
                    dataSource.addEvent(addEvent);
                }
            }

            UI.getCurrent().removeWindow(deleteSchedulePopup);

            UI.getCurrent().removeWindow(scheduleEventPopup);

        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(cancel);
    buttons.addComponent(deleteAll);
    buttons.addComponent(deleteFuture);
    buttons.addComponent(deleteSelected);
    deleteSelected.focus();

    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);

    if (!UI.getCurrent().getWindows().contains(deleteSchedulePopup)) {
        UI.getCurrent().addWindow(deleteSchedulePopup);
    }
}

From source file:de.catma.ui.analyzer.querybuilder.AbstractSearchPanel.java

License:Open Source License

protected void initSearchPanelComponents(Component content) {
    setSizeFull();/* w w  w  .ja va  2 s.  co  m*/
    setSpacing(true);
    cbComplexQuery = new CheckBox("continue to build a complex query");
    cbComplexQuery.setImmediate(true);
    addComponent(cbComplexQuery);

    setExpandRatio(content, 0.99f);
    setExpandRatio(cbComplexQuery, 0.01f);
    setComponentAlignment(cbComplexQuery, Alignment.BOTTOM_RIGHT);

    initSearchPanelActions();
}

From source file:de.catma.ui.analyzer.TagKwicDialog.java

License:Open Source License

private void initComponents() {
    window = new Window("Select affected User Markup Collections");
    window.setModal(true);/*from www  .ja  v a 2s.  co m*/

    setSpacing(true);
    setMargin(true);
    setSizeFull();

    Label tagResultsLabel = new Label(
            "The selected User Markup Collections will be modfied by this tagging operation. Are sure?");
    addComponent(tagResultsLabel);

    umcTable = new TreeTable("User Markup Collections");
    umcTable.addContainerProperty(UmcTableProperty.CAPTION, String.class, null);
    umcTable.setColumnHeader(UmcTableProperty.CAPTION, "Document/Collection");
    umcTable.addContainerProperty(UmcTableProperty.TARGET, Component.class, null);
    umcTable.setColumnHeader(UmcTableProperty.TARGET, "targeted User Markup Collection");
    umcTable.setSizeFull();

    addComponent(umcTable);

    setExpandRatio(umcTable, 1.0f);

    btOk = new Button("Ok");
    btOk.setEnabled(false);

    btCancel = new Button("Cancel");

    HorizontalLayout buttonPanel = new HorizontalLayout();
    buttonPanel.setSpacing(true);

    buttonPanel.addComponent(btOk);
    buttonPanel.addComponent(btCancel);

    buttonPanel.setComponentAlignment(btOk, Alignment.MIDDLE_RIGHT);
    buttonPanel.setComponentAlignment(btCancel, Alignment.MIDDLE_RIGHT);

    addComponent(buttonPanel);
    setComponentAlignment(buttonPanel, Alignment.BOTTOM_RIGHT);

    window.setContent(this);
    window.setWidth("50%");
    window.setHeight("80%");
}