Example usage for com.vaadin.v7.ui VerticalLayout VerticalLayout

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

Introduction

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

Prototype

public VerticalLayout() 

Source Link

Document

Constructs an empty VerticalLayout.

Usage

From source file:info.magnolia.vaadin.periscope.ResultList.java

License:Open Source License

@Inject
public ResultList() {
    layout = new VerticalLayout();
    layout.addStyleName("result-list");

    loadingIcon = new Label();
    loadingIcon.addStyleName("async-loading");
}

From source file:org.esn.esobase.view.tab.BookTranslateTab.java

public BookTranslateTab(DBService service) {
    this.service = service;
    this.setSizeFull();
    FilterChangeListener filterChangeListener = new FilterChangeListener();
    bookListlayout = new HorizontalLayout();
    bookListlayout.setWidth(100f, Unit.PERCENTAGE);
    bookTable = new ComboBox("");
    bookTable.setPageLength(20);//from   w w w. j  a va  2  s . com
    bookTable.setScrollToSelectedItem(true);
    bookTable.setDataProvider(new ListDataProvider<>(books));
    bookTable.addValueChangeListener(new BookSelectListener());

    bookTable.setWidth(100f, Unit.PERCENTAGE);
    locationTable = new ComboBox("?");
    locationTable.setPageLength(15);
    locationTable.setScrollToSelectedItem(true);

    locationTable.setWidth(100f, Unit.PERCENTAGE);
    locationTable.setDataProvider(new ListDataProvider<>(locations));

    locationTable.addValueChangeListener(filterChangeListener);

    subLocationTable = new ComboBox("?");
    subLocationTable.setPageLength(15);
    subLocationTable.setScrollToSelectedItem(true);
    subLocationTable.addValueChangeListener(filterChangeListener);

    subLocationTable.setWidth(100f, Unit.PERCENTAGE);
    subLocationTable.setDataProvider(new ListDataProvider<>(subLocations));

    FormLayout locationAndBook = new FormLayout(locationTable, subLocationTable, bookTable);
    locationAndBook.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    locationAndBook.setSizeFull();

    bookListlayout.addComponent(locationAndBook);
    translateStatus = new ComboBoxMultiselect("? ",
            Arrays.asList(TRANSLATE_STATUS.values()));
    translateStatus.setClearButtonCaption("?");
    translateStatus.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            LoadFilters();
        }
    });
    noTranslations = new CheckBox("?  ?");
    noTranslations.setValue(Boolean.FALSE);
    noTranslations.addValueChangeListener(filterChangeListener);
    emptyTranslations = new CheckBox("?  ");
    emptyTranslations.setValue(Boolean.FALSE);
    emptyTranslations.addValueChangeListener(filterChangeListener);
    HorizontalLayout checkBoxlayout = new HorizontalLayout(noTranslations, emptyTranslations);
    translatorBox = new ComboBox("");
    translatorBox.setPageLength(15);
    translatorBox.setScrollToSelectedItem(true);
    translatorBox.setDataProvider(new ListDataProvider(service.getSysAccounts()));
    translatorBox.addValueChangeListener(filterChangeListener);
    refreshButton = new Button("");
    refreshButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            LoadFilters();
            LoadBookContent();
        }
    });
    countLabel = new Label();
    searchField = new TextField("?? ?");
    searchField.setSizeFull();
    searchField.setNullRepresentation("");
    searchField.addValueChangeListener(filterChangeListener);

    FormLayout filtersLayout = new FormLayout(translateStatus, translatorBox, checkBoxlayout, searchField);
    filtersLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    filtersLayout.setSizeFull();
    bookListlayout.addComponent(filtersLayout);
    bookListlayout.addComponent(refreshButton);
    bookListlayout.addComponent(countLabel);
    bookListlayout.setExpandRatio(locationAndBook, 0.4f);
    bookListlayout.setExpandRatio(filtersLayout, 0.4f);
    bookListlayout.setExpandRatio(refreshButton, 0.1f);
    bookListlayout.setExpandRatio(countLabel, 0.1f);
    bookListlayout.setHeight(105f, Unit.PIXELS);

    bookContentLayout = new TabSheet();
    bookContentLayout.setSizeFull();
    bookNameLayout = new HorizontalLayout();
    bookNameLayout.setSizeFull();
    bookNameOrigLayout = new VerticalLayout();
    bookNameEn = new TextField("?");
    bookNameEn.setWidth(500f, Unit.PIXELS);
    bookNameRu = new TextField(" ?");
    bookNameRu.setWidth(500f, Unit.PIXELS);
    bookNameRu.setNullRepresentation("");
    bookNameOrigLayout.addComponent(bookNameEn);
    bookNameOrigLayout.addComponent(bookNameRu);
    bookNameLayout.addComponent(bookNameOrigLayout);
    bookNameTranslationsLayout = new VerticalLayout();
    bookNameTranslationsLayout.setSizeFull();
    bookNameLayout.addComponent(bookNameTranslationsLayout);
    bookContentLayout.addTab(bookNameLayout, "?");

    bookTextLayout = new HorizontalLayout();
    bookTextLayout.setSizeFull();
    bookTextOrigLayout = new HorizontalLayout();
    bookTextOrigLayout.setSizeFull();
    bookTextEn = new TextArea("?");
    bookTextEn.setRows(20);
    bookTextEn.setSizeFull();
    bookTextRu = new TextArea(" ?");
    bookTextRu.setRows(20);
    bookTextRu.setSizeFull();
    bookTextRu.setNullRepresentation("");
    bookTextOrigLayout.addComponent(bookTextEn);
    bookTextOrigLayout.addComponent(bookTextRu);
    bookTextLayout.addComponent(bookTextOrigLayout);
    bookTextTranslationsLayout = new VerticalLayout();
    bookTextTranslationsLayout.setSizeFull();
    bookTextLayout.addComponent(bookTextTranslationsLayout);
    bookTextLayout.setExpandRatio(bookTextOrigLayout, 2f);
    bookTextLayout.setExpandRatio(bookTextTranslationsLayout, 1f);
    bookContentLayout.addTab(bookTextLayout, "?");
    bookNameEn.setReadOnly(true);
    bookNameRu.setReadOnly(true);
    bookTextEn.setReadOnly(true);
    bookTextRu.setReadOnly(true);
    this.addComponent(bookListlayout);
    this.addComponent(bookContentLayout);
    this.bookListlayout.setHeight(105f, Unit.PIXELS);
    this.setExpandRatio(bookContentLayout, 1f);
    new NoAutcompleteComboBoxExtension(locationTable);
    new NoAutcompleteComboBoxExtension(subLocationTable);
    new NoAutcompleteComboBoxExtension(translatorBox);
    LoadFilters();
}

