Example usage for com.vaadin.v7.shared.ui.grid ScrollDestination MIDDLE

List of usage examples for com.vaadin.v7.shared.ui.grid ScrollDestination MIDDLE

Introduction

In this page you can find the example usage for com.vaadin.v7.shared.ui.grid ScrollDestination MIDDLE.

Prototype

ScrollDestination MIDDLE

To view the source code for com.vaadin.v7.shared.ui.grid ScrollDestination MIDDLE.

Click Source Link

Document

Scrolls so that the element is shown in the middle of the viewport.

Usage

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

private void goToItem(DAO entity) {
    Component targetTabId = null;
    RefreshableGrid targetTable = null;//from w  w w . java2  s.  c o m
    Integer rowNum = 1;
    Object itemId = entity;
    if (entity instanceof GSpreadSheetsNpcName) {
        targetTabId = npcNameTable;
        targetTable = npcNameTable;
        rowNum = ((GSpreadSheetsNpcName) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsLocationName) {
        targetTabId = locationNameTable;
        targetTable = locationNameTable;
        rowNum = ((GSpreadSheetsLocationName) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsPlayerPhrase) {
        targetTabId = playerPhraseTable;
        targetTable = playerPhraseTable;
        rowNum = ((GSpreadSheetsPlayerPhrase) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsNpcPhrase) {
        targetTabId = npcPhraseTable;
        targetTable = npcPhraseTable;
        rowNum = ((GSpreadSheetsNpcPhrase) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsQuestName) {
        targetTabId = questNameTable;
        targetTable = questNameTable;
        rowNum = ((GSpreadSheetsQuestName) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsQuestDescription) {
        targetTabId = questDescriptionTable;
        targetTable = questDescriptionTable;
        rowNum = ((GSpreadSheetsQuestDescription) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsQuestDirection) {
        targetTabId = questDirectionTable;
        targetTable = questDirectionTable;
        rowNum = ((GSpreadSheetsQuestDirection) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsActivator) {
        targetTabId = activatorTable;
        targetTable = activatorTable;
        rowNum = ((GSpreadSheetsActivator) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsAchievement) {
        targetTabId = achievementTable;
        targetTable = achievementTable;
        rowNum = ((GSpreadSheetsAchievement) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsAchievementDescription) {
        targetTabId = achievementDescriptionTable;
        targetTable = achievementDescriptionTable;
        rowNum = ((GSpreadSheetsAchievementDescription) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsNote) {
        targetTabId = noteTable;
        targetTable = noteTable;
        rowNum = ((GSpreadSheetsNote) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsJournalEntry) {
        targetTabId = journalEntryTable;
        targetTable = journalEntryTable;
        rowNum = ((GSpreadSheetsJournalEntry) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsItemName) {
        targetTabId = itemNameLayout;
        targetTable = itemNameTable;
        rowNum = ((GSpreadSheetsItemName) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsItemDescription) {
        targetTabId = itemDescriptionTable;
        targetTable = itemDescriptionTable;
        rowNum = ((GSpreadSheetsItemDescription) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsAbilityDescription) {
        targetTabId = abilityDescriptionTable;
        targetTable = abilityDescriptionTable;
        rowNum = ((GSpreadSheetsAbilityDescription) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsCollectible) {
        targetTabId = collectibleTable;
        targetTable = collectibleTable;
        rowNum = ((GSpreadSheetsCollectible) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsCollectibleDescription) {
        targetTabId = collectibleDescriptionTable;
        targetTable = collectibleDescriptionTable;
        rowNum = ((GSpreadSheetsCollectibleDescription) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsLoadscreen) {
        targetTabId = loadscreenTable;
        targetTable = loadscreenTable;
        rowNum = ((GSpreadSheetsLoadscreen) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsQuestStartTip) {
        targetTabId = questStartTipTable;
        targetTable = questStartTipTable;
        rowNum = ((GSpreadSheetsQuestStartTip) entity).getRowNum().intValue();
    } else if (entity instanceof GSpreadSheetsQuestEndTip) {
        targetTabId = questEndTipTable;
        targetTable = questEndTipTable;
        rowNum = ((GSpreadSheetsQuestEndTip) entity).getRowNum().intValue();
    }
    if (rowNum != null) {
        rowNum = rowNum - 2;
        if (rowNum < 1) {
            rowNum = 1;
        }
        if (targetTabId != null) {
            tableTabs.setSelectedTab(targetTabId);
            if (entity instanceof HibernateProxy) {
                itemId = ((HibernateProxy) itemId).getHibernateLazyInitializer().getImplementation();
            }
            targetTable.scrollToRow(rowNum, itemId, ScrollDestination.MIDDLE);
        }
    }
}