Example usage for com.vaadin.ui TabSheet TabSheet

List of usage examples for com.vaadin.ui TabSheet TabSheet

Introduction

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

Prototype

public TabSheet() 

Source Link

Document

Constructs a new TabSheet.

Usage

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

public QuestTranslateTab(DBService service_) {
    this.setSizeFull();
    this.setSpacing(false);
    this.setMargin(false);
    this.service = service_;
    QuestChangeListener questChangeListener = new QuestChangeListener();
    FilterChangeListener filterChangeListener = new FilterChangeListener();
    questListlayout = new HorizontalLayout();
    questListlayout.setWidth(100f, Unit.PERCENTAGE);
    questListlayout.setSpacing(false);//from   ww w . j  a  v  a 2s  .co  m
    questListlayout.setMargin(false);
    locationTable = new ComboBox("?");
    locationTable.setPageLength(30);
    locationTable.setScrollToSelectedItem(true);
    locationTable.setWidth(100f, Unit.PERCENTAGE);
    locationTable.addValueChangeListener(filterChangeListener);
    locationTable.setDataProvider(new ListDataProvider<>(locations));
    questTable = new ComboBox("?");
    questTable.setWidth(100f, Unit.PERCENTAGE);
    questTable.setPageLength(15);
    questTable.setScrollToSelectedItem(true);

    questTable.setWidth(100f, Unit.PERCENTAGE);
    questTable.addValueChangeListener(questChangeListener);
    questTable.setDataProvider(new ListDataProvider<>(questList));
    questListlayout.addComponent(questTable);
    FormLayout locationAndQuestLayout = new FormLayout(locationTable, questTable);
    locationAndQuestLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    locationAndQuestLayout.setSizeFull();
    questListlayout.addComponent(locationAndQuestLayout);
    translateStatus = new ComboBoxMultiselect("? ",
            Arrays.asList(TRANSLATE_STATUS.values()));
    translateStatus.setClearButtonCaption("?");
    translateStatus.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            LoadFilters();
            LoadContent();
        }
    });
    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);
    checkBoxlayout.setSpacing(false);
    checkBoxlayout.setMargin(false);
    translatorBox = new ComboBox("");
    translatorBox.setPageLength(15);
    translatorBox.setScrollToSelectedItem(true);
    translatorBox.setDataProvider(new ListDataProvider<SysAccount>(service.getSysAccounts()));
    translatorBox.addValueChangeListener(filterChangeListener);
    refreshButton = new Button("");
    refreshButton.addClickListener(new Button.ClickListener() {

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

    FormLayout filtersLayout = new FormLayout(translateStatus, translatorBox, checkBoxlayout, searchField);
    filtersLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    filtersLayout.setSizeFull();
    questListlayout.addComponent(filtersLayout);
    questListlayout.addComponent(refreshButton);
    questListlayout.addComponent(countLabel);
    questListlayout.setExpandRatio(locationAndQuestLayout, 0.4f);
    questListlayout.setExpandRatio(filtersLayout, 0.4f);
    questListlayout.setExpandRatio(refreshButton, 0.1f);
    questListlayout.setExpandRatio(countLabel, 0.1f);
    questListlayout.setHeight(105f, Unit.PIXELS);
    this.addComponent(questListlayout);
    infoLayout = new VerticalLayout();
    infoLayout.setSizeFull();
    infoLayout.setSpacing(false);
    infoLayout.setMargin(false);
    tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    nameLayout = new VerticalLayout();
    nameLayout.setSizeFull();
    nameHLayout = new HorizontalLayout();
    nameHLayout.setSizeFull();
    nameHLayout.setSpacing(false);
    nameHLayout.setMargin(false);
    nameLayout = new VerticalLayout();
    nameLayout.setSizeFull();
    nameLayout.setSpacing(false);
    nameLayout.setMargin(false);
    questNameEnArea = new TextArea("?");
    questNameEnArea.setSizeFull();
    questNameEnArea.setRows(1);
    questNameEnArea.setReadOnly(true);
    questNameRuArea = new TextArea("? Ru");
    questNameRuArea.setSizeFull();
    questNameRuArea.setRows(1);
    questNameRuArea.setReadOnly(true);
    questNameRawEnArea = new TextArea("?  ");
    questNameRawEnArea.setSizeFull();
    questNameRawEnArea.setRows(1);
    questNameRawEnArea.setReadOnly(true);
    questNameRawRuArea = new TextArea("?   Ru");
    questNameRawRuArea.setSizeFull();
    questNameRawRuArea.setRows(1);
    questNameRawRuArea.setReadOnly(true);
    nameLayout.addComponents(questNameEnArea, questNameRuArea, questNameRawEnArea, questNameRawRuArea);
    nameHLayout.addComponent(nameLayout);
    nameTranslateLayout = new VerticalLayout();
    nameTranslateLayout.setSizeFull();
    nameTranslateLayout.setSpacing(false);
    nameTranslateLayout.setMargin(false);
    nameHLayout.addComponent(nameTranslateLayout);
    infoLayout.addComponent(nameHLayout);
    descriptionLayout = new VerticalLayout();
    descriptionLayout.setSizeFull();
    descriptionHLayout = new HorizontalLayout();
    descriptionHLayout.setSizeFull();
    descriptionHLayout.setSpacing(false);
    descriptionHLayout.setMargin(false);
    descriptionLayout = new VerticalLayout();
    descriptionLayout.setSizeFull();
    descriptionLayout.setSpacing(false);
    descriptionLayout.setMargin(false);
    questDescriptionEnArea = new TextArea("?");
    questDescriptionEnArea.setSizeFull();
    questDescriptionEnArea.setRows(4);
    questDescriptionEnArea.setReadOnly(true);
    questDescriptionRuArea = new TextArea("? Ru");
    questDescriptionRuArea.setSizeFull();
    questDescriptionRuArea.setRows(4);
    questDescriptionRuArea.setReadOnly(true);
    questDescriptionRawEnArea = new TextArea("?  ");
    questDescriptionRawEnArea.setSizeFull();
    questDescriptionRawEnArea.setRows(4);
    questDescriptionRawEnArea.setReadOnly(true);
    questDescriptionRawRuArea = new TextArea("?   Ru");
    questDescriptionRawRuArea.setSizeFull();
    questDescriptionRawRuArea.setRows(4);
    questDescriptionRawRuArea.setReadOnly(true);
    descriptionLayout.addComponents(questDescriptionEnArea, questDescriptionRuArea, questDescriptionRawEnArea,
            questDescriptionRawRuArea);
    descriptionHLayout.addComponent(descriptionLayout);
    descriptionTranslateLayout = new VerticalLayout();
    descriptionTranslateLayout.setSizeFull();
    descriptionTranslateLayout.setSpacing(false);
    descriptionTranslateLayout.setMargin(false);
    descriptionHLayout.addComponent(descriptionTranslateLayout);
    infoLayout.addComponent(descriptionHLayout);
    tabSheet.addTab(infoLayout, "?");
    stepsLayout = new VerticalLayout();
    stepsLayout.setSizeFull();
    stepsLayout.setSpacing(false);
    stepsLayout.setMargin(false);
    stepsData = new TreeData();
    stepsGrid = new TreeGrid(new TreeDataProvider(stepsData));
    stepsGrid.setSelectionMode(Grid.SelectionMode.NONE);
    stepsGrid.setRowHeight(250);
    stepsGrid.setHeaderVisible(false);
    stepsGrid.setSizeFull();
    stepsGrid.setItemCollapseAllowedProvider(new ItemCollapseAllowedProvider() {
        @Override
        public boolean test(Object item) {
            return false;
        }
    });
    stepsGrid.addColumn(new ValueProvider() {
        @Override
        public Object apply(Object source) {
            if (source instanceof QuestStep) {
                return "?";
            }
            if (source instanceof QuestDirection) {
                return " - " + ((QuestDirection) source).getDirectionType().name();
            }
            return null;
        }
    }).setId("rowType").setCaption("").setWidth(132).setStyleGenerator(rowStyleGenerator);
    stepsGrid.addComponentColumn(new ValueProvider() {
        @Override
        public Object apply(Object source) {
            VerticalLayout result = new VerticalLayout();
            result.setSpacing(false);
            result.setMargin(false);
            if (source instanceof QuestStep) {

                QuestStep step = (QuestStep) source;
                if (step.getTextEn() != null && !step.getTextEn().isEmpty()) {
                    TextArea textEnArea = new TextArea("?  ");
                    textEnArea.setValue(step.getTextEn());
                    textEnArea.setReadOnly(true);
                    textEnArea.setWidth(100f, Unit.PERCENTAGE);
                    result.addComponent(textEnArea);
                }
                if (step.getTextRu() != null && !step.getTextRu().isEmpty()) {
                    TextArea textRuArea = new TextArea("  ");
                    textRuArea.setValue(step.getTextRu());
                    textRuArea.setReadOnly(true);
                    textRuArea.setWidth(100f, Unit.PERCENTAGE);
                    result.addComponent(textRuArea);
                }
            } else if (source instanceof QuestDirection) {
                QuestDirection d = (QuestDirection) source;
                if (d.getTextEn() != null && !d.getTextEn().isEmpty()) {
                    TextArea textEnArea = new TextArea("?  ");
                    textEnArea.setValue(d.getTextEn());
                    textEnArea.setRows(2);
                    textEnArea.setReadOnly(true);
                    textEnArea.setWidth(100f, Unit.PERCENTAGE);
                    result.addComponent(textEnArea);
                }
                if (d.getTextRu() != null && !d.getTextRu().isEmpty()) {
                    TextArea textRuArea = new TextArea("  ");
                    textRuArea.setValue(d.getTextRu());
                    textRuArea.setRows(2);
                    textRuArea.setReadOnly(true);
                    textRuArea.setWidth(100f, Unit.PERCENTAGE);
                    result.addComponent(textRuArea);
                }

            }
            return result;
        }
    }).setId("ingameText").setStyleGenerator(rowStyleGenerator);
    stepsGrid.addComponentColumn(new ValueProvider() {
        @Override
        public Object apply(Object source) {
            VerticalLayout result = new VerticalLayout();
            result.setSpacing(false);
            result.setMargin(false);
            if (source instanceof QuestStep) {

                QuestStep step = (QuestStep) source;
                if (step.getSheetsJournalEntry() != null) {
                    TextArea textEnRawArea = new TextArea("?  ");
                    textEnRawArea.setValue(step.getSheetsJournalEntry().getTextEn());
                    textEnRawArea.setReadOnly(true);
                    textEnRawArea.setWidth(100f, Unit.PERCENTAGE);
                    result.addComponent(textEnRawArea);
                    if (step.getSheetsJournalEntry().getTextRu() != null && !step.getSheetsJournalEntry()
                            .getTextRu().equals(step.getSheetsJournalEntry().getTextEn())) {
                        TextArea textRuRawArea = new TextArea("    "
                                + step.getSheetsJournalEntry().getTranslator());
                        textRuRawArea.setValue(step.getSheetsJournalEntry().getTextRu());
                        textRuRawArea.setReadOnly(true);
                        textRuRawArea.setWidth(100f, Unit.PERCENTAGE);
                        result.addComponent(textRuRawArea);//, "  " 
                    }
                }

            } else if (source instanceof QuestDirection) {
                QuestDirection d = (QuestDirection) source;
                if (d.getSheetsQuestDirection() != null) {
                    TextArea textEnRawArea = new TextArea("?  ");
                    textEnRawArea.setValue(d.getSheetsQuestDirection().getTextEn());
                    textEnRawArea.setRows(2);
                    textEnRawArea.setReadOnly(true);
                    textEnRawArea.setWidth(100f, Unit.PERCENTAGE);
                    result.addComponent(textEnRawArea);
                    if (d.getSheetsQuestDirection().getTextRu() != null && !d.getSheetsQuestDirection()
                            .getTextRu().equals(d.getSheetsQuestDirection().getTextEn())) {
                        TextArea textRuRawArea = new TextArea("    "
                                + d.getSheetsQuestDirection().getTranslator());
                        textRuRawArea.setValue(d.getSheetsQuestDirection().getTextRu());
                        textRuRawArea.setRows(2);
                        textRuRawArea.setReadOnly(true);
                        textRuRawArea.setWidth(100f, Unit.PERCENTAGE);
                        result.addComponent(textRuRawArea);
                    }
                }
            }
            return result;
        }
    }).setId("rawText").setStyleGenerator(rowStyleGenerator);
    stepsGrid.addComponentColumn(new ValueProvider() {
        @Override
        public Object apply(Object source) {
            Panel panel = new Panel();
            panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
            panel.setWidth(100f, Unit.PERCENTAGE);
            panel.setHeight(245f, Unit.PIXELS);
            final VerticalLayout result = new VerticalLayout();
            result.setSpacing(false);
            result.setMargin(false);
            if (source instanceof QuestStep) {

                Set<TranslatedText> list = new HashSet<>();
                List<SysAccount> accounts = new ArrayList<>();

                QuestStep step = (QuestStep) source;
                list.addAll(step.getSheetsJournalEntry().getTranslatedTexts());

                if (list != null) {
                    for (TranslatedText t : list) {
                        result.addComponent(new TranslationCell(t));
                        accounts.add(t.getAuthor());
                    }
                }
                if (!accounts.contains(SpringSecurityHelper.getSysAccount())
                        && step.getSheetsJournalEntry() != null
                        && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) {
                    final TranslatedText translatedText = new TranslatedText();
                    translatedText.setAuthor(SpringSecurityHelper.getSysAccount());
                    translatedText.setSpreadSheetsJournalEntry(step.getSheetsJournalEntry());
                    Button addTranslation = new Button(" ",
                            FontAwesome.PLUS_SQUARE);
                    addTranslation.addClickListener(new Button.ClickListener() {

                        @Override
                        public void buttonClick(Button.ClickEvent event) {

                            if (translatedText.getSpreadSheetsJournalEntry() != null) {
                                translatedText.getSpreadSheetsJournalEntry().getTranslatedTexts()
                                        .add(translatedText);
                            }
                            result.addComponent(new TranslationCell(translatedText));
                            event.getButton().setVisible(false);
                        }
                    });
                    result.addComponent(addTranslation);
                }
            } else if (source instanceof QuestDirection) {
                Set<TranslatedText> list = new HashSet<>();
                List<SysAccount> accounts = new ArrayList<>();

                QuestDirection d = (QuestDirection) source;
                list.addAll(d.getSheetsQuestDirection().getTranslatedTexts());

                if (list != null) {
                    for (TranslatedText t : list) {
                        result.addComponent(new TranslationCell(t));
                        accounts.add(t.getAuthor());
                    }
                }
                if (!accounts.contains(SpringSecurityHelper.getSysAccount())
                        && d.getSheetsQuestDirection() != null
                        && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) {
                    final TranslatedText translatedText = new TranslatedText();
                    translatedText.setAuthor(SpringSecurityHelper.getSysAccount());
                    translatedText.setSpreadSheetsQuestDirection(d.getSheetsQuestDirection());
                    Button addTranslation = new Button(" ");
                    addTranslation.addClickListener(new Button.ClickListener() {

                        @Override
                        public void buttonClick(Button.ClickEvent event) {

                            if (translatedText.getSpreadSheetsQuestDirection() != null) {
                                translatedText.getSpreadSheetsQuestDirection().getTranslatedTexts()
                                        .add(translatedText);
                            }
                            result.addComponent(new TranslationCell(translatedText));
                            event.getButton().setVisible(false);
                        }
                    });
                    result.addComponent(addTranslation);
                }
            }
            panel.setContent(result);
            return panel;
        }
    }).setId("translation").setStyleGenerator(rowStyleGenerator);
    stepsGrid.setColumns("rowType", "ingameText", "rawText", "translation");
    stepsLayout.addComponent(stepsGrid);
    tabSheet.addTab(stepsLayout, "");
    itemsGrid = new Grid(new ListDataProvider(itemList));
    itemsGrid.setSelectionMode(Grid.SelectionMode.NONE);
    itemsGrid.setRowHeight(250);
    itemsGrid.setHeaderVisible(false);
    itemsGrid.setSizeFull();
    itemsGrid.addComponentColumn(new ValueProvider() {
        @Override
        public Object apply(Object source) {
            VerticalLayout result = new VerticalLayout();
            result.setSpacing(false);
            result.setMargin(false);
            if (source instanceof QuestItem) {

                QuestItem item = (QuestItem) source;
                if (item.getName() != null) {
                    TextArea textEnRawArea = new TextArea("?  ");
                    textEnRawArea.setValue(item.getName().getTextEn());
                    textEnRawArea.setReadOnly(true);
                    textEnRawArea.setWidth(100f, Unit.PERCENTAGE);
                    result.addComponent(textEnRawArea);
                    if (item.getName().getTextRu() != null
                            && !item.getName().getTextRu().equals(item.getName().getTextEn())) {
                        TextArea textRuRawArea = new TextArea(
                                " ?    "
                                        + item.getName().getTranslator());
                        textRuRawArea.setValue(item.getName().getTextRu());
                        textRuRawArea.setReadOnly(true);
                        textRuRawArea.setWidth(100f, Unit.PERCENTAGE);
                        result.addComponent(textRuRawArea);//, "  " 
                    }
                }

            }
            return result;
        }
    }).setId("rawName");
    itemsGrid.addComponentColumn(new ValueProvider() {
        @Override
        public Object apply(Object source) {
            VerticalLayout result = new VerticalLayout();
            result.setSpacing(false);
            result.setMargin(false);
            if (source instanceof QuestItem) {

                QuestItem item = (QuestItem) source;
                if (item.getDescription() != null) {
                    TextArea textEnRawArea = new TextArea("?  ");
                    textEnRawArea.setValue(item.getDescription().getTextEn());
                    textEnRawArea.setReadOnly(true);
                    textEnRawArea.setWidth(100f, Unit.PERCENTAGE);
                    result.addComponent(textEnRawArea);
                    if (item.getDescription().getTextRu() != null
                            && !item.getDescription().getTextRu().equals(item.getDescription().getTextEn())) {
                        TextArea textRuRawArea = new TextArea(
                                " ??    "
                                        + item.getDescription().getTranslator());
                        textRuRawArea.setValue(item.getDescription().getTextRu());
                        textRuRawArea.setReadOnly(true);
                        textRuRawArea.setWidth(100f, Unit.PERCENTAGE);
                        result.addComponent(textRuRawArea);//, "  " 
                    }
                }

            }
            return result;
        }
    }).setId("rawDescription");
    itemsGrid.addComponentColumn(new ValueProvider() {
        @Override
        public Object apply(Object source) {
            Panel panel = new Panel();
            panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
            panel.setWidth(100f, Unit.PERCENTAGE);
            panel.setHeight(245f, Unit.PIXELS);
            final VerticalLayout result = new VerticalLayout();
            result.setSpacing(false);
            result.setMargin(false);
            if (source instanceof QuestItem) {

                Set<TranslatedText> list = new HashSet<>();
                List<SysAccount> accounts = new ArrayList<>();

                QuestItem item = (QuestItem) source;
                if (item.getName() != null) {
                    String text = item.getName().getTextEn();
                    list.addAll(item.getName().getTranslatedTexts());

                    if (list != null) {
                        for (TranslatedText t : list) {
                            result.addComponent(new TranslationCell(t));
                            accounts.add(t.getAuthor());
                        }
                    }
                    if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && text != null
                            && !text.isEmpty() && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) {
                        final TranslatedText translatedText = new TranslatedText();
                        translatedText.setAuthor(SpringSecurityHelper.getSysAccount());
                        translatedText.setSpreadSheetsItemName(item.getName());
                        Button addTranslation = new Button(" ",
                                FontAwesome.PLUS_SQUARE);
                        addTranslation.addClickListener(new Button.ClickListener() {

                            @Override
                            public void buttonClick(Button.ClickEvent event) {

                                if (translatedText.getSpreadSheetsItemName() != null) {
                                    translatedText.getSpreadSheetsItemName().getTranslatedTexts()
                                            .add(translatedText);
                                }
                                result.addComponent(new TranslationCell(translatedText));
                                event.getButton().setVisible(false);
                            }
                        });
                        result.addComponent(addTranslation);
                    }
                }
            }
            panel.setContent(result);
            return panel;
        }
    }).setId("nameTranslation");
    itemsGrid.addComponentColumn(new ValueProvider() {
        @Override
        public Object apply(Object source) {
            Panel panel = new Panel();
            panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
            panel.setWidth(100f, Unit.PERCENTAGE);
            panel.setHeight(245f, Unit.PIXELS);
            final VerticalLayout result = new VerticalLayout();
            result.setSpacing(false);
            result.setMargin(false);
            if (source instanceof QuestItem) {

                Set<TranslatedText> list = new HashSet<>();
                List<SysAccount> accounts = new ArrayList<>();

                QuestItem item = (QuestItem) source;
                if (item.getDescription() != null) {
                    String text = item.getDescription().getTextEn();
                    list.addAll(item.getDescription().getTranslatedTexts());

                    if (list != null) {
                        for (TranslatedText t : list) {
                            result.addComponent(new TranslationCell(t));
                            accounts.add(t.getAuthor());
                        }
                    }
                    if (!accounts.contains(SpringSecurityHelper.getSysAccount()) && text != null
                            && !text.isEmpty() && SpringSecurityHelper.hasRole("ROLE_TRANSLATE")) {
                        final TranslatedText translatedText = new TranslatedText();
                        translatedText.setAuthor(SpringSecurityHelper.getSysAccount());
                        translatedText.setSpreadSheetsItemDescription(item.getDescription());
                        Button addTranslation = new Button(" ",
                                FontAwesome.PLUS_SQUARE);
                        addTranslation.addClickListener(new Button.ClickListener() {

                            @Override
                            public void buttonClick(Button.ClickEvent event) {

                                if (translatedText.getSpreadSheetsItemDescription() != null) {
                                    translatedText.getSpreadSheetsItemDescription().getTranslatedTexts()
                                            .add(translatedText);
                                }
                                result.addComponent(new TranslationCell(translatedText));
                                event.getButton().setVisible(false);
                            }
                        });
                        result.addComponent(addTranslation);
                    }
                }
            }
            panel.setContent(result);
            return panel;
        }
    }).setId("descriptionTranslation");
    itemsGrid.addComponentColumn(new ValueProvider() {
        @Override
        public Object apply(Object source) {
            VerticalLayout result = new VerticalLayout();
            result.setMargin(new MarginInfo(true, false, false, false));
            result.setSpacing(false);
            if (source instanceof QuestItem) {
                GSpreadSheetsItemName name = ((QuestItem) source).getName();
                if (name.getIcon() != null) {
                    Image image = new Image(null, new ExternalResource(
                            "https://elderscrolls.net" + name.getIcon().replaceAll(".dds", ".png")));
                    result.addComponent(image);
                    return result;
                }
            }
            return result;
        }
    }).setId("icon").setWidth(95);
    itemsGrid.setColumns("icon", "rawName", "nameTranslation", "rawDescription", "descriptionTranslation");
    tabSheet.addTab(itemsGrid, "");
    this.addComponent(tabSheet);
    this.setExpandRatio(tabSheet, 1f);
    GridScrollExtension stepsScrollExtension = new GridScrollExtension(stepsGrid);
    GridScrollExtension itemsScrollExtension = new GridScrollExtension(itemsGrid);
    new NoAutcompleteComboBoxExtension(locationTable);
    new NoAutcompleteComboBoxExtension(questTable);
    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//www .  j  av a  2  s  .  c om
        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.esn.esobase.view.tab.TranslateTab.java

public void Init() {
    removeAllComponents();//w ww  .  ja v a 2 s  . c  o m
    TopicNpcColumnGenerator topicNpcColumnGenerator = new TopicNpcColumnGenerator();
    TopicPlayerColumnGenerator topicPlayerColumnGenerator = new TopicPlayerColumnGenerator();
    SubtitleColumnGenerator subtitleColumnGenerator = new SubtitleColumnGenerator();
    TranslationColumnGenerator translationColumnGenerator = new TranslationColumnGenerator();
    FilterChangeListener filterChangeListener = new FilterChangeListener();
    this.setSizeFull();
    this.setSpacing(false);
    this.setMargin(false);
    npcListlayout = new HorizontalLayout();
    npcListlayout.setSpacing(false);
    npcListlayout.setMargin(false);
    npcListlayout.setSizeFull();
    npcTable = new ComboBox("NPC");
    npcTable.setPageLength(30);
    npcTable.setScrollToSelectedItem(true);
    npcTable.setWidth(100f, Unit.PERCENTAGE);
    npcTable.addValueChangeListener(new NpcSelectListener());
    npcTable.setScrollToSelectedItem(true);
    npcTable.setEmptySelectionAllowed(true);
    locationTable = new ComboBox("?");
    locationTable.setPageLength(30);
    locationTable.setScrollToSelectedItem(true);
    locationTable.setWidth(100f, Unit.PERCENTAGE);
    locationTable.addValueChangeListener(filterChangeListener);
    locationTable.setDataProvider(new ListDataProvider<>(locations));
    locationTable.setEmptySelectionAllowed(true);

    subLocationTable = new ComboBox("?");
    subLocationTable.setPageLength(30);
    subLocationTable.setScrollToSelectedItem(true);
    subLocationTable.setWidth(100f, Unit.PERCENTAGE);
    subLocationTable.addValueChangeListener(filterChangeListener);
    subLocationTable.setDataProvider(new ListDataProvider<>(subLocations));
    subLocationTable.setEmptySelectionAllowed(true);
    questTable = new ComboBox("?");
    questTable.setPageLength(30);
    questTable.setScrollToSelectedItem(true);

    questTable.setWidth(100f, Unit.PERCENTAGE);
    questTable.addValueChangeListener(filterChangeListener);
    questTable.setDataProvider(new ListDataProvider<>(questList));
    npcTable.setDataProvider(new ListDataProvider<>(npcList));

    FormLayout locationAndNpc = new FormLayout(questTable, locationTable, subLocationTable, npcTable);
    locationAndNpc.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    locationAndNpc.setSizeFull();

    npcListlayout.addComponent(locationAndNpc);

    translateStatus = new ComboBoxMultiselect("? ",
            Arrays.asList(TRANSLATE_STATUS.values()));
    translateStatus.setClearButtonCaption("?");
    translateStatus.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            LoadFilters();
            LoadNpcContent();
        }
    });
    translateStatus.setPageLength(20);
    noTranslations = new CheckBox("?  ?");
    noTranslations.setValue(Boolean.FALSE);
    noTranslations.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() {
        @Override
        public void valueChange(HasValue.ValueChangeEvent<Boolean> event) {
            LoadFilters();
            LoadNpcContent();
        }
    });

    emptyTranslations = new CheckBox("?  ");
    emptyTranslations.setValue(Boolean.FALSE);
    emptyTranslations.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() {
        @Override
        public void valueChange(HasValue.ValueChangeEvent<Boolean> event) {
            LoadFilters();
            LoadNpcContent();
        }
    });
    HorizontalLayout checkBoxlayout = new HorizontalLayout(noTranslations, emptyTranslations);
    translatorBox = new ComboBox("");
    translatorBox.setPageLength(15);
    translatorBox.setScrollToSelectedItem(true);
    translatorBox.setDataProvider(new ListDataProvider(service.getSysAccounts()));
    translatorBox.addValueChangeListener(new HasValue.ValueChangeListener() {
        @Override
        public void valueChange(HasValue.ValueChangeEvent event) {
            LoadFilters();
            LoadNpcContent();
        }
    });
    refreshButton = new Button("");
    refreshButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            LoadFilters();
            LoadNpcContent();
        }
    });
    countLabel = new Label();
    searchField = new TextField("?? ?");
    searchField.setSizeFull();
    searchField.addValueChangeListener(new HasValue.ValueChangeListener<String>() {
        @Override
        public void valueChange(HasValue.ValueChangeEvent<String> event) {
            LoadFilters();
            LoadNpcContent();
        }
    });

    FormLayout questAndWithNewTranslations = new FormLayout(translateStatus, translatorBox, checkBoxlayout,
            searchField);
    questAndWithNewTranslations.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    questAndWithNewTranslations.setSizeFull();
    npcListlayout.addComponent(questAndWithNewTranslations);
    npcListlayout.addComponent(refreshButton);
    npcListlayout.addComponent(countLabel);
    npcListlayout.setExpandRatio(locationAndNpc, 0.4f);
    npcListlayout.setExpandRatio(questAndWithNewTranslations, 0.4f);
    npcListlayout.setExpandRatio(refreshButton, 0.1f);
    npcListlayout.setExpandRatio(countLabel, 0.1f);
    npcContentLayout = new VerticalLayout();
    npcContentLayout.setSizeFull();
    npcContentLayout.setSpacing(false);
    npcContentLayout.setMargin(false);
    npcTabSheet = new TabSheet();
    npcTabSheet.setSizeFull();
    npcTabLayout = new VerticalLayout();
    locationName = new TextField("? ");
    npcTabLayout.addComponent(locationName);
    locationNameRu = new TextField(" ? ");
    npcTabLayout.addComponent(locationNameRu);
    npcName = new TextField("? NPC");
    npcTabLayout.addComponent(npcName);
    npcNameRu = new TextField("  NPC");
    npcTabLayout.addComponent(npcNameRu);
    npcTab = npcTabSheet.addTab(npcTabLayout, "");
    npcTopicsTable = new Table();
    npcTopicsTable.addStyleName(ValoTheme.TABLE_COMPACT);
    npcTopicsTable.setSizeFull();
    npcTopicsTable.setPageLength(0);
    topicsContainer = new BeanItemContainer<>(Topic.class);
    npcTopicsTable.setContainerDataSource(topicsContainer);
    npcTopicsTable.addGeneratedColumn("npcTextG", topicNpcColumnGenerator);
    npcTopicsTable.addGeneratedColumn("playerTextG", topicPlayerColumnGenerator);
    npcTopicsTable.removeGeneratedColumn("playerTranslations");
    npcTopicsTable.addGeneratedColumn("playerTranslations", translationColumnGenerator);
    npcTopicsTable.removeGeneratedColumn("npcTranslations");
    npcTopicsTable.addGeneratedColumn("npcTranslations", translationColumnGenerator);
    npcTopicsTable.setVisibleColumns(
            new Object[] { "playerTextG", "playerTranslations", "npcTextG", "npcTranslations" });
    npcTopicsTable.setColumnHeaders(new String[] { " ", "",
            " NPC", "" });
    npcTopicsTable.setColumnExpandRatio("playerTextG", 1f);
    npcTopicsTable.setColumnExpandRatio("playerTranslations", 1.5f);
    npcTopicsTable.setColumnExpandRatio("npcTextG", 1.5f);
    npcTopicsTable.setColumnExpandRatio("npcTranslations", 1.5f);
    npcTopicsTable.setColumnWidth("actions", 150);
    npcSubtitlesTable = new Table();
    npcSubtitlesTable.addStyleName(ValoTheme.TABLE_COMPACT);
    npcSubtitlesTable.setSizeFull();
    npcSubtitlesTable.setPageLength(0);
    subtitlesContainer = new BeanItemContainer<>(Subtitle.class);
    npcSubtitlesTable.setContainerDataSource(subtitlesContainer);
    npcSubtitlesTable.addGeneratedColumn("textG", subtitleColumnGenerator);
    npcSubtitlesTable.removeGeneratedColumn("translations");
    npcSubtitlesTable.addGeneratedColumn("translations", translationColumnGenerator);
    npcSubtitlesTable.setVisibleColumns(new Object[] { "textG", "translations" });
    npcSubtitlesTable.setColumnHeaders(new String[] { "", "" });
    npcSubtitlesTable.setColumnExpandRatio("textG", 1f);
    npcSubtitlesTable.setColumnExpandRatio("translations", 1f);
    npcSubtitlesTable.setColumnWidth("actions", 150);

    npcTopicsTab = npcTabSheet.addTab(npcTopicsTable, "");
    npcSubtitlesTab = npcTabSheet.addTab(npcSubtitlesTable, "");
    npcContentLayout.addComponent(npcTabSheet);
    this.addComponent(npcListlayout);
    this.addComponent(npcContentLayout);
    this.npcListlayout.setHeight(105f, Unit.PIXELS);
    this.setExpandRatio(npcContentLayout, 1f);
    LoadFilters();
    new NoAutcompleteComboBoxExtension(questTable);
    new NoAutcompleteComboBoxExtension(locationTable);
    new NoAutcompleteComboBoxExtension(subLocationTable);
    new NoAutcompleteComboBoxExtension(npcTable);
    new NoAutcompleteComboBoxExtension(translatorBox);
}