From source file:org.esn.esobase.view.tab.SynchronizationTab.java

public SynchronizationTab(DBService service_) {
    this.setSizeFull();
    this.service = service_;
    TextColumnGenerator textColumnGenerator = new TextColumnGenerator();
    tabs = new TabSheet();
    playerLayout = new VerticalLayout();
    syncPlayerPhrasesActions = new HorizontalLayout();
    syncPlayerPhrasesButton = new Button("");
    syncPlayerPhrasesButton.addClickListener(new Button.ClickListener() {

        @Override/*from   w  ww .j av a2 s  .  c  o  m*/
        public void buttonClick(Button.ClickEvent event) {
            GoogleDocsService docsService = new GoogleDocsService();
            List<GSpreadSheetsPlayerPhrase> playerPhrases = docsService.getPlayerPhrases();
            try {
                playerPhraseDiffContainer = service.getPlayerPhrasesDiff(playerPhrases,
                        playerPhraseDiffContainer);
            } catch (OriginalTextMismatchException ex) {
                Logger.getLogger(SynchronizationTab.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
            }
        }
    });
    syncPlayerPhrasesActions.addComponent(syncPlayerPhrasesButton);
    savePlayerPhrasesButton = new Button("");
    savePlayerPhrasesButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            List<PlayerPhraseDiff> diffs = (List<PlayerPhraseDiff>) playerPhraseDiffContainer.getItemIds();
            List<GSpreadSheetsPlayerPhrase> phrasesToSh = new ArrayList<>();
            List<GSpreadSheetsPlayerPhrase> phrasesToDb = new ArrayList<>();
            for (PlayerPhraseDiff diff : diffs) {
                if (diff.getSyncType() == SYNC_TYPE.TO_SPREADSHEET) {
                    phrasesToSh.add(diff.getDbPhrase());
                } else if (diff.getSyncType() == SYNC_TYPE.TO_DB) {
                    phrasesToDb.add(diff.getSpreadsheetsPhrase());
                }
            }
            GoogleDocsService docsService = new GoogleDocsService();
            docsService.uploadPlayerPhrases(phrasesToSh);
            service.savePlayerPhrases(phrasesToDb);
            playerPhraseDiffContainer.removeAllItems();
        }
    });
    syncPlayerPhrasesActions.addComponent(savePlayerPhrasesButton);
    playerLayout.addComponent(syncPlayerPhrasesActions);
    playerPhraseDiffTable = new Table();
    playerPhraseDiffTable.setSizeFull();
    playerPhraseDiffContainer = new HierarchicalContainer();
    playerPhraseDiffContainer.addContainerProperty("shText", String.class, null);
    playerPhraseDiffContainer.addContainerProperty("shNic", String.class, null);
    playerPhraseDiffContainer.addContainerProperty("shDate", Date.class, null);
    playerPhraseDiffContainer.addContainerProperty("dbText", String.class, null);
    playerPhraseDiffContainer.addContainerProperty("dbNic", String.class, null);
    playerPhraseDiffContainer.addContainerProperty("dbDate", Date.class, null);
    playerPhraseDiffContainer.addContainerProperty("syncType", String.class, null);
    playerPhraseDiffTable.setContainerDataSource(playerPhraseDiffContainer);
    playerPhraseDiffTable.removeGeneratedColumn("shText");
    playerPhraseDiffTable.addGeneratedColumn("shText", textColumnGenerator);
    playerPhraseDiffTable.removeGeneratedColumn("dbText");
    playerPhraseDiffTable.addGeneratedColumn("dbText", textColumnGenerator);
    playerPhraseDiffTable.setVisibleColumns(columns);
    playerPhraseDiffTable.setColumnHeaders(columnHeaders);
    playerLayout.addComponent(playerPhraseDiffTable);
    tabs.addTab(playerLayout, " ");
    npcLayout = new VerticalLayout();
    syncNpcPhrasesActions = new HorizontalLayout();
    syncNpcPhrasesButton = new Button("");
    syncNpcPhrasesButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            GoogleDocsService docsService = new GoogleDocsService();
            try {
                List<GSpreadSheetsNpcPhrase> npcPhrases = docsService.getNpcPhrases();
                npcPhraseDiffContainer = service.getNpcPhrasesDiff(npcPhrases, npcPhraseDiffContainer);
            } catch (Exception ex) {
                Logger.getLogger(SynchronizationTab.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
            }
        }
    });
    syncNpcPhrasesActions.addComponent(syncNpcPhrasesButton);
    saveNpcPhrasesButton = new Button("");
    saveNpcPhrasesButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            List<NpcPhraseDiff> diffs = (List<NpcPhraseDiff>) npcPhraseDiffContainer.getItemIds();
            List<GSpreadSheetsNpcPhrase> phrasesToSh = new ArrayList<>();
            List<GSpreadSheetsNpcPhrase> phrasesToDb = new ArrayList<>();
            for (NpcPhraseDiff diff : diffs) {
                if (diff.getSyncType() == SYNC_TYPE.TO_SPREADSHEET) {
                    phrasesToSh.add(diff.getDbPhrase());
                } else if (diff.getSyncType() == SYNC_TYPE.TO_DB) {
                    phrasesToDb.add(diff.getSpreadsheetsPhrase());
                }
            }
            GoogleDocsService docsService = new GoogleDocsService();
            docsService.uploadNpcPhrases(phrasesToSh);
            service.saveNpcPhrases(phrasesToDb);
            npcPhraseDiffContainer.removeAllItems();
        }
    });
    syncNpcPhrasesActions.addComponent(saveNpcPhrasesButton);
    npcLayout.addComponent(syncNpcPhrasesActions);
    npcPhraseDiffTable = new Table();
    npcPhraseDiffTable.setSizeFull();
    npcPhraseDiffContainer = new HierarchicalContainer();
    npcPhraseDiffContainer.addContainerProperty("shText", String.class, null);
    npcPhraseDiffContainer.addContainerProperty("shNic", String.class, null);
    npcPhraseDiffContainer.addContainerProperty("shDate", Date.class, null);
    npcPhraseDiffContainer.addContainerProperty("dbText", String.class, null);
    npcPhraseDiffContainer.addContainerProperty("dbNic", String.class, null);
    npcPhraseDiffContainer.addContainerProperty("dbDate", Date.class, null);
    npcPhraseDiffContainer.addContainerProperty("syncType", String.class, null);
    npcPhraseDiffTable.setContainerDataSource(npcPhraseDiffContainer);
    npcPhraseDiffTable.removeGeneratedColumn("shText");
    npcPhraseDiffTable.addGeneratedColumn("shText", textColumnGenerator);
    npcPhraseDiffTable.removeGeneratedColumn("dbText");
    npcPhraseDiffTable.addGeneratedColumn("dbText", textColumnGenerator);
    npcPhraseDiffTable.setVisibleColumns(columns);
    npcPhraseDiffTable.setColumnHeaders(columnHeaders);
    npcLayout.addComponent(npcPhraseDiffTable);
    tabs.addTab(npcLayout, " ?");

    npcNamesLayout = new VerticalLayout();
    syncNpcNamesActions = new HorizontalLayout();
    syncNpcNamesButton = new Button("");
    syncNpcNamesButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            GoogleDocsService docsService = new GoogleDocsService();
            List<GSpreadSheetsNpcName> npcNames = docsService.getNpcNames();
            try {
                npcNamesDiffContainer = service.getNpcnamessDiff(npcNames, npcNamesDiffContainer);
            } catch (OriginalTextMismatchException ex) {
                Logger.getLogger(SynchronizationTab.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
            }
        }
    });
    syncNpcNamesActions.addComponent(syncNpcNamesButton);
    saveNpcNamesButton = new Button("");
    saveNpcNamesButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            List<NpcNameDiff> diffs = (List<NpcNameDiff>) npcNamesDiffContainer.getItemIds();
            List<GSpreadSheetsNpcName> namesToSh = new ArrayList<>();
            List<GSpreadSheetsNpcName> namesToDb = new ArrayList<>();
            for (NpcNameDiff diff : diffs) {
                if (diff.getSyncType() == SYNC_TYPE.TO_SPREADSHEET) {
                    namesToSh.add(diff.getDbName());
                } else if (diff.getSyncType() == SYNC_TYPE.TO_DB) {
                    namesToDb.add(diff.getSpreadsheetsName());
                }
            }
            GoogleDocsService docsService = new GoogleDocsService();
            docsService.uploadNpcNames(namesToSh);
            service.saveNpcnames(namesToDb);
            npcNamesDiffContainer.removeAllItems();
        }
    });
    syncNpcNamesActions.addComponent(saveNpcNamesButton);
    npcNamesLayout.addComponent(syncNpcNamesActions);
    npcNamesDiffTable = new Table();
    npcNamesDiffTable.setSizeFull();
    npcNamesDiffContainer = new HierarchicalContainer();
    npcNamesDiffContainer.addContainerProperty("shText", String.class, null);
    npcNamesDiffContainer.addContainerProperty("shNic", String.class, null);
    npcNamesDiffContainer.addContainerProperty("shDate", Date.class, null);
    npcNamesDiffContainer.addContainerProperty("dbText", String.class, null);
    npcNamesDiffContainer.addContainerProperty("dbNic", String.class, null);
    npcNamesDiffContainer.addContainerProperty("dbDate", Date.class, null);
    npcNamesDiffContainer.addContainerProperty("syncType", String.class, null);
    npcNamesDiffTable.setContainerDataSource(npcNamesDiffContainer);
    npcNamesDiffTable.removeGeneratedColumn("shText");
    npcNamesDiffTable.addGeneratedColumn("shText", textColumnGenerator);
    npcNamesDiffTable.removeGeneratedColumn("dbText");
    npcNamesDiffTable.addGeneratedColumn("dbText", textColumnGenerator);
    npcNamesDiffTable.setVisibleColumns(columns);
    npcNamesDiffTable.setColumnHeaders(columnHeaders);
    npcNamesLayout.addComponent(npcNamesDiffTable);
    tabs.addTab(npcNamesLayout, " ?");

    locationsLayout = new VerticalLayout();
    syncLocationsActions = new HorizontalLayout();
    syncLocationsButton = new Button("");
    syncLocationsButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            GoogleDocsService docsService = new GoogleDocsService();
            List<GSpreadSheetsLocationName> locationNames = docsService.getLocationsNames();
            try {
                locationsDiffContainer = service.getLocationNamesDiff(locationNames, locationsDiffContainer);
            } catch (OriginalTextMismatchException ex) {
                Logger.getLogger(SynchronizationTab.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
            }
        }
    });
    syncLocationsActions.addComponent(syncLocationsButton);
    saveLocationsButton = new Button("");
    saveLocationsButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            List<LocationsDiff> diffs = (List<LocationsDiff>) locationsDiffContainer.getItemIds();
            List<GSpreadSheetsLocationName> namesToSh = new ArrayList<>();
            List<GSpreadSheetsLocationName> namesToDb = new ArrayList<>();
            for (LocationsDiff diff : diffs) {
                if (diff.getSyncType() == SYNC_TYPE.TO_SPREADSHEET) {
                    namesToSh.add(diff.getDbName());
                } else if (diff.getSyncType() == SYNC_TYPE.TO_DB) {
                    namesToDb.add(diff.getSpreadsheetsName());
                }
            }
            GoogleDocsService docsService = new GoogleDocsService();
            docsService.uploadLocationNames(namesToSh);
            service.saveLocationNames(namesToDb);
            locationsDiffContainer.removeAllItems();
        }
    });
    syncLocationsActions.addComponent(saveLocationsButton);
    locationsLayout.addComponent(syncLocationsActions);
    locationsDiffTable = new Table();
    locationsDiffTable.setSizeFull();
    locationsDiffContainer = new HierarchicalContainer();
    locationsDiffContainer.addContainerProperty("shText", String.class, null);
    locationsDiffContainer.addContainerProperty("shNic", String.class, null);
    locationsDiffContainer.addContainerProperty("shDate", Date.class, null);
    locationsDiffContainer.addContainerProperty("dbText", String.class, null);
    locationsDiffContainer.addContainerProperty("dbNic", String.class, null);
    locationsDiffContainer.addContainerProperty("dbDate", Date.class, null);
    locationsDiffContainer.addContainerProperty("syncType", String.class, null);
    locationsDiffTable.setContainerDataSource(locationsDiffContainer);
    locationsDiffTable.removeGeneratedColumn("shText");
    locationsDiffTable.addGeneratedColumn("shText", textColumnGenerator);
    locationsDiffTable.removeGeneratedColumn("dbText");
    locationsDiffTable.addGeneratedColumn("dbText", textColumnGenerator);
    locationsDiffTable.setVisibleColumns(columns);
    locationsDiffTable.setColumnHeaders(columnHeaders);
    locationsLayout.addComponent(locationsDiffTable);
    tabs.addTab(locationsLayout, "?? ");

    questNamesLayout = new VerticalLayout();
    syncQuestNamesActions = new HorizontalLayout();
    syncQuestNamesButton = new Button("");
    syncQuestNamesButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            GoogleDocsService docsService = new GoogleDocsService();
            List<GSpreadSheetsQuestName> items = docsService.getQuestNames();
            try {
                questNamesDiffContainer = service.getQuestNamesDiff(items, questNamesDiffContainer);
            } catch (OriginalTextMismatchException ex) {
                Logger.getLogger(SynchronizationTab.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
            }
        }
    });
    syncQuestNamesActions.addComponent(syncQuestNamesButton);
    saveQuestNamesButton = new Button("");
    saveQuestNamesButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            List<QuestNamesDiff> diffs = (List<QuestNamesDiff>) questNamesDiffContainer.getItemIds();
            List<GSpreadSheetsQuestName> itemsToSh = new ArrayList<>();
            List<GSpreadSheetsQuestName> itemsToDb = new ArrayList<>();
            for (QuestNamesDiff diff : diffs) {
                if (diff.getSyncType() == SYNC_TYPE.TO_SPREADSHEET) {
                    itemsToSh.add(diff.getDbName());
                } else if (diff.getSyncType() == SYNC_TYPE.TO_DB) {
                    itemsToDb.add(diff.getSpreadsheetsName());
                }
            }
            GoogleDocsService docsService = new GoogleDocsService();
            docsService.uploadQuestNames(itemsToSh);
            service.saveQuestNames(itemsToDb);
            questNamesDiffContainer.removeAllItems();
        }
    });
    syncQuestNamesActions.addComponent(saveQuestNamesButton);
    questNamesLayout.addComponent(syncQuestNamesActions);
    questNamesDiffTable = new Table();
    questNamesDiffTable.setSizeFull();
    questNamesDiffContainer = new HierarchicalContainer();
    questNamesDiffContainer.addContainerProperty("shText", String.class, null);
    questNamesDiffContainer.addContainerProperty("shNic", String.class, null);
    questNamesDiffContainer.addContainerProperty("shDate", Date.class, null);
    questNamesDiffContainer.addContainerProperty("dbText", String.class, null);
    questNamesDiffContainer.addContainerProperty("dbNic", String.class, null);
    questNamesDiffContainer.addContainerProperty("dbDate", Date.class, null);
    questNamesDiffContainer.addContainerProperty("syncType", String.class, null);
    questNamesDiffTable.setContainerDataSource(questNamesDiffContainer);
    questNamesDiffTable.removeGeneratedColumn("shText");
    questNamesDiffTable.addGeneratedColumn("shText", textColumnGenerator);
    questNamesDiffTable.removeGeneratedColumn("dbText");
    questNamesDiffTable.addGeneratedColumn("dbText", textColumnGenerator);
    questNamesDiffTable.setVisibleColumns(columns);
    questNamesDiffTable.setColumnHeaders(columnHeaders);
    questNamesLayout.addComponent(questNamesDiffTable);
    tabs.addTab(questNamesLayout, "?? ?");

    questDescriptionsLayout = new VerticalLayout();
    syncQuestDescriptionsActions = new HorizontalLayout();
    syncQuestDescriptionsButton = new Button("");
    syncQuestDescriptionsButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            GoogleDocsService docsService = new GoogleDocsService();
            List<GSpreadSheetsQuestDescription> items = docsService.getQuestDescriptions();
            try {
                questDescriptionsDiffContainer = service.getQuestDescriptionsDiff(items,
                        questDescriptionsDiffContainer);
            } catch (OriginalTextMismatchException ex) {
                Logger.getLogger(SynchronizationTab.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
            }
        }
    });
    syncQuestDescriptionsActions.addComponent(syncQuestDescriptionsButton);
    saveQuestDescriptionsButton = new Button("");
    saveQuestDescriptionsButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            List<QuestDescriptionsDiff> diffs = (List<QuestDescriptionsDiff>) questDescriptionsDiffContainer
                    .getItemIds();
            List<GSpreadSheetsQuestDescription> itemsToSh = new ArrayList<>();
            List<GSpreadSheetsQuestDescription> itemsToDb = new ArrayList<>();
            for (QuestDescriptionsDiff diff : diffs) {
                if (diff.getSyncType() == SYNC_TYPE.TO_SPREADSHEET) {
                    itemsToSh.add(diff.getDbName());
                } else if (diff.getSyncType() == SYNC_TYPE.TO_DB) {
                    itemsToDb.add(diff.getSpreadsheetsName());
                }
            }
            GoogleDocsService docsService = new GoogleDocsService();
            docsService.uploadQuestDescriptions(itemsToSh);
            service.saveQuestDescriptions(itemsToDb);
            questDescriptionsDiffContainer.removeAllItems();
        }
    });
    syncQuestDescriptionsActions.addComponent(saveQuestDescriptionsButton);
    questDescriptionsLayout.addComponent(syncQuestDescriptionsActions);
    questDescriptionsDiffTable = new Table();
    questDescriptionsDiffTable.setSizeFull();
    questDescriptionsDiffContainer = new HierarchicalContainer();
    questDescriptionsDiffContainer.addContainerProperty("shText", String.class, null);
    questDescriptionsDiffContainer.addContainerProperty("shNic", String.class, null);
    questDescriptionsDiffContainer.addContainerProperty("shDate", Date.class, null);
    questDescriptionsDiffContainer.addContainerProperty("dbText", String.class, null);
    questDescriptionsDiffContainer.addContainerProperty("dbNic", String.class, null);
    questDescriptionsDiffContainer.addContainerProperty("dbDate", Date.class, null);
    questDescriptionsDiffContainer.addContainerProperty("syncType", String.class, null);
    questDescriptionsDiffTable.setContainerDataSource(questDescriptionsDiffContainer);
    questDescriptionsDiffTable.removeGeneratedColumn("shText");
    questDescriptionsDiffTable.addGeneratedColumn("shText", textColumnGenerator);
    questDescriptionsDiffTable.removeGeneratedColumn("dbText");
    questDescriptionsDiffTable.addGeneratedColumn("dbText", textColumnGenerator);
    questDescriptionsDiffTable.setVisibleColumns(columns);
    questDescriptionsDiffTable.setColumnHeaders(columnHeaders);
    questDescriptionsLayout.addComponent(questDescriptionsDiffTable);
    tabs.addTab(questDescriptionsLayout, "?? ?");

    this.addComponent(tabs);

}

From source file:org.jpos.qi.InfoDialog.java

License:Open Source License

public InfoDialog(String caption, String info) {
    super(caption);
    setWidth("350px");
    setModal(true);/*from w w  w  .  j ava2  s .com*/
    setResizable(false);
    close.setStyleName(ValoTheme.BUTTON_SMALL);

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    setContent(content);
    if (info != null) {
        Label l = new Label(info);
        l.setContentMode(ContentMode.HTML);
        content.addComponent(l);
    }
    HorizontalLayout hl = new HorizontalLayout();
    hl.setMargin(new MarginInfo(true, false, false, false));
    hl.setSpacing(true);
    hl.setWidth("100%");
    hl.addComponent(close);
    hl.setComponentAlignment(close, Alignment.BOTTOM_RIGHT);
    content.addComponent(hl);
}