Search in sources :

Example 16 with Icon

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

the class HtmlTableTest method coloredTableProducesSameHtmlAsOldCode.

@Test
void coloredTableProducesSameHtmlAsOldCode() {
    // Produced by old code
    String expected = "<div class=\"scrollbar\"><table class=\"table table-striped\"><thead class=\"bg-amber\"><tr><th><i class=\" fa fa-test\"></i> Col 1</th><th><i class=\" fa fa-test\"></i> Col 2</th><th><i class=\" fa fa-test\"></i> Col 3</th></tr></thead><tbody><tr><td>1</td><td>2</td><td>three</td></tr></tbody></table></div>";
    Icon icon = Icon.called("test").build();
    String result = HtmlTable.fromExtensionTable(Table.builder().columnOne("Col 1", icon).columnTwo("Col 2", icon).columnThree("Col 3", icon).addRow("1", 2, "three").build(), Color.AMBER).toHtml();
    assertEquals(expected, result);
}
Also used : Icon(com.djrapitops.plan.extension.icon.Icon) Test(org.junit.jupiter.api.Test)

Example 17 with Icon

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

the class HtmlTableTest method dynamicTableProducesSameHtmlAsOldCode.

@Test
void dynamicTableProducesSameHtmlAsOldCode() {
    // Produced by old code
    String expected = "<table class=\"table table-bordered table-striped table-hover player-plugin-table\" style=\"width: 100%\"><thead><tr><th><i class=\" fa fa-test\"></i> Col 1</th><th><i class=\" fa fa-test\"></i> Col 2</th><th><i class=\" fa fa-test\"></i> Col 3</th></tr></thead><tbody><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr>" + "<tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr>" + "<tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr><tr><td data-order=\"1\">1</td><td data-order=\"2\">2</td><td>three</td></tr></tbody></table>";
    Icon icon = Icon.called("test").build();
    Table.Factory buildingTable = Table.builder().columnOne("Col 1", icon).columnTwo("Col 2", icon).columnThree("Col 3", icon);
    for (int i = 0; i < 60; i++) {
        buildingTable.addRow("1", 2, "three");
    }
    String result = HtmlTable.fromExtensionTable(buildingTable.build(), Color.AMBER).toHtml();
    assertEquals(expected, result);
}
Also used : Table(com.djrapitops.plan.extension.table.Table) Icon(com.djrapitops.plan.extension.icon.Icon) Test(org.junit.jupiter.api.Test)

Example 18 with Icon

use of com.djrapitops.plan.extension.icon.Icon 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 19 with Icon

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

the class ExtensionAggregateDoublesQuery method extractTabIcon.

private Icon extractTabIcon(ResultSet set) throws SQLException {
    Optional<String> iconName = Optional.ofNullable(set.getString("tab_icon_name"));
    if (iconName.isPresent()) {
        Family iconFamily = Family.getByName(set.getString("tab_icon_family")).orElse(Family.SOLID);
        Color iconColor = Color.getByName(set.getString("tab_icon_color")).orElse(Color.NONE);
        return new Icon(iconFamily, iconName.get(), iconColor);
    } else {
        return TabInformation.defaultIcon();
    }
}
Also used : Color(com.djrapitops.plan.extension.icon.Color) Family(com.djrapitops.plan.extension.icon.Family) Icon(com.djrapitops.plan.extension.icon.Icon)

Example 20 with Icon

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

the class ExtensionAggregateNumbersQuery 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

Icon (com.djrapitops.plan.extension.icon.Icon)31 Family (com.djrapitops.plan.extension.icon.Family)17 Color (com.djrapitops.plan.extension.icon.Color)15 TabInformation (com.djrapitops.plan.extension.implementation.TabInformation)9 ElementOrder (com.djrapitops.plan.extension.ElementOrder)8 ExtensionDescription (com.djrapitops.plan.extension.implementation.results.ExtensionDescription)5 StoreIconTransaction (com.djrapitops.plan.extension.implementation.storage.transactions.StoreIconTransaction)3 Table (com.djrapitops.plan.extension.table.Table)3 Database (com.djrapitops.plan.storage.database.Database)3 Test (org.junit.jupiter.api.Test)3 ProviderInformation (com.djrapitops.plan.extension.implementation.ProviderInformation)2 StoreTableProviderTransaction (com.djrapitops.plan.extension.implementation.storage.transactions.providers.StoreTableProviderTransaction)2 ExtensionInformation (com.djrapitops.plan.extension.implementation.results.ExtensionInformation)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