Search in sources :

Example 1 with TabInformation

use of com.djrapitops.plan.extension.implementation.TabInformation in project Plan by plan-player-analytics.

the class ServerPluginTabs method buildContentHtml.

private String buildContentHtml(ExtensionTabData tabData) {
    TabInformation tabInformation = tabData.getTabInformation();
    List<ElementOrder> order = tabInformation.getTabElementOrder();
    String values = buildValuesHtml(tabData);
    String valuesHtml = values.isEmpty() ? "" : "<div class=\"card-body\">" + values + "</div>";
    String tablesHtml = buildTablesHtml(tabData);
    StringBuilder builder = new StringBuilder();
    for (ElementOrder ordering : order) {
        switch(ordering) {
            case VALUES:
                builder.append(valuesHtml);
                break;
            case TABLE:
                builder.append(tablesHtml);
                break;
            default:
                break;
        }
    }
    return builder.toString();
}
Also used : TabInformation(com.djrapitops.plan.extension.implementation.TabInformation) ElementOrder(com.djrapitops.plan.extension.ElementOrder)

Example 2 with TabInformation

use of com.djrapitops.plan.extension.implementation.TabInformation in project Plan by plan-player-analytics.

the class QueriedTables method extractTabInformation.

private TabInformation extractTabInformation(Table.Factory table) {
    String tabName = TableAccessor.getTabName(table);
    int tabPriority = TableAccessor.getTabPriority(table);
    ElementOrder[] tabOrder = TableAccessor.getTabOrder(table);
    Icon tabIcon = TableAccessor.getTabIcon(table);
    return new TabInformation(tabName, tabIcon, tabOrder, tabPriority);
}
Also used : TabInformation(com.djrapitops.plan.extension.implementation.TabInformation) Icon(com.djrapitops.plan.extension.icon.Icon) ElementOrder(com.djrapitops.plan.extension.ElementOrder)

Example 3 with TabInformation

use of com.djrapitops.plan.extension.implementation.TabInformation in project Plan by plan-player-analytics.

the class ExtensionAggregateDoublesQuery method extractTabInformation.

private TabInformation extractTabInformation(String tabName, ResultSet set) throws SQLException {
    Optional<Integer> tabPriority = Optional.of(set.getInt("tab_priority"));
    if (set.wasNull()) {
        tabPriority = Optional.empty();
    }
    Optional<ElementOrder[]> elementOrder = Optional.ofNullable(set.getString(ExtensionTabTable.ELEMENT_ORDER)).map(ElementOrder::deserialize);
    Icon tabIcon = extractTabIcon(set);
    return new TabInformation(tabName, tabIcon, elementOrder.orElse(ElementOrder.values()), tabPriority.orElse(100));
}
Also used : TabInformation(com.djrapitops.plan.extension.implementation.TabInformation) Icon(com.djrapitops.plan.extension.icon.Icon) ElementOrder(com.djrapitops.plan.extension.ElementOrder)

Example 4 with TabInformation

use of com.djrapitops.plan.extension.implementation.TabInformation in project Plan by plan-player-analytics.

the class ExtensionPlayerGroupsQuery method extractTabInformation.

private TabInformation extractTabInformation(String tabName, ResultSet set) throws SQLException {
    Optional<Integer> tabPriority = Optional.of(set.getInt("tab_priority"));
    if (set.wasNull()) {
        tabPriority = Optional.empty();
    }
    Optional<ElementOrder[]> elementOrder = Optional.ofNullable(set.getString(ExtensionTabTable.ELEMENT_ORDER)).map(ElementOrder::deserialize);
    Icon tabIcon = extractTabIcon(set);
    return new TabInformation(tabName, tabIcon, elementOrder.orElse(ElementOrder.values()), tabPriority.orElse(100));
}
Also used : TabInformation(com.djrapitops.plan.extension.implementation.TabInformation) Icon(com.djrapitops.plan.extension.icon.Icon) ElementOrder(com.djrapitops.plan.extension.ElementOrder)

Example 5 with TabInformation

use of com.djrapitops.plan.extension.implementation.TabInformation in project Plan by plan-player-analytics.

the class DataValueGatherer method storeExtensionInformation.

public void storeExtensionInformation() {
    String pluginName = extension.getPluginName();
    Icon pluginIcon = extension.getPluginIcon();
    long time = System.currentTimeMillis();
    ServerUUID serverUUID = serverInfo.getServerUUID();
    Database database = dbSystem.getDatabase();
    database.executeTransaction(new StoreIconTransaction(pluginIcon));
    database.executeTransaction(new StorePluginTransaction(pluginName, time, serverUUID, pluginIcon));
    for (TabInformation tab : extension.getPluginTabs()) {
        database.executeTransaction(new StoreIconTransaction(tab.getTabIcon()));
        database.executeTransaction(new StoreTabInformationTransaction(pluginName, serverUUID, tab));
    }
    database.executeTransaction(new RemoveInvalidResultsTransaction(pluginName, serverUUID, extension.getInvalidatedMethods()));
}
Also used : StoreIconTransaction(com.djrapitops.plan.extension.implementation.storage.transactions.StoreIconTransaction) ServerUUID(com.djrapitops.plan.identification.ServerUUID) Database(com.djrapitops.plan.storage.database.Database) StoreTabInformationTransaction(com.djrapitops.plan.extension.implementation.storage.transactions.StoreTabInformationTransaction) TabInformation(com.djrapitops.plan.extension.implementation.TabInformation) Icon(com.djrapitops.plan.extension.icon.Icon) StorePluginTransaction(com.djrapitops.plan.extension.implementation.storage.transactions.StorePluginTransaction)

Aggregations

TabInformation (com.djrapitops.plan.extension.implementation.TabInformation)13 ElementOrder (com.djrapitops.plan.extension.ElementOrder)10 Icon (com.djrapitops.plan.extension.icon.Icon)9 TabsElement (com.djrapitops.plan.delivery.rendering.html.structure.TabsElement)2 StoreIconTransaction (com.djrapitops.plan.extension.implementation.storage.transactions.StoreIconTransaction)1 StorePluginTransaction (com.djrapitops.plan.extension.implementation.storage.transactions.StorePluginTransaction)1 StoreTabInformationTransaction (com.djrapitops.plan.extension.implementation.storage.transactions.StoreTabInformationTransaction)1 ServerUUID (com.djrapitops.plan.identification.ServerUUID)1 Database (com.djrapitops.plan.storage.database.Database)1