Search in sources :

Example 11 with Icon

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

the class ExtensionAggregateNumbersQuery 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 12 with Icon

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

the class ExtensionAggregateNumbersQuery method extractDescription.

private ExtensionDescription extractDescription(ResultSet set) throws SQLException {
    String name = set.getString("provider_name");
    String text = set.getString(ExtensionProviderTable.TEXT);
    String description = set.getString(ExtensionProviderTable.DESCRIPTION);
    int priority = set.getInt("provider_priority");
    String iconName = set.getString("provider_icon_name");
    Family family = Family.getByName(set.getString("provider_icon_family")).orElse(Family.SOLID);
    Color color = Color.getByName(set.getString("provider_icon_color")).orElse(Color.NONE);
    Icon icon = new Icon(family, iconName, color);
    return new ExtensionDescription(name, text, description, icon, priority);
}
Also used : Color(com.djrapitops.plan.extension.icon.Color) ExtensionDescription(com.djrapitops.plan.extension.implementation.results.ExtensionDescription) Family(com.djrapitops.plan.extension.icon.Family) Icon(com.djrapitops.plan.extension.icon.Icon)

Example 13 with Icon

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

the class ExtensionPlayerDataQuery 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 14 with Icon

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

the class DataValueGatherer method storePlayerTable.

private void storePlayerTable(Parameters parameters, Conditions conditions, TableDataValue data) {
    ProviderInformation information = data.getInformation();
    Table value = getValue(conditions, data, information);
    if (value == null)
        return;
    Database db = dbSystem.getDatabase();
    for (Icon icon : value.getIcons()) {
        if (icon != null)
            db.executeTransaction(new StoreIconTransaction(icon));
    }
    db.executeTransaction(new StoreTableProviderTransaction(information, parameters, value));
    db.executeTransaction(new StorePlayerTableResultTransaction(information, parameters, value));
}
Also used : StoreIconTransaction(com.djrapitops.plan.extension.implementation.storage.transactions.StoreIconTransaction) Table(com.djrapitops.plan.extension.table.Table) Database(com.djrapitops.plan.storage.database.Database) Icon(com.djrapitops.plan.extension.icon.Icon) ProviderInformation(com.djrapitops.plan.extension.implementation.ProviderInformation) StoreTableProviderTransaction(com.djrapitops.plan.extension.implementation.storage.transactions.providers.StoreTableProviderTransaction)

Example 15 with Icon

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

the class HtmlTableTest method coloredTableProducesSameHtmlAsOldCodeWhenEmpty.

@Test
void coloredTableProducesSameHtmlAsOldCodeWhenEmpty() {
    // 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>No Data</td><td>-</td><td>-</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).build(), Color.AMBER).toHtml();
    assertEquals(expected, result);
}
Also used : Icon(com.djrapitops.plan.extension.icon.Icon) Test(org.junit.jupiter.api.Test)

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