Example usage for com.vaadin.server Page getCurrent

List of usage examples for com.vaadin.server Page getCurrent

Introduction

In this page you can find the example usage for com.vaadin.server Page getCurrent.

Prototype

public static Page getCurrent() 

Source Link

Document

Gets the Page to which the current uI belongs.

Usage

From source file:org.eclipse.hawkbit.ui.menu.DashboardMenu.java

License:Open Source License

private Component buildUserMenu(final UiProperties uiProperties) {
    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");
    settings.setHtmlContentAllowed(true);

    final MenuItem settingsItem = settings.addItem("", getImage(uiProperties.isGravatar()), null);

    final String formattedTenant = UserDetailsFormatter.formatCurrentTenant();
    if (!StringUtils.isEmpty(formattedTenant)) {
        settingsItem.setText(formattedTenant);
        UserDetailsFormatter.getCurrentTenant()
                .ifPresent(tenant -> settingsItem.setDescription(i18n.getMessage("menu.user.description",
                        tenant, UserDetailsFormatter.getCurrentUser().getUsername())));
    } else {/*from   w  ww  .  j  av  a  2  s  .  c  o m*/
        settingsItem.setText("...");
    }

    settingsItem.setStyleName("user-menuitem");

    final String logoutUrl = generateLogoutUrl();

    settingsItem.addItem(i18n.getMessage("label.sign.out"),
            selectedItem -> Page.getCurrent().setLocation(logoutUrl));
    return settings;
}

From source file:org.eclipse.hawkbit.ui.utils.NotificationMessage.java

License:Open Source License

/**
 * Notification message component./* www . ja v  a  2  s  .c  om*/
 * 
 * @param styleName
 *            style name of message
 * @param caption
 *            message caption
 * @param description
 *            message description
 * @param autoClose
 *            flag to indicate enable close option
 */
void showNotification(final String styleName, final String caption, final String description,
        final Boolean autoClose) {
    decorate(styleName, caption, description, autoClose);
    this.show(Page.getCurrent());
}

From source file:org.eclipse.hawkbit.ui.utils.ShortCutModifierUtils.java

License:Open Source License

/**
 * Returns the ctrl or meta modifier depending on the platform.
 * //from   www.  j  a  v a 2 s  .c o  m
 * @return on mac return
 *         {@link com.vaadin.event.ShortcutAction.ModifierKey#META} other
 *         platform return
 *         {@link com.vaadin.event.ShortcutAction.ModifierKey#CTRL}
 */
public static int getCtrlOrMetaModifier() {
    final WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    if (webBrowser.isMacOSX()) {
        return ShortcutAction.ModifierKey.META;
    }

    return ShortcutAction.ModifierKey.CTRL;
}

From source file:org.esn.esobase.view.MainView.java

@PostConstruct
public void PostConstruct() {
    setSizeFull();/*from   w ww.  j  a v a 2 s .co  m*/
    this.setHeight(100f, Unit.PERCENTAGE);
    Page.Styles styles = Page.getCurrent().getStyles();
    styles.add(".v-label {\n" + "    white-space: pre-line;\n" + "    overflow: hidden;\n" + "}"
            + ".v-caption-darkblue {\n" + "   font-weight:bold;margin-bottom:0.33em;margin-top:0.55em;\n" + "}"
            + ".my-grid .v-grid-body .v-grid-cell { height: 100px; }"
            + ".v-treegrid-cell.step_row {background-color: #d7e7d5 !important;}"
            + ".v-treegrid-cell.direction_row {background-color: #ffffff !important;}"
            + ".v-table, .v-table * { overflow-anchor: none; };");
    VerticalLayout layout = new VerticalLayout();
    layout.setHeight(100f, Unit.PERCENTAGE);
    layout.setSpacing(false);
    layout.setMargin(true);
    layout.addComponent(headerLayout);
    buildHeader();
    layout.addComponent(mainMenu);
    buildMenu();
    layout.addComponent(tabs);
    layout.setExpandRatio(tabs, 40f);
    buildTabs();

    setContent(layout);

}

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