From source file:org.generationcp.breeding.manager.crossingmanager.SelectGermplasmListComponent.java

License:Open Source License

protected void initializeComponents() {
    mainLayout = new HorizontalLayout();

    tabSheetGermplasmListDatabaseInstance = new TabSheet();
    tabLocalInstance = new VerticalLayout();
    tabCentralInstance = new VerticalLayout();

    tabSheetGermplasmListDatabaseInstance.addTab(tabLocalInstance)
            .setCaption(messageSource.getMessage(Message.DB_LOCAL_TEXT)); // "Local"
    tabSheetGermplasmListDatabaseInstance.addTab(tabCentralInstance)
            .setCaption(messageSource.getMessage(Message.DB_CENTRAL_TEXT)); // "Central"
    tabSheetGermplasmListDatabaseInstance.setSelectedTab(tabCentralInstance);

    listInfoComponent = new SelectGermplasmListInfoComponent(lastOpenedListId);
    centralGermplasmListTreeComponent = new SelectGermplasmListTreeComponent(Database.CENTRAL,
            listInfoComponent);/*from www.j  av  a 2s.  c  om*/
    localGermplasmListTreeComponent = new SelectGermplasmListTreeComponent(Database.LOCAL, listInfoComponent);
}

From source file:org.icrisat.gdms.ui.GDMSMain.java

