Search in sources :

Example 6 with ElementOrder

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

the class PlayerPluginTab 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 7 with ElementOrder

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

the class ExtensionAggregateBooleansQuery 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 8 with ElementOrder

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

the class ExtensionAggregatePercentagesQuery 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 9 with ElementOrder

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

the class ExtensionPlayerDataQuery 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 10 with ElementOrder

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

the class ExtensionServerDataQuery 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)

Aggregations

ElementOrder (com.djrapitops.plan.extension.ElementOrder)10 TabInformation (com.djrapitops.plan.extension.implementation.TabInformation)10 Icon (com.djrapitops.plan.extension.icon.Icon)8