public DirectTableEditTab(DBService service_, SearchService searchService_) {
    this.service = service_;
    this.searchService = searchService_;
    this.setSizeFull();
    this.setMargin(false);
    linkedItemClickListener = new LinkedItemClickListener();
    searchTabs = new TabSheet();
    searchTabs.setSizeFull();/*from  w ww . j a v a2 s . c om*/
    searchTabs.setHeight(250f, Unit.PIXELS);
    VerticalLayout searchInCatalogsLayout = new VerticalLayout();
    searchInCatalogsLayout.setSizeFull();
    searchInCatalogsLayout.setMargin(false);
    HorizontalLayout hl = new HorizontalLayout();
    hl.setDefaultComponentAlignment(Alignment.BOTTOM_LEFT);
    searchField = new TextField();
    searchField.setWidth(500, Unit.PIXELS);
    searchField
            .addShortcutListener(new ShortcutListener("Search shortcut", ShortcutAction.KeyCode.ENTER, null) {
                @Override
                public void handleAction(Object sender, Object target) {
                    search();
                }
            });
    hl.addComponent(searchField);
    searchButton = new Button("?");
    searchButton.setIcon(FontAwesome.SEARCH);
    searchButton.addClickListener(new Button.ClickListener() {

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

        }
    });
    hl.addComponent(searchButton);
    hl.addComponent(new Label(""));

    tableNamesList.add("GSpreadSheetsNpcName");
    tableNamesList.add("GSpreadSheetsNpcPhrase");
    tableNamesList.add("GSpreadSheetsPlayerPhrase");
    tableNamesList.add("GSpreadSheetsAbilityDescription");
    tableNamesList.add("GSpreadSheetsAchievement");
    tableNamesList.add("GSpreadSheetsAchievementDescription");
    tableNamesList.add("GSpreadSheetsActivator");
    tableNamesList.add("GSpreadSheetsCollectible");
    tableNamesList.add("GSpreadSheetsCollectibleDescription");
    tableNamesList.add("GSpreadSheetsItemDescription");
    tableNamesList.add("GSpreadSheetsItemName");
    tableNamesList.add("GSpreadSheetsJournalEntry");
    tableNamesList.add("GSpreadSheetsLoadscreen");
    tableNamesList.add("GSpreadSheetsLocationName");
    tableNamesList.add("GSpreadSheetsNote");
    tableNamesList.add("GSpreadSheetsQuestDescription");
    tableNamesList.add("GSpreadSheetsQuestDirection");
    tableNamesList.add("GSpreadSheetsQuestName");
    tableNamesList.add("GSpreadSheetsQuestStartTip");
    tableNamesList.add("GSpreadSheetsQuestEndTip");
    tableNames = new ComboBoxMultiselect(null);
    tableNames.setSelectAllButtonCaption(" ?");
    tableNames.setShowSelectAllButton(new ComboBoxMultiselect.ShowButton() {
        @Override
        public boolean isShow(String filter, int page) {
            return true;
        }
    });
    tableNames.setClearButtonCaption("? ");
    tableNames.setPageLength(0);
    tableNames.addItems(tableNamesList);
    tableNames.selectAll();
    tableNames.setItemCaption("GSpreadSheetsAbilityDescription", "?? ???");
    tableNames.setItemCaption("GSpreadSheetsAchievement", "??");
    tableNames.setItemCaption("GSpreadSheetsAchievementDescription", "?? ?");
    tableNames.setItemCaption("GSpreadSheetsActivator", "?");
    tableNames.setItemCaption("GSpreadSheetsCollectible", " ");
    tableNames.setItemCaption("GSpreadSheetsCollectibleDescription",
            "??  ");
    tableNames.setItemCaption("GSpreadSheetsItemDescription", "?? ");
    tableNames.setItemCaption("GSpreadSheetsItemName", "?? ");
    tableNames.setItemCaption("GSpreadSheetsJournalEntry", "? ");
    tableNames.setItemCaption("GSpreadSheetsLoadscreen", " ?");
    tableNames.setItemCaption("GSpreadSheetsLocationName", "");
    tableNames.setItemCaption("GSpreadSheetsNote", "?");
    tableNames.setItemCaption("GSpreadSheetsNpcName", "NPC");
    tableNames.setItemCaption("GSpreadSheetsNpcPhrase", " NPC");
    tableNames.setItemCaption("GSpreadSheetsPlayerPhrase", " ");
    tableNames.setItemCaption("GSpreadSheetsQuestDescription", "?? ?");
    tableNames.setItemCaption("GSpreadSheetsQuestDirection", " ?");
    tableNames.setItemCaption("GSpreadSheetsQuestEndTip", " ");
    tableNames.setItemCaption("GSpreadSheetsQuestName", "?? ?");
    tableNames.setItemCaption("GSpreadSheetsQuestStartTip", "? ");
    hl.addComponent(tableNames);
    regularExpression = new CheckBox("regexp", false);
    hl.addComponent(regularExpression);
    withTranslatedNeighbours = new CheckBox(
            "? ?  ???", false);
    hl.addComponent(withTranslatedNeighbours);
    neighboursCount = new Slider(null, 1, 200);
    neighboursCount.setValue(20d);
    hl.addComponent(neighboursCount);
    searchInCatalogsLayout.addComponent(hl);
    translatedTextSpecification = new TranslatedTextSpecification();
    resultTable = new Table(" ?");
    resultTable.addStyleName(ValoTheme.TABLE_SMALL);
    resultTable.addStyleName(ValoTheme.TABLE_COMPACT);
    resultTable.setSizeFull();
    resultTable.setPageLength(0);
    hc.addContainerProperty("textEn", String.class, null);
    hc.addContainerProperty("textRu", String.class, null);
    hc.addContainerProperty("catalogType", String.class, null);
    hc.addContainerProperty("translator", String.class, null);
    hc.addContainerProperty("weight", Integer.class, null);
    resultTable.setContainerDataSource(hc);
    resultTable.setVisibleColumns(new Object[] { "textEn", "textRu", "catalogType", "translator" });
    resultTable.setColumnHeaders(
            new String[] { "?", "?? ?", "", "" });
    resultTable.addItemClickListener(new SearchTableRowClickListener());

    searchInCatalogsLayout.addComponent(resultTable);
    searchInCatalogsLayout.setExpandRatio(resultTable, 5f);

    searchTabs.addTab(searchInCatalogsLayout, "?");
    VerticalLayout translationsLayout = new VerticalLayout();
    translationsLayout.setMargin(false);
    translationsLayout.setSpacing(false);
    translationsLayout.setSizeFull();
    HorizontalLayout traslationsFilterslayout = new HorizontalLayout();
    statusFilter = new ComboBox("?", Arrays.asList(TRANSLATE_STATUS.values()));
    statusFilter.setNullSelectionAllowed(false);
    statusFilter.setValue(TRANSLATE_STATUS.NEW);
    traslationsFilterslayout.addComponent(statusFilter);
    translatorBox = new ComboBox("");
    translatorBox.setPageLength(15);
    sysAccountContainer = service.loadBeanItems(sysAccountContainer);
    translatorBox.setContainerDataSource(sysAccountContainer);
    translatorBox.setFilteringMode(FilteringMode.CONTAINS);
    traslationsFilterslayout.addComponent(translatorBox);
    translateTypeBox = new ComboBox("");
    translateTypeBox.setNullSelectionAllowed(true);
    translateTypeBox.setPageLength(15);
    translateTypeBox.addItem("spreadSheetsActivator");
    translateTypeBox.setItemCaption("spreadSheetsActivator", "?");
    translateTypeBox.addItem("spreadSheetsAchievement");
    translateTypeBox.setItemCaption("spreadSheetsAchievement", "??");
    translateTypeBox.addItem("spreadSheetsAchievementDescription");
    translateTypeBox.setItemCaption("spreadSheetsAchievementDescription",
            "?? ?");
    translateTypeBox.addItem("spreadSheetsNote");
    translateTypeBox.setItemCaption("spreadSheetsNote", "?");
    translateTypeBox.addItem("spreadSheetsItemDescription");
    translateTypeBox.setItemCaption("spreadSheetsItemDescription", "?? ");
    translateTypeBox.addItem("spreadSheetsItemName");
    translateTypeBox.setItemCaption("spreadSheetsItemName", "?? ");
    translateTypeBox.addItem("spreadSheetsJournalEntry");
    translateTypeBox.setItemCaption("spreadSheetsJournalEntry", "?  ");
    translateTypeBox.addItem("spreadSheetsLocationName");
    translateTypeBox.setItemCaption("spreadSheetsLocationName", "?? ");
    translateTypeBox.addItem("spreadSheetsNpcName");
    translateTypeBox.setItemCaption("spreadSheetsNpcName", " NPC");
    translateTypeBox.addItem("spreadSheetsNpcPhrase");
    translateTypeBox.setItemCaption("spreadSheetsNpcPhrase", " NPC");
    translateTypeBox.addItem("spreadSheetsPlayerPhrase");
    translateTypeBox.setItemCaption("spreadSheetsPlayerPhrase", " ");
    translateTypeBox.addItem("spreadSheetsQuestDescription");
    translateTypeBox.setItemCaption("spreadSheetsQuestDescription", "?? ?");
    translateTypeBox.addItem("spreadSheetsQuestDirection");
    translateTypeBox.setItemCaption("spreadSheetsQuestDirection", " ?");
    translateTypeBox.addItem("spreadSheetsQuestName");
    translateTypeBox.setItemCaption("spreadSheetsQuestName", "?? ?");
    translateTypeBox.addItem("spreadSheetsQuestStartTip");
    translateTypeBox.setItemCaption("spreadSheetsQuestStartTip", "? ");
    translateTypeBox.addItem("spreadSheetsQuestEndTip");
    translateTypeBox.setItemCaption("spreadSheetsQuestEndTip", " ");
    translateTypeBox.addItem("sheetsCollectible");
    translateTypeBox.setItemCaption("sheetsCollectible",
            "??  ");
    translateTypeBox.addItem("sheetsCollectibleDescription");
    translateTypeBox.setItemCaption("sheetsCollectibleDescription",
            "??  ");
    translateTypeBox.addItem("sheetsLoadscreen");
    translateTypeBox.setItemCaption("sheetsLoadscreen", " ?");
    translateTypeBox.setFilteringMode(FilteringMode.CONTAINS);
    traslationsFilterslayout.addComponent(translateTypeBox);
    filterTranslationButton = new Button("?");
    filterTranslationButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            filterTranslations();
        }
    });
    traslationsFilterslayout.addComponent(filterTranslationButton);
    traslationsFilterslayout.setComponentAlignment(filterTranslationButton, Alignment.BOTTOM_LEFT);
    translationsLayout.addComponent(traslationsFilterslayout);
    newTranslationsTable = new MGrid();
    newTranslationsTable.setSizeFull();
    newTranslationsContainer = new GeneratedPropertyListContainer<>(TranslatedText.class);
    newTranslationsTable.setContainerDataSource(newTranslationsContainer);
    filterTranslations();
    newTranslationsContainer.sort(new Object[] { "id" }, new boolean[] { true });
    newTranslationsTable.setContainerDataSource(newTranslationsContainer);
    newTranslationsTable.setColumns("author", "createTime", "text");
    newTranslationsTable.getColumn("author").setHeaderCaption("?").setMaximumWidth(200);
    newTranslationsTable.getColumn("createTime").setHeaderCaption("").setWidth(140);
    newTranslationsTable.getColumn("text").setHeaderCaption("").setMaximumWidth(800)
            .setMinimumWidth(600);
    newTranslationsTable.addItemClickListener(new TranslationsTableRowClickListener());
    translationsLayout.addComponent(newTranslationsTable);
    translationsLayout.setExpandRatio(newTranslationsTable, 5f);
    searchTabs.addTab(translationsLayout, "");
    this.addComponent(searchTabs);
    filterLayout = new HorizontalLayout();
    Label itemTypeLabel = new Label("");
    itemType = new ComboBox();
    itemType.addItems(service.getTypes());
    itemType.setNullSelectionAllowed(true);
    itemType.setFilteringMode(FilteringMode.CONTAINS);
    filterLayout.addComponent(itemTypeLabel);
    filterLayout.addComponent(itemType);
    Label itemSubTypeLabel = new Label("");
    itemSubType = new ComboBox();
    itemSubType.addItems(service.getSubTypes());
    itemSubType.setNullSelectionAllowed(true);
    itemSubType.setFilteringMode(FilteringMode.CONTAINS);
    filterLayout.addComponent(itemSubTypeLabel);
    filterLayout.addComponent(itemSubType);
    notTranslated = new CheckBox("? ");
    notTranslated.setValue(Boolean.FALSE);
    filterLayout.addComponent(notTranslated);
    filterLayout.setComponentAlignment(notTranslated, Alignment.MIDDLE_LEFT);
    this.addComponent(filterLayout);
    tableTabs = new TabSheet();
    tableTabs.setSizeFull();
    gSpreadSheetsNpcNameContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsNpcName.class);
    npcNameTable = new GspreadSheetTable(gSpreadSheetsNpcNameContainer, PAGESIZE,
            service.getgSpreadSheetsNpcNameRepository(), specification);
    npcNameTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    npcNameTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(npcNameTable));
    tableTabs.addTab(npcNameTable, "NPC");
    npcNameTable.build();
    npcNameTable.setVisibleColumns(
            new Object[] { "rowNum", "sex", "textEn", "textRu", "infoColumn", "translateColumn" });
    npcNameTable.setColumnWidth("sex", 87);
    npcNameTable.setColumnHeader("sex", "");

    locationNameContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsLocationName.class);
    locationNameTable = new GspreadSheetTable(locationNameContainer, PAGESIZE,
            service.getgSpreadSheetsLocationNameRepository(), specification);
    locationNameTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    locationNameTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(locationNameTable));
    tableTabs.addTab(locationNameTable, "");
    locationNameTable.build();
    locationNameTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    activatorContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsActivator.class);
    activatorTable = new GspreadSheetTable(activatorContainer, PAGESIZE,
            service.getgSpreadSheetsActivatorRepository(), specification);
    activatorTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    activatorTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(activatorTable));
    tableTabs.addTab(activatorTable, "?");
    activatorTable.build();
    activatorTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    playerPhraseContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsPlayerPhrase.class);
    playerPhraseTable = new GspreadSheetTable(playerPhraseContainer, PAGESIZE,
            service.getgSpreadSheetsPlayerPhraseRepository(), specification);
    playerPhraseTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    playerPhraseTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(playerPhraseTable));
    tableTabs.addTab(playerPhraseTable, " ");
    playerPhraseTable.build();
    playerPhraseTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    Page.Styles styles = Page.getCurrent().getStyles();
    styles.add(".wrapped-text {\n" + "    white-space: normal;\n" + "    overflow: hidden;\n" + "}");
    npcPhraseContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsNpcPhrase.class);
    npcPhraseTable = new GspreadSheetTable(npcPhraseContainer, PAGESIZE,
            service.getgSpreadSheetsNpcPhraseRepository(), specification);
    npcPhraseTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    npcPhraseTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(npcPhraseTable));
    tableTabs.addTab(npcPhraseTable, " NPC");
    npcPhraseTable.build();
    npcPhraseTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    questNameContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsQuestName.class);
    questNameTable = new GspreadSheetTable(questNameContainer, PAGESIZE,
            service.getgSpreadSheetsQuestNameRepository(), specification);
    questNameTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    questNameTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(questNameTable));
    tableTabs.addTab(questNameTable, "?? ?");
    questNameTable.build();
    questNameTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    questDescriptionContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsQuestDescription.class);
    questDescriptionTable = new GspreadSheetTable(questDescriptionContainer, PAGESIZE,
            service.getgSpreadSheetsQuestDescriptionRepository(), specification);
    questDescriptionTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    questDescriptionTable.addGeneratedColumn("translateColumn",
            new TranslateColumnGenerator(questDescriptionTable));
    tableTabs.addTab(questDescriptionTable, "?? ?");
    questDescriptionTable.build();
    questDescriptionTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    questDirectionContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsQuestDirection.class);
    questDirectionTable = new GspreadSheetTable(questDirectionContainer, PAGESIZE,
            service.getgSpreadSheetsQuestDirectionRepository(), specification);
    questDirectionTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    questDirectionTable.addGeneratedColumn("translateColumn",
            new TranslateColumnGenerator(questDirectionTable));
    tableTabs.addTab(questDirectionTable, " ?");
    questDirectionTable.build();
    questDirectionTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    questStartTipContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsQuestStartTip.class);
    questStartTipTable = new GspreadSheetTable(questStartTipContainer, PAGESIZE,
            service.getgSpreadSheetsQuestStartTipRepository(), specification);
    questStartTipTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    questStartTipTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(questStartTipTable));
    tableTabs.addTab(questStartTipTable, "? ");
    questStartTipTable.build();
    questStartTipTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    questEndTipContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsQuestEndTip.class);
    questEndTipTable = new GspreadSheetTable(questEndTipContainer, PAGESIZE,
            service.getgSpreadSheetsQuestEndTipRepository(), specification);
    questEndTipTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    questEndTipTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(questEndTipTable));
    tableTabs.addTab(questEndTipTable, " ");
    questEndTipTable.build();
    questEndTipTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    itemNameLayout = new VerticalLayout();
    itemNameLayout.setMargin(false);
    itemNameLayout.setSpacing(false);
    itemNameLayout.setSizeFull();
    Label itemNameLabel = new Label(
            "???!  ?  ?:   ? ?, ? ? ? ? .");
    itemNameLabel.setStyleName(ValoTheme.LABEL_COLORED);
    itemNameContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsItemName.class);
    itemNameTable = new GspreadSheetTable(itemNameContainer, PAGESIZE,
            service.getgSpreadSheetsItemNameRepository(), itemNameSpecification);
    itemNameTable.addGeneratedColumn("itemTypeColumn", new ItemInfoColumnGenerator());
    itemNameTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    itemNameTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(itemNameTable));
    itemNameLayout.addComponent(itemNameLabel);
    itemNameLayout.addComponent(itemNameTable);
    itemNameLayout.setExpandRatio(itemNameTable, 1f);
    tableTabs.addTab(itemNameLayout, "?? ");
    itemNameTable.build();
    itemNameTable.setVisibleColumns(
            new Object[] { "rowNum", "textEn", "textRu", "itemTypeColumn", "infoColumn", "translateColumn" });
    itemNameTable.setColumnHeader("itemTypeColumn", "");
    itemNameTable.setColumnExpandRatio("itemTypeColumn", 0.5f);

    itemDescriptionContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsItemDescription.class);
    itemDescriptionTable = new GspreadSheetTable(itemDescriptionContainer, PAGESIZE,
            service.getgSpreadSheetsItemDescriptionRepository(), specification);
    itemDescriptionTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    itemDescriptionTable.addGeneratedColumn("translateColumn",
            new TranslateColumnGenerator(itemDescriptionTable));
    tableTabs.addTab(itemDescriptionTable, "?? ");
    itemDescriptionTable.build();
    itemDescriptionTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    journalEntryContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsJournalEntry.class);
    journalEntryTable = new GspreadSheetTable(journalEntryContainer, PAGESIZE,
            service.getgSpreadSheetsJournalEntryRepository(), specification);
    journalEntryTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    journalEntryTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(journalEntryTable));
    tableTabs.addTab(journalEntryTable, "? ");
    journalEntryTable.build();
    journalEntryTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    achievementContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsAchievement.class);
    achievementTable = new GspreadSheetTable(achievementContainer, PAGESIZE,
            service.getgSpreadSheetsAchievementRepository(), specification);
    achievementTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    achievementTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(achievementTable));
    tableTabs.addTab(achievementTable, "??");
    achievementTable.build();
    achievementTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    achievementDescriptionContainer = new GeneratedPropertyListContainer<>(
            GSpreadSheetsAchievementDescription.class);
    achievementDescriptionTable = new GspreadSheetTable(achievementDescriptionContainer, PAGESIZE,
            service.getgSpreadSheetsAchievementDescriptionRepository(), specification);
    achievementDescriptionTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    achievementDescriptionTable.addGeneratedColumn("translateColumn",
            new TranslateColumnGenerator(achievementDescriptionTable));
    tableTabs.addTab(achievementDescriptionTable, "?? ?");
    achievementDescriptionTable.build();
    achievementDescriptionTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    abilityDescriptionContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsAbilityDescription.class);
    abilityDescriptionTable = new GspreadSheetTable(abilityDescriptionContainer, PAGESIZE,
            service.getgSpreadSheetsAbilityDescriptionRepository(), specification);
    abilityDescriptionTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    abilityDescriptionTable.addGeneratedColumn("translateColumn",
            new TranslateColumnGenerator(abilityDescriptionTable));
    tableTabs.addTab(abilityDescriptionTable, "?? ???");
    abilityDescriptionTable.build();
    abilityDescriptionTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    noteContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsNote.class);
    noteTable = new GspreadSheetTable(noteContainer, PAGESIZE, service.getgSpreadSheetsNoteRepository(),
            specification);
    noteTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    noteTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(noteTable));
    tableTabs.addTab(noteTable, "?");
    noteTable.build();
    noteTable.setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    collectibleContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsCollectible.class);
    collectibleTable = new GspreadSheetTable(collectibleContainer, PAGESIZE,
            service.getgSpreadSheetsCollectibleRepository(), specification);
    collectibleTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    collectibleTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(collectibleTable));
    tableTabs.addTab(collectibleTable, " ");
    collectibleTable.build();
    collectibleTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    collectibleDescriptionContainer = new GeneratedPropertyListContainer<>(
            GSpreadSheetsCollectibleDescription.class);
    collectibleDescriptionTable = new GspreadSheetTable(collectibleDescriptionContainer, PAGESIZE,
            service.getgSpreadSheetsCollectibleDescriptionRepository(), specification);
    collectibleDescriptionTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    collectibleDescriptionTable.addGeneratedColumn("translateColumn",
            new TranslateColumnGenerator(collectibleDescriptionTable));
    tableTabs.addTab(collectibleDescriptionTable,
            "??  ");
    collectibleDescriptionTable.build();
    collectibleDescriptionTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });

    loadscreenContainer = new GeneratedPropertyListContainer<>(GSpreadSheetsLoadscreen.class);
    loadscreenTable = new GspreadSheetTable(loadscreenContainer, PAGESIZE,
            service.getgSpreadSheetsLoadscreenRepository(), specification);
    loadscreenTable.addGeneratedColumn("infoColumn", new InfoColumnGenerator());
    loadscreenTable.addGeneratedColumn("translateColumn", new TranslateColumnGenerator(loadscreenTable));
    tableTabs.addTab(loadscreenTable, " ?");
    loadscreenTable.build();
    loadscreenTable
            .setVisibleColumns(new Object[] { "rowNum", "textEn", "textRu", "infoColumn", "translateColumn" });
    LoadTables();
    itemType.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            LoadTables();
        }
    });
    itemSubType.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            LoadTables();
        }
    });
    notTranslated.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() {
        @Override
        public void valueChange(HasValue.ValueChangeEvent<Boolean> event) {
            LoadTables();
        }
    });

    this.addComponent(tableTabs);
    this.setExpandRatio(tableTabs, 20f);
}

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