void buildMainView() {
    _mainLayout.setSizeFull();//  w  ww .  j  a  v a  2  s. co m

    _lblLoginMessage = new Label("");
    _lblLoginMessage.setStyleName(Reindeer.LABEL_H2);

    HorizontalLayout topMenuLayout = getTopMenu();
    CssLayout headerImageLayout = getHeader();

    VerticalLayout topLayout = new VerticalLayout();
    topLayout.addComponent(headerImageLayout);
    topLayout.addComponent(topMenuLayout);
    topLayout.setComponentAlignment(topMenuLayout, Alignment.TOP_RIGHT);
    topLayout.addComponent(_lblLoginMessage);
    topLayout.setComponentAlignment(_lblLoginMessage, Alignment.TOP_RIGHT);
    topLayout.setMargin(false, true, true, true);
    _mainLayout.addComponent(topLayout);

    CssLayout mainCSSLayout = new CssLayout();
    mainCSSLayout.setMargin(false, true, true, true);
    mainCSSLayout.setSizeFull();

    _tabsheet = new TabSheet();
    _tabsheet.setSizeFull();

    mainCSSLayout.addComponent(_tabsheet);
    _mainLayout.addComponent(mainCSSLayout);
    _mainLayout.setExpandRatio(mainCSSLayout, 1);

    buildWelcomeScreen = buildWelcomeScreen();
    buildAboutScreen = buildAboutScreen();
    buildUploadDataWindow = new UploadComponent(this);
    buildUploadDataWindow.setImmediate(true);
    buildUploadDataWindow.setEnabled(false);
    buildUploadDataWindow.addListener(this);
    buildUploadDataWindow.setWidth("100%");

    buildRetrieveWindow = new RetrieveComponent(this);
    buildRetrieveWindow.setImmediate(true);
    buildRetrieveWindow.setEnabled(false);
    buildRetrieveWindow.addListener(this);
    buildRetrieveWindow.setWidth("100%");

    buildDeleteWindow = new DeleteComponent(this);
    buildDeleteWindow.setImmediate(true);
    buildDeleteWindow.setEnabled(false);
    buildDeleteWindow.addListener(this);
    buildRetrieveWindow.setWidth("100%");

    _tabsheet.addComponent(buildWelcomeScreen);
    _tabsheet.addComponent(buildAboutScreen);
    _tabsheet.addComponent(buildUploadDataWindow);
    _tabsheet.addComponent(buildRetrieveWindow);
    _tabsheet.addComponent(buildDeleteWindow);

    /*if (null == _gdmsModel.getLoggedInUser()){
       buildUploadDataWindow.setEnabled(false);
       buildRetrieveWindow.setEnabled(false);
       buildDeleteWindow.setEnabled(false);
    } else {
       buildUploadDataWindow.setEnabled(true);
       buildRetrieveWindow.setEnabled(true);
       buildDeleteWindow.setEnabled(true);
    }*/

    if (null == _gdmsModel.getLoggedInUser()) {
        _tabsheet.getTab(1).setEnabled(false);
        _tabsheet.getTab(2).setEnabled(false);
        _tabsheet.getTab(3).setEnabled(false);
    } else {
        _tabsheet.getTab(1).setEnabled(true);
        _tabsheet.getTab(2).setEnabled(true);
        _tabsheet.getTab(3).setEnabled(true);
    }

    _tabsheet.addListener(new SelectedTabChangeListener() {

        private static final long serialVersionUID = 1L;

        public void selectedTabChange(SelectedTabChangeEvent event) {
            User loggedInUser = _gdmsModel.getLoggedInUser();
            //System.out.println("loggedInUser:"+loggedInUser);
            if (null == loggedInUser) {
                if (!(buildWelcomeScreen == _tabsheet.getSelectedTab())) {
                    getMainWindow().showNotification("Please login inorder to Upload, Retrieve or Delete data.",
                            Notification.TYPE_HUMANIZED_MESSAGE);
                    return;
                }
            } else {
                if (event.getTabSheet().getSelectedTab().getCaption() == "Upload") {
                    updateUploadTabComponent();
                } else if (event.getTabSheet().getSelectedTab().getCaption() == "Retrieve") {
                    updateRetrieveTabComponent();
                } else if (event.getTabSheet().getSelectedTab().getCaption() == "View") {
                    updateDeleteTabComponent();
                }
            }

        }

    });

    CssLayout bottomPanelLayout = getBottomPanelLayout();
    VerticalLayout bottomContactLayout = new VerticalLayout();
    bottomContactLayout.addComponent(bottomPanelLayout);
    bottomContactLayout.setComponentAlignment(bottomPanelLayout, Alignment.BOTTOM_LEFT);
    bottomContactLayout.setMargin(false, true, false, true);
}