public QuestsTab(DBService service) {
    this.service = service;
    actions = new HorizontalLayout();
    refreshButton = new Button("");
    refreshButton.addClickListener(new Button.ClickListener() {

        @Override/*w  ww. ja v  a 2s .  c om*/
        public void buttonClick(Button.ClickEvent event) {
            LoadTable();
            CloseForm();
        }
    });
    actions.addComponent(refreshButton);
    addButton = new Button("");
    addButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            AddItem();
        }
    });
    actions.addComponent(addButton);
    this.addComponent(actions);
    tableAndForm = new HorizontalLayout();
    tableAndForm.setSizeFull();
    table = new Table();
    table.setSizeFull();
    container = new BeanItemContainer<>(Quest.class);
    table.setContainerDataSource(container);

    table.setVisibleColumns(new Object[] { "name", "nameRu", "progress" });
    table.setColumnHeaders(new String[] { "?", " ?",
            "? " });
    table.setConverter("progress", new Converter<String, BigDecimal>() {

        @Override
        public BigDecimal convertToModel(String value, Class<? extends BigDecimal> targetType, Locale locale)
                throws Converter.ConversionException {
            return null;
        }

        @Override
        public String convertToPresentation(BigDecimal value, Class<? extends String> targetType, Locale locale)
                throws Converter.ConversionException {
            String r = "";
            if (value != null) {
                r = value.multiply(BigDecimal.valueOf(100L).setScale(2, RoundingMode.HALF_DOWN))
                        .setScale(0, RoundingMode.HALF_UP).toString() + "%";
            }
            return r;
        }

        @Override
        public Class<BigDecimal> getModelType() {
            return BigDecimal.class;
        }

        @Override
        public Class<String> getPresentationType() {
            return String.class;
        }

    });
    table.addItemClickListener(new TableClickListener());
    LoadTable();
    table.sort(new Object[] { "name" }, new boolean[] { true });
    tableAndForm.addComponent(table);
    tableAndForm.setExpandRatio(table, 0.2f);
    form = new FormLayout();
    form.setSizeFull();
    name = new TextField("?");
    name.setNullRepresentation("");
    name.setRequired(true);
    form.addComponent(name);
    nameRu = new TextField(" ?");
    nameRu.setNullRepresentation("");
    nameRu.setRequired(false);
    form.addComponent(nameRu);

    npcs = new TwinColSelect("NPC");
    npcsContainer = new BeanItemContainer<>(Npc.class);
    npcsContainer = service.loadBeanItems(npcsContainer);
    npcsContainer.sort(new Object[] { "name" }, new boolean[] { true });
    npcsContainer.addNestedContainerProperty("location.name");
    npcsContainer.addNestedContainerProperty("location.nameRu");
    npcs.setContainerDataSource(npcsContainer);
    npcs.setWidth(900f, Unit.PIXELS);
    Page.Styles styles = Page.getCurrent().getStyles();
    styles.add(".v-font-size {\n" + "    font-size: 11px;\n" + "}");
    npcs.addStyleName("v-font-size");
    npcFilter = new TextField(" ?? NPC");
    npcFilter.setNullRepresentation("");
    npcFilter.setImmediate(true);
    npcFilter.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.TIMEOUT);
    npcFilter.setTextChangeTimeout(500);
    npcFilter.addTextChangeListener(new FieldEvents.TextChangeListener() {

        @Override
        public void textChange(FieldEvents.TextChangeEvent event) {
            npcsContainer.removeAllContainerFilters();
            if (event.getText() != null && !event.getText().isEmpty()) {
                try {
                    npcsContainer
                            .addContainerFilter(new Or(new Like("name", "%" + event.getText() + "%", false),
                                    new Like("nameRu", "%" + event.getText() + "%", false),
                                    new Like("location.name", "%" + event.getText() + "%", false),
                                    new Like("location.nameRu", "%" + event.getText() + "%", false)));
                } catch (UnsupportedFilterException | PatternSyntaxException ex) {

                }
            }
        }
    });
    form.addComponent(npcFilter);
    form.addComponent(npcs);
    saveButton = new Button("");
    saveButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            SaveForm();
        }
    });
    cancelButton = new Button("");
    cancelButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            CloseForm();
            LoadTable();
        }
    });
    HorizontalLayout actions = new HorizontalLayout(cancelButton, saveButton);
    form.addComponent(actions);
    form.setVisible(false);
    tableAndForm.addComponent(form);
    tableAndForm.setExpandRatio(form, 0.75f);
    this.addComponent(tableAndForm);
}

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

public SearchInCatalogsTab(DBService service_, DictionaryService dictionaryService_) {
    this.dictionaryService = dictionaryService_;
    this.service = service_;
    this.setSizeFull();
    GridLayout hl = new GridLayout(2, 1);
    hl.setHeight(100, Unit.PIXELS);/*from  w ww.  j  a  va2 s  .com*/
    searchField = new TextField();
    searchField.setWidth(500, Unit.PIXELS);
    searchField
            .addShortcutListener(new ShortcutListener("Search shortcut", ShortcutAction.KeyCode.ENTER, null) {
                @Override
                public void handleAction(Object sender, Object target) {
                    search();
                }
            });
    hl.addComponent(searchField, 0, 0);
    searchButton = new Button("?");
    searchButton.addClickListener(new ClickListener() {

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

        }
    });
    hl.addComponent(searchButton, 1, 0);
    this.addComponent(hl);
    resultTable = new Table("");
    resultTable.setSizeFull();

    Styles styles = Page.getCurrent().getStyles();
    styles.add(".v-table-cell-wrapper {\n" + "    /* Do not specify any margins, paddings or borders here */\n"
            + "    white-space: normal;\n" + "    overflow: hidden;\n" + "}");
    resultTable.addStyleName("v-table-cell-wrapper");
    resultTable.setPageLength(0);
    hc.addContainerProperty("textEn", String.class, null);
    hc.addContainerProperty("textRu", String.class, null);
    hc.addContainerProperty("catalogType", String.class, null);
    hc.addContainerProperty("translator", String.class, null);
    hc.addContainerProperty("weight", Integer.class, null);
    resultTable.setContainerDataSource(hc);
    resultTable.setVisibleColumns(new Object[] { "textEn", "textRu", "catalogType", "translator" });
    resultTable.setColumnHeaders(
            new String[] { "?", "?? ?", "", "" });
    resultTable.setColumnExpandRatio("textEn", 4f);
    resultTable.setColumnExpandRatio("textRu", 4f);
    resultTable.setColumnExpandRatio("catalogType", 1f);
    resultTable.setColumnExpandRatio("translator", 1f);

    this.addComponent(resultTable);
    this.setExpandRatio(hl, 5);
    this.setExpandRatio(resultTable, 95);

}

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