From source file:org.ikasan.dashboard.ui.topology.panel.TopologyViewPanel.java

License:BSD License

protected void createTabSheet() {
    tabsheet = new TabSheet();
    tabsheet.setSizeFull();/*  ww  w  . ja  va 2s  .com*/

    final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest()
            .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER);

    if (authentication != null && (authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY)
            || authentication.hasGrantedAuthority(SecurityConstants.VIEW_BUSINESS_STREAM_AUTHORITY))) {
        VerticalLayout tab1 = new VerticalLayout();
        tab1.setSizeFull();

        BusinessStreamTab businessStreamTab = new BusinessStreamTab(this.topologyService,
                this.businessStreamCombo);

        tab1.addComponent(businessStreamTab.createBusinessStreamLayout());
        tabsheet.addTab(tab1, "Business Stream");
    }

    if (authentication != null && (authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY)
            || authentication.hasGrantedAuthority(SecurityConstants.VIEW_WIRETAP_AUTHORITY))) {
        VerticalLayout tab2 = new VerticalLayout();
        tab2.setSizeFull();

        WiretapTab wiretapTab = new WiretapTab(this.wiretapDao, this.treeViewBusinessStreamCombo);
        tab2.addComponent(wiretapTab.createWiretapLayout());

        tabsheet.addTab(tab2, "Wiretaps");
    }

    if (authentication != null && (authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY)
            || authentication.hasGrantedAuthority(SecurityConstants.VIEW_ERRORS_AUTHORITY))) {
        VerticalLayout tab3 = new VerticalLayout();
        tab3.setSizeFull();

        ErrorOccurrenceTab errorOccurrenceTab = new ErrorOccurrenceTab(this.errorReportingService,
                this.treeViewBusinessStreamCombo);
        tab3.addComponent(errorOccurrenceTab.createCategorisedErrorLayout());

        tabsheet.addTab(tab3, "Errors");
    }

    if (authentication != null && (authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY)
            || authentication.hasGrantedAuthority(SecurityConstants.VIEW_EXCLUSION_AUTHORITY))) {
        final VerticalLayout tab4 = new VerticalLayout();
        tab4.setSizeFull();
        final ExclusionsTab actionedExclusionsTab = new ExclusionsTab(this.errorReportingService,
                this.exclusionManagementService, this.hospitalManagementService, this.topologyService,
                this.serialiserFactory, this.treeViewBusinessStreamCombo);

        tab4.addComponent(actionedExclusionsTab.createLayout());
        tabsheet.addTab(tab4, "Exclusions");
    }

    if (authentication != null && (authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY)
            || authentication.hasGrantedAuthority(SecurityConstants.VIEW_ACTIONED_EXCLUSIONS_AUTHORITY))) {
        final VerticalLayout tab5 = new VerticalLayout();
        tab5.setSizeFull();
        ActionedExclusionTab actionedExclusionTab = new ActionedExclusionTab(this.exclusionManagementService,
                this.hospitalManagementService, this.errorReportingService, this.topologyService,
                this.serialiserFactory, this.treeViewBusinessStreamCombo);
        tab5.addComponent(actionedExclusionTab.createLayout());
        tabsheet.addTab(tab5, "Actioned Exclusions");
    }

    if (authentication != null && (authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY)
            || authentication.hasGrantedAuthority(SecurityConstants.VIEW_ACTIONED_EXCLUSIONS_AUTHORITY))) {
        final VerticalLayout tab6 = new VerticalLayout();
        tab6.setSizeFull();
        tab6.addComponent(this.createSystemEventPanel());
        tabsheet.addTab(tab6, "System Events");
    }

    if (authentication != null && (authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY)
            || authentication.hasGrantedAuthority(SecurityConstants.VIEW_CATEGORISED_ERRORS_AUTHORITY))) {
        final VerticalLayout tab8 = new VerticalLayout();
        tab8.setSizeFull();
        CategorisedErrorTab categorisedErrorTab = new CategorisedErrorTab(this.errorCategorisationService,
                this.treeViewBusinessStreamCombo, this.serialiserFactory);
        tab8.addComponent(categorisedErrorTab.createCategorisedErrorLayout());
        tabsheet.addTab(tab8, "Categorised Errors");
    }

    this.tabsheetPanel.setContent(tabsheet);
}

From source file:org.ikasan.dashboard.ui.topology.window.CategorisedErrorOccurrenceViewWindow.java

License:BSD License

protected Panel createErrorOccurrenceDetailsPanel() {
    Panel errorOccurrenceDetailsPanel = new Panel();

    GridLayout layout = new GridLayout(4, 7);
    layout.setWidth("100%");
    layout.setSpacing(true);//ww  w. j a v  a  2 s  .c o m
    layout.setColumnExpandRatio(0, .10f);
    layout.setColumnExpandRatio(1, .30f);
    layout.setColumnExpandRatio(2, .05f);
    layout.setColumnExpandRatio(3, .30f);

    Label errorOccurrenceDetailsLabel = new Label(" Categorised Error Occurence Details", ContentMode.HTML);
    Label errorCategoryLabel = new Label();

    if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.BLOCKER)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.BAN.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.BAN.getHtml() + " Blocker", ContentMode.HTML);
    } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.CRITICAL)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.EXCLAMATION.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.EXCLAMATION.getHtml() + " Critical", ContentMode.HTML);
    } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.MAJOR)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.ARROW_UP.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.ARROW_UP.getHtml() + " Major", ContentMode.HTML);
    } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.TRIVIAL)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.ARROW_DOWN.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.ARROW_DOWN.getHtml() + " Trivial", ContentMode.HTML);
    }

    errorOccurrenceDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(errorOccurrenceDetailsLabel, 0, 0, 3, 0);

    Label label = new Label("Module Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf1 = new TextField();
    tf1.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getModuleName());
    tf1.setReadOnly(true);
    tf1.setWidth("80%");
    layout.addComponent(tf1, 1, 1);

    label = new Label("Flow Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf2 = new TextField();
    tf2.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getFlowName());
    tf2.setReadOnly(true);
    tf2.setWidth("80%");
    layout.addComponent(tf2, 1, 2);

    label = new Label("Component Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf3 = new TextField();
    tf3.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getFlowElementName());
    tf3.setReadOnly(true);
    tf3.setWidth("80%");
    layout.addComponent(tf3, 1, 3);

    label = new Label("Date/Time:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf4 = new TextField();
    tf4.setValue(new Date(this.categorisedErrorOccurrence.getErrorOccurrence().getTimestamp()).toString());
    tf4.setReadOnly(true);
    tf4.setWidth("80%");
    layout.addComponent(tf4, 1, 4);

    GridLayout wrapperLayout = new GridLayout(1, 4);
    wrapperLayout.setMargin(true);
    wrapperLayout.setWidth("100%");

    Label errorMessageLabel = new Label("Error Message:");
    errorMessageLabel.setSizeUndefined();
    layout.addComponent(errorMessageLabel, 0, 5);
    layout.setComponentAlignment(errorMessageLabel, Alignment.TOP_RIGHT);

    final TextArea errorMessageTextArea = new TextArea();
    errorMessageTextArea.setWidth("650px");
    errorMessageTextArea.setRows(6);
    errorMessageTextArea
            .setValue(this.categorisedErrorOccurrence.getErrorCategorisation().getErrorDescription());

    layout.addComponent(errorMessageTextArea, 1, 5, 3, 5);

    AceEditor editor = new AceEditor();
    editor.setCaption("Error Details");
    editor.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getErrorDetail());
    editor.setReadOnly(true);
    editor.setMode(AceMode.xml);
    editor.setTheme(AceTheme.eclipse);
    editor.setHeight(470, Unit.PIXELS);
    editor.setWidth("100%");

    label = new Label("Error Category:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    layout.addComponent(errorCategoryLabel, 3, 1);
    layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_LEFT);

    label = new Label("System Action:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField systemAction = new TextField();
    systemAction.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getAction());
    systemAction.setReadOnly(true);
    systemAction.setWidth("80%");
    layout.addComponent(systemAction, 3, 2);

    label = new Label("User Action:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField userAction = new TextField();
    userAction.setValue("");
    userAction.setReadOnly(true);
    userAction.setWidth("80%");
    layout.addComponent(userAction, 3, 3);

    label = new Label("User Action By:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    Label userActionBy = new Label();
    userActionBy.setValue("");
    userActionBy.setReadOnly(true);
    userActionBy.setWidth("80%");
    layout.addComponent(userActionBy, 3, 4);

    AceEditor eventEditor = new AceEditor();
    eventEditor.setCaption("Event Payload");

    if (this.categorisedErrorOccurrence.getErrorOccurrence().getEvent() != null) {
        eventEditor
                .setValue(new String((byte[]) this.categorisedErrorOccurrence.getErrorOccurrence().getEvent()));
    }

    eventEditor.setReadOnly(true);
    eventEditor.setMode(AceMode.java);
    eventEditor.setTheme(AceTheme.eclipse);
    eventEditor.setHeight(470, Unit.PIXELS);
    eventEditor.setWidth("100%");

    HorizontalLayout formLayout = new HorizontalLayout();
    formLayout.setWidth("100%");
    formLayout.setHeight(300, Unit.PIXELS);
    formLayout.addComponent(layout);
    wrapperLayout.addComponent(formLayout, 0, 0);

    //      VerticalSplitPanel vSplitPanel = new VerticalSplitPanel();
    //      vSplitPanel.setWidth("100%");
    //      vSplitPanel.setHeight(800, Unit.PIXELS);
    //      vSplitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE);

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setSizeFull();
    h1.setMargin(true);
    h1.addComponent(eventEditor);
    //      vSplitPanel.setFirstComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setSizeFull();
    h2.setMargin(true);
    h2.addComponent(editor);
    //      vSplitPanel.setSecondComponent(h2);

    tabsheet.addTab(h2, "Error Details");
    tabsheet.addTab(h1, "Event Payload");

    wrapperLayout.addComponent(tabsheet, 0, 1);

    //      wrapperLayout.addComponent(vSplitPanel, 0, 1);

    errorOccurrenceDetailsPanel.setContent(wrapperLayout);
    return errorOccurrenceDetailsPanel;
}

From source file:org.ikasan.dashboard.ui.topology.window.ErrorOccurrenceViewWindow.java

License:BSD License

protected Panel createErrorOccurrenceDetailsPanel() {
    Panel errorOccurrenceDetailsPanel = new Panel();

    GridLayout layout = new GridLayout(2, 6);
    layout.setSizeFull();/*from  www .  j av a2 s . c om*/
    layout.setSpacing(true);
    layout.setColumnExpandRatio(0, 0.25f);
    layout.setColumnExpandRatio(1, 0.75f);

    Label errorOccurrenceDetailsLabel = new Label("Error Occurence Details");
    errorOccurrenceDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(errorOccurrenceDetailsLabel);

    Label label = new Label("Module Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf1 = new TextField();
    tf1.setValue(this.errorOccurrence.getModuleName());
    tf1.setReadOnly(true);
    tf1.setWidth("80%");
    layout.addComponent(tf1, 1, 1);

    label = new Label("Flow Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf2 = new TextField();
    tf2.setValue(this.errorOccurrence.getFlowName());
    tf2.setReadOnly(true);
    tf2.setWidth("80%");
    layout.addComponent(tf2, 1, 2);

    label = new Label("Component Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf3 = new TextField();
    tf3.setValue(this.errorOccurrence.getFlowElementName());
    tf3.setReadOnly(true);
    tf3.setWidth("80%");
    layout.addComponent(tf3, 1, 3);

    label = new Label("Date/Time:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf4 = new TextField();
    tf4.setValue(new Date(this.errorOccurrence.getTimestamp()).toString());
    tf4.setReadOnly(true);
    tf4.setWidth("80%");
    layout.addComponent(tf4, 1, 4);

    label = new Label("Error Message:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 5);
    layout.setComponentAlignment(label, Alignment.TOP_RIGHT);

    TextArea tf5 = new TextArea();
    tf5.setValue(this.errorOccurrence.getErrorMessage());
    tf5.setReadOnly(true);
    tf5.setWidth("80%");
    tf5.setRows(3);
    layout.addComponent(tf5, 1, 5);

    GridLayout wrapperLayout = new GridLayout(1, 4);
    wrapperLayout.setMargin(true);
    wrapperLayout.setWidth("100%");

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    AceEditor editor = new AceEditor();
    //      editor.setCaption("Error Details");
    editor.setValue(this.errorOccurrence.getErrorDetail());
    editor.setReadOnly(true);
    editor.setMode(AceMode.xml);
    editor.setTheme(AceTheme.eclipse);
    editor.setHeight(470, Unit.PIXELS);
    editor.setWidth("100%");

    AceEditor eventEditor = new AceEditor();
    //      eventEditor.setCaption("Event Payload");

    if (this.errorOccurrence.getEvent() != null) {
        eventEditor.setValue(new String((byte[]) this.errorOccurrence.getEvent()));
    }

    eventEditor.setReadOnly(true);
    eventEditor.setMode(AceMode.java);
    eventEditor.setTheme(AceTheme.eclipse);
    eventEditor.setHeight(470, Unit.PIXELS);
    eventEditor.setWidth("100%");

    HorizontalLayout formLayout = new HorizontalLayout();
    formLayout.setWidth("100%");
    formLayout.setHeight(230, Unit.PIXELS);
    formLayout.addComponent(layout);
    wrapperLayout.addComponent(formLayout, 0, 0);

    //      VerticalSplitPanel vSplitPanel = new VerticalSplitPanel();
    //      vSplitPanel.setWidth("100%");
    //      vSplitPanel.setHeight(800, Unit.PIXELS);
    //      vSplitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setSizeFull();
    h1.setMargin(true);
    h1.addComponent(eventEditor);
    //      vSplitPanel.setFirstComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setSizeFull();
    h2.setMargin(true);
    h2.addComponent(editor);
    //      vSplitPanel.setSecondComponent(h2);

    tabsheet.addTab(h2, "Error Details");
    tabsheet.addTab(h1, "Event Payload");

    wrapperLayout.addComponent(tabsheet, 0, 1);

    errorOccurrenceDetailsPanel.setContent(wrapperLayout);
    return errorOccurrenceDetailsPanel;
}

From source file:org.jpos.qi.views.TabView.java

License:Open Source License

public TabView() {
    setWidth("100%");
    tabs = new TabSheet();
    tabs.addSelectedTabChangeListener(this);
    addComponent(tabs);
}

From source file:org.jumpmind.vaadin.ui.common.CommonUiUtils.java

License:Open Source License

public static TabSheet createTabSheet() {
    TabSheet tabSheet = new TabSheet();
    styleTabSheet(tabSheet);
    return tabSheet;
}