public SearchInRawStringsTab(DBService service_) {
    this.service = service_;
    this.setSizeFull();
    GridLayout hl = new GridLayout(3, 1);
    hl.setHeight(100, Unit.PIXELS);/* ww  w . ja va2  s  .c  o m*/
    searchField = new TextField();
    searchField.setWidth(500, Unit.PIXELS);
    searchField
            .addShortcutListener(new ShortcutListener("Search shortcut", ShortcutAction.KeyCode.ENTER, null) {
                @Override
                public void handleAction(Object sender, Object target) {
                    search();
                }
            });
    hl.addComponent(searchField, 0, 0);
    isJp = new CheckBox("?");
    isJp.setValue(Boolean.FALSE);
    isJp.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() {
        @Override
        public void valueChange(HasValue.ValueChangeEvent<Boolean> event) {
            setColumns();
        }
    });
    hl.addComponent(isJp, 1, 0);
    searchButton = new Button("?");
    searchButton.addClickListener(new ClickListener() {

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

        }
    });
    hl.addComponent(searchButton, 2, 0);
    this.addComponent(hl);
    resultTable = new Table("");
    resultTable.setSizeFull();

    Styles styles = Page.getCurrent().getStyles();
    styles.add(".v-table-cell-wrapper {\n" + "    /* Do not specify any margins, paddings or borders here */\n"
            + "    white-space: pre-line;\n" + "    overflow: hidden;\n" + "}");
    resultTable.addStyleName("v-table-cell-wrapper");
    resultTable.setPageLength(0);
    hc.addContainerProperty("textEn", String.class, null);
    hc.addContainerProperty("textDe", String.class, null);
    hc.addContainerProperty("textFr", String.class, null);
    hc.addContainerProperty("textJp", String.class, null);
    resultTable.setContainerDataSource(hc);
    setColumns();

    this.addComponent(resultTable);
    this.setExpandRatio(hl, 5);
    this.setExpandRatio(resultTable, 95);

}

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

public SpellerTestTab(DBService service_) {
    this.service = service_;
    this.setSizeFull();
    hl = new HorizontalLayout();
    startDate = new DateField();
    startDate.setResolution(Resolution.DAY);
    endDate = new DateField();
    endDate.setResolution(Resolution.DAY);
    hl.addComponent(startDate);//  w w w . j  a  va  2  s.co m
    hl.addComponent(endDate);

    checkButton = new Button("");
    checkButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            Date dateEndValue = null;
            if (endDate.getValue() != null) {
                Calendar cal = Calendar.getInstance();
                cal.setTime(endDate.getValue());
                cal.add(Calendar.DAY_OF_YEAR, 1);
                dateEndValue = cal.getTime();
            }
            hc = service.getTextForSpellCheck(startDate.getValue(), dateEndValue, hc);
            try {
                SpellService yservice = new SpellService();
                SpellServiceSoap port = yservice.getSpellServiceSoap12();
                List<Object> parentIds = new ArrayList<>();
                for (Object itemId : hc.getItemIds()) {
                    parentIds.add(itemId);
                }
                for (Object itemId : parentIds) {
                    CheckTextRequest parameters = new CheckTextRequest();
                    parameters.setLang("ru");
                    parameters.setText((String) hc.getItem(itemId).getItemProperty("textRu").getValue());
                    parameters.setFormat("plain");
                    parameters.setOptions(0);
                    CheckTextResponse result = port.checkText(parameters);
                    if (result != null && result.getSpellResult() != null
                            && result.getSpellResult().getError() != null) {
                        for (SpellError error : result.getSpellResult().getError()) {

                            SPELLER_ERROR e = SPELLER_ERROR.valueOf(error.getCode());
                            String word = error.getWord();
                            boolean existSpellerWord = service.isExistSpellerWord(word);
                            if (!((e == SPELLER_ERROR.ERROR_UNKNOWN_WORD) && (existSpellerWord))) {
                                Item item = hc.addItem(error);

                                item.getItemProperty("errorType").setValue(e);
                                item.getItemProperty("word").setValue(error.getWord());
                                item.getItemProperty("s").setValue(error.getS());
                                hc.setParent(error, itemId);
                                hc.setChildrenAllowed(error, false);
                            }

                        }
                    }

                    resultTable.setCollapsed(itemId, false);
                }

                excludeWithoutErrors();

            } catch (Exception ex) {
                LOG.log(Level.INFO, null, ex);
            }

        }
    });
    hl.addComponent(checkButton);
    this.addComponent(hl);
    hc = new HierarchicalContainer();
    hc.addContainerProperty("textEn", String.class, null);
    hc.addContainerProperty("textRu", String.class, null);
    hc.addContainerProperty("catalogType", String.class, null);
    hc.addContainerProperty("translator", String.class, null);
    hc.addContainerProperty("errorType", SPELLER_ERROR.class, null);
    hc.addContainerProperty("word", String.class, null);
    hc.addContainerProperty("s", List.class, null);
    resultTable = new TreeTable();
    resultTable.setContainerDataSource(hc);
    resultTable.setWidth(100f, Unit.PERCENTAGE);

    resultTable.addGeneratedColumn("actionsColumn", new Table.ColumnGenerator() {

        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            if (itemId instanceof SpellError) {
                Button b = new Button("  ??");
                b.addClickListener(new WordAddClickListener(service,
                        (String) source.getItem(itemId).getItemProperty("word").getValue(),
                        (SpellError) itemId));
                return b;
            } else {
                Button b = new Button("");
                b.addClickListener(new SaveItemListener(itemId));
                return b;
            }

        }
    });
    resultTable.setVisibleColumns(new Object[] { "textEn", "textRu", "catalogType", "translator", "errorType",
            "word", "s", "actionsColumn" });
    resultTable.setColumnHeaders(new String[] { "", "", " ",
            "", " ", "", "", "" });
    Page.Styles styles = Page.getCurrent().getStyles();
    styles.add(".v-table-cell-wrapper {\n" + "    /* Do not specify any margins, paddings or borders here */\n"
            + "    white-space: normal;\n" + "    /*overflow: hidden;*/\n" + "}");
    resultTable.addStyleName("v-table-cell-wrapper");
    resultTable.setColumnExpandRatio("textEn", 3f);
    resultTable.setColumnExpandRatio("textRu", 3f);
    resultTable.setColumnExpandRatio("catalogType", 1f);
    resultTable.setColumnExpandRatio("translator", 0.7f);
    resultTable.setColumnExpandRatio("errorType", 1f);
    resultTable.setColumnExpandRatio("word", 1f);
    resultTable.setColumnExpandRatio("s", 1f);
    resultTable.setColumnExpandRatio("actionsColumn", 1.2f);
    resultTable.setConverter("s", new Converter<String, List>() {

        @Override
        public List convertToModel(String value, Class<? extends List> targetType, Locale locale)
                throws Converter.ConversionException {
            if (value != null && !value.isEmpty()) {
                String[] split = value.split("\n");
                return new ArrayList(Arrays.asList(split));
            }
            return null;
        }

        @Override
        public String convertToPresentation(List value, Class<? extends String> targetType, Locale locale)
                throws Converter.ConversionException {
            StringBuilder sb = new StringBuilder("");
            if (value != null) {
                for (int i = 0; i < value.size(); i++) {
                    sb.append(value.get(i));
                    if (i != value.size() - 1) {
                        sb.append("\n");
                    }
                }
            }

            String joined = sb.toString();
            return joined;
        }

        @Override
        public Class<List> getModelType() {
            return List.class;
        }

        @Override
        public Class<String> getPresentationType() {
            return String.class;
        }

    });
    resultTable.setTableFieldFactory(new TableFieldFactory() {

        @Override
        public Field<?> createField(Container container, Object itemId, Object propertyId,
                Component uiContext) {
            Field result = null;
            if (!(itemId instanceof SpellError) && propertyId.equals("textRu")) {
                result = new TextArea();
                result.setPropertyDataSource(container.getItem(itemId).getItemProperty(propertyId));
                result.setSizeFull();
            }
            if (!(itemId instanceof SpellError) && propertyId.equals("textEn")) {
                result = new TextArea();
                result.setPropertyDataSource(container.getItem(itemId).getItemProperty(propertyId));
                result.setReadOnly(true);
                result.setSizeFull();
            }
            return result;
        }
    });
    resultTable.setEditable(true);
    this.addComponent(resultTable);
}

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

public UsersTab(DBService service) {
    this.service = service;
    actions = new HorizontalLayout();
    refreshButton = new Button("");
    refreshButton.addClickListener(new Button.ClickListener() {

        @Override/*w  w  w.ja va2s .c  o  m*/
        public void buttonClick(Button.ClickEvent event) {
            LoadTable();
        }
    });
    actions.addComponent(refreshButton);
    addButton = new Button("");
    addButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            AddUser();
        }
    });
    actions.addComponent(addButton);
    this.addComponent(actions);
    tableAndForm = new HorizontalLayout();
    tableAndForm.setSizeFull();
    table = new Table();
    table.setSizeFull();
    container = new BeanItemContainer<>(SysAccount.class);
    table.setContainerDataSource(container);
    table.setVisibleColumns(new Object[] { "login", "roles" });
    table.addItemClickListener(new TableClickListener());
    LoadTable();
    tableAndForm.addComponent(table);
    tableAndForm.setExpandRatio(table, 0.5f);
    form = new FormLayout();
    form.setSizeFull();
    login = new TextField("");
    login.setNullRepresentation("");
    login.setRequired(true);
    form.addComponent(login);
    password = new PasswordField("");
    form.addComponent(password);
    passwordRepeat = new PasswordField(" ?");
    passwordRepeat.addValidator(new PasswordValidator(password, passwordRepeat));
    form.addComponent(passwordRepeat);
    roles = new TwinColSelect("");
    BeanItemContainer<SysAccountRole> rolesContainer = new BeanItemContainer<>(SysAccountRole.class);
    rolesContainer = service.loadBeanItems(rolesContainer);
    roles.setContainerDataSource(rolesContainer);
    roles.setWidth(900f, Unit.PIXELS);
    Page.Styles styles = Page.getCurrent().getStyles();
    styles.add(".v-font-size {\n" + "    font-size: 11px;\n" + "}");
    roles.addStyleName("v-font-size");
    form.addComponent(roles);
    isBlocked = new CheckBox("");
    form.addComponent(isBlocked);
    saveButton = new Button("");
    saveButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            SaveForm();
        }
    });
    form.addComponent(saveButton);
    form.setVisible(false);
    tableAndForm.addComponent(form);
    tableAndForm.setExpandRatio(form, 0.5f);
    this.addComponent(tableAndForm);